import{r as c,j as n}from"./@radix-B1sy0Lhr.js";import{w as l,R as f,U as d,V as h,T as m,W as x,a6 as u}from"./index-CO6UN3UX.js";function p(t){const s=new Date(`${t}Z`),e=new Date;if(s<e)return"Expired";const a=s.getTime()-e.getTime(),r=Math.floor(a/(1e3*60*60*24)),i=Math.floor(a%(1e3*60*60*24)/(1e3*60*60)),o=Math.floor(a%(1e3*60*60)/(1e3*60));return r>0?`in ${r} ${r===1?"day":"days"}`:i>0?`in ${i} ${i===1?"hour":"hours"}`:o>0?`in ${o} ${o===1?"minute":"minutes"}`:"in less than a minute"}function T({expires:t}){const[s,e]=c.useState("");return c.useEffect(()=>{e(p(t))},[t]),s==="Expired"?n.jsxs("div",{className:"flex items-center space-x-0.5 text-theme-text-warning",children:[n.jsx(l,{className:"size-3 shrink-0 fill-theme-text-warning"}),n.jsx("span",{children:"Expired"})]}):n.jsx("div",{children:s})}function j({connector:t}){var e;const s=((e=t.body)==null?void 0:e.resource_id)||"Multiple";return n.jsx(f,{children:n.jsxs(d,{children:[n.jsx(h,{className:"max-w-full truncate",children:n.jsx(m,{size:"sm",rounded:!1,emphasis:"minimal",className:"block w-fit max-w-full gap-0.5 truncate text-theme-text-primary",color:"grey",children:s})}),n.jsx(x,{children:s})]})})}function M(t){var r,i;const s=((r=t.body)==null?void 0:r.resource_types)??[],e=(i=t.body)==null?void 0:i.connector_type;return u(e)?[]:((e==null?void 0:e.resource_types)??[]).filter(o=>s.includes(o.resource_type))}function w(t){var r,i;const s=((r=t.body)==null?void 0:r.auth_method)||"",e=(i=t.body)==null?void 0:i.connector_type;return u(e)?void 0:((e==null?void 0:e.auth_methods)??[]).find(o=>o.auth_method===s)}export{T as E,j as R,w as a,M as e};
