import{r as s,j as a,cl as w,Z as x,cm as j,aU as b}from"./index-CfKY7XrC.js";import{M as E}from"./memory-browse-layout-B_YNXhu9.js";import{S}from"./section-mark-F5ZGiWj1.js";var A="Separator",p="horizontal",O=["horizontal","vertical"],h=s.forwardRef((r,e)=>{const{decorative:t,orientation:o=p,...i}=r,n=I(o)?o:p,l=t?{role:"none"}:{"aria-orientation":n==="vertical"?n:void 0,role:"separator"};return a.jsx(w.div,{"data-orientation":n,...l,...i,ref:e})});h.displayName=A;function I(r){return O.includes(r)}var g=h;const U=s.forwardRef(({className:r,orientation:e="horizontal",decorative:t=!0,...o},i)=>a.jsx(g,{ref:i,decorative:t,orientation:e,className:x("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",r),...o}));U.displayName=g.displayName;function z({ownerSlug:r,organizationId:e,activeEntityTypeSlug:t,isLoading:o,children:i}){return a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(S,{middle:a.jsx(j,{className:"h-3.5 w-3.5"})}),a.jsx("h1",{className:"text-3xl font-semibold leading-tight",children:"Entities"})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Browse and manage workspace records by type."})]}),a.jsx(E,{mode:"browse",ownerSlug:r,organizationId:e,activeEntityTypeSlug:t,isLoading:o,children:i})]})}function u(r,e){const t=r?.properties;if(t)return Object.entries(t).find(([,o])=>o[e])?.[0]}function P(r){const[e,t]=s.useState();return s.useEffect(()=>{if(!r){t(void 0);return}let o=!1;const i=r.trim().toLowerCase();return crypto.subtle.digest("SHA-256",new TextEncoder().encode(i)).then(n=>{o||t(Array.from(new Uint8Array(n)).map(c=>c.toString(16).padStart(2,"0")).join(""))}),()=>{o=!0}},[r]),e?`https://www.gravatar.com/avatar/${e}?d=identicon&s=80`:void 0}function B({metadata:r,metadataSchema:e,name:t,typeIcon:o,className:i="h-6 w-6",iconClassName:n="h-5 w-5"}){const c=u(e,"x-image"),l=u(e,"x-email"),f=c&&r?.[c]||void 0,v=l&&r?.[l]||void 0,y=P(f?void 0:v),d=f||y,[N,m]=s.useState(!1);return s.useEffect(()=>{m(!1)},[d]),d&&!N?a.jsx("img",{src:d,alt:t,referrerPolicy:"no-referrer",onError:()=>m(!0),className:x("rounded-full object-cover border border-border",i)}):a.jsx(b,{icon:o,className:n})}function M(r){return r.replace(/[-_]/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}function k(r){return r==null?"-":typeof r=="number"?new Intl.NumberFormat("en-US",{maximumFractionDigits:Number.isInteger(r)?0:2}).format(r):typeof r=="boolean"?r?"Yes":"No":typeof r=="object"?JSON.stringify(r):String(r)}export{B as E,U as S,z as a,k as f,M as t};
