import{r,m as ce,j as e,i as Te,q as Je,u as Qe,n as Se,z as te,P as et}from"./index-B1SopS7p.js";import{S as tt}from"./folder-tWfgBi6i.js";import{S as Ke}from"./trash-CBTUDu6I.js";import{S as Re,a as rt}from"./open-MnZv2bFN.js";import{M as at,i as st,u as Ve,P as nt,a as ot,b as it,L as dt,m as ke}from"./proxy-CeMnCUct.js";import{X as Ie}from"./x-XA1t71y1.js";import{S as qe}from"./search-Cdnx4iUA.js";const Oe=n=>r.createElement("svg",{className:"size-6",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2C8.41421 2 8.75 2.33579 8.75 2.75V3.75H15.25V2.75C15.25 2.33579 15.5858 2 16 2C16.4142 2 16.75 2.33579 16.75 2.75V3.75H18.5C19.7426 3.75 20.75 4.75736 20.75 6V9V19C20.75 20.2426 19.7426 21.25 18.5 21.25H5.5C4.25736 21.25 3.25 20.2426 3.25 19V9V6C3.25 4.75736 4.25736 3.75 5.5 3.75H7.25V2.75C7.25 2.33579 7.58579 2 8 2ZM8 5.25H5.5C5.08579 5.25 4.75 5.58579 4.75 6V8.25H19.25V6C19.25 5.58579 18.9142 5.25 18.5 5.25H16H8ZM19.25 9.75H4.75V19C4.75 19.4142 5.08579 19.75 5.5 19.75H18.5C18.9142 19.75 19.25 19.4142 19.25 19V9.75Z",fill:"currentColor"})),lt=n=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"icon icon-tabler icons-tabler-outline icon-tabler-database",...n},r.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),r.createElement("path",{d:"M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0"}),r.createElement("path",{d:"M4 6v6a8 3 0 0 0 16 0v-6"}),r.createElement("path",{d:"M4 12v6a8 3 0 0 0 16 0v-6"})),We=n=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"icon icon-tabler icons-tabler-outline icon-tabler-signature",...n},r.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),r.createElement("path",{d:"M3 17c3.333 -3.333 5 -6 5 -8c0 -3 -1 -3 -2 -3s-2.032 1.085 -2 3c.034 2.048 1.658 4.877 2.5 6c1.5 2 2.5 2.5 3.5 1l2 -3c.333 2.667 1.333 4 3 4c.53 0 2.639 -2 3 -2c.517 0 1.517 .667 3 2"}));/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ct=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Xe=ce("circle-plus",ct);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ut=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],mt=ce("cloud-download",ut);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xt=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],gt=ce("download",xt);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ht=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ae=ce("shield-check",ht);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bt=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ft=ce("user-minus",bt);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pt=[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]],Ge=ce("user-round-plus",pt);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yt=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],kt=ce("users",yt);function _e(n,t){if(typeof n=="function")return n(t);n!=null&&(n.current=t)}function wt(...n){return t=>{let l=!1;const w=n.map(m=>{const c=_e(m,t);return!l&&typeof c=="function"&&(l=!0),c});if(l)return()=>{for(let m=0;m<w.length;m++){const c=w[m];typeof c=="function"?c():_e(n[m],null)}}}}function vt(...n){return r.useCallback(wt(...n),n)}class jt extends r.Component{getSnapshotBeforeUpdate(t){const l=this.props.childRef.current;if(l&&t.isPresent&&!this.props.isPresent){const w=l.offsetParent,m=st(w)&&w.offsetWidth||0,c=this.props.sizeRef.current;c.height=l.offsetHeight||0,c.width=l.offsetWidth||0,c.top=l.offsetTop,c.left=l.offsetLeft,c.right=m-c.width-c.left}return null}componentDidUpdate(){}render(){return this.props.children}}function Nt({children:n,isPresent:t,anchorX:l,root:w}){const m=r.useId(),c=r.useRef(null),S=r.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:A}=r.useContext(at),I=vt(c,n==null?void 0:n.ref);return r.useInsertionEffect(()=>{const{width:y,height:E,top:h,left:x,right:D}=S.current;if(t||!c.current||!y||!E)return;const k=l==="left"?`left: ${x}`:`right: ${D}`;c.current.dataset.motionPopId=m;const f=document.createElement("style");A&&(f.nonce=A);const P=w!=null?w:document.head;return P.appendChild(f),f.sheet&&f.sheet.insertRule(`
          [data-motion-pop-id="${m}"] {
            position: absolute !important;
            width: ${y}px !important;
            height: ${E}px !important;
            ${k}px !important;
            top: ${h}px !important;
          }
        `),()=>{P.contains(f)&&P.removeChild(f)}},[t]),e.jsx(jt,{isPresent:t,childRef:c,sizeRef:S,children:r.cloneElement(n,{ref:I})})}const Ct=({children:n,initial:t,isPresent:l,onExitComplete:w,custom:m,presenceAffectsLayout:c,mode:S,anchorX:A,root:I})=>{const y=Ve(St),E=r.useId();let h=!0,x=r.useMemo(()=>(h=!1,{id:E,initial:t,isPresent:l,custom:m,onExitComplete:D=>{y.set(D,!0);for(const k of y.values())if(!k)return;w&&w()},register:D=>(y.set(D,!1),()=>y.delete(D))}),[l,y,w]);return c&&h&&(x={...x}),r.useMemo(()=>{y.forEach((D,k)=>y.set(k,!1))},[l]),r.useEffect(()=>{!l&&!y.size&&w&&w()},[l]),S==="popLayout"&&(n=e.jsx(Nt,{isPresent:l,anchorX:A,root:I,children:n})),e.jsx(nt.Provider,{value:x,children:n})};function St(){return new Map}const we=n=>n.key||"";function ze(n){const t=[];return r.Children.forEach(n,l=>{r.isValidElement(l)&&t.push(l)}),t}const $e=({children:n,custom:t,initial:l=!0,onExitComplete:w,presenceAffectsLayout:m=!0,mode:c="sync",propagate:S=!1,anchorX:A="left",root:I})=>{const[y,E]=ot(S),h=r.useMemo(()=>ze(n),[n]),x=S&&!y?[]:h.map(we),D=r.useRef(!0),k=r.useRef(h),f=Ve(()=>new Map),[P,C]=r.useState(h),[p,d]=r.useState(h);it(()=>{D.current=!1,k.current=h;for(let O=0;O<p.length;O++){const N=we(p[O]);x.includes(N)?f.delete(N):f.get(N)!==!0&&f.set(N,!1)}},[p,x.length,x.join("-")]);const $=[];if(h!==P){let O=[...h];for(let N=0;N<p.length;N++){const R=p[N],U=we(R);x.includes(U)||(O.splice(N,0,R),$.push(R))}return c==="wait"&&$.length&&(O=$),d(ze(O)),C(h),null}const{forceRender:_}=r.useContext(dt);return e.jsx(e.Fragment,{children:p.map(O=>{const N=we(O),R=S&&!y?!1:h===p||x.includes(N),U=()=>{if(f.has(N))f.set(N,!0);else return;let F=!0;f.forEach(H=>{H||(F=!1)}),F&&(_==null||_(),d(k.current),S&&(E==null||E()),w&&w())};return e.jsx(Ct,{isPresent:R,initial:!D.current||l?void 0:!1,custom:t,presenceAffectsLayout:m,mode:c,root:I,onExitComplete:R?void 0:U,anchorX:A,children:O},N)})})};function Z(...n){return n.filter(Boolean).join(" ")}const Ue="subpixel-antialiased [text-rendering:optimizeLegibility]",ve=n=>t=>{if(n)return;const l=t.currentTarget;document.activeElement!==l&&l.focus()},Dt=({onOpen:n,onRename:t,onRemove:l,onShare:w,className:m})=>{const[c,S]=r.useState(!1),[A,I]=r.useState({left:0,top:0}),y=r.useRef(null),E=r.useRef(null),h=r.useRef([]),x=r.useId(),D=typeof document!="undefined"?document.body:null,k=!n,f=!t,P=!w,C=!l,p=r.useCallback(()=>{const a=y.current;if(!a)return;const o=a.getBoundingClientRect(),s=8,u=176,j=184,b=window.innerWidth,z=window.innerHeight;let v=o.right-u,B=o.bottom+8;v=Math.max(s,Math.min(v,b-u-s)),B+j>z-s&&(B=o.top-j-8),B=Math.max(s,Math.min(B,z-j-s)),I({left:v,top:B})},[]),d=r.useCallback(()=>{S(!1),queueMicrotask(()=>{var a;return(a=y.current)==null?void 0:a.focus()})},[]),$=r.useCallback(a=>{a.preventDefault(),a.stopPropagation(),S(o=>{const s=!o;return s&&queueMicrotask(()=>p()),s})},[p]),_=r.useCallback(()=>{S(!0),queueMicrotask(()=>p())},[p]),O=r.useCallback(a=>{(a.key==="Enter"||a.key===" "||a.key==="F10"||a.key==="ArrowDown")&&(a.preventDefault(),a.stopPropagation(),_())},[_]);r.useEffect(()=>{if(!c)return;const a=s=>{const u=s.target;u&&(E.current&&E.current.contains(u)||y.current&&y.current.contains(u)||d())},o=s=>{s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),d())};return window.addEventListener("pointerdown",a,!0),window.addEventListener("keydown",o,!0),()=>{window.removeEventListener("pointerdown",a,!0),window.removeEventListener("keydown",o,!0)}},[c,d]),r.useEffect(()=>{if(!c)return;p();const a=()=>p();return window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),()=>{window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[c,p]),r.useEffect(()=>{c&&queueMicrotask(()=>{const o=h.current.filter(Boolean).find(s=>s.dataset.disabled!=="true");o==null||o.focus()})},[c]);const N=r.useCallback(a=>o=>{h.current[a]=o},[]),R=a=>o=>{o.preventDefault(),o.stopPropagation(),a==null||a(),d()},U=r.useCallback(a=>{const o=h.current.filter(Boolean);if(!o.length)return;const s=b=>(b==null?void 0:b.dataset.disabled)==="true",u=o.findIndex(b=>b===document.activeElement),j=b=>{let z=u;for(let v=0;v<o.length;v++)if(z=(z+b+o.length)%o.length,!s(o[z])){o[z].focus();break}};switch(a.key){case"ArrowDown":a.preventDefault(),j(1);break;case"ArrowUp":a.preventDefault(),j(-1);break;case"Home":{a.preventDefault();const b=o.find(z=>!s(z));b==null||b.focus();break}case"End":{a.preventDefault();for(let b=o.length-1;b>=0;b--)if(!s(o[b])){o[b].focus();break}break}case"Tab":d();break;case"Escape":a.preventDefault(),d();break}},[d]),F="px-4 py-2.5 outline-none flex items-center gap-2 text-sm font-medium",H="cursor-pointer transition hover:bg-gray-50 focus:bg-gray-100 dark:hover:bg-slate-800/70 dark:focus:bg-slate-800/70",W="cursor-not-allowed opacity-50 text-gray-400 dark:text-gray-500",X=Z(Ue,"flex h-9 w-9 items-center justify-center rounded-xl border transition","border-gray-300/80 bg-white text-gray-700 shadow-sm hover:border-gray-400 hover:shadow-md","dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200 dark:hover:border-gray-600",c?"border-indigo-500/40 ring-2 ring-indigo-500/15":""),K=e.jsx("div",{ref:E,id:x,role:"menu",tabIndex:-1,onKeyDown:U,className:Z(Ue,"fixed z-[10000] w-44 overflow-hidden rounded-xl border shadow-2xl","border-gray-300/90 bg-white","dark:border-gray-700 dark:bg-slate-900"),style:{left:A.left,top:A.top},onMouseDown:a=>{a.preventDefault(),a.stopPropagation()},children:e.jsxs("ul",{className:"py-1 text-gray-800 dark:text-gray-200",children:[e.jsxs("li",{ref:N(0),tabIndex:-1,role:"menuitem","aria-disabled":k,"data-disabled":k?"true":"false",className:Z(F,k?W:H),onClick:k?void 0:R(n),onPointerMove:ve(k),onKeyDown:k?void 0:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),n==null||n(),d())},children:[e.jsx(Re,{className:Z("h-5 w-5",k?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-200")}),e.jsx("span",{children:"Open"})]}),e.jsxs("li",{ref:N(1),tabIndex:-1,role:"menuitem","aria-disabled":f,"data-disabled":f?"true":"false",className:Z(F,f?W:H),onClick:f?void 0:R(t),onPointerMove:ve(f),onKeyDown:f?void 0:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t==null||t(),d())},children:[e.jsx(We,{className:Z("h-5 w-5",f?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-200")}),e.jsx("span",{children:"Rename"})]}),e.jsxs("li",{ref:N(2),tabIndex:-1,role:"menuitem","aria-disabled":P,"data-disabled":P?"true":"false",className:Z(F,P?W:H),onClick:P?void 0:R(w),onPointerMove:ve(P),onKeyDown:P?void 0:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),w==null||w(),d())},children:[e.jsx(Ge,{className:Z("h-4 w-4",P?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-200")}),e.jsx("span",{children:"Share"})]}),e.jsxs("li",{ref:N(3),tabIndex:-1,role:"menuitem","aria-disabled":C,"data-disabled":C?"true":"false",className:Z(F,C?W:H,C?"":"hover:bg-red-50 focus:bg-red-50 dark:hover:bg-red-950/20 dark:focus:bg-red-950/20"),onClick:C?void 0:R(l),onPointerMove:ve(C),onKeyDown:C?void 0:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),l==null||l(),d())},children:[e.jsx(Ke,{className:Z("h-5 w-5",C?"text-gray-400 dark:text-gray-500":"text-red-700 dark:text-red-300")}),e.jsx("span",{className:C?void 0:"text-red-700 dark:text-red-300",children:"Remove"})]})]})});return e.jsxs("div",{className:Z("relative flex items-center",m),children:[e.jsx("button",{ref:y,type:"button",onClick:$,onKeyDown:O,className:X,"aria-haspopup":"menu","aria-expanded":c,"aria-controls":x,children:e.jsx(Je,{className:Z("h-6 w-6",c?"text-indigo-600 dark:text-indigo-300":"")})}),c&&D?Te.createPortal(K,D):null]})};function L(...n){return n.filter(Boolean).join(" ")}function Fe(n){if(typeof n=="boolean")return n;if(typeof n=="number")return n===1;if(typeof n=="string"){const t=n.trim().toLowerCase();return t==="true"||t==="1"||t==="owner"||t==="yes"}return!1}function He(n){if(!n)return"—";const t=new Date(n);if(Number.isNaN(t.getTime()))return"—";try{return new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"2-digit"}).format(t)}catch(l){return t.toISOString().slice(0,10)}}function Mt(n){const t=String(n!=null?n:"").trim().toLowerCase();return t?t.includes("done")||t.includes("finished")||t.includes("complete")||t.includes("success")?L("border-emerald-300/80 bg-emerald-50 text-emerald-800","dark:border-emerald-700 dark:bg-emerald-950/30 dark:text-emerald-200"):t.includes("run")||t.includes("active")||t.includes("progress")||t.includes("queue")?L("border-sky-300/80 bg-sky-50 text-sky-800","dark:border-sky-700 dark:bg-sky-950/30 dark:text-sky-200"):t.includes("warn")||t.includes("hold")||t.includes("pending")||t.includes("pause")?L("border-amber-300/80 bg-amber-50 text-amber-800","dark:border-amber-700 dark:bg-amber-950/30 dark:text-amber-200"):t.includes("fail")||t.includes("error")||t.includes("stopped")||t.includes("abort")?L("border-rose-300/80 bg-rose-50 text-rose-800","dark:border-rose-700 dark:bg-rose-950/30 dark:text-rose-200"):L("border-violet-300/80 bg-violet-50 text-violet-800","dark:border-violet-700 dark:bg-violet-950/30 dark:text-violet-200"):L("border-gray-300/80 bg-white/90 text-gray-700","dark:border-gray-700 dark:bg-slate-800 dark:text-gray-200")}const je="subpixel-antialiased [text-rendering:optimizeLegibility]";function Et(n){const{id:t,label:l,value:w,badgeValue:m,createdAt:c,updatedAt:S,diskUsage:A,isSelected:I,onSelect:y,isExpanded:E,onToggleExpand:h,description:x="",status:D,icon:k=e.jsx(tt,{className:"h-5 w-5 text-gray-900 dark:text-white"}),onDelete:f,onRename:P,onShare:C,isShared:p,isOwner:d,permission:$}=n,_=Qe(),O=Se(),[N,R]=r.useState(!1),[U,F]=r.useState(l),[H,W]=r.useState(x),[X,K]=r.useState(!1),[a,o]=r.useState(""),[s,u]=r.useState({open:!1,x:0,y:0}),j=r.useRef(null),b=r.useRef([]),z=typeof document!="undefined"?document.body:null,v=Fe(d),Y=!!(Fe(p)&&!v),V=v,Q=r.useMemo(()=>(x!=null?x:"").trim().length>140&&typeof h=="function",[x,h]),De=r.useMemo(()=>`P${String(t)}`,[t]),Me=r.useMemo(()=>Y?$!=null&&$.trim()?`Shared · ${$}`:"Shared":$!=null&&$.trim()?$:v?"Owner":"Private",[Y,$,v]),ue=r.useMemo(()=>{var g;return String((g=D!=null?D:m)!=null?g:"").trim()||null},[D,m]);r.useEffect(()=>{F(l),W(x||"")},[l,x]);const ne=r.useCallback(()=>{N||_(`/project/load/${t}`)},[t,N,_]),be=r.useCallback(()=>{ne()},[ne]),me=r.useCallback(()=>{F(l),W(x||""),R(!0),o("")},[l,x]),xe=r.useCallback(()=>{K(!0)},[]),ge=r.useCallback(()=>{V&&(C==null||C(t))},[V,t,C]),fe=r.useCallback(async()=>{try{await O.deleteProject(String(t)),te.success(`Project "${l}" deleted successfully`),K(!1),f==null||f(t)}catch(i){te.error((i==null?void 0:i.message)||"Error deleting project")}},[O,t,l,f]),he=r.useCallback(async()=>{if(!U.trim()){o("Project name cannot be empty.");return}if(H&&H.trim().length>0&&H.trim().length<3){o("Description must be at least 3 characters.");return}try{await O.renameProject(String(t),U.trim(),(H||"").trim()),te.success("Project renamed successfully"),R(!1),o(""),P==null||P(t,U.trim(),(H||"").trim())}catch(i){te.error((i==null?void 0:i.message)||"Failed to rename project"),o("Failed to update project.")}},[O,t,U,H,P]),G=r.useCallback(()=>{u(i=>i.open?{...i,open:!1}:i)},[]),pe=r.useCallback(i=>{if(N||X)return;i.preventDefault(),i.stopPropagation(),y==null||y();const g=8,M=192,q=196,re=window.innerWidth,T=window.innerHeight,ee=i.clientX,ae=i.clientY,Ee=Math.max(g,Math.min(ee,re-M-g)),Ze=Math.max(g,Math.min(ae,T-q-g));u({open:!0,x:Ee,y:Ze})},[N,X,y]),oe=r.useCallback(i=>g=>{b.current[i]=g},[]),ie=i=>g=>{if(i)return;const M=g.currentTarget;document.activeElement!==M&&M.focus()},de=(i,g)=>M=>{M.preventDefault(),M.stopPropagation(),!i&&(g==null||g(),G())},ye=r.useCallback(i=>{const g=b.current.filter(Boolean);if(!g.length)return;const M=T=>(T==null?void 0:T.dataset.disabled)==="true",q=g.findIndex(T=>T===document.activeElement),re=T=>{let ee=q;for(let ae=0;ae<g.length;ae++)if(ee=(ee+T+g.length)%g.length,!M(g[ee])){g[ee].focus();break}};switch(i.key){case"ArrowDown":i.preventDefault(),re(1);break;case"ArrowUp":i.preventDefault(),re(-1);break;case"Home":{i.preventDefault();const T=g.find(ee=>!M(ee));T==null||T.focus();break}case"End":{i.preventDefault();for(let T=g.length-1;T>=0;T--)if(!M(g[T])){g[T].focus();break}break}case"Escape":i.preventDefault(),G();break}},[G]);r.useEffect(()=>{(N||X)&&G()},[N,X,G]),r.useEffect(()=>{if(!s.open)return;const i=q=>{const re=q.target;re&&j.current&&!j.current.contains(re)&&G()},g=q=>{q.key==="Escape"&&G()},M=()=>G();return window.addEventListener("pointerdown",i,!0),window.addEventListener("keydown",g,!0),window.addEventListener("scroll",M,!0),window.addEventListener("wheel",M,!0),window.addEventListener("touchmove",M,!0),()=>{window.removeEventListener("pointerdown",i,!0),window.removeEventListener("keydown",g,!0),window.removeEventListener("scroll",M,!0),window.removeEventListener("wheel",M,!0),window.removeEventListener("touchmove",M,!0)}},[s.open,G]),r.useEffect(()=>{s.open&&queueMicrotask(()=>{const g=b.current.filter(Boolean).find(M=>M.dataset.disabled!=="true");g==null||g.focus()})},[s.open]);const Ye=L(je,"relative min-h-[290px] cursor-pointer overflow-hidden rounded-[15px] border p-5 transition md:p-6","border-gray-300/85 bg-gradient-to-br from-white via-white to-indigo-50/45","shadow-[0_10px_35px_rgba(15,23,42,0.05)]","dark:border-gray-700 dark:bg-gradient-to-br dark:from-slate-900 dark:via-slate-900 dark:to-slate-950",I?"":"hover:border-gray-400 dark:hover:border-gray-600",!N&&!I?"hover:-translate-y-0.5 hover:shadow-[0_18px_45px_rgba(15,23,42,0.09)]":"","active:border-indigo-500/40 active:ring-2 active:ring-inset active:ring-indigo-500/15",I?"border-indigo-500/55 ring-2 ring-inset ring-indigo-500/16":"");return e.jsxs(e.Fragment,{children:[e.jsx(ke.div,{initial:{opacity:0,y:14},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},className:"relative",children:e.jsxs("div",{tabIndex:0,onClick:y,onDoubleClick:be,onContextMenu:pe,className:Ye,children:[e.jsxs("div",{className:"pointer-events-none absolute inset-0",children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-1 opacity-80"}),e.jsx("div",{className:"absolute -right-10 -top-10 h-28 w-28 rounded-full bg-indigo-100/90 blur-3xl dark:bg-indigo-900/20"}),e.jsx("div",{className:"absolute -left-10 bottom-2 h-24 w-24 rounded-full bg-cyan-100/70 blur-3xl dark:bg-cyan-900/10"}),e.jsx("div",{className:"absolute inset-x-0 bottom-0 h-28 bg-gradient-to-t from-white/70 to-transparent dark:from-slate-950/25 dark:to-transparent"})]}),e.jsxs("div",{className:"relative flex h-full flex-col",children:[e.jsx("div",{className:L("-mx-2 -mt-2 mb-2 rounded-t-[24px] border-b px-5 pt-5 pb-4 md:-mx-6 md:-mt-6 md:px-6 md:pt-6","border-gray-200/90 bg-gradient-to-br from-slate-50 via-white to-indigo-50/70","dark:border-gray-800 dark:bg-gradient-to-br dark:from-slate-900 dark:via-slate-900 dark:to-indigo-950/25"),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3.5",children:[e.jsx("div",{className:L("flex h-12 w-12 shrink-0 items-center justify-center rounded-[18px] border shadow-sm","border-white/80 bg-gradient-to-br from-white to-indigo-50","dark:border-slate-700 dark:bg-gradient-to-br dark:from-slate-800 dark:to-slate-900"),children:k}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:L("inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-semibold tracking-[0.08em]","border-indigo-300/80 bg-indigo-50 text-indigo-800","dark:border-indigo-700 dark:bg-indigo-950/30 dark:text-indigo-200"),children:De}),e.jsx("span",{className:L("inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-semibold","border-gray-300/80 bg-white/90 text-gray-700","dark:border-gray-700 dark:bg-slate-800 dark:text-gray-200"),children:Me}),Y?e.jsx("span",{className:"shrink-0 rounded-full border border-sky-300/80 bg-sky-50 px-2.5 py-0.5 text-[11px] font-semibold text-sky-800 dark:border-sky-700 dark:bg-sky-950/30 dark:text-sky-200",children:"Guest"}):null,ue?e.jsx("span",{className:L("shrink-0 rounded-full border px-2.5 py-0.5 text-[11px] font-semibold",Mt(ue)),children:ue}):null]}),e.jsx("div",{className:"flex min-w-0 items-start gap-2",children:e.jsx("span",{className:"truncate text-[17px] font-semibold leading-6 tracking-[0.01em] text-gray-950 dark:text-white",title:l,children:U})})]})]}),e.jsx("div",{className:"shrink-0 pt-0.5",children:e.jsx(Dt,{icon:null,label:"",onOpen:ne,onRename:V?me:void 0,onRemove:V?xe:void 0,onShare:V?ge:void 0})})]})}),e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:L("rounded-2xl border px-4 py-3.5","border-gray-200/90 bg-white/75","dark:border-gray-800 dark:bg-slate-950/30"),children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-gray-500 dark:text-gray-400",children:"Overview"}),e.jsx("div",{className:L("mt-2 text-sm leading-6 text-gray-700 dark:text-gray-300",E?"":"line-clamp-3"),children:x!=null&&x.trim()?x:"No description available."}),Q?e.jsx("button",{type:"button",className:"mt-3 inline-flex items-center gap-1 rounded-full border border-gray-300/80 bg-white px-3 py-1.5 text-sm font-medium text-gray-800 transition hover:bg-gray-50 hover:shadow-sm dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200 dark:hover:bg-slate-800",onClick:i=>{i.preventDefault(),i.stopPropagation(),h==null||h()},children:E?"Show less":"Show more"}):null]})}),e.jsx("div",{className:"mt-auto pt-5",children:e.jsxs("div",{className:L("flex flex-wrap items-center justify-between gap-3 border-t pt-4","border-gray-200/90 dark:border-gray-800"),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 text-sm",children:[S?e.jsxs("span",{className:L("inline-flex items-center gap-2 rounded-full px-3 py-1.5","bg-white/80 text-gray-700","dark:bg-slate-900 dark:text-gray-300"),children:[e.jsx(Oe,{className:"h-4 w-4 text-violet-600 dark:text-violet-300"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Updated"}),e.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:He(S)})]}):c?e.jsxs("span",{className:L("inline-flex items-center gap-2 rounded-full px-3 py-1.5","bg-white/80 text-gray-700","dark:bg-slate-900 dark:text-gray-300"),children:[e.jsx(Oe,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-300"}),e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:"Created"}),e.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:He(c)})]}):null,A?e.jsxs("span",{className:L("inline-flex items-center gap-2 rounded-full px-3 py-1.5","bg-white/80 text-gray-700","dark:bg-slate-900 dark:text-gray-300"),children:[e.jsx(lt,{className:"h-4 w-4 text-cyan-700 dark:text-cyan-300"}),e.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:A})]}):null]}),e.jsxs("button",{type:"button",onClick:i=>{i.preventDefault(),i.stopPropagation(),ne()},className:L("inline-flex items-center gap-2 rounded-[10px] px-4 py-2.5 text-sm  transition","bg-gradient-to-r from-indigo-600 via-sky-600 to-cyan-600 text-white shadow-sm","hover:brightness-[0.98] hover:shadow-md"),children:[e.jsx(Re,{className:"h-4 w-4"}),"Open project"]})]})})]}),e.jsx($e,{children:N&&e.jsx(ke.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:L(je,"absolute inset-0 z-20 overflow-hidden rounded-[28px] border","border-gray-300/90 bg-white","dark:border-gray-700 dark:bg-slate-900"),role:"dialog","aria-modal":"true",onClick:i=>i.stopPropagation(),onKeyDown:i=>{var M;i.key==="Escape"&&R(!1);const g=(M=i.target)==null?void 0:M.tagName;i.key==="Enter"&&g!=="TEXTAREA"&&(i.preventDefault(),he())},children:e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-gray-300/80 px-4 py-3 dark:border-gray-700",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl border border-gray-300/80 bg-gray-100 dark:border-gray-700 dark:bg-slate-800",children:k}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-950 dark:text-white",children:"Rename project"}),e.jsx("div",{className:"truncate text-sm text-gray-700 dark:text-gray-300",children:l})]})]}),e.jsx("button",{type:"button",onClick:()=>R(!1),className:L("inline-flex h-9 w-9 items-center justify-center rounded-xl border transition","border-gray-300/80 bg-white text-gray-800 hover:shadow-sm","dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200"),"aria-label":"Close",children:e.jsx(Ie,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-4 py-4",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("label",{className:"text-sm font-medium text-gray-800 dark:text-gray-300",children:["Name",e.jsx("input",{type:"text",value:U,onChange:i=>F(i.target.value),placeholder:"Project name",className:L(je,"mt-1 w-full rounded-xl border px-3 py-2.5 text-sm font-medium outline-none","border-gray-300/80 bg-white text-gray-950","focus:border-indigo-500/40 focus:ring-2 focus:ring-indigo-500/10","dark:border-gray-700 dark:bg-slate-900 dark:text-white"),autoFocus:!0})]}),e.jsxs("label",{className:"text-sm font-medium text-gray-800 dark:text-gray-300",children:["Description",e.jsx("textarea",{value:H,onChange:i=>W(i.target.value),placeholder:"Project description",rows:4,className:L(je,"mt-1 w-full rounded-xl border px-3 py-2.5 text-sm leading-6 outline-none","border-gray-300/80 bg-white text-gray-950","focus:border-indigo-500/40 focus:ring-2 focus:ring-indigo-500/10","dark:border-gray-700 dark:bg-slate-900 dark:text-white")})]}),a?e.jsx("div",{className:"rounded-xl border border-red-200/80 bg-red-50 px-3 py-2 text-sm leading-6 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-200",children:a}):null]})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-300/80 bg-white px-4 py-3 dark:border-gray-700 dark:bg-slate-900",children:[e.jsx("button",{type:"button",onClick:()=>R(!1),className:L("rounded-xl border px-4 py-2 text-sm font-semibold transition","border-gray-300/80 bg-white text-gray-800 hover:shadow-sm","dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200"),children:"Cancel"}),e.jsx("button",{type:"button",onClick:he,className:"rounded-xl bg-gradient-to-r from-indigo-600 via-sky-600 to-cyan-600 px-4 py-2 text-sm font-semibold text-white shadow-sm transition hover:brightness-[0.98] hover:shadow-md",children:"Save"})]})]})})})]})}),s.open&&z?Te.createPortal(e.jsx("div",{className:"fixed inset-0 z-[9999]",onClick:i=>{i.preventDefault(),i.stopPropagation(),G()},onContextMenu:i=>{i.preventDefault(),i.stopPropagation(),G()},children:e.jsx("div",{ref:j,role:"menu",tabIndex:-1,onKeyDown:ye,className:"fixed w-48 overflow-hidden rounded-xl border border-gray-300/90 bg-white shadow-2xl dark:border-gray-700 dark:bg-slate-900",style:{left:s.x,top:s.y},onClick:i=>{i.preventDefault(),i.stopPropagation()},onContextMenu:i=>{i.preventDefault(),i.stopPropagation()},children:(()=>{const g=!V,M=!V,q=!V,re="flex items-center gap-2 px-4 py-2.5 outline-none text-sm",T="cursor-pointer transition hover:bg-gray-50 focus:bg-gray-100 dark:hover:bg-slate-800/70 dark:focus:bg-slate-800/70",ee="cursor-not-allowed opacity-50 text-gray-400 dark:text-gray-500",ae=Ee=>L(re,Ee?ee:T);return e.jsxs("ul",{className:"py-1 text-gray-800 dark:text-gray-200",children:[e.jsxs("li",{ref:oe(0),tabIndex:-1,role:"menuitem","aria-disabled":!1,"data-disabled":"false",className:ae(!1),onPointerMove:ie(!1),onClick:de(!1,ne),children:[e.jsx(Re,{className:"h-5 w-5 text-gray-700 dark:text-gray-200"}),e.jsx("span",{children:"Open"})]}),e.jsxs("li",{ref:oe(1),tabIndex:-1,role:"menuitem","aria-disabled":g,"data-disabled":g?"true":"false",className:ae(g),onPointerMove:ie(g),onClick:de(g,me),children:[e.jsx(We,{className:L("h-5 w-5",g?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-200")}),e.jsx("span",{children:"Rename"})]}),e.jsxs("li",{ref:oe(2),tabIndex:-1,role:"menuitem","aria-disabled":M,"data-disabled":M?"true":"false",className:ae(M),onPointerMove:ie(M),onClick:de(M,ge),children:[e.jsx(Ge,{className:L("h-4 w-4",M?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-200")}),e.jsx("span",{children:"Share"})]}),e.jsxs("li",{ref:oe(3),tabIndex:-1,role:"menuitem","aria-disabled":q,"data-disabled":q?"true":"false",className:L(ae(q),q?"":"hover:bg-red-50 focus:bg-red-50 dark:hover:bg-red-950/20 dark:focus:bg-red-950/20"),onPointerMove:ie(q),onClick:de(q,xe),children:[e.jsx(Ke,{className:L("h-5 w-5",q?"text-gray-400 dark:text-gray-500":"text-red-700 dark:text-red-300")}),e.jsx("span",{className:q?void 0:"text-red-700 dark:text-red-300",children:"Remove"})]})]})})()})}),z):null,e.jsx($e,{children:X&&e.jsx(ke.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/35",role:"dialog","aria-modal":"true",onClick:()=>K(!1),children:e.jsxs(ke.div,{initial:{scale:.96,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.96,opacity:0},transition:{duration:.18},className:"w-full max-w-sm rounded-2xl border border-gray-300/90 bg-white p-6 shadow-2xl subpixel-antialiased dark:border-gray-700 dark:bg-slate-900",onClick:i=>i.stopPropagation(),children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-gray-950 dark:text-white",children:"Delete project?"}),e.jsxs("p",{className:"mb-6 text-sm leading-6 text-gray-800 dark:text-gray-200",children:["This action cannot be undone. Are you sure you want to delete ",e.jsx("strong",{children:l}),"?"]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:()=>K(!1),className:"rounded-xl border border-gray-300/80 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:shadow-sm dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200",children:"Cancel"}),e.jsx("button",{type:"button",onClick:fe,className:"rounded-xl bg-gradient-to-r from-red-600 via-rose-600 to-orange-600 px-4 py-2 text-sm font-semibold text-white transition hover:brightness-[0.98] hover:shadow-md",children:"Delete"})]})]})})})]})}function le(...n){return n.filter(Boolean).join(" ")}const Ne="subpixel-antialiased [text-rendering:optimizeLegibility]";function Pt({open:n,onClose:t,onCreate:l}){const w=Se(),[m,c]=r.useState(""),[S,A]=r.useState(""),[I,y]=r.useState(!1),[E,h]=r.useState(""),x=r.useRef(null),D=r.useRef(null);r.useEffect(()=>{n||(c(""),A(""),y(!1),h(""))},[n]),r.useEffect(()=>{n&&queueMicrotask(()=>{var d;return(d=D.current)==null?void 0:d.focus()})},[n]);const k=r.useCallback(()=>{const d=m.trim();return d?d.length<2?(h("Project name must be at least 2 characters."),!1):d.length>120?(h("Project name is too long (max 120)."),!1):(h(""),!0):(h("Project name is required."),!1)},[m]),f=r.useCallback(async()=>{if(k()){y(!0);try{const d=await w.createProject({name:m.trim(),description:S.trim()});te.success(`Project "${m}" created successfully`),l==null||l(d),t()}catch(d){console.error("Failed to create project",d),te.error((d==null?void 0:d.message)||"Failed to create project")}finally{y(!1)}}},[w,m,S,l,t,k]),P=r.useCallback(d=>{x.current&&!x.current.contains(d.target)&&t()},[t]),C=r.useCallback(d=>{d.key==="Escape"&&(d.stopPropagation(),t())},[t]),p=d=>{d.key==="Enter"&&!(d.shiftKey||d.ctrlKey||d.metaKey)&&(d.preventDefault(),f())};return n?e.jsx("div",{className:le(Ne,"fixed inset-0 z-50 flex items-center justify-center"),onMouseDown:P,onKeyDown:C,role:"dialog","aria-modal":"true","aria-labelledby":"new-project-title","aria-describedby":"new-project-desc",children:e.jsx("div",{ref:x,className:le(Ne,"relative w-full max-w-md overflow-hidden rounded-2xl border p-5 shadow-2xl","border-gray-300/90 bg-white","ring-1 ring-inset ring-black/[0.08]","dark:border-gray-700 dark:bg-slate-900","dark:ring-white/[0.08]"),onMouseDown:d=>d.stopPropagation(),children:e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl border border-gray-300/80 bg-gray-100 text-gray-800 dark:border-gray-700 dark:bg-slate-800 dark:text-gray-200",children:e.jsx(Xe,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h3",{id:"new-project-title",className:"text-[15px] font-semibold tracking-[0.01em] text-gray-950 dark:text-white",children:"New project"}),e.jsx("p",{id:"new-project-desc",className:"text-sm leading-6 text-gray-700 dark:text-gray-300",children:"Create a new project with a name and optional description."})]})]}),e.jsx("button",{type:"button",onClick:t,disabled:I,className:le("inline-flex items-center justify-center rounded-xl border p-2 transition","border-gray-300/80 bg-white text-gray-800 hover:shadow-sm","dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200",I?"opacity-60":""),"aria-label":"Close",children:e.jsx(Ie,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("label",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",children:["Name ",e.jsx("span",{className:"text-red-500",children:"*"}),e.jsx("input",{ref:D,value:m,onChange:d=>c(d.target.value),onKeyDown:p,placeholder:"Project name",className:le(Ne,"mt-1 w-full rounded-xl border px-3 py-2.5 text-sm font-medium outline-none transition","border-gray-300/80 bg-white text-gray-950 placeholder:text-gray-400","focus:border-indigo-500/40 focus:ring-2 focus:ring-indigo-500/10","dark:border-gray-700 dark:bg-slate-900 dark:text-white dark:placeholder:text-gray-500"),"aria-invalid":!!E,"aria-describedby":E?"new-project-error":void 0,maxLength:120})]}),e.jsxs("label",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",children:["Description ",e.jsx("span",{className:"font-medium text-gray-400",children:"(optional)"}),e.jsx("textarea",{value:S,onChange:d=>A(d.target.value),onKeyDown:p,placeholder:"A short description",className:le(Ne,"mt-1 w-full rounded-xl border px-3 py-2.5 text-sm leading-6 outline-none transition","border-gray-300/80 bg-white text-gray-950 placeholder:text-gray-400","focus:border-indigo-500/40 focus:ring-2 focus:ring-indigo-500/10","dark:border-gray-700 dark:bg-slate-900 dark:text-white dark:placeholder:text-gray-500"),rows:3,maxLength:2e3})]}),E&&e.jsx("div",{id:"new-project-error",className:"rounded-xl border border-red-200/80 bg-red-50 px-3 py-2 text-sm leading-6 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-200",children:E}),e.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:t,disabled:I,className:le("rounded-xl border px-4 py-2 text-sm font-semibold transition disabled:opacity-60","border-gray-300/80 bg-white text-gray-800 hover:shadow-sm","dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200"),children:"Cancel"}),e.jsx("button",{type:"button",onClick:f,disabled:I,className:le("rounded-xl px-4 py-2 text-sm font-semibold text-white transition disabled:opacity-60","bg-gradient-to-r from-indigo-600 via-sky-600 to-cyan-600 hover:brightness-[0.98] hover:shadow-md"),children:I?"Creating...":"Create"})]})]})]})})}):null}function J(...n){return n.filter(Boolean).join(" ")}const Pe="subpixel-antialiased [text-rendering:optimizeLegibility]";function Lt({open:n,projectId:t,projectName:l,projectOwnerId:w,onClose:m}){const c=Se(),[S,A]=r.useState([]),[I,y]=r.useState([]),[E,h]=r.useState(""),[x,D]=r.useState(!1),[k,f]=r.useState(!1),[P,C]=r.useState(""),[p,d]=r.useState(null),$=r.useRef(null),_=r.useCallback(()=>{A([]),y([]),h(""),D(!1),f(!1),C(""),d(null)},[]);r.useEffect(()=>{if(!n||!t){_();return}(async()=>{D(!0),C("");try{const[o,s]=await Promise.all([c.listUsers(),c.listProjectShares(String(t))]),u=Array.isArray(s)?s:(s==null?void 0:s.results)||(s==null?void 0:s.shares)||[],j=new Set(u.map(v=>{var B,Y,V,Q;return(Q=(V=(Y=(B=v.userId)!=null?B:v.sharedUserId)!=null?Y:v.shared_with_id)!=null?V:v.targetUserId)!=null?Q:v.user_id})),b=w!=null?String(w):null,z=o.map(v=>{var ne,be,me,xe,ge,fe,he,G,pe,oe,ie,de;const B=(xe=(me=(be=(ne=v.id)!=null?ne:v.pk)!=null?be:v.username)!=null?me:v.email)!=null?xe:"",Y=String(B),V=(fe=(ge=v.firstName)!=null?ge:v.first_name)!=null?fe:void 0,Q=(G=(he=v.lastName)!=null?he:v.last_name)!=null?G:void 0,De=b!==null&&Y===b,Me=j.has(B)||j.has(Y);let ue=(de=(ie=(oe=(pe=v.name)!=null?pe:v.fullName)!=null?oe:v.username)!=null?ie:v.email)!=null?de:"Unknown user";if(!v.name&&(V||Q)){const ye=`${V!=null?V:""} ${Q!=null?Q:""}`.trim();ye&&(ue=ye)}return{id:B,name:ue,email:v.email,firstName:V,lastName:Q,isOwner:De,alreadyShared:Me}});A(z)}catch(o){console.error("Failed to load users for sharing",o),C((o==null?void 0:o.message)||"Failed to load users."),A([])}finally{D(!1)}})()},[n,c,_,t,w]);const O=r.useMemo(()=>{const a=E.trim().toLowerCase();return a?S.filter(o=>{const s=String(o.name||"").toLowerCase(),u=String(o.email||"").toLowerCase();return s.includes(a)||u.includes(a)}):S},[S,E]),N=r.useCallback(a=>{y(o=>o.includes(a)?o.filter(s=>s!==a):[...o,a])},[]),R=r.useCallback(a=>{a.key==="Escape"&&(a.stopPropagation(),p?d(null):m())},[m,p]),U=r.useCallback(a=>{$.current&&!$.current.contains(a.target)&&m()},[m]),F=r.useCallback(async()=>{if(!t)return;const a=I.filter(o=>{const s=S.find(u=>String(u.id)===String(o));return!(!s||s.isOwner||s.alreadyShared)});if(!a.length){C("Select at least one new user.");return}f(!0),C("");try{await c.shareProject(String(t),a.map(o=>String(o))),te.success("Project shared successfully"),m()}catch(o){console.error("Failed to share project",o),C((o==null?void 0:o.message)||"Failed to share project."),te.error((o==null?void 0:o.message)||"Failed to share project")}finally{f(!1)}},[c,t,I,m,S]),H=r.useCallback(a=>{a.isOwner||(C(""),d(a))},[]),W=r.useCallback(()=>d(null),[]),X=r.useCallback(async()=>{if(!t||!p)return;const a=p.email||p.name;f(!0);try{await c.revokeProjectShare(String(t),String(p.id)),te.success(`Access revoked for ${a}`),A(o=>o.map(s=>String(s.id)===String(p.id)?{...s,alreadyShared:!1}:s)),y(o=>o.filter(s=>String(s)!==String(p.id))),d(null)}catch(o){console.error("Failed to revoke project share",o),te.error((o==null?void 0:o.message)||"Failed to revoke project share")}finally{f(!1)}},[t,p,c]);if(!n)return null;const K=I.length;return e.jsx("div",{className:J(Pe,"fixed inset-0 z-50 flex items-center justify-center","bg-black/[0.02] dark:bg-white/[0.02]"),onMouseDown:U,onKeyDown:R,role:"dialog","aria-modal":"true","aria-labelledby":"share-project-title","aria-describedby":"share-project-desc",children:e.jsx("div",{ref:$,className:J(Pe,"relative flex max-h-[82vh] w-full max-w-xl flex-col overflow-hidden rounded-2xl border shadow-2xl","border-gray-300/90 bg-white","ring-1 ring-inset ring-black/[0.08]","dark:border-gray-700 dark:bg-slate-900","dark:ring-white/[0.08]"),onMouseDown:a=>a.stopPropagation(),children:e.jsxs("div",{className:"relative flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-start justify-between border-b border-gray-300/80 px-5 pb-3 pt-4 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl border border-gray-300/80 bg-gray-100 text-gray-800 dark:border-gray-700 dark:bg-slate-800 dark:text-gray-200",children:e.jsx(kt,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h3",{id:"share-project-title",className:"text-[15px] font-semibold tracking-[0.01em] text-gray-950 dark:text-white",children:"Share project"}),e.jsxs("p",{id:"share-project-desc",className:"mt-1 text-sm leading-6 text-gray-700 dark:text-gray-300",children:["Share access to ",e.jsx("span",{className:"font-semibold",children:l||"this project"}),"."]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"hidden items-center gap-2 rounded-full border border-amber-300/80 bg-amber-50 px-3 py-1 text-xs font-semibold text-amber-800 dark:border-amber-700 dark:bg-amber-950/30 dark:text-amber-200 sm:inline-flex",children:[e.jsx(Ae,{className:"h-4 w-4"}),"Owner only"]}),e.jsx("button",{type:"button",onClick:m,disabled:k,className:J("inline-flex items-center justify-center rounded-xl border p-2 transition","border-gray-300/80 bg-white text-gray-800 hover:shadow-sm","dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200",k?"opacity-60":""),"aria-label":"Close",children:e.jsx(Ie,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"border-b border-gray-300/80 px-5 py-3 dark:border-gray-700",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-2 flex items-center",children:e.jsx(qe,{className:"h-4 w-4 text-gray-500 dark:text-gray-400"})}),e.jsx("input",{type:"text",value:E,onChange:a=>h(a.target.value),placeholder:"Search users…",className:J(Pe,"w-full rounded-xl border px-8 py-2.5 text-sm font-medium outline-none transition","border-gray-300/80 bg-white text-gray-950 placeholder:text-gray-400","focus:border-indigo-500/40 focus:ring-2 focus:ring-indigo-500/10","dark:border-gray-700 dark:bg-slate-900 dark:text-white dark:placeholder:text-gray-500")})]}),e.jsxs("div",{className:"hidden items-center gap-2 rounded-xl border border-amber-300/80 bg-amber-50 px-3 py-2 text-sm font-medium text-amber-800 dark:border-amber-700 dark:bg-amber-950/30 dark:text-amber-200 md:flex",children:[e.jsx(Ae,{className:"h-4 w-4"}),e.jsx("span",{children:"Only the owner can change access."})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-3",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-300/80 bg-white shadow-sm dark:border-gray-700 dark:bg-slate-900",children:[x&&e.jsx("div",{className:"py-6 text-center text-sm leading-6 text-gray-700 dark:text-gray-300",children:"Loading users..."}),!x&&!O.length&&e.jsx("div",{className:"py-6 text-center text-sm leading-6 text-gray-700 dark:text-gray-300",children:"No users found."}),!x&&O.length>0&&e.jsx("ul",{className:"divide-y divide-gray-200/90 dark:divide-gray-700",children:O.map(a=>{const o=I.includes(a.id),s=!!(a.isOwner||a.alreadyShared),u=a.isOwner?"Owner":a.alreadyShared?"Shared":"Invite",j=a.isOwner?"border-emerald-300/80 bg-emerald-50 text-emerald-800 dark:border-emerald-700 dark:bg-emerald-950/30 dark:text-emerald-200":a.alreadyShared?"border-sky-300/80 bg-sky-50 text-sky-800 dark:border-sky-700 dark:bg-sky-950/30 dark:text-sky-200":"border-gray-300/80 bg-gray-100 text-gray-700 dark:border-gray-700 dark:bg-slate-800 dark:text-gray-200",b=!!(a.alreadyShared&&!a.isOwner);return e.jsxs("li",{className:"flex items-center justify-between px-4 py-3 text-sm",children:[e.jsxs("label",{className:J("flex min-w-0 flex-1 items-center gap-3",s?"cursor-default opacity-60":"cursor-pointer"),children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500",checked:o,disabled:s||k,onChange:()=>!s&&!k&&N(a.id)}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-gray-950 dark:text-white",children:a.name}),e.jsx("span",{className:J("inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-semibold",j),children:u})]}),e.jsx("span",{className:"mt-1 truncate text-sm leading-6 text-gray-700 dark:text-gray-300",children:a.email})]})]}),b&&e.jsx("button",{type:"button",onClick:()=>H(a),disabled:k,className:J("ml-3 shrink-0 rounded-xl px-3 py-2 text-xs font-semibold text-white transition disabled:opacity-60","bg-gradient-to-r from-red-600 via-rose-600 to-orange-600 hover:brightness-[0.98] hover:shadow-md"),children:"Remove"})]},String(a.id))})})]}),P?e.jsx("div",{className:"mt-2 text-sm leading-6 text-red-600 dark:text-red-300",children:P}):null]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-gray-300/80 px-5 py-3 text-sm text-gray-700 dark:border-gray-700 dark:text-gray-300",children:[e.jsx("div",{className:"leading-6",children:K>0?`${K} user${K>1?"s":""} selected.`:"No new users selected."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:m,disabled:k,className:J("rounded-xl border px-4 py-2 text-sm font-semibold transition disabled:opacity-60","border-gray-300/80 bg-white text-gray-800 hover:shadow-sm","dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200"),children:"Cancel"}),e.jsx("button",{type:"button",onClick:F,disabled:k||K===0,className:J("rounded-xl px-4 py-2 text-sm font-semibold text-white transition disabled:opacity-60","bg-gradient-to-r from-indigo-600 via-sky-600 to-cyan-600 hover:brightness-[0.98] hover:shadow-md"),children:k?"Sharing...":K>0?`Share (${K})`:"Share"})]})]}),p&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-black/35",children:e.jsxs("div",{className:"w-full max-w-sm overflow-hidden rounded-2xl border border-red-300/80 bg-white px-5 py-4 text-sm shadow-2xl dark:border-red-800/70 dark:bg-slate-900",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 flex h-10 w-10 items-center justify-center rounded-xl bg-red-50 text-red-700 dark:bg-red-950/30 dark:text-red-200",children:e.jsx(ft,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-base font-semibold text-gray-950 dark:text-white",children:"Remove access"}),e.jsxs("p",{className:"mt-1 text-sm leading-6 text-gray-700 dark:text-gray-300",children:["Remove access to ",e.jsx("span",{className:"font-semibold",children:l||"this project"})," for:"]}),e.jsx("p",{className:"mt-2 text-sm font-semibold text-gray-950 dark:text-white",children:p.name}),p.email?e.jsx("span",{className:"block text-sm leading-6 text-gray-700 dark:text-gray-300",children:p.email}):null,e.jsx("p",{className:"mt-2 text-sm leading-6 text-gray-700 dark:text-gray-300",children:"The user will no longer see this project or its data."})]})]}),e.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:W,disabled:k,className:J("rounded-xl border px-4 py-2 text-sm font-semibold transition disabled:opacity-60","border-gray-300/80 bg-white text-gray-800 hover:shadow-sm","dark:border-gray-700 dark:bg-slate-900 dark:text-gray-200"),children:"Cancel"}),e.jsx("button",{type:"button",onClick:X,disabled:k,className:J("rounded-xl px-4 py-2 text-sm font-semibold text-white transition disabled:opacity-60","bg-gradient-to-r from-red-600 via-rose-600 to-orange-600 hover:brightness-[0.98] hover:shadow-md"),children:k?"Removing...":"Remove access"})]})]})})]})})})}const Rt=250;function se(...n){return n.filter(Boolean).join(" ")}const Ce="subpixel-antialiased [text-rendering:optimizeLegibility]";function Be(n){var S,A,I,y,E,h,x,D,k,f,P,C,p,d,$,_,O,N,R,U,F,H,W,X,K,a;const t=n!=null?n:{},l=(S=t.createdAt)!=null?S:t.created_at,w=(A=t.updatedAt)!=null?A:t.updated_at,m=!!t.isShared,c=t.isOwner!==void 0&&t.isOwner!==null?!!t.isOwner:!m;return{id:(h=(E=(y=(I=t.id)!=null?I:t.pk)!=null?y:t._id)!=null?E:t.name)!=null?h:"",name:(k=(D=(x=t.name)!=null?x:t.label)!=null?D:t.title)!=null?k:"Untitled project",shortName:(C=(P=(f=t.shortName)!=null?f:t.short_name)!=null?P:t.slug)!=null?C:t.name?String(t.name).slice(0,20):"",description:(d=(p=t.description)!=null?p:t.desc)!=null?d:"",createdAt:l?new Date(l):new Date,updatedAt:w?new Date(w):void 0,status:($=t.status)!=null?$:"unknown",protocolsCount:(O=(_=t.protocolsCount)!=null?_:t.protocols_count)!=null?O:Array.isArray(t.protocols)?t.protocols.length:0,diskUsage:(U=(R=(N=t.diskUsage)!=null?N:t.disk_usage)!=null?R:t.storage)!=null?U:void 0,protocols:(H=(F=t.protocols)!=null?F:t.protocolsMap)!=null?H:void 0,isShared:m,isOwner:c,permission:(W=t.permission)!=null?W:"full",projectOwnerId:(a=(K=(X=t.projectOwnerId)!=null?X:t.ownerId)!=null?K:t.owner_id)!=null?a:null}}function Le(n){return e.jsxs("div",{className:se(Ce,"rounded-xl border p-3 shadow-sm","border-gray-300/80 bg-white","dark:border-gray-700 dark:bg-slate-900"),children:[e.jsx("div",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:n.label}),e.jsx("div",{className:"mt-1 text-xl font-bold tracking-[-0.01em] text-gray-950 dark:text-white",children:n.value})]})}function Ft({service:n,fetchList:t}){var a,o;const l=Se(),w=n!=null?n:l,[m,c]=r.useState([]),[S,A]=r.useState(""),[I,y]=r.useState(null),[E,h]=r.useState(!1),x=r.useRef(null),[D,k]=r.useState(null),[f,P]=r.useState(!1),[C,p]=r.useState(!0),[d,$]=r.useState(null),[_,O]=r.useState(null),N=r.useCallback(async()=>{var s;p(!0),$(null);try{const u=await(t?t():w.fetchList());let j=[];Array.isArray(u)?j=u:u&&Array.isArray(u.results)?j=u.results:u&&typeof u=="object"&&(j=Object.values(u)),c(j.map(Be))}catch(u){console.error("[Projects] failed to load projects:",u),$((s=u==null?void 0:u.message)!=null?s:String(u)),c([])}finally{p(!1)}},[t,w]);r.useEffect(()=>{const s=u=>{x.current&&!x.current.contains(u.target)&&h(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]),r.useEffect(()=>{N()},[N]);const R=S.trim().toLowerCase(),U=r.useMemo(()=>R?m.filter(s=>{var z,v,B;const u=String((z=s.name)!=null?z:"").toLowerCase(),j=String((v=s.id)!=null?v:"").toLowerCase(),b=String((B=s.description)!=null?B:"").toLowerCase();return u.includes(R)||j.includes(R)||b.includes(R)}):m,[m,R]),F=r.useMemo(()=>{const s=m.length,u=m.filter(b=>!!b.isShared&&!b.isOwner).length,j=m.filter(b=>!!b.isOwner).length;return{total:s,shared:u,owned:j}},[m]),H=r.useCallback(s=>{c(u=>u.filter(j=>String(j.id)!==String(s)))},[]),W=r.useCallback((s,u,j)=>{c(b=>b.map(z=>String(z.id)===String(s)?{...z,name:u,description:j}:z))},[]),X=r.useCallback(s=>{var b;const u=(b=s&&(s.project||s.data||s.result))!=null?b:s,j=Be(u);c(z=>[j,...z]),A("")},[]),K=r.useCallback((s,u,j)=>{O({id:s,name:u,projectOwnerId:j!=null?j:null})},[]);return e.jsxs(e.Fragment,{children:[e.jsx(et,{title:"Scipion | Projects",description:"Projects page"}),e.jsx("div",{className:se(Ce,"relative overflow-hidden rounded-2xl border p-5 shadow-sm","border-gray-300/90 bg-white","dark:border-gray-700 dark:bg-slate-900","lg:p-6"),children:e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-[15px] font-semibold tracking-[0.01em] text-gray-950 dark:text-white",children:"Projects"}),e.jsx("span",{className:"rounded-full border border-gray-300/80 bg-gray-100 px-2 py-0.5 text-xs font-semibold text-gray-800 dark:border-gray-700 dark:bg-slate-800 dark:text-gray-200",children:F.total})]}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-gray-700 dark:text-gray-300",children:"Browse your projects, open workflows, and manage sharing."})]}),e.jsx("div",{className:"flex flex-wrap items-center justify-start gap-2 sm:justify-end",children:e.jsxs("div",{className:"relative",ref:x,children:[e.jsxs("button",{type:"button",onClick:()=>h(s=>!s),className:se("inline-flex items-center gap-2 rounded-[10px] px-3 py-2 text-sm font-semibold transition","text-white shadow-sm hover:shadow-md hover:brightness-[0.98]","bg-gradient-to-r from-indigo-600 via-sky-600 to-cyan-600"),children:[e.jsx("span",{className:"whitespace-nowrap",children:"Actions"}),e.jsx(rt,{className:"h-5 w-5 opacity-90"})]}),E&&e.jsx("div",{className:se(Ce,"absolute right-0 z-50 mt-2 w-56 overflow-hidden rounded-xl border shadow-xl","border-gray-300/90 bg-white","dark:border-gray-700 dark:bg-slate-900"),children:e.jsxs("ul",{className:"text-sm text-gray-800 dark:text-gray-200",children:[e.jsx("li",{children:e.jsxs("button",{type:"button",className:se("flex w-full items-center gap-2 px-4 py-3 text-left transition","hover:bg-gray-50 dark:hover:bg-slate-800/70"),onClick:()=>{h(!1),P(!0)},children:[e.jsx(Xe,{className:"h-4 w-4"}),e.jsx("span",{children:"New project"})]})}),e.jsx("li",{children:e.jsxs("button",{type:"button",className:se("flex w-full items-center gap-2 px-4 py-3 text-left transition","hover:bg-gray-50 dark:hover:bg-slate-800/70"),onClick:()=>{h(!1),console.log("Import Project")},children:[e.jsx(gt,{className:"h-4 w-4"}),e.jsx("span",{children:"Import project"})]})}),e.jsx("li",{children:e.jsxs("button",{type:"button",className:se("flex w-full items-center gap-2 px-4 py-3 text-left transition","hover:bg-gray-50 dark:hover:bg-slate-800/70"),onClick:()=>{h(!1),console.log("Import Workflow")},children:[e.jsx(mt,{className:"h-4 w-4"}),e.jsx("span",{children:"Import workflow"})]})})]})})]})})]}),e.jsxs("div",{className:"mb-4 grid grid-cols-1 gap-3 lg:grid-cols-12",children:[e.jsx("div",{className:"lg:col-span-6",children:e.jsxs("div",{className:"relative",children:[e.jsx(qe,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500 dark:text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search projects…",value:S,onChange:s=>A(s.target.value),className:se(Ce,"w-full rounded-xl border py-2.5 pl-9 pr-3 text-sm font-medium outline-none transition","border-gray-300/80 bg-white text-gray-950 placeholder:text-gray-400","focus:border-indigo-500/40 focus:ring-2 focus:ring-indigo-500/10","dark:border-gray-700 dark:bg-slate-900 dark:text-white dark:placeholder:text-gray-500","dark:focus:border-indigo-400/40 dark:focus:ring-indigo-400/15")})]})}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 lg:col-span-6 sm:grid-cols-3",children:[e.jsx(Le,{label:"Total",value:F.total}),e.jsx(Le,{label:"Owned",value:F.owned}),e.jsx(Le,{label:"Shared",value:F.shared})]})]}),e.jsxs("div",{className:"overscroll-contain",style:{height:`calc(100vh - ${Rt}px)`,overflowY:"auto",WebkitOverflowScrolling:"touch",paddingRight:4},children:[C&&e.jsx("div",{className:"grid grid-cols-1 items-start gap-6 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6}).map((s,u)=>e.jsxs("div",{className:se("h-[210px] animate-pulse rounded-2xl border p-5 shadow-sm","border-gray-300/80 bg-white","dark:border-gray-700 dark:bg-slate-900"),children:[e.jsx("div",{className:"h-5 w-2/3 rounded bg-gray-200 dark:bg-slate-700"}),e.jsx("div",{className:"mt-3 h-4 w-1/2 rounded bg-gray-200 dark:bg-slate-700"}),e.jsx("div",{className:"mt-6 h-12 rounded bg-gray-100 dark:bg-slate-800"}),e.jsx("div",{className:"mt-3 h-4 w-1/3 rounded bg-gray-200 dark:bg-slate-700"})]},u))}),!C&&d&&e.jsxs("div",{className:"rounded-2xl border border-red-200/80 bg-red-50 p-4 text-sm leading-6 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-200",children:["Error loading projects: ",d]}),!C&&!d&&U.length===0&&e.jsx("div",{className:"rounded-2xl border border-gray-300/80 bg-white p-6 text-sm leading-6 text-gray-700 dark:border-gray-700 dark:bg-slate-900 dark:text-gray-300",children:"No projects found."}),!C&&!d&&U.length>0&&e.jsx("div",{className:"grid grid-cols-1 items-start gap-6 sm:grid-cols-2 lg:grid-cols-3","aria-label":"Projects list",children:U.map(s=>{var u,j,b,z,v;return e.jsx("div",{className:"mt-2 h-full",children:e.jsx(Et,{id:s.id,label:s.name,value:(u=s.protocolsCount)!=null?u:"0",createdAt:s.createdAt?String(s.createdAt):void 0,updatedAt:s.updatedAt?String(s.updatedAt):void 0,diskUsage:(j=s.diskUsage)==null?void 0:j.toString(),isSelected:I===s.name,onSelect:()=>y(s.name),isExpanded:D===s.name,description:(b=s.description)!=null?b:"No description available.",onToggleExpand:()=>k(B=>B===s.name?null:s.name),onDelete:H,onRename:W,onShare:B=>{var Y;return K(B,s.name,(Y=s.projectOwnerId)!=null?Y:null)},isShared:s.isShared,isOwner:s.isOwner,permission:(z=s.permission)==null?void 0:z.toString(),projectOwnerId:(v=s.projectOwnerId)!=null?v:null})},String(s.id))})})]})]})}),e.jsx(Pt,{open:f,onClose:()=>P(!1),onCreate:X}),e.jsx(Lt,{open:!!_,projectId:(a=_==null?void 0:_.id)!=null?a:null,projectName:_==null?void 0:_.name,projectOwnerId:(o=_==null?void 0:_.projectOwnerId)!=null?o:void 0,onClose:()=>O(null)})]})}export{Ft as default};
