@inkeep/open-knowledge 0.5.0-beta.5 → 0.5.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/open-knowledge/SKILL.md +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/constants-Dv1H5oyE.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-Dg9dAN4u.mjs +1 -0
- package/dist/{init-i-jBgnJ2.mjs → init-RvzYffmP.mjs} +3 -3
- package/dist/loader-CDxOkkqb.mjs +1 -0
- package/dist/{loader-CnH9VoDJ.mjs → loader-DUJ2_HFb.mjs} +2 -2
- package/dist/{preview-CCbpDues.mjs → preview-BCygcOLG.mjs} +2 -2
- package/dist/preview-CGVK0lQ4.mjs +1 -0
- package/dist/public/assets/{index-Bzh2wENQ.js → index-BIP_iWia.js} +61 -61
- package/dist/public/assets/index-TsaKvhZv.css +1 -0
- package/dist/public/index.html +2 -2
- package/dist/{src-D_lB64Ap.mjs → src-Cr32cihT.mjs} +2 -2
- package/dist/start-CpQRxtF-.mjs +1 -0
- package/dist/{start-CbyceAIT.mjs → start-DUscODNa.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-B2q9_EXF.mjs +0 -2
- package/dist/init-Dpxl7-0c.mjs +0 -1
- package/dist/loader-mM5jGq2A.mjs +0 -1
- package/dist/preview-UJpuXEs3.mjs +0 -1
- package/dist/public/assets/index-BHqEYdAv.css +0 -1
- package/dist/start-Bo61NrI5.mjs +0 -1
|
@@ -31,7 +31,7 @@ This template lives at an ancestor folder — deleting affects every folder unde
|
|
|
31
31
|
This template lives in your user home (~/.ok/templates/) — deleting affects every OK project you open with this user account.`:``}`}),t[37]=c,t[38]=f,t[39]=_,t[40]=k):k=t[40],t[41]!==D||t[42]!==O||t[43]!==k?(w=(0,Z.jsx)(Ga,{open:D,onOpenChange:O,children:k}),t[41]=D,t[42]=O,t[43]=k,t[44]=w):w=t[44],y=Qi,b=n,x=new Set(e.map(lD)),t[7]=c,t[8]=f,t[9]=o,t[10]=n,t[11]=_,t[12]=i,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w}else y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19];let T;t[45]!==y||t[46]!==m||t[47]!==i||t[48]!==b||t[49]!==x?(T=(0,Z.jsx)(y,{folderPath:b,existingNames:x,open:m,onOpenChange:h,onCreated:i}),t[45]=y,t[46]=m,t[47]=i,t[48]=b,t[49]=x,t[50]=T):T=t[50];let E=u!==null,D;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||d(null)},t[51]=D):D=t[51];let O=u??void 0,k;t[52]!==a||t[53]!==n||t[54]!==O||t[55]!==E?(k=(0,Z.jsx)(wf,{open:E,onOpenChange:D,kind:`file`,initialDir:n,initialTemplate:O,folderConfig:a}),t[52]=a,t[53]=n,t[54]=O,t[55]=E,t[56]=k):k=t[56];let A;return t[57]!==k||t[58]!==S||t[59]!==C||t[60]!==w||t[61]!==T?(A=(0,Z.jsxs)(Z.Fragment,{children:[S,C,w,T,k]}),t[57]=k,t[58]=S,t[59]=C,t[60]=w,t[61]=T,t[62]=A):A=t[62],A}function lD(e){return e.name}function uD(e){return e.scope!==`user`}function dD(e){let t=(0,$.c)(43),{template:n,onCreate:r,onEdit:i,onDelete:a}=e,o=n.title&&n.title!==n.name,s=n.title??n.name,c;t[0]===s?c=t[1]:(c=(0,Z.jsx)(`span`,{className:`font-medium truncate`,children:s}),t[0]=s,t[1]=c);let l;t[2]!==o||t[3]!==n.name?(l=o?(0,Z.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground shrink-0`,children:n.name}):null,t[2]=o,t[3]=n.name,t[4]=l):l=t[4];let u;t[5]===n.scope?u=t[6]:(u=n.scope===`inherited`?(0,Z.jsx)(We,{variant:`gray`,className:`ml-auto shrink-0 text-2xs`,children:`inherited`}):null,t[5]=n.scope,t[6]=u);let d;t[7]===n.scope?d=t[8]:(d=n.scope===`user`?(0,Z.jsx)(We,{variant:`primary`,className:`ml-auto shrink-0 text-2xs`,children:`user`}):null,t[7]=n.scope,t[8]=d);let f;t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[c,l,u,d]}),t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.description?p=t[15]:(p=n.description?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground truncate mt-0.5`,children:n.description}):null,t[14]=n.description,t[15]=p);let m;t[16]!==i||t[17]!==f||t[18]!==p?(m=(0,Z.jsxs)(`button`,{type:`button`,onClick:i,className:`min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm`,children:[f,p]}),t[16]=i,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h=`Create note from ${s}`,g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(ys,{className:`size-3.5`,"aria-hidden":!0}),t[20]=g):g=t[20];let _;t[21]!==r||t[22]!==h?(_=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`font-mono uppercase shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:r,"aria-label":h,children:[g,`Create`]}),t[21]=r,t[22]=h,t[23]=_):_=t[23];let v=`Actions for ${s}`,y;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(mi,{className:`size-4`,"aria-hidden":!0}),t[24]=y):y=t[24];let b;t[25]===v?b=t[26]:(b=(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":v,children:y})}),t[25]=v,t[26]=b);let x;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Re,{"aria-hidden":!0}),t[27]=x):x=t[27];let S;t[28]===i?S=t[29]:(S=(0,Z.jsxs)(li,{onSelect:i,children:[x,`Edit`]}),t[28]=i,t[29]=S);let C;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(et,{"aria-hidden":!0}),t[30]=C):C=t[30];let w;t[31]===a?w=t[32]:(w=(0,Z.jsxs)(li,{variant:`destructive`,onSelect:a,children:[C,`Delete`]}),t[31]=a,t[32]=w);let T;t[33]!==S||t[34]!==w?(T=(0,Z.jsxs)(ki,{align:`end`,children:[S,w]}),t[33]=S,t[34]=w,t[35]=T):T=t[35];let E;t[36]!==b||t[37]!==T?(E=(0,Z.jsxs)(Ca,{children:[b,T]}),t[36]=b,t[37]=T,t[38]=E):E=t[38];let D;return t[39]!==_||t[40]!==E||t[41]!==m?(D=(0,Z.jsxs)(`li`,{className:`group flex items-center gap-2 rounded-md px-2 py-2 hover:bg-muted/50 text-sm`,children:[m,_,E]}),t[39]=_,t[40]=E,t[41]=m,t[42]=D):D=t[42],D}function fD(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Y(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Y(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function pD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hD(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=Y(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function gD(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=Y(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function _D(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vD(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<30?`${a}d ago`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function yD(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function bD(e){let t=(0,$.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Z.jsx)(Ne,{className:`ml-1 size-3`}):(0,Z.jsx)(O,{className:`ml-1 size-3`}):(0,Z.jsx)(Qo,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function xD(e){let t=(0,$.c)(81),{folderPath:n}=e,{folderPaths:r,loading:i,pages:a,pageTitles:o,pageMeta:s}=xr(),c=ma(n),{state:l,refresh:u}=c,[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(`name`),[h,g]=(0,Q.useState)(`asc`);if(i){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(na,{className:`size-5 rounded`}),(0,Z.jsx)(na,{className:`h-7 w-48`})]}),(0,Z.jsx)(na,{className:`h-9 w-20 rounded-md`})]}),t[0]=e):e=t[0];let n;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(na,{className:`h-4 w-16`}),t[1]=n):n=t[1];let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":`Loading folder contents`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[e,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[n,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(na,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(wD)]})]})}),t[2]=r):r=t[2],r}let _,v,y,b,x,S,C,w,T,E;if(t[3]!==l||t[4]!==c||t[5]!==n||t[6]!==r||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==u||t[11]!==h||t[12]!==p){let e=sD(n,{pages:a,pageTitles:o,pageMeta:s,folderPaths:r}),i=yD(e.children,p,h),d;t[23]===p?d=t[24]:(d=function(e){e===p?g(CD):(m(e),g(`asc`))},t[23]=p,t[24]=d);let D=d;E=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,S=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let O;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(fe,{className:`size-5 text-muted-foreground`}),t[25]=O):O=t[25];let k=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e.title})]}),A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsxs)(X,{onClick:()=>f(!0),children:[(0,Z.jsx)(Sa,{className:`size-4`}),`New`]}),t[26]=A):A=t[26],t[27]===k?C=t[28]:(C=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[k,A]})}),t[27]=k,t[28]=C),t[29]!==l||t[30]!==n||t[31]!==u?(w=(0,Z.jsx)(tD,{folderPath:n,state:l,onChange:u}),t[29]=l,t[30]=n,t[31]=u,t[32]=w):w=t[32],t[33]!==l||t[34]!==c||t[35]!==n||t[36]!==u?(T=(0,Z.jsx)(cD,{folderPath:n,state:l,onChange:u,folderConfigHandle:c}),t[33]=l,t[34]=c,t[35]=n,t[36]=u,t[37]=T):T=t[37],x=`rounded-lg border`,v=fD;let j=p===`name`?h===`asc`?`ascending`:`descending`:`none`,M;t[38]!==D||t[39]!==h||t[40]!==p?(M=(0,Z.jsx)(bD,{label:`Name`,sortKey:`name`,activeKey:p,activeDir:h,onSort:D}),t[38]=D,t[39]=h,t[40]=p,t[41]=M):M=t[41];let N;t[42]!==j||t[43]!==M?(N=(0,Z.jsx)(gD,{"aria-sort":j,children:M}),t[42]=j,t[43]=M,t[44]=N):N=t[44];let P=p===`modified`?h===`asc`?`ascending`:`descending`:`none`,F;t[45]!==D||t[46]!==h||t[47]!==p?(F=(0,Z.jsx)(bD,{label:`Modified`,sortKey:`modified`,activeKey:p,activeDir:h,onSort:D}),t[45]=D,t[46]=h,t[47]=p,t[48]=F):F=t[48];let I;t[49]!==P||t[50]!==F?(I=(0,Z.jsx)(gD,{className:`w-32`,"aria-sort":P,children:F}),t[49]=P,t[50]=F,t[51]=I):I=t[51],t[52]!==N||t[53]!==I?(b=(0,Z.jsx)(pD,{children:(0,Z.jsxs)(hD,{children:[N,I]})}),t[52]=N,t[53]=I,t[54]=b):b=t[54],_=mD,y=i.length?i.map(SD):(0,Z.jsx)(hD,{children:(0,Z.jsx)(_D,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:`This folder is empty.`})}),t[3]=l,t[4]=c,t[5]=n,t[6]=r,t[7]=s,t[8]=o,t[9]=a,t[10]=u,t[11]=h,t[12]=p,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E}else _=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22];let D;t[55]!==_||t[56]!==y?(D=(0,Z.jsx)(_,{children:y}),t[55]=_,t[56]=y,t[57]=D):D=t[57];let O;t[58]!==v||t[59]!==b||t[60]!==D?(O=(0,Z.jsxs)(v,{children:[b,D]}),t[58]=v,t[59]=b,t[60]=D,t[61]=O):O=t[61];let k;t[62]!==O||t[63]!==x?(k=(0,Z.jsx)(`div`,{className:x,children:O}),t[62]=O,t[63]=x,t[64]=k):k=t[64];let A;t[65]!==k||t[66]!==S||t[67]!==C||t[68]!==w||t[69]!==T?(A=(0,Z.jsxs)(`div`,{className:S,children:[C,w,T,k]}),t[65]=k,t[66]=S,t[67]=C,t[68]=w,t[69]=T,t[70]=A):A=t[70];let j;t[71]!==A||t[72]!==E?(j=(0,Z.jsx)(`div`,{className:E,children:A}),t[71]=A,t[72]=E,t[73]=j):j=t[73];let M;t[74]!==d||t[75]!==c||t[76]!==n?(M=(0,Z.jsx)(wf,{open:d,onOpenChange:f,kind:`file`,initialDir:n,folderConfig:c,suggestedName:`index`}),t[74]=d,t[75]=c,t[76]=n,t[77]=M):M=t[77];let N;return t[78]!==j||t[79]!==M?(N=(0,Z.jsxs)(Z.Fragment,{children:[j,M]}),t[78]=j,t[79]=M,t[80]=N):N=t[80],N}function SD(e){return(0,Z.jsxs)(hD,{children:[(0,Z.jsx)(_D,{children:(0,Z.jsxs)(`a`,{href:$n(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(Ts,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(gt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(_D,{className:`text-muted-foreground`,children:e.kind===`file`?vD(e.modified):`—`})]},e.path)}function CD(e){return e===`asc`?`desc`:`asc`}function wD(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(na,{className:`size-4 rounded`}),(0,Z.jsx)(na,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(na,{className:`h-4 w-16`})})]},e)}function TD(e){let t=(0,$.c)(7),{docName:n}=e,[r,i]=(0,Q.useState)(ED),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>Oe(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){Ce(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:`Still loading`}),t[4]=l):l=t[4];let u;return t[5]===c?u=t[6]:(u=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:`Cancel`})]}),t[5]=c,t[6]=u),u}function ED(){return new Set}var DD=(0,Q.createContext)(null);function OD(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(kD),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{i(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},t[1]=s):s=t[1];let c=s,l;t[2]===r?l=t[3]:(l={addPropertySignal:r,requestAddProperty:o,clearAddProperty:c},t[2]=r,t[3]=l);let u=l,d;return t[4]!==n||t[5]!==u?(d=(0,Z.jsx)(DD,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function kD(){return new Map}function AD(){let e=(0,Q.use)(DD);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function jD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Cy,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function MD(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(Ey,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function ND(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Y(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(Ay,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var PD=960,FD=1024;function ID(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(RD),[r,i]=(0,Q.useState)(LD),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.matchMedia(`(max-width: ${PD-1}px)`),t=window.matchMedia(`(max-width: ${FD-1}px)`),r=()=>{let r=e.matches;n(r?`sheet`:`panel`),i(!r&&t.matches)};return e.addEventListener(`change`,r),t.addEventListener(`change`,r),()=>{e.removeEventListener(`change`,r),t.removeEventListener(`change`,r)}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o);let s;return e[2]!==r||e[3]!==t?(s={layout:t,autoCollapse:r},e[2]=r,e[3]=t,e[4]=s):s=e[4],s}function LD(){return window.innerWidth>=PD&&window.innerWidth<FD}function RD(){return window.innerWidth<PD?`sheet`:`panel`}var zD={words:0,chars:0,tokens:0},BD=/[ -〿-ゟ゠-ヿ㐀-䶿一-鿿豈---ក-]/,VD=/[\p{L}\p{N}]/u,HD=new Set([`text`,`inlineCode`,`code`,`tag`]),UD=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),WD=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function GD(e,t){if(!e)return;let n=e.type;if(!UD.has(n)){if(HD.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
|
|
32
32
|
`));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)GD(n,t);if(WD.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
|
|
33
33
|
`)&&t.push(`
|
|
34
|
-
`)}}}}function KD(e){try{let t=z().parseToMdast(e),n=[];return GD(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function qD(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))VD.test(n)&&t++;return t}function JD(e){let t=globalThis.Intl.Segmenter;if(!t)return qD(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function YD(e){let t=BD.test(e)?1.5:4;return Math.ceil(e.length/t)}function XD(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=Mn(e);if(!t.trim())return{words:0,chars:0,tokens:0};let n=KD(t);return n?{words:BD.test(n)?JD(n):qD(n),chars:n.length,tokens:YD(n)}:{words:0,chars:0,tokens:0}}var ZD=300;function QD(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(zD),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(zD);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(XD(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,ZD)};return n.observe(s),()=>{r=!0,n.unobserve(s),a&&clearTimeout(a)}},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function $D(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(`connecting`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(`connecting`);return}let t=e.configuration.websocketProvider.status;e.isSynced?r(`synced`):r(t===`connected`?`connected`:t===`disconnected`?`disconnected`:`connecting`);let n=e=>{let{status:t}=e;r(t===`connected`?eO:t===`disconnected`?`disconnected`:`connecting`)},i=e=>{let{state:t}=e;r(t?`synced`:`connected`)},a=()=>r(`disconnected`);return e.on(`status`,n),e.on(`synced`,i),e.on(`disconnect`,a),()=>{e.off(`status`,n),e.off(`synced`,i),e.off(`disconnect`,a)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function eO(e){return e===`synced`?`synced`:`connected`}var tO=yr;function nO(e,t={}){let n=ee(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var rO=200,iO=`Outside any block`;function aO(e){let t=(0,$.c)(5),{editor:n}=e,r=we(n),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(a.current!==null&&(window.clearTimeout(a.current),a.current=null),!n||!i.current)return;let e=r!==null&&r.ancestorChain.length>0,t;return t=e?oO(n,r):o.current?iO:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},rO),()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{ref:i,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`}),t[4]=l):l=t[4],l}function oO(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=nO(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=nO(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}function sO(){let[e]=(0,Q.useState)(Or);return e}function cO({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Yn(e.display_name),color:vr(e.id,Fn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:vr(e.id,Fn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function lO(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var uO=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&kr(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Xt(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(yn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(hn(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(tn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(rn(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push($t(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(nr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(mn(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Vn(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof nn){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof tr){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():lO(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&ir(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},dO=e=>new en({key:typeof e.pluginKey==`string`?new vn(e.pluginKey):e.pluginKey,view:t=>new uO({view:t,...e})});fr.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[dO({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var fO=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return cr(e,{textSerializers:Zn(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Xt(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(yn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(hn(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(tn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(rn(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push($t(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(nr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(mn(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=Vn(this.view,e.from,e.to);ir({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},pO=e=>new en({key:typeof e.pluginKey==`string`?new vn(e.pluginKey):e.pluginKey,view:t=>new fO({view:t,...e})});fr.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[pO({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function mO(e,t){return e??new vn(t)}var hO=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,gO=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),_O=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),vO=new Set([`children`,`className`,`style`]),yO=new Set([`tabIndex`]),bO=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),xO={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function SO(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function CO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function wO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||bO.has(e)}function TO(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function EO(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:xO[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function DO(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function OO(e){return yO.has(e)}function kO(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function AO(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function jO(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||_O.has(e)?String(t):`${t}px`}function MO(e,t){gO.has(t)||e.style.removeProperty(TO(t))}function NO(e,t,n){gO.has(t)||e.style.setProperty(TO(t),jO(t,n))}function PO(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(vO.has(r)||!wO(r)||SO(r,t[r])||SO(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=CO(r);if(a==null||a===!1){OO(r)&&AO(e,r),e.removeAttribute(o);return}if(a===!0){OO(r)&&kO(e,r,!0),e.setAttribute(o,``);return}if(OO(r)){kO(e,r,a);return}e.setAttribute(o,String(a))})}function FO(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function IO(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){MO(e,t);return}NO(e,t,a)}})}function LO(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!SO(t,n))return;let{eventName:i,options:a}=EO(t),o=t=>{n(DO(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function RO(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);hO(()=>{let i=n.current;return FO(e,i.className,t.className),IO(e,i.style,t.style),PO(e,i,t),r.current=LO(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var zO=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(mO(e,`bubbleMenu`)).current;RO(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=ae(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=dO({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,Q.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,ts.createPortal)(c,d.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,Q.useRef)(document.createElement(`div`)),d=(0,Q.useRef)(mO(e,`floatingMenu`)).current;RO(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=ae(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=pO({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,Q.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,ts.createPortal)(s,u.current)});var BO=[{name:`paragraph`,label:`Text`,icon:Ws,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:ut,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:oe,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:Te,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Se,isActive:e=>e.isActive(`list`,{ordered:!1})&&!e.isActive(`listItem`,{checked:!0})&&!e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleBulletList().run()},{name:`orderedList`,label:`Ordered List`,icon:Ve,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Xe,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:he,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:ec,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function VO(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:HO},t[0]=n,t[1]=r);let{current:i,activeStates:a}=L(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Z.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Z.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Fe,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=BO.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(li,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:e.label})]},e.name)}),t[10]=a,t[11]=n,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(ki,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==u||t[16]!==f?(p=(0,Z.jsxs)(Ca,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function HO(e){let t=Object.fromEntries(BO.map(t=>[t.name,t.isActive(e.editor)]));return{current:BO.find(e=>t[e.name])??BO[0],activeStates:t}}function UO(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`File`&&n!==`WikiEmbedFile`)return null;let r=(t.attrs.props??{}).src;return typeof r!=`string`||r.length===0?null:r}function WO(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:ie(typeof n.src==`string`?n.src:``)}function GO(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,n.rel=`noopener noreferrer`,n.style.display=`none`,document.body.appendChild(n),n.click(),n.remove()}function KO(e){let t=(0,$.c)(10),{editor:n}=e,r;if(t[0]===n?r=t[1]:(r={editor:n,selector:qO},t[0]=n,t[1]=r),L(r)===null)return null;let i;t[2]===n?i=t[3]:(i=e=>{e.preventDefault();let t=UO(n);t&&GO(t,WO(n))},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(fi,{className:`size-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Download file`,className:`text-accent-foreground`,onMouseDown:i,children:a})}),t[5]=i,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ao,{side:`bottom`,sideOffset:8,children:`Download file`}),t[7]=s):s=t[7];let c;return t[8]===o?c=t[9]:(c=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(so,{children:[o,s]})}),t[8]=o,t[9]=c),c}function qO(e){return UO(e.editor)}function JO(e){return UO(e)!==null}var YO=[{value:`left`,label:`Align left`,icon:Ae},{value:`center`,label:`Align center`,icon:qe},{value:`right`,label:`Align right`,icon:le}];function XO(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`img`&&n!==`CommonMarkImage`&&n!==`Embed`)return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function ZO(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:QO},t[0]=n,t[1]=r);let i=L(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=YO.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(a!==`img`&&a!==`CommonMarkImage`&&a!==`Embed`||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(nn.create(u.doc,s)),n.view.dispatch(u)},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(ao,{side:`bottom`,sideOffset:8,children:r})]},t)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function QO(e){return XO(e.editor)}function $O(e){return XO(e)!==null}var ek=[{name:`bold`,icon:es,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘B`},{name:`italic`,icon:As,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘I`},{name:`underline`,icon:cc,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘U`},{name:`strikethrough`,icon:rc,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘⇧X`},{name:`code`,icon:ds,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘E`},{name:`highlight`,icon:ks,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘⇧H`}];function tk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:nk},t[0]=n,t[1]=r);let i=L(r),a;t[2]!==i||t[3]!==n?(a=ek.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(ao,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:e.shortcut})]})]},e.name)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function nk(e){return Object.fromEntries(ek.map(t=>[t.name,t.isActive(e.editor)]))}function rk(e){let t=(0,$.c)(46),{editor:n}=e,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.useRef)(null),c;t[0]===n?c=t[1]:(c=n.isActive(`link`),t[0]=n,t[1]=c);let l=c,u;t[2]===n?u=t[3]:(u=n.getAttributes(`link`).href??``,t[2]=n,t[3]=u);let d=u,p,m;t[4]===n?(p=t[5],m=t[6]):(p=()=>{let e=function(){n.state.selection.empty&&i(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},m=[n],t[4]=n,t[5]=p,t[6]=m),(0,Q.useEffect)(p,m);let h,g;t[7]!==d||t[8]!==r?(h=()=>{r&&(o(d),requestAnimationFrame(()=>s.current?.focus()))},g=[r,d],t[7]=d,t[8]=r,t[9]=h,t[10]=g):(h=t[9],g=t[10]),(0,Q.useEffect)(h,g);let _;t[11]!==n||t[12]!==l||t[13]!==a?(_=function(){a.trim()?n.chain().focus().setLink({href:a.trim()}).run():l&&n.chain().focus().unsetLink().run(),i(!1)},t[11]=n,t[12]=l,t[13]=a,t[14]=_):_=t[14];let v=_,y;t[15]===n?y=t[16]:(y=function(){n.chain().focus().unsetLink().run(),i(!1)},t[15]=n,t[16]=y);let b=y,x;t[17]!==v||t[18]!==n?(x=function(e){e.key===`Enter`&&(e.preventDefault(),v()),e.key===`Escape`&&(e.preventDefault(),i(!1),n.chain().focus().run())},t[17]=v,t[18]=n,t[19]=x):x=t[19];let S=x;if(r){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>o(e.target.value),t[20]=e):e=t[20];let n;t[21]!==S||t[22]!==a?(n=(0,Z.jsx)(`input`,{ref:s,type:`url`,placeholder:`Paste link`,value:a,onChange:e,onKeyDown:S,"aria-label":`Link URL`,className:`h-5 w-44 bg-transparent text-sm border-none outline-none placeholder:text-muted-foreground`}),t[21]=S,t[22]=a,t[23]=n):n=t[23];let r;t[24]===v?r=t[25]:(r=()=>{v()},t[24]=v,t[25]=r);let i;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(hs,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[26]=i):i=t[26];let c;t[27]===r?c=t[28]:(c=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Apply link`,onClick:r,children:i}),t[27]=r,t[28]=c);let u;t[29]!==n||t[30]!==c?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1`,children:[n,c]}),t[29]=n,t[30]=c,t[31]=u):u=t[31];let p;t[32]!==d||t[33]!==l||t[34]!==b?(p=l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open link in new tab`,onMouseDown:e=>{e.preventDefault(),f(d)},children:(0,Z.jsx)(ka,{className:`size-3.5`})})}),(0,Z.jsx)(ao,{side:`bottom`,sideOffset:8,children:`Open link in new tab`})]}),(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Remove link`,onMouseDown:e=>{e.preventDefault(),b()},children:(0,Z.jsx)(et,{className:`size-3.5`})})}),(0,Z.jsx)(ao,{side:`bottom`,sideOffset:8,children:`Remove link`})]})]}),t[32]=d,t[33]=l,t[34]=b,t[35]=p):p=t[35];let m;return t[36]!==u||t[37]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[u,p]}),t[36]=u,t[37]=p,t[38]=m):m=t[38],m}let C=l?`bg-accent text-primary`:`text-accent-foreground`,w,T;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e.preventDefault(),i(!0)},T=(0,Z.jsx)(Ps,{className:`size-3.5`}),t[39]=w,t[40]=T):(w=t[39],T=t[40]);let E;t[41]===C?E=t[42]:(E=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Insert link`,className:C,onMouseDown:w,children:T})}),t[41]=C,t[42]=E);let D;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(ao,{side:`bottom`,sideOffset:8,children:[`Link`,(0,Z.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:`⌘K`})]}),t[43]=D):D=t[43];let O;return t[44]===E?O=t[45]:(O=(0,Z.jsxs)(so,{children:[E,D]}),t[44]=E,t[45]=O),O}function ik({editor:e}){if(e.isActive(`codeBlock`))return!1;if($O(e)||JO(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function ak(e){let t=(0,$.c)(22),{editor:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),s;t[0]===n?s=t[1]:(s={editor:n,selector:uk},t[0]=n,t[1]=s);let c=L(s),l;t[2]===n?l=t[3]:(l={editor:n,selector:lk},t[2]=n,t[3]=l);let u=L(l),d;t[4]!==n.state||t[5]!==n.view?(d=()=>{try{let{from:e,to:t}=n.state.selection;return Vn(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=d):d=t[6];let f;if(t[7]!==n.view.dom||t[8]!==d){let e={getBoundingClientRect:d,contextElement:n.view.dom};f=()=>{let t=r.current;t&&(o.current?.(),o.current=_n(e,t,()=>{ir(e,t,{placement:`top`,strategy:`fixed`,middleware:[hn(8),Xt(),yn({padding:8})]}).then(e=>{let{x:n,y:r}=e;t.isConnected&&(t.style.position=`fixed`,t.style.left=`${n}px`,t.style.top=`${r}px`)}).catch(ck)}))},t[7]=n.view.dom,t[8]=d,t[9]=f}else f=t[9];let p=f,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{o.current?.(),o.current=null,a(sk)},t[10]=m):m=t[10];let h=m,g;t[11]===p?g=t[12]:(g={onShow:p,onHide:h,strategy:`fixed`},t[11]=p,t[12]=g);let _;t[13]!==n||t[14]!==u||t[15]!==c||t[16]!==i?(_=c?(0,Z.jsx)(ZO,{editor:n},`${i}-img-align`):u?(0,Z.jsx)(KO,{editor:n},`${i}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(VO,{editor:n}),(0,Z.jsx)(yi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(tk,{editor:n},i),(0,Z.jsx)(yi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(rk,{editor:n},`${i}-link`)]}),t[13]=n,t[14]=u,t[15]=c,t[16]=i,t[17]=_):_=t[17];let v;return t[18]!==n||t[19]!==g||t[20]!==_?(v=(0,Z.jsx)(zO,{ref:r,editor:n,appendTo:ok,shouldShow:ik,updateDelay:250,options:g,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:_}),t[18]=n,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function ok(){return document.body}function sk(e){return e+1}function ck(){}function lk(e){return JO(e.editor)}function uk(e){return $O(e.editor)}var dk=[{name:`addRowBefore`,icon:Ne,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:O,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:et,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],fk=[{name:`addColumnBefore`,icon:Qr,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:Ti,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:et,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],pk=[{name:`toggleHeaderRow`,icon:ac,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:ps,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:Ds,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function mk({editor:e}){return e.isActive(`table`)}function hk(e){let t=(0,$.c)(14),{action:n,editor:r}=e,i=n.icon,a;t[0]!==n||t[1]!==r?(a=e=>{e.preventDefault(),n.command(r)},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(i,{className:`size-3.5`}),t[3]=i,t[4]=o);let s;t[5]!==n.label||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":n.label,className:`text-muted-foreground`,onMouseDown:a,children:o})}),t[5]=n.label,t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;t[9]===n.label?c=t[10]:(c=(0,Z.jsx)(ao,{side:`bottom`,sideOffset:8,children:n.label}),t[9]=n.label,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,Z.jsxs)(so,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function gk(e){let t=(0,$.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=dk.map(e=>(0,Z.jsx)(hk,{action:e,editor:n},e.name)),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(yi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=fk.map(e=>(0,Z.jsx)(hk,{action:e,editor:n},e.name)),t[3]=n,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(yi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=pk.map(e=>(0,Z.jsx)(hk,{action:e,editor:n},e.name)),t[6]=n,t[7]=s);let c;return t[8]!==n||t[9]!==r||t[10]!==a||t[11]!==s?(c=(0,Z.jsxs)(zO,{editor:n,shouldShow:mk,updateDelay:100,className:`flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[r,i,a,o,s]}),t[8]=n,t[9]=r,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}var _k=new WeakMap;function vk(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=Tr(e.color),n.textContent=e.name,t.append(n),t}var yk={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function bk(){let e=new jr({extensions:On});return{mdManager:e,text:q({mdManager:e}),html:G({mdManager:e}),paste:w({mdManager:e}),drop:x({mdManager:e})}}function xk(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...Ye.map(e=>e.name===`link`||e.name===`wikiLink`?e.configure({docName:t.configuration.name??``}):e),tO.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),K.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),fr.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[I]}}),fr.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[b(e,{cursorBuilder:vk})]}})]}function Sk(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{_k.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=_k.get(e);if(_k.delete(e),r==null)return;let i=performance.now();ye(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:(e,t)=>n.drop(e,t)},extensions:$u(xk(e))}}function Ck(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=hr(xk({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=F(t.document.getXmlFragment(`default`),a);return{...Sk({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var wk=e=>{let t=(0,$.c)(20),{provider:n,placeholder:r,isSourceMode:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(yk),s=sO(),{principal:c,activeDocName:l}=Ue(),u=n.configuration.name??``,[d]=(0,Q.useState)(bk),f;t[0]!==d||t[1]!==r||t[2]!==n?(f=()=>()=>({editor:new Rn(Ck({provider:n,placeholder:r,clipboard:d,ctorStart:performance.now()})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=d,t[1]=r,t[2]=n,t[3]=f):f=t[3];let[p]=(0,Q.useState)(f),m,h;if(t[4]!==p||t[5]!==u||t[6]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=se(u)??crypto.randomUUID();m=Q.use,h=He({docName:u,mountId:r,construct:p,sizeStats:e}),t[4]=p,t[5]=u,t[6]=n.document,t[7]=m,t[8]=h}else m=t[7],h=t[8];let g=m(h),_=g.editor,v,y;t[9]===g?(v=t[10],y=t[11]):(v=()=>()=>{ze(g)},y=[g],t[9]=g,t[10]=v,t[11]=y),(0,Q.useEffect)(v,y);let b;return t[12]!==l||t[13]!==u||t[14]!==_||t[15]!==s||t[16]!==i||t[17]!==c||t[18]!==n?(b=(0,Z.jsx)(Tk,{provider:n,isSourceMode:i,docName:u,activeDocName:l,identity:s,principal:c,editor:_,wrapperRef:a,flashStateRef:o}),t[12]=l,t[13]=u,t[14]=_,t[15]=s,t[16]=i,t[17]=c,t[18]=n,t[19]=b):b=t[19],b},Tk=e=>{let t=(0,$.c)(62),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u}=e,d;t[0]!==c||t[1]!==n.configuration.name?(d=()=>(be(c,n.configuration.name??null),()=>{be(c,null)}),t[0]=c,t[1]=n.configuration.name,t[2]=d):d=t[2];let f;t[3]!==c||t[4]!==n?(f=[c,n],t[3]=c,t[4]=n,t[5]=f):f=t[5],(0,Q.useEffect)(d,f);let m;t[6]!==c||t[7]!==n.configuration.name?(m=()=>{},t[6]=c,t[7]=n.configuration.name,t[8]=m):m=t[8];let h;t[9]!==c||t[10]!==n?(h=[c,n],t[9]=c,t[10]=n,t[11]=h):h=t[11],(0,Q.useEffect)(m,h);let g;t[12]!==c||t[13]!==n.configuration.name?(g=()=>{},t[12]=c,t[13]=n.configuration.name,t[14]=g):g=t[14];let _;t[15]!==c||t[16]!==n?(_=[c,n],t[15]=c,t[16]=n,t[17]=_):_=t[17],(0,Q.useEffect)(g,_);let v,b;t[18]===c?(v=t[19],b=t[20]):(v=()=>{let e=Ek,t=null,n=()=>{if(t||c.isDestroyed)return;let n=p(c);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return p(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},b=[c],t[18]=c,t[19]=v,t[20]=b),(0,Q.useEffect)(v,b);let x,C;t[21]!==u||t[22]!==n.document||t[23]!==l?(C=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},lr)};c(yk);let f=()=>{if(Wn(e),!Bn(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?Bn(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},x=[n.document,u,l],t[21]=u,t[22]=n.document,t[23]=l,t[24]=x,t[25]=C):(x=t[24],C=t[25]),(0,Q.useEffect)(C,x);let w,T;t[26]===n?(w=t[27],T=t[28]):(w=()=>{let e=window.location.hash,t=e.indexOf(`?`),r=t>=0?new URLSearchParams(e.slice(t+1)).get(`anchor`):null;if(!r)return;let i=r,a=0,o,s=!1;function c(){if(s)return;let e=document.getElementById(i);e?(e.scrollIntoView({behavior:`smooth`,block:`start`}),s=!0,n.off(`synced`,c)):a<20&&(a+=1,o=window.setTimeout(c,100))}return c(),n.on(`synced`,c),()=>{o!==void 0&&clearTimeout(o),n.off(`synced`,c)}},T=[n],t[26]=n,t[27]=w,t[28]=T),(0,Q.useEffect)(w,T);let E,D;t[29]===c?(E=t[30],D=t[31]):(E=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=p(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&r.scrollIntoView({behavior:`smooth`,block:`start`})};return window.addEventListener(Io,e),()=>window.removeEventListener(Io,e)},D=[c],t[29]=c,t[30]=E,t[31]=D),(0,Q.useEffect)(E,D);let O;t[32]!==a||t[33]!==i||t[34]!==o||t[35]!==r||t[36]!==s||t[37]!==n.awareness?(O=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:cO({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[32]=a,t[33]=i,t[34]=o,t[35]=r,t[36]=s,t[37]=n.awareness,t[38]=O):O=t[38];let k;t[39]!==a||t[40]!==i||t[41]!==o||t[42]!==r||t[43]!==s||t[44]!==n?(k=[n,i,a,o,s,r],t[39]=a,t[40]=i,t[41]=o,t[42]=r,t[43]=s,t[44]=n,t[45]=k):k=t[45],(0,Q.useEffect)(O,k);let A,j,M,N;t[46]===c?(A=t[47],j=t[48],M=t[49],N=t[50]):(A=(0,Z.jsx)(ak,{editor:c}),j=(0,Z.jsx)(gk,{editor:c}),M=(0,Z.jsx)(re,{editor:c,className:`h-full`}),N=(0,Z.jsx)(aO,{editor:c}),t[46]=c,t[47]=A,t[48]=j,t[49]=M,t[50]=N);let P;t[51]===c?P=t[52]:(P=y(c),t[51]=c,t[52]=P);let F;t[53]===P.store?F=t[54]:(F=(0,Z.jsx)(S,{store:P.store}),t[53]=P.store,t[54]=F);let I;return t[55]!==A||t[56]!==j||t[57]!==M||t[58]!==N||t[59]!==F||t[60]!==l?(I=(0,Z.jsxs)(`div`,{ref:l,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[A,j,M,N,F]}),t[55]=A,t[56]=j,t[57]=M,t[58]=N,t[59]=F,t[60]=l,t[61]=I):I=t[61],I};function Ek(){return ft()}function Dk(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(st(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var Ok=`__back-nav__`;function kk(e){return e instanceof me||e instanceof Ke||e instanceof ce||e instanceof ke||e instanceof nt||e instanceof ve?e.docName:null}function Ak(e){return e instanceof me?{title:`Couldn't load document`,summary:`"${e.docName}" took too long. Check your connection.`}:e instanceof Ke?{title:`Connection dropped`,summary:`Lost connection to "${e.docName}".`}:e instanceof ce?{title:`Document not found`,summary:`"${e.docName}" doesn't exist.`}:e instanceof ke?{title:`Couldn't open document`,summary:`Something went wrong opening "${e.docName}".`}:e instanceof nt?{title:`Server can't open documents`,summary:`This project's running server doesn't support live editing. Restart Open Knowledge to fix.`}:e instanceof ve?{title:`Cancelled`,summary:`You cancelled loading "${e.docName}".`}:{title:`Unknown error`,summary:e instanceof Error&&e.message?e.message:`An unexpected error occurred.`}}function jk(e){let t=(0,$.c)(27),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=Ak(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(rb,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-lg font-medium`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===r?v=t[13]:(v=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:`Try again`}),t[12]=r,t[13]=v);let y;t[14]!==i||t[15]!==u||t[16]!==n||t[17]!==o||t[18]!==a||t[19]!==r?(y=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Le(kk(n)??i),o(a),r(Ok))},children:`Go back`}):null,t[14]=i,t[15]=u,t[16]=n,t[17]=o,t[18]=a,t[19]=r,t[20]=y):y=t[20];let b;t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==_?(x=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[m,_,b]}),t[24]=b,t[25]=_,t[26]=x):x=t[26],x}function Mk(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(jk,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===Ok){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=e=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${Ak(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(P,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}var Nk={text:``,number:0,boolean:!1,date:``,list:[]};function Pk(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=fn(t);return{map:n,keys:an(t),parseError:r}}function Fk(e){let t=(0,$.c)(169),{provider:n}=e,[r,i]=(0,Q.useState)(null),a;t[0]===n?a=t[1]:(a=()=>Pk(n),t[0]=n,t[1]=a);let[o,s]=(0,Q.useState)(a),c,l;t[2]===n?(c=t[3],l=t[4]):(c=()=>{let e=gr(n);i(e),s(e.current());let t=e.subscribe(e=>{s(e)});return()=>{t(),e.dispose(),i(t=>t===e?null:t)}},l=[n],t[2]=n,t[3]=c,t[4]=l),(0,Q.useEffect)(c,l);let u=o.map,d=o.keys,f=o.parseError,[p,m]=(0,Q.useState)(!1),h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h={},t[5]=h):h=t[5];let[g,_]=(0,Q.useState)(h),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S={},t[6]=S):S=t[6];let[C,w]=(0,Q.useState)(S),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[7]=T):T=t[7];let[E,O]=(0,Q.useState)(T),k=n.configuration.name??``,j;t[8]===k?j=t[9]:(j=Lk(k),t[8]=k,t[9]=j);let N=ma(j),P;t[10]!==N.state.data||t[11]!==N.state.status?(P=N.state.status===`ready`?N.state.data.folder.frontmatter_defaults??{}:{},t[10]=N.state.data,t[11]=N.state.status,t[12]=P):P=t[12];let F=P,I;t[13]!==N.state.data||t[14]!==N.state.status?(I=N.state.status===`ready`?N.state.data.frontmatterSources:{},t[13]=N.state.data,t[14]=N.state.status,t[15]=I):I=t[15];let L=I,R;t[16]===r?R=t[17]:(R=function(e){if(!r)return{ok:!1,error:`Connecting`};let t=r.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=sr(t.error);return{ok:!1,error:t.error.issues[0]?.message??`Invalid patch payload`,fieldErrors:Object.keys(n).length>0?n:void 0}},t[16]=r,t[17]=R);let z=R,B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){w(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[18]=B):B=t[18];let V=B,H;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e,t){if(e.ok)return;let n=e.error??`Failed to update property`,r=e.fieldErrors??{};w(e=>{let i={...e};for(let e of t)i[e]=r[e]??n;return i}),O(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[19]=H):H=t[19];let U=H,W;t[20]===z?W=t[21]:(W=function(e,t){V(e),U(z({[e]:t}),[e])},t[20]=z,t[21]=W);let G=W,K;t[22]===z?K=t[23]:(K=function(e){V(e),U(z({[e]:null}),[e])},t[22]=z,t[23]=K);let q=K,ee;t[24]===r?ee=t[25]:(ee=function(e,t){if(!r)return{ok:!1,error:`Connecting`};if(e===t)return{ok:!0};let n=r.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=sr(n.error);return{ok:!1,error:n.error.issues[0]?.message??`Failed to rename`,fieldErrors:Object.keys(i).length>0?i:void 0}},t[24]=r,t[25]=ee);let te=ee,ne;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e,t){return`${e} ${t}`},t[26]=ne):ne=t[26];let re=ne,ie;t[27]!==r||t[28]!==d?(ie=function(e){if(!r)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let i=d.map((e,t)=>re(e,t)),a=i.indexOf(t),o=i.indexOf(n);if(a<0||o<0)return;let s=d.slice(),[c]=s.splice(a,1);if(!c)return;s.splice(o,0,c);let l=r.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[27]=r,t[28]=d,t[29]=ie):ie=t[29];let ae=ie,oe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(oe={activationConstraint:{distance:4}},t[30]=oe):oe=t[30];let se;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(se={coordinateGetter:Ci},t[31]=se):se=t[31];let ce=Pi(ci(Oi,oe),ci(xi,se)),le;t[32]!==F||t[33]!==G||t[34]!==u?(le=function(e,t){let n=u[e]??Rk(F[e]);if(n===void 0)return;_(n=>({...n,[e]:t}));let r=HE(n,t);(!Object.hasOwn(u,e)||!Ik(n,r))&&G(e,r)},t[32]=F,t[33]=G,t[34]=u,t[35]=le):le=t[35];let ue=le,de;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(de=function(){y({name:``,type:`text`,value:``,error:null}),m(!1)},t[36]=de):de=t[36];let fe=de,{addPropertySignal:pe,clearAddProperty:me}=AD(),he;t[37]!==pe||t[38]!==k?(he=pe.get(k)??0,t[37]=pe,t[38]=k,t[39]=he):he=t[39];let ge=he,_e,ve;t[40]===ge?(_e=t[41],ve=t[42]):(_e=()=>{ge>0&&(y({name:``,type:`text`,value:``,error:null}),m(!1))},ve=[ge],t[40]=ge,t[41]=_e,t[42]=ve),(0,Q.useEffect)(_e,ve);let ye,be;t[43]!==me||t[44]!==k?(ye=()=>()=>me(k),be=[k,me],t[43]=me,t[44]=k,t[45]=ye,t[46]=be):(ye=t[45],be=t[46]),(0,Q.useEffect)(ye,be);let xe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(e){y(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Nk[e];return{...t,type:e,value:n,error:null}})},t[47]=xe):xe=t[47];let Se=xe,Ce;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){y(t=>t&&{...t,value:e})},t[48]=Ce):Ce=t[48];let we=Ce,Te;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){y(t=>t&&{...t,name:e,error:null})},t[49]=Te):Te=t[49];let J=Te,Ee;t[50]!==v||t[51]!==z||t[52]!==u?(Ee=function(){if(!v)return;let e=v.name.trim();if(!e){y({...v,error:`Name is required`});return}if(e===`frontmatter`){y({...v,error:`"frontmatter" is a reserved property name`});return}if(Object.hasOwn(u,e)){y({...v,error:`Property "${e}" already exists`});return}let t=z({[e]:v.value});if(t.ok){y(null);return}let n=t.fieldErrors?.[e],r=t.error??`Failed to add property`;y({...v,error:n??r})},t[50]=v,t[51]=z,t[52]=u,t[53]=Ee):Ee=t[53];let De=Ee,Oe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){y(null)},t[54]=Oe):Oe=t[54];let ke=Oe,Ae;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=function(e){x({key:e,draft:e,error:null})},t[55]=Ae):Ae=t[55];let je=Ae,Ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){x(t=>t&&{...t,draft:e,error:null})},t[56]=Ne):Ne=t[56];let Pe=Ne,Fe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(){x(null)},t[57]=Fe):Fe=t[57];let Ie=Fe,Le;t[58]!==u||t[59]!==te||t[60]!==b?(Le=function(){if(!b)return;let e=b.draft.trim();if(!e){x(null);return}if(e===b.key){x(null);return}if(e===`frontmatter`){x({...b,error:`"frontmatter" is a reserved property name`});return}if(Object.hasOwn(u,e)){x({...b,error:`Property "${e}" already exists`});return}let t=te(b.key,e);if(t.ok){_(t=>{if(!Object.hasOwn(t,b.key))return t;let n={...t};return n[e]=n[b.key],delete n[b.key],n}),V(b.key),x(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[b.key]??t.error??`Failed to rename property`;x({...b,error:n})},t[58]=u,t[59]=te,t[60]=b,t[61]=Le):Le=t[61];let Re=Le,ze;t[62]!==u||t[63]!==d?(ze=d.length>0?d:Object.keys(u),t[62]=u,t[63]=d,t[64]=ze):ze=t[64];let Be=ze,Ve;if(t[65]!==Be){Ve=new Map;for(let e of Be)Ve.set(e,(Ve.get(e)??0)+1);t[65]=Be,t[66]=Ve}else Ve=t[66];let He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e;if(t[67]!==v||t[68]!==F||t[69]!==L||t[70]!==p||t[71]!==G||t[72]!==Re||t[73]!==Ve||t[74]!==C||t[75]!==ae||t[76]!==u||t[77]!==g||t[78]!==f||t[79]!==q||t[80]!==b||t[81]!==Be||t[82]!==E||t[83]!==ce||t[84]!==ue){$e=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(F).filter(e=>!Object.hasOwn(u,e)).sort();if(Be.length===0&&e.length===0&&!v&&!f){$e=null;break bb0}Ze=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,Qe=`property-panel`,Ue=Me,Je=!p,t[97]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=e=>m(!e),t[97]=Ye):Ye=t[97];let n=!p,r;t[98]===n?r=t[99]:(r=(0,Z.jsx)(M,{"data-expanded":n,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[98]=n,t[99]=r);let i;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{children:`Properties`}),t[100]=i):i=t[100],t[101]===r?Xe=t[102]:(Xe=(0,Z.jsx)(A,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[r,i]})}),t[101]=r,t[102]=Xe),He=D,We=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[103]===f?Ge=t[104]:(Ge=f?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Cn,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[`Frontmatter YAML is malformed; fix in source mode to recover.`,(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:f})]})]}):null,t[103]=f,t[104]=Ge);let a;if(t[105]!==Be){let e;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>re(e,t),t[107]=e):e=t[107],a=Be.map(e),t[105]=Be,t[106]=a}else a=t[106];let o;if(t[108]!==F||t[109]!==L||t[110]!==G||t[111]!==Re||t[112]!==Ve||t[113]!==C||t[114]!==u||t[115]!==g||t[116]!==q||t[117]!==b||t[118]!==Be||t[119]!==E||t[120]!==ue){let e;t[122]!==F||t[123]!==L||t[124]!==G||t[125]!==Re||t[126]!==Ve||t[127]!==C||t[128]!==u||t[129]!==g||t[130]!==q||t[131]!==b||t[132]!==E||t[133]!==ue?(e=(e,t)=>{let n=u[e];if(n===void 0)return null;let r=g[e]??bn(n),i=b?.key===e?b:null,a=(Ve.get(e)??0)>1,o=Object.hasOwn(F,e)?(0,Z.jsx)(zk,{source:L[e]??``}):void 0;return(0,Z.jsx)(WE,{sortableId:re(e,t),keyName:e,value:n,declared:r,error:C[e]??null,resetCounter:E[e]??0,isDuplicate:a,badge:o,rename:{state:i,onBegin:()=>je(e),onChangeDraft:Pe,onCommit:Re,onCancel:Ie},onCommit:t=>G(e,t),onChangeType:t=>ue(e,t),onRemove:()=>q(e)},`${e}-${t}`)},t[122]=F,t[123]=L,t[124]=G,t[125]=Re,t[126]=Ve,t[127]=C,t[128]=u,t[129]=g,t[130]=q,t[131]=b,t[132]=E,t[133]=ue,t[134]=e):e=t[134],o=Be.map(e),t[108]=F,t[109]=L,t[110]=G,t[111]=Re,t[112]=Ve,t[113]=C,t[114]=u,t[115]=g,t[116]=q,t[117]=b,t[118]=Be,t[119]=E,t[120]=ue,t[121]=o}else o=t[121];let s;t[135]!==a||t[136]!==o?(s=(0,Z.jsx)(Si,{items:a,strategy:hi,children:o}),t[135]=a,t[136]=o,t[137]=s):s=t[137],t[138]!==ae||t[139]!==ce||t[140]!==s?(Ke=(0,Z.jsx)(vi,{sensors:ce,collisionDetection:Da,onDragEnd:ae,children:s}),t[138]=ae,t[139]=ce,t[140]=s,t[141]=Ke):Ke=t[141];let c;t[142]!==F||t[143]!==L||t[144]!==G||t[145]!==C||t[146]!==E||t[147]!==ue?(c=e=>{let t=F[e],n=Rk(t),r=bn(n),i=L[e]??``;return(0,Z.jsx)(WE,{keyName:e,value:n,declared:r,error:C[e]??null,resetCounter:E[e]??0,isInherited:!0,badge:(0,Z.jsx)(ZE,{source:i}),onCommit:t=>G(e,t),onChangeType:t=>ue(e,t)},`inherited-${e}`)},t[142]=F,t[143]=L,t[144]=G,t[145]=C,t[146]=E,t[147]=ue,t[148]=c):c=t[148],qe=e.map(c)}t[67]=v,t[68]=F,t[69]=L,t[70]=p,t[71]=G,t[72]=Re,t[73]=Ve,t[74]=C,t[75]=ae,t[76]=u,t[77]=g,t[78]=f,t[79]=q,t[80]=b,t[81]=Be,t[82]=E,t[83]=ce,t[84]=ue,t[85]=He,t[86]=Ue,t[87]=We,t[88]=Ge,t[89]=Ke,t[90]=qe,t[91]=Je,t[92]=Ye,t[93]=Xe,t[94]=Ze,t[95]=Qe,t[96]=$e}else He=t[85],Ue=t[86],We=t[87],Ge=t[88],Ke=t[89],qe=t[90],Je=t[91],Ye=t[92],Xe=t[93],Ze=t[94],Qe=t[95],$e=t[96];if($e!==Symbol.for(`react.early_return_sentinel`))return $e;let et;t[149]!==v||t[150]!==De?(et=v?(0,Z.jsx)(YE,{draft:v,onChangeName:J,onChangeType:Se,onChangeValue:we,onCommit:De,onCancel:ke}):(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:fe,className:`mt-1 flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(Sa,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:`Add property`})]}),t[149]=v,t[150]=De,t[151]=et):et=t[151];let tt;t[152]!==He||t[153]!==We||t[154]!==Ge||t[155]!==Ke||t[156]!==qe||t[157]!==et?(tt=(0,Z.jsxs)(He,{className:We,children:[Ge,Ke,qe,et]}),t[152]=He,t[153]=We,t[154]=Ge,t[155]=Ke,t[156]=qe,t[157]=et,t[158]=tt):tt=t[158];let nt;t[159]!==Ue||t[160]!==Je||t[161]!==Ye||t[162]!==Xe||t[163]!==tt?(nt=(0,Z.jsxs)(Ue,{open:Je,onOpenChange:Ye,children:[Xe,tt]}),t[159]=Ue,t[160]=Je,t[161]=Ye,t[162]=Xe,t[163]=tt,t[164]=nt):nt=t[164];let rt;return t[165]!==Ze||t[166]!==Qe||t[167]!==nt?(rt=(0,Z.jsx)(`div`,{className:Ze,"data-testid":Qe,children:nt}),t[165]=Ze,t[166]=Qe,t[167]=nt,t[168]=rt):rt=t[168],rt}function Ik(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function Lk(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function Rk(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}function zk(e){let t=(0,$.c)(2),{source:n}=e,r=`Overrides default from ${n===``?`.ok/frontmatter.yml`:`${n}/.ok/frontmatter.yml`}. Remove to revert.`,i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(We,{variant:`primary`,"data-testid":`property-override-badge`,title:r,className:`text-2xs`,children:`overrides`}),t[0]=r,t[1]=i),i}var Bk=at(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Vk(e){let t=e.threshold??Bk;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Hk(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var Uk=at(`ACTIVITY_MOUNT_LIMIT`,3);function Wk(){return r(()=>import(`./SourceEditor-CJiFlEvK.js`),__vite__mapDeps([43,1,35,2,36,37,21,38,39,40,41,20,3,6,7,15,4,8,14,9,44,24]),import.meta.url)}var Gk=(0,Q.lazy)(async()=>({default:(await Wk()).SourceEditor}));function Kk(e,t,n){if(n<=0)return[];let r=e.filter(e=>!xe(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function qk(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:`Couldn't reconnect after server restart`,summary:t.reason===`clear-data-timeout`?`Local collaboration data for "${e}" could not be cleared in time. Reload to retry.`:`Local collaboration data for "${e}" could not be cleared. Reload to retry.`,actionLabel:`Reload`}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:`Reconnecting after server restart`,summary:t.phase===`clearing-local-cache`?`Clearing local collaboration data for "${e}" before reconnecting.`:`Reopening "${e}" with a fresh local collaboration cache.`}:null}function Jk(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(c,{name:`activity-pool`,children:(0,Z.jsx)(Yk,{...e})}),t[0]=e,t[1]=n),n}function Yk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=Ue(),{pages:u,loading:d}=xr(),f=Kk(c,n,Uk),p=(0,Q.useRef)(``),m=f.map(Xk).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)J(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;dt(e,t&&t.length>0?t:crypto.randomUUID())}ye(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,lt(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(tA,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function Xk(e){return e.docName}function Zk(e){let t=(0,$.c)(8),{isActive:n,children:r}=e,i=(0,Q.useRef)(null),a=(0,Q.useRef)(0),o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=i.current;if(!e)return;let t=()=>{e.scrollTop>0&&(a.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,Q.useEffect)(o,s);let c,l;t[2]===n?(c=t[3],l=t[4]):(c=()=>{if(!n)return;let e=i.current;if(!e)return;let t=a.current;if(t===0||(e.scrollTop=t,e.scrollTop===t))return;let r=!1,o=()=>{r||(r=!0,s.disconnect(),clearTimeout(c))},s=new ResizeObserver(()=>{r||!e||e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&o())});s.observe(e);let c=setTimeout(o,500);return o},l=[n],t[2]=n,t[3]=c,t[4]=l),(0,Q.useLayoutEffect)(c,l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={overflowAnchor:`auto`},t[5]=u):u=t[5];let d;return t[6]===r?d=t[7]:(d=(0,Z.jsx)(`div`,{ref:i,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:u,children:r}),t[6]=r,t[7]=d),d}function Qk(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ny,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(Gk,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function $k(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(qs,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(_e,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:eA,children:[(0,Z.jsx)(qs,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function eA(){return window.location.reload()}function tA(e){let t=(0,$.c)(45),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=qk(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=n.provider.document.getText(`source`).length,[m,h]=(0,Q.useState)(i),[g,_]=(0,Q.useState)(!i),v,y;t[3]!==i||t[4]!==m||t[5]!==g?(v=()=>{i&&!m?h(!0):!i&&!g&&_(!0)},y=[i,m,g],t[3]=i,t[4]=m,t[5]=g,t[6]=v,t[7]=y):(v=t[6],y=t[7]),(0,Q.useEffect)(v,y);let b=Vk({ytextLength:p,isSourceMode:i,visitedSource:m,visitedVisual:g}),x=(0,Q.useRef)(``),S=`${b.isLarge}-${b.renderSource}-${b.renderVisual}`,C,w;t[8]!==n.docName||t[9]!==b.isLarge||t[10]!==b.renderSource||t[11]!==b.renderVisual||t[12]!==S||t[13]!==i||t[14]!==p?(C=()=>{x.current!==S&&(x.current=S,b.isLarge&&ye(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:p,isSourceMode:i,renderSource:b.renderSource,renderVisual:b.renderVisual}))},w=[S,b.isLarge,b.renderSource,b.renderVisual,n.docName,p,i],t[8]=n.docName,t[9]=b.isLarge,t[10]=b.renderSource,t[11]=b.renderVisual,t[12]=S,t[13]=i,t[14]=p,t[15]=C,t[16]=w):(C=t[15],w=t[16]),(0,Q.useEffect)(C,w);let[T,E]=(0,Q.useState)(!1),D,O;t[17]!==n.docName||t[18]!==b.isLarge||t[19]!==b.renderSource||t[20]!==b.renderVisual||t[21]!==T||t[22]!==i||t[23]!==p?(D=()=>{Hk({isLarge:b.isLarge,renderSource:b.renderSource,renderVisual:b.renderVisual,hasEmittedFirstToggle:T})&&(ye(`ok/cold/first-toggle`,{docName:n.docName,mountId:se(n.docName),ytextLength:p,modeEnteredFirst:i?`source`:`visual`}),E(!0))},O=[T,b.isLarge,b.renderSource,b.renderVisual,n.docName,p,i],t[17]=n.docName,t[18]=b.isLarge,t[19]=b.renderSource,t[20]=b.renderVisual,t[21]=T,t[22]=i,t[23]=p,t[24]=D,t[25]=O):(D=t[24],O=t[25]),(0,Q.useEffect)(D,O);let k=r?`visible`:`hidden`,A=`editor:${n.docName}`,j;t[26]!==a||t[27]!==n||t[28]!==b.renderSource||t[29]!==b.renderVisual||t[30]!==r||t[31]!==o||t[32]!==i||t[33]!==c||t[34]!==l||t[35]!==s||t[36]!==f?(j=f?(0,Z.jsx)($k,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Mk,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(Ny,{}),children:(0,Z.jsx)(Dk,{docName:n.docName,provider:n.provider,children:(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Fk,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[b.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Qk,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,b.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(wk,{provider:n.provider,placeholder:a,isSourceMode:i},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[26]=a,t[27]=n,t[28]=b.renderSource,t[29]=b.renderVisual,t[30]=r,t[31]=o,t[32]=i,t[33]=c,t[34]=l,t[35]=s,t[36]=f,t[37]=j):j=t[37];let M;t[38]!==r||t[39]!==j?(M=(0,Z.jsx)(Zk,{isActive:r,children:j}),t[38]=r,t[39]=j,t[40]=M):M=t[40];let N;return t[41]!==M||t[42]!==k||t[43]!==A?(N=(0,Z.jsx)(Q.Activity,{mode:k,name:A,children:M}),t[41]=M,t[42]=k,t[43]=A,t[44]=N):N=t[44],N}function nA(e){let t=(0,$.c)(27),{stats:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[0]=r):r=t[0];let i;t[1]===n.words?i=t[2]:(i=n.words.toLocaleString(),t[1]=n.words,t[2]=i);let a;t[3]===i?a=t[4]:(a=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:i}),t[3]=i,t[4]=a);let o=n.words===1?`word`:`words`,s;t[5]!==a||t[6]!==o?(s=(0,Z.jsxs)(`span`,{children:[a,` `,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7];let c;t[8]===n.chars?c=t[9]:(c=n.chars.toLocaleString(),t[8]=n.chars,t[9]=c);let l;t[10]===c?l=t[11]:(l=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:c}),t[10]=c,t[11]=l);let u=n.chars===1?`char`:`chars`,d;t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{children:[l,` `,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f=n.tokens>0?`~`:``,p;t[15]===n.tokens?p=t[16]:(p=n.tokens.toLocaleString(),t[15]=n.tokens,t[16]=p);let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:p}),t[17]=p,t[18]=m);let h=n.tokens===1?`token`:`tokens`,g;t[19]!==f||t[20]!==m||t[21]!==h?(g=(0,Z.jsxs)(`span`,{children:[f,m,` `,h]}),t[19]=f,t[20]=m,t[21]=h,t[22]=g):g=t[22];let _;return t[23]!==g||t[24]!==s||t[25]!==d?(_=(0,Z.jsxs)(`section`,{"aria-label":`Document statistics`,className:`relative flex h-6 shrink-0 items-center justify-end gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[r,s,d,g]}),t[23]=g,t[24]=s,t[25]=d,t[26]=_):_=t[26],_}var rA={fill:`none`,height:24,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`},iA=e=>{let t=(0,$.c)(15),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({color:a,size:o,strokeWidth:s,absoluteStrokeWidth:n,className:c,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`currentColor`:a,u=o===void 0?24:o,d=s===void 0?2:s,f=c===void 0?``:c,p=n?Number(d)*24/Number(u):d,m;return t[8]!==r||t[9]!==f||t[10]!==l||t[11]!==i||t[12]!==u||t[13]!==p?(m=(0,Z.jsx)(`svg`,{"aria-hidden":`true`,...rA,className:f,height:u,stroke:l,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:p,width:u,...i,children:r}),t[8]=r,t[9]=f,t[10]=l,t[11]=i,t[12]=u,t[13]=p,t[14]=m):m=t[14],m},aA=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Markdown`}),r=(0,Z.jsx)(`path`,{d:`M232,48H24A16,16,0,0,0,8,64V192a16,16,0,0,0,16,16H232a16,16,0,0,0,16-16V64A16,16,0,0,0,232,48Zm0,144H24V64H232V192ZM128,104v48a8,8,0,0,1-16,0V123.31L93.66,141.66a8,8,0,0,1-11.32,0L64,123.31V152a8,8,0,0,1-16,0V104a8,8,0,0,1,13.66-5.66L88,124.69l26.34-26.35A8,8,0,0,1,128,104Zm77.66,18.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L168,132.69V104a8,8,0,0,1,16,0v28.69l10.34-10.35A8,8,0,0,1,205.66,122.34Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(iA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},oA=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Textbox`}),r=(0,Z.jsx)(`path`,{d:`M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(iA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function sA(e){let t=(0,$.c)(39),{isSourceMode:n,sourceDisabled:r,onModeChange:i,showAddPropertyButton:a,onAddProperty:o,showPanelOpen:s,onTogglePanel:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{}),t[0]=l):l=t[0];let u=n?`source`:`wysiwyg`,d;t[1]===i?d=t[2]:(d=e=>{e&&i(e)},t[1]=i,t[2]=d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(so,{children:[(0,Z.jsx)(eo,{value:`wysiwyg`,"aria-label":`Visual editor`,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:(0,Z.jsx)(io,{children:(0,Z.jsx)(oA,{className:`size-4`})})}),(0,Z.jsx)(ao,{side:`bottom`,children:`Visual`})]}),t[3]=f):f=t[3];let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(aA,{className:`size-4`}),t[4]=p):p=t[4];let m;t[5]===r?m=t[6]:(m=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(eo,{value:`source`,"aria-label":`Markdown source`,disabled:r,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:p})})}),t[5]=r,t[6]=m);let h=r?`Source mode requires a live connection — your edits are saved and will appear when you reconnect.`:`Markdown`,g;t[7]===h?g=t[8]:(g=(0,Z.jsx)(ao,{side:`bottom`,children:h}),t[7]=h,t[8]=g);let _;t[9]!==m||t[10]!==g?(_=(0,Z.jsxs)(so,{children:[m,g]}),t[9]=m,t[10]=g,t[11]=_):_=t[11];let v;t[12]!==u||t[13]!==d||t[14]!==_?(v=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(no,{type:`single`,value:u,onValueChange:d,"aria-label":`Editor mode`,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[f,_]})}),t[12]=u,t[13]=d,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==o||t[17]!==a?(y=a&&(0,Z.jsxs)(so,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`Add properties`,onClick:o,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(io,{children:(0,Z.jsx)(Is,{})})}),(0,Z.jsx)(ao,{side:`bottom`,children:`Add properties`})]}),t[16]=o,t[17]=a,t[18]=y):y=t[18];let b=s?`Show document panel`:`Hide document panel`,x;t[19]===s?x=t[20]:(x=(0,Z.jsx)(io,{children:s?(0,Z.jsx)(Us,{}):(0,Z.jsx)(Hs,{})}),t[19]=s,t[20]=x);let S;t[21]!==c||t[22]!==b||t[23]!==x?(S=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,onClick:c,"aria-label":b,asChild:!0,children:x}),t[21]=c,t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=s?`Show panel`:`Hide panel`,w;t[25]===C?w=t[26]:(w=(0,Z.jsx)(ao,{side:`bottom`,children:C}),t[25]=C,t[26]=w);let T;t[27]!==S||t[28]!==w?(T=(0,Z.jsxs)(so,{children:[S,w]}),t[27]=S,t[28]=w,t[29]=T):T=t[29];let E;t[30]!==y||t[31]!==T?(E=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex items-center justify-end gap-1`,children:[y,T]}),t[30]=y,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==v||t[34]!==E?(D=(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center px-2 py-2 bg-background`,children:[l,v,E]}),t[33]=v,t[34]=E,t[35]=D):D=t[35];let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[36]=O):O=t[36];let k;return t[37]===D?k=t[38]:(k=(0,Z.jsxs)(`div`,{"data-testid":`editor-toolbar`,className:`pointer-events-none absolute inset-x-0 top-0 z-10`,children:[D,O]}),t[37]=D,t[38]=k),k}function cA(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var lA=(0,Q.lazy)(()=>r(()=>import(`./SettingsDialog-D6nNBqeV.js`).then(e=>({default:e.SettingsDialog})),__vite__mapDeps([45,1,35,2,36,37,21,38,39,40,41,20,3,6,7,15,4,8,14,9,46,16,22,10,23]),import.meta.url));function uA(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(fA,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(dA,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(c,{name:`editor-area`,children:(0,Z.jsxs)(OD,{children:[n,r]})}),t[3]=n,t[4]=i),i}function dA(){let e=(0,$.c)(8),t=Pf(),[n,r]=(0,Q.useState)(!1),i,a;if(e[0]===t.open?(i=e[1],a=e[2]):(i=()=>{t.open&&r(!0)},a=[t.open],e[0]=t.open,e[1]=i,e[2]=a),(0,Q.useEffect)(i,a),!n)return null;let o;e[3]===t?o=e[4]:(o=e=>{e||t.close()},e[3]=t,e[4]=o);let s;return e[5]!==t.open||e[6]!==o?(s=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(lA,{open:t.open,onOpenChange:o})}),e[5]=t.open,e[6]=o,e[7]=s):s=e[7],s}function fA(e){let t=(0,$.c)(95),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a}=e,{activeDocName:o,activeProvider:s,activeTarget:c,recycleDocument:l,docPanelMode:u,docPanelExpandSignal:d}=Ue(),{openDocumentTransition:f}=$e(),{requestAddProperty:p}=AD(),m=QD(s,o),h=$D(s),g=h===`connected`||h===`synced`,_=(0,Q.useDeferredValue)(o),v=c?.kind===`missing`,y=!!o&&c?.kind!==`folder`,b=v?`Start writing to create this page`:void 0,x=Oy(),[S,C]=(0,Q.useState)(!1),{layout:w,autoCollapse:T}=ID(),E=w===`sheet`,[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(!1),A,j;t[0]!==T||t[1]!==w||t[2]!==x?(A=()=>{w===`panel`&&(T?(k.current=!1,x.current?.collapse()):k.current||x.current?.expand())},j=[T,w,x],t[0]=T,t[1]=w,t[2]=x,t[3]=A,t[4]=j):(A=t[3],j=t[4]),(0,Q.useEffect)(A,j);let M,N;t[5]!==E||t[6]!==a||t[7]!==x?(M=()=>{let e=e=>{a(e),E?O(!0):(k.current=!1,x.current?.expand())},t=lf();return t&&e(t),df(t=>{lf(),e(t)})},N=[E,a,x],t[5]=E,t[6]=a,t[7]=x,t[8]=M,t[9]=N):(M=t[8],N=t[9]),(0,Q.useEffect)(M,N);let P,F;t[10]!==d||t[11]!==E||t[12]!==x?(P=()=>{d!==0&&(E?O(!0):(k.current=!1,x.current?.expand()))},F=[d,E,x],t[10]=d,t[11]=E,t[12]=x,t[13]=P,t[14]=F):(P=t[13],F=t[14]),(0,Q.useEffect)(P,F);let I=(0,Q.useRef)(null),[L,R]=(0,Q.useState)(null),z,B;if(t[15]===o?(z=t[16],B=t[17]):(z=()=>{if(o&&o!==I.current){let e=I.current;I.current=o,R(e)}},B=[o],t[15]=o,t[16]=z,t[17]=B),(0,Q.useEffect)(z,B),c?.kind===`folder`){let e;return t[18]===c.folderPath?e=t[19]:(e=(0,Z.jsx)(xD,{folderPath:c.folderPath}),t[18]=c.folderPath,t[19]=e),e}if(c?.kind===`asset`){let e;return t[20]!==c.assetPath||t[21]!==c.mediaKind?(e=(0,Z.jsx)(My,{assetPath:c.assetPath,mediaKind:c.mediaKind}),t[20]=c.assetPath,t[21]=c.mediaKind,t[22]=e):e=t[22],e}if(!s||!o){if((typeof window<`u`?ur(window.location.hash):null)!==null){let e;return t[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ny,{}),t[23]=e):e=t[23],e}let e;return t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Cb,{}),t[24]=e):e=t[24],e}let V=n===`source`,H=!g,U=E?!D:S,W;t[25]!==o||t[26]!==p?(W=function(){o&&p(o)},t[25]=o,t[26]=p,t[27]=W):W=t[27];let G=W,K;t[28]!==S||t[29]!==E||t[30]!==x?(K=function(){E?O(pA):S?(k.current=!1,x.current?.expand()):(k.current=!0,x.current?.collapse())},t[28]=S,t[29]=E,t[30]=x,t[31]=K):K=t[31];let q=K,ee=_??o,te=L??void 0,ne;t[32]===f?ne=t[33]:(ne=e=>{let t=$n(e);window.location.hash===t?f(e):window.location.hash=t},t[32]=f,t[33]=ne);let re;t[34]!==b||t[35]!==V||t[36]!==l||t[37]!==ee||t[38]!==te||t[39]!==ne?(re=(0,Z.jsx)(Jk,{activeDocName:ee,isSourceMode:V,editorPlaceholder:b,previousDocName:te,onNavigateBack:ne,onRecycle:l}),t[34]=b,t[35]=V,t[36]=l,t[37]=ee,t[38]=te,t[39]=ne,t[40]=re):re=t[40];let ie;t[41]!==o||t[42]!==_?(ie=cA({activeDocName:o,deferredActiveDocName:_,mountResolved:o!==null&&Ze(o),syncResolved:o!==null&&ge(o)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Ny,{}),o===null?null:(0,Z.jsx)(TD,{docName:o})]}):null,t[41]=o,t[42]=_,t[43]=ie):ie=t[43];let ae;t[44]!==re||t[45]!==ie?(ae=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[re,ie]}),t[44]=re,t[45]=ie,t[46]=ae):ae=t[46];let oe=!V,se;t[47]!==V||t[48]!==r||t[49]!==G||t[50]!==U||t[51]!==H||t[52]!==oe||t[53]!==q?(se=(0,Z.jsx)(sA,{isSourceMode:V,sourceDisabled:H,onModeChange:r,showAddPropertyButton:oe,onAddProperty:G,showPanelOpen:U,onTogglePanel:q}),t[47]=V,t[48]=r,t[49]=G,t[50]=U,t[51]=H,t[52]=oe,t[53]=q,t[54]=se):se=t[54];let ce;t[55]!==ae||t[56]!==se?(ce=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[ae,se]}),t[55]=ae,t[56]=se,t[57]=ce):ce=t[57];let le;t[58]!==y||t[59]!==m?(le=y&&(0,Z.jsx)(nA,{stats:m}),t[58]=y,t[59]=m,t[60]=le):le=t[60];let ue;t[61]!==ce||t[62]!==le?(ue=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[ce,le]}),t[61]=ce,t[62]=le,t[63]=ue):ue=t[63];let de=ue;if(E){let e;t[64]===de?e=t[65]:(e=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:de}),t[64]=de,t[65]=e);let n;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(ig,{className:`sr-only`,children:(0,Z.jsx)(ag,{children:`Document panel`})}),t[66]=n):n=t[66];let r;t[67]!==o||t[68]!==i||t[69]!==u||t[70]!==V||t[71]!==a?(r=(0,Z.jsxs)(rg,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[n,(0,Z.jsx)(F_,{docName:o,isSourceMode:V,activeTab:i,onActiveTabChange:a,mode:u})]}),t[67]=o,t[68]=i,t[69]=u,t[70]=V,t[71]=a,t[72]=r):r=t[72];let s;t[73]!==D||t[74]!==r?(s=(0,Z.jsx)(eg,{open:D,onOpenChange:O,children:r}),t[73]=D,t[74]=r,t[75]=s):s=t[75];let c;return t[76]!==e||t[77]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[e,s]}),t[76]=e,t[77]=s,t[78]=c):c=t[78],c}let fe;t[79]===de?fe=t[80]:(fe=(0,Z.jsx)(MD,{minSize:`30%`,defaultSize:`75%`,children:de}),t[79]=de,t[80]=fe);let pe;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(ND,{withHandle:!0}),t[81]=pe):pe=t[81];let me;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>C(e.asPercentage===0),t[82]=me):me=t[82];let he;t[83]!==o||t[84]!==i||t[85]!==u||t[86]!==V||t[87]!==a?(he=(0,Z.jsx)(F_,{docName:o,isSourceMode:V,activeTab:i,onActiveTabChange:a,mode:u}),t[83]=o,t[84]=i,t[85]=u,t[86]=V,t[87]=a,t[88]=he):he=t[88];let _e;t[89]!==x||t[90]!==he?(_e=(0,Z.jsx)(MD,{panelRef:x,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:me,className:`flex flex-col bg-muted/20`,children:he}),t[89]=x,t[90]=he,t[91]=_e):_e=t[91];let ve;return t[92]!==fe||t[93]!==_e?(ve=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(jD,{orientation:`horizontal`,children:[fe,pe,_e]})}),t[92]=fe,t[93]=_e,t[94]=ve):ve=t[94],ve}function pA(e){return!e}var mA=1280;function hA(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(gA),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${mA-1}px)`),t=()=>{n(window.innerWidth<mA)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function gA(){return window.innerWidth<mA}function _A(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function vA(e){let{value:t,unit:n}=_A(e);return n===`rem`?t*16:t}function yA(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var bA=3600*24*7;function xA(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?SA:m,O=g===void 0?bA:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=vA(b),ee;t[6]===x?ee=t[7]:(ee=vA(x),t[6]=x,t[7]=ee);let te=ee,ne;t[8]!==E||t[9]!==k?(ne=function(e){P.current=!0,E&&(j.current=H.current?0:vA(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=ne):ne=t[10];let re=ne,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==te||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=_A(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(te,t)),u=yA(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(te,u)),f=yA(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,q,te,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=te,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function SA(){}var CA=`sidebar_state`,wA=3600*24*7,TA=`18rem`,EA=`3rem`,DA=`\\`,OA=`app-file-sidebar`,kA=`14.625rem`,AA=`22rem`,jA=`sidebar_width`,MA=/^\d+(?:\.\d+)?(?:rem|px)$/,NA=Q.createContext(null);function PA(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${jA}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return MA.test(n)?n:e}function FA(){let e=Q.use(NA);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function IA(e){let t=(0,$.c)(53),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:l,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=c===void 0?!0:c,d=l===void 0?TA:l,f=hA(),p;t[9]===d?p=t[10]:(p=()=>PA(d),t[9]=d,t[10]=p);let[m,h]=Q.useState(p),[g,_]=Q.useState(!1),v=Q.useRef(g),[y,b]=Q.useState(!1),[x,S]=Q.useState(!1),[C,w]=Q.useState(u),T=i??C,E;t[11]!==T||t[12]!==o?(E=e=>{let t=typeof e==`function`?e(T):e;o?o(t):w(t),document.cookie=`${CA}=${t}; path=/; max-age=${wA}`},t[11]=T,t[12]=o,t[13]=E):E=t[13];let D=E,O;t[14]===D?O=t[15]:(O=function(){return window.innerWidth<1280?_(RA):D(LA)},t[14]=D,t[15]=O);let k=O,A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){window.innerWidth>=1280||v.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||S(!0))},t[16]=A):A=t[16];let j=A,M;t[17]===g?M=t[18]:(M=()=>{v.current=g},t[17]=g,t[18]=M),Q.useLayoutEffect(M);let N,P;t[19]===k?(N=t[20],P=t[21]):(N=()=>{let e=e=>{e.key===DA&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),k())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},P=[k],t[19]=k,t[20]=N,t[21]=P),Q.useEffect(N,P);let F,I;t[22]!==f||t[23]!==g?(F=()=>{if(!f||!g)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||_(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},I=[f,g],t[22]=f,t[23]=g,t[24]=F,t[25]=I):(F=t[24],I=t[25]),Q.useEffect(F,I);let L=Q.useRef(f),R,z;t[26]!==f||t[27]!==T?(R=()=>{!L.current&&f&&_(T),L.current=f},z=[f,T],t[26]=f,t[27]=T,t[28]=R,t[29]=z):(R=t[28],z=t[29]),Q.useEffect(R,z);let B=f?g?`expanded`:`collapsed`:T?`expanded`:`collapsed`,V;t[30]!==y||t[31]!==f||t[32]!==T||t[33]!==g||t[34]!==D||t[35]!==x||t[36]!==B||t[37]!==k||t[38]!==m?(V={state:B,open:T,setOpen:D,isMobile:f,openMobile:g,setOpenMobile:_,toggleSidebar:k,width:m,setWidth:h,isDraggingRail:y,setIsDraggingRail:b,showPushPulse:x,setShowPushPulse:S,notifySidebarFileSelected:j},t[30]=y,t[31]=f,t[32]=T,t[33]=g,t[34]=D,t[35]=x,t[36]=B,t[37]=k,t[38]=m,t[39]=V):V=t[39];let H;t[40]!==s||t[41]!==m?(H={"--sidebar-width":m,"--sidebar-width-icon":EA,...s},t[40]=s,t[41]=m,t[42]=H):H=t[42];let U=H,W;t[43]===r?W=t[44]:(W=Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[43]=r,t[44]=W);let G;t[45]!==n||t[46]!==a||t[47]!==U||t[48]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[45]=n,t[46]=a,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;return t[50]!==V||t[51]!==G?(K=(0,Z.jsx)(NA.Provider,{value:V,children:G}),t[50]=V,t[51]=G,t[52]=K):K=t[52],K}function LA(e){return!e}function RA(e){return!e}function zA(e){let t=(0,$.c)(51),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{isMobile:d,state:f,openMobile:p,isDraggingRail:m}=FA();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Y(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}if(d){let e=p?`expanded`:`collapsed`,a=l===`floating`||l===`inset`?`p-2`:``,o;t[14]!==r||t[15]!==a?(o=Y(`fixed inset-y-0 z-30 flex h-svh w-(--sidebar-width)`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`data-[side=left]:left-0 data-[side=right]:right-0`,`group-data-[state=collapsed]:data-[side=left]:-translate-x-full`,`group-data-[state=collapsed]:data-[side=right]:translate-x-full`,a,r),t[14]=r,t[15]=a,t[16]=o):o=t[16];let s;t[17]===n?s=t[18]:(s=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[17]=n,t[18]=s);let u;t[19]!==i||t[20]!==c||t[21]!==o||t[22]!==s?(u=(0,Z.jsx)(`nav`,{id:OA,"aria-label":`File sidebar`,"data-slot":`sidebar-container`,"data-side":c,className:o,...i,children:s}),t[19]=i,t[20]=c,t[21]=o,t[22]=s,t[23]=u):u=t[23];let d;return t[24]!==e||t[25]!==c||t[26]!==u||t[27]!==l?(d=(0,Z.jsx)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":e,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-mobile":`true`,children:u}),t[24]=e,t[25]=c,t[26]=u,t[27]=l,t[28]=d):d=t[28],d}let h=f===`collapsed`?u:``,g=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[29]===g?_=t[30]:(_=Y(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[29]=g,t[30]=_);let v;t[31]===_?v=t[32]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[31]=_,t[32]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[33]!==r||t[34]!==y?(b=Y(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[33]=r,t[34]=y,t[35]=b):b=t[35];let x;t[36]===n?x=t[37]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[36]=n,t[37]=x);let S;t[38]!==i||t[39]!==c||t[40]!==x||t[41]!==b?(S=(0,Z.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[38]=i,t[39]=c,t[40]=x,t[41]=b,t[42]=S):S=t[42];let C;return t[43]!==m||t[44]!==c||t[45]!==f||t[46]!==S||t[47]!==h||t[48]!==v||t[49]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":f,"data-collapsible":h,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":m,children:[v,S]}),t[43]=m,t[44]=c,t[45]=f,t[46]=S,t[47]=h,t[48]=v,t[49]=l,t[50]=C):C=t[50],C}function BA(e){let t=(0,$.c)(16),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a,state:o}=FA(),s=o===`expanded`,c;t[4]===n?c=t[5]:(c=Y(n),t[4]=n,t[5]=c);let l;t[6]!==r||t[7]!==a?(l=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=l):l=t[8];let u,d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ct,{}),d=(0,Z.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=u,t[10]=d):(u=t[9],d=t[10]);let f;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==l?(f=(0,Z.jsxs)(X,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":s,"aria-controls":OA,className:c,onClick:l,...i,children:[u,d]}),t[11]=i,t[12]=s,t[13]=c,t[14]=l,t[15]=f):f=t[15],f}function VA(e){let t=(0,$.c)(24),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{toggleSidebar:l,setWidth:u,state:d,width:f,setIsDraggingRail:p}=FA(),m=d===`collapsed`,h;t[6]!==s||t[7]!==c||t[8]!==p||t[9]!==u||t[10]!==m||t[11]!==l||t[12]!==f?(h={direction:`right`,enableDrag:s,enableToggle:c,onResize:u,onToggle:l,currentWidth:f,isCollapsed:m,minResizeWidth:kA,maxResizeWidth:AA,setIsDraggingRail:p,widthCookieName:jA,widthCookieMaxAge:wA},t[6]=s,t[7]=c,t[8]=p,t[9]=u,t[10]=m,t[11]=l,t[12]=f,t[13]=h):h=t[13];let{dragRef:g,handleMouseDown:_}=xA(h),v;t[14]!==_||t[15]!==r?(v=e=>{r?.(e),e.defaultPrevented||_(e)},t[14]=_,t[15]=r,t[16]=v):v=t[16];let y;t[17]===n?y=t[18]:(y=Y(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[17]=n,t[18]=y);let b;return t[19]!==g||t[20]!==i||t[21]!==v||t[22]!==y?(b=(0,Z.jsx)(`button`,{ref:g,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onMouseDown:v,title:`Toggle Sidebar`,className:y,...i}),t[19]=g,t[20]=i,t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function HA(e){let t=(0,$.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onClick:i,onAnimationEnd:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{isMobile:o,openMobile:s,setOpenMobile:c,showPushPulse:l,setShowPushPulse:u}=FA(),d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==c?(d=e=>{i?.(e),!e.defaultPrevented&&(!o||!s||e.target?.closest(`[data-sidebar="trigger"]`)||c(!1))},t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=d):d=t[9];let f=d,p;t[10]!==r||t[11]!==u?(p=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&u(!1)},t[10]=r,t[11]=u,t[12]=p):p=t[12];let m=p,h=l?``:void 0,g;t[13]===n?g=t[14]:(g=Y(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`peer-data-[mobile=true]:peer-data-[state=expanded]:translate-x-(--sidebar-width)`,n),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==f||t[17]!==a||t[18]!==h||t[19]!==g?(_=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":h,onClick:f,onAnimationEnd:m,className:g,...a}),t[15]=m,t[16]=f,t[17]=a,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function UA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function GA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function KA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var JA=Pr(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function YA(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?Fr:`button`,{isMobile:m,state:h}=FA(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=Y(JA({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,Z.jsx)(io,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,Z.jsx)(ao,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,Z.jsxs)(so,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function XA(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function ZA(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var QA=1e3,$A=!1;function ej(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function tj(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:ii(i)?a=i:(a=void 0,$A||($A=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(ej({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=ZA(i),{current:c,crossDoc:l}=a?$r(a,n,Date.now()):{current:[],crossDoc:[]},u=nj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>XA(e.current,p)&&XA(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,QA);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function nj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var rj=`sync-status`;function ij(e,t){let n=(0,$.c)(4),r=(0,Q.useRef)(!1),i=(0,Q.useRef)(!1),a=(0,Q.useRef)(t),o,s;n[0]!==t||n[1]!==e?(o=()=>{a.current!==t&&(a.current=t,r.current=!1,i.current=!1),t&&(e===`synced`&&(r.current=!0),e===`disconnected`&&r.current?(i.current=!0,qa.warning(`Connection lost — keep this tab open, your edits will sync when reconnected`,{id:rj,duration:1/0})):i.current&&e===`synced`&&(i.current=!1,qa.success(`Reconnected`,{id:rj,duration:3e3})))},s=[e,t],n[0]=t,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),(0,Q.useEffect)(o,s)}var aj=4,oj=3,sj={Bird:$o,Cat:as,Dog:_s,Fish:xs,Mouse:Ks,Rabbit:Gs,Shrimp:Zs,Snail:Qs,Squirrel:nc,Turtle:oc};Object.freeze([...Object.keys(sj)]);function cj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(sj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var lj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function uj(e){let t=(0,$.c)(20),{user:n,mode:r,tabCount:i}=e,a=cj(n),o=a.kind===`animal`?sj[a.animal]:void 0,s;t[0]===n.name?s=t[1]:(s=Ln(n.name),t[0]=n.name,t[1]=s);let c=s,l;t[2]===n.color?l=t[3]:(l=Tr(n.color),t[2]=n.color,t[3]=l);let u=l,d=i>1?`${n.name} · ${i} tabs`:n.name,f=i>1?`${n.name}, ${i} concurrent tabs`:n.name,p;t[4]===n.color?p=t[5]:(p={backgroundColor:n.color},t[4]=n.color,t[5]=p);let m;t[6]!==o||t[7]!==u||t[8]!==c?(m=o?(0,Z.jsx)(o,{size:18,color:u,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:u},children:c}),t[6]=o,t[7]=u,t[8]=c,t[9]=m):m=t[9];let h;t[10]!==f||t[11]!==r||t[12]!==p||t[13]!==m?(h=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":f,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:p,children:m})}),t[10]=f,t[11]=r,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===d?g=t[16]:(g=(0,Z.jsx)(ao,{children:d}),t[15]=d,t[16]=g);let _;return t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(so,{children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function dj(e){let t=lj[e.icon];return e.displayName||t||`Agent`}function fj(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function pj(e){let t=(0,$.c)(36),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{presence:o,agentId:s}=n,c;t[0]===o?c=t[1]:(c=dj(o),t[0]=o,t[1]=c);let l=c,u=fj(o.mode),d=!r&&u,f=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,p=d&&!i?`ring-primary/40 animate-pulse`:``,m;t[2]!==f||t[3]!==p?(m=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2 cursor-pointer`,f,p].filter(Boolean),t[2]=f,t[3]=p,t[4]=m):m=t[4];let h=m.join(` `),g=r?`true`:void 0,_=i?`true`:void 0,v;t[5]!==o.mode||t[6]!==g||t[7]!==_?(v={"data-presence-badge":`agent`,"data-presence-mode":o.mode,"data-presence-crossdoc":g,"data-presence-scoped":_},t[5]=o.mode,t[6]=g,t[7]=_,t[8]=v):v=t[8];let y=v,b=r&&o.currentDoc?`Open activity panel for ${l}, editing ${o.currentDoc}`:`Open activity panel for ${l}`,x;t[9]===o.color?x=t[10]:(x={backgroundColor:o.color},t[9]=o.color,t[10]=x);let S;t[11]!==s||t[12]!==a?(S=()=>a(s),t[11]=s,t[12]=a,t[13]=S):S=t[13];let C;t[14]===o.icon?C=t[15]:(C=(0,Z.jsx)(ni,{icon:o.icon,width:16,height:16,className:`text-white`}),t[14]=o.icon,t[15]=C);let w;t[16]!==b||t[17]!==y||t[18]!==h||t[19]!==C||t[20]!==x||t[21]!==S?(w=(0,Z.jsx)(`button`,{type:`button`,...y,"aria-label":b,className:h,style:x,onClick:S,children:C}),t[16]=b,t[17]=y,t[18]=h,t[19]=C,t[20]=x,t[21]=S,t[22]=w):w=t[22];let T=w,E;t[23]===T?E=t[24]:(E=(0,Z.jsx)(io,{asChild:!0,children:T}),t[23]=T,t[24]=E);let D;t[25]===l?D=t[26]:(D=(0,Z.jsx)(`span`,{className:`font-medium`,children:l}),t[25]=l,t[26]=D);let O;t[27]!==r||t[28]!==o.currentDoc?(O=r&&o.currentDoc?(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`editing [[`,o.currentDoc,`]]`]}):null,t[27]=r,t[28]=o.currentDoc,t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==O?(k=(0,Z.jsxs)(ao,{className:`flex flex-col gap-0.5`,children:[D,O]}),t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==E||t[34]!==k?(A=(0,Z.jsxs)(so,{children:[E,k]}),t[33]=E,t[34]=k,t[35]=A):A=t[35],A}function mj(e){let t=(0,$.c)(18),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s=i?`true`:void 0,c=`${n} more ${i?`cross-doc `:``}${n===1?`participant`:`participants`}`,l;t[0]!==n||t[1]!==s||t[2]!==c?(l=(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":s,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[0]=n,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;if(t[4]!==i||t[5]!==o||t[6]!==r||t[7]!==a){let e;t[9]!==i||t[10]!==o||t[11]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(uj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(pj,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[9]=i,t[10]=o,t[11]=a,t[12]=e):e=t[12],u=r.map(e),t[4]=i,t[5]=o,t[6]=r,t[7]=a,t[8]=u}else u=t[8];let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(C,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:u})}),t[13]=u,t[14]=d);let f;return t[15]!==l||t[16]!==d?(f=(0,Z.jsxs)(Qe,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function hj(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(uj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(pj,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function gj(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Ue(),{current:s,crossDoc:c}=tj(t,r,n);ij($D(t),n);let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,aj),n;e[6]===s?n=e[7]:(n=s.slice(aj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,oj),d;e[8]===c?d=e[9]:(d=c.slice(oj),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>hj(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(mj,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border`,"aria-hidden":!0,"data-slot":`presence-divider`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 opacity-60 grayscale`,"data-presence-section":`crossdoc`,children:[u.map(e=>hj(e,p,!0,m)),f.length>0?(0,Z.jsx)(mj,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]})]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function _j(e,t){return t.trim()}function vj(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function yj(e,t){let n=_j(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function bj(e,t,n=[]){if(t.length===0&&n.length===0)return e;let r=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>Dr(e)?{...e,docName:r.get(e.docName)??e.docName}:Mr(e)||Pn(e)?{...e,path:Cj(e.path,n)}:e)}function xj(e,t,n){if(t.length===0&&!n)return e;let r=new Set(t);return e.filter(e=>Dr(e)?!r.has(e.docName)&&!wj(e.docName,n):Mr(e)||Pn(e)?!wj(e.path,n):!0)}function Sj(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function Cj(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function wj(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function Tj(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(fl,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function Ej(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(pl,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ml,{children:(0,Z.jsx)(hl,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Oj(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Y(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(gl,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function kj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Aj=Pr(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function jj(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=Y(Aj({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":a,className:o,onMouseDown:Mj,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function Mj(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Pr(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function Nj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(co,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Fj=[`.md`,`.mdx`];function Ij(e,t){let n=e.lastIndexOf(`/`),r=n<0?e:e.slice(n+1),i=`${r}${t}`;return n<0?{baseName:r,extension:t,label:i,prefix:``}:{baseName:r,extension:t,label:i,prefix:`${e.slice(0,n)}/`}}function Lj(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function Rj(e){let t=$n(e);window.location.hash!==t&&(window.location.hash=t)}function zj(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function Bj(e,t){let n=[t,...Fj].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function Vj(e){let t=(0,$.c)(26),{children:n,closeTab:r,closeTabs:i,disabled:a,openTabs:o,tabId:s}=e;if(a!==void 0&&a)return n;let c;if(t[0]!==o||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>e!==s,t[3]=s,t[4]=e),c=o.filter(e),t[0]=o,t[1]=s,t[2]=c}else c=t[2];let l=c,u;t[5]===n?u=t[6]:(u=(0,Z.jsx)(Ej,{asChild:!0,children:n}),t[5]=n,t[6]=u);let d;t[7]!==r||t[8]!==s?(d=(0,Z.jsx)(Oj,{onSelect:()=>r(s),children:`Close`}),t[7]=r,t[8]=s,t[9]=d):d=t[9];let f=l.length===0,p;t[10]!==i||t[11]!==l?(p=()=>{i(l)},t[10]=i,t[11]=l,t[12]=p):p=t[12];let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsx)(Oj,{disabled:f,onSelect:p,children:`Close others`}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==i||t[17]!==o?(h=(0,Z.jsx)(Oj,{onSelect:()=>{i(o)},children:`Close all`}),t[16]=i,t[17]=o,t[18]=h):h=t[18];let g;t[19]!==d||t[20]!==m||t[21]!==h?(g=(0,Z.jsxs)(Dj,{className:`min-w-40`,children:[d,m,h]}),t[19]=d,t[20]=m,t[21]=h,t[22]=g):g=t[22];let _;return t[23]!==u||t[24]!==g?(_=(0,Z.jsxs)(Tj,{children:[u,g]}),t[23]=u,t[24]=g,t[25]=_):_=t[25],_}function Hj(){let e=(0,$.c)(65),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:c,closeTab:l,closeTabs:u,isNewTabActive:f,newTabIds:p,openNewTab:m,openTabs:h,remapTabsForRename:g}=Ue(),{pageMeta:_}=xr(),v=(0,Q.useRef)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(null),O=(0,Q.useRef)(!1),k=(0,Q.useRef)(!1),A=(0,Q.useRef)(null),j=(0,Q.useRef)(t),M;e[0]!==n||e[1]!==t||e[2]!==i?(M=n??(i?Je(i):t?Ge(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=M):M=e[3];let N=M,P;e[4]!==r||e[5]!==N||e[6]!==f||e[7]!==p||e[8]!==h?(P=f?`${r??`__new-tab__`}\u0000${h.join(`\0`)}\u0000${p.join(`\0`)}`:N?`${N}\u0000${h.join(`\0`)}`:``,e[4]=r,e[5]=N,e[6]=f,e[7]=p,e[8]=h,e[9]=P):P=e[9];let F=P,I,L;e[10]===t?(I=e[11],L=e[12]):(I=()=>{j.current=t},L=[t],e[10]=t,e[11]=I,e[12]=L),(0,Q.useEffect)(I,L);let R,z;e[13]===F?(R=e[14],z=e[15]):(R=()=>{F&&(v.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},z=[F],e[13]=F,e[14]=R,e[15]=z),(0,Q.useEffect)(R,z);let B,V;e[16]===y?(B=e[17],V=e[18]):(B=()=>{y&&(D.current?.focus(),D.current?.select())},V=[y],e[16]=y,e[17]=B,e[18]=V),(0,Q.useEffect)(B,V);let H,U;e[19]!==h||e[20]!==y?(H=()=>{!y||h.includes(Ge(y))||(k.current=!0,A.current=null,b(null),S(``),w(null),E(!1))},U=[h,y],e[19]=h,e[20]=y,e[21]=H,e[22]=U):(H=e[21],U=e[22]),(0,Q.useEffect)(H,U);let W,G,K,q,ee;if(e[23]!==a||e[24]!==N||e[25]!==s||e[26]!==l||e[27]!==u||e[28]!==T||e[29]!==h||e[30]!==_||e[31]!==g||e[32]!==C||e[33]!==x||e[34]!==y){let t=function(e){let t=e.split(`/`);k.current=!1,A.current=null,b(e),S(t[t.length-1]),w(null)},n=function(){k.current=!0,A.current=null,b(null),S(``),w(null),E(!1)},r=async function(){if(k.current){k.current=!1;return}if(O.current)return;let e=y;if(!e){n();return}let t=_j(`file`,Bj(x,_.get(e)?.docExt??`.md`)),r=e.split(`/`),i=r[r.length-1];if(t===i){n();return}if(t===A.current){D.current?.focus();return}if(!vj(t)){w(`Name can’t be empty, ".", "..", or contain / or \\`),D.current?.focus();return}let a=yj({kind:`file`,path:e,name:i},t);O.current=!0,E(!0),w(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:a})});if(k.current){E(!1),O.current=!1;return}let r=await Ie(n,`Server error (HTTP ${n.status})`);if(!r.ok){w(r.title),E(!1),O.current=!1,A.current=t,D.current?.focus();return}let i=d(gn,r.body,`rename-path:tab`,{renamed:[]}).renamed,o=j.current,c=Sj(o,i);await Promise.all(i.flatMap(e=>[s(e.fromDocName),s(e.toDocName)])),g(i),Kn([`files`,`backlinks`,`graph`]),k.current=!0,b(null),S(``),w(null),E(!1),O.current=!1,A.current=null,c&&c!==o&&Rj(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:a,normalized:t}),w(`Network error — please try again`),E(!1),O.current=!1,A.current=t,D.current?.focus()}};W=typeof window<`u`&&window.okDesktop!=null,G=v,e[40]===Symbol.for(`react.memo_cache_sentinel`)?(K=Y(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,W&&`[-webkit-app-region:drag]`),e[40]=K):K=e[40],q=zj,ee=h.map(e=>{let i=je(e),o=e===N;if(i.kind===`folder`){let{baseName:t,label:n,prefix:r}=Ij(i.folderPath,`/`),s=`${r}${n}`;return(0,Z.jsx)(Vj,{tabId:e,openTabs:h,closeTab:l,closeTabs:u,children:(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":o?`true`:void 0,className:Y(`group flex min-w-28 max-w-64 shrink-0 items-center overflow-hidden rounded-lg border border-b-transparent py-1.5 relative`,o?`tab-bottom-flares -mb-px self-end pb-3.5 border-border border-b-background bg-background text-foreground rounded-b-none overflow-visible`:`border-transparent text-muted-foreground hover:bg-muted/70 hover:text-foreground`,W&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":s,title:s,className:`flex h-full min-w-0 flex-1 items-center gap-1.5 overflow-hidden px-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,onClick:()=>{a(e)},children:[(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),r?(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate`,o&&`text-muted-foreground`),children:r}):null,(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center font-medium`,r?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close ${s}`,className:Y(`mr-1 flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50`,o?`opacity-100`:`opacity-0 hover:opacity-100 focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100`),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Ma,{"aria-hidden":`true`,className:`size-3.5`})}),o?(0,Z.jsx)(`div`,{className:`z-0 h-2 w-[calc(100%+16px)] absolute -left-[8px] -bottom-[2px] bg-background pointer-events-none`}):null]})},e)}let s=i.docName,c=_.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=Ij(s,c),g=`${m}${p}`,v=y===s,b=`editor-tab-rename-error-${Lj(s)}`;return(0,Z.jsx)(Vj,{disabled:v,tabId:e,openTabs:h,closeTab:l,closeTabs:u,children:(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":o?`true`:void 0,className:Y(`group flex min-w-28 max-w-64 shrink-0 items-center overflow-hidden rounded-lg border border-b-transparent py-1.5 relative`,o?`tab-bottom-flares -mb-px self-end pb-3.5 border-border border-b-background bg-background text-foreground rounded-b-none overflow-visible`:`border-transparent text-muted-foreground hover:bg-muted/70 hover:text-foreground`,v&&C&&`border-destructive`,W&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},children:[v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(kj,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent`,children:[(0,Z.jsx)(Pj,{ref:D,value:x,disabled:T,"aria-label":`Rename ${p}`,"aria-invalid":C?!0:void 0,"aria-describedby":C?b:void 0,"aria-busy":T||void 0,title:C??s,className:`h-full min-w-0 px-2 py-0 text-xs`,onChange:e=>{S(Bj(e.target.value,c)),w(null),A.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),r()):e.key===`Escape`&&(e.preventDefault(),n())},onBlur:r}),(0,Z.jsx)(jj,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(Nj,{className:`text-xs text-muted-foreground/60`,children:c})})]}),C?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:C}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:`flex h-full min-w-0 flex-1 items-center gap-1.5 overflow-hidden px-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,onClick:()=>{a(e)},onDoubleClick:e=>{e.preventDefault(),e.stopPropagation(),t(s)},children:[m?(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate text-muted-foreground/60`,o&&`text-muted-foreground`),children:m}):null,(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center font-medium`,m?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close ${g}`,className:Y(`mr-1 flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50`,o?`opacity-100`:`opacity-0 hover:opacity-100 focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100`),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Ma,{"aria-hidden":`true`,className:`size-3.5`})})]}),o?(0,Z.jsx)(`div`,{className:`z-0 h-2 w-[calc(100%+16px)] absolute -left-[8px] -bottom-[2px] bg-background pointer-events-none`}):null]})},e)}),e[23]=a,e[24]=N,e[25]=s,e[26]=l,e[27]=u,e[28]=T,e[29]=h,e[30]=_,e[31]=g,e[32]=C,e[33]=x,e[34]=y,e[35]=W,e[36]=G,e[37]=K,e[38]=q,e[39]=ee}else W=e[35],G=e[36],K=e[37],q=e[38],ee=e[39];let te;if(e[41]!==o||e[42]!==r||e[43]!==c||e[44]!==W||e[45]!==p){let t;e[47]!==o||e[48]!==r||e[49]!==c||e[50]!==W?(t=e=>{let t=e===r;return(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":t?`true`:void 0,className:Y(`group flex min-w-28 max-w-64 shrink-0 items-center overflow-hidden rounded-lg border border-b-transparent py-1.5 relative`,t?`tab-bottom-flares -mb-px self-end pb-3.5 border-border border-b-background bg-background text-foreground rounded-b-none overflow-visible`:`border-transparent text-muted-foreground hover:bg-muted/70 hover:text-foreground`,W&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),c(e))},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Activate new tab`,title:`New tab`,className:`flex h-full min-w-0 flex-1 items-center overflow-hidden px-2 text-left font-medium text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,onClick:()=>o(e),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:`New tab`})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close new tab`,className:Y(`mr-1 flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50`,t?`opacity-100`:`opacity-0 hover:opacity-100 focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100`),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(Ma,{"aria-hidden":`true`,className:`size-3.5`})}),t?(0,Z.jsx)(`div`,{className:`z-0 h-2 w-[calc(100%+16px)] absolute -left-[8px] -bottom-[2px] bg-background pointer-events-none`}):null]},e)},e[47]=o,e[48]=r,e[49]=c,e[50]=W,e[51]=t):t=e[51],te=p.map(t),e[41]=o,e[42]=r,e[43]=c,e[44]=W,e[45]=p,e[46]=te}else te=e[46];let ne;e[52]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(Sa,{"aria-hidden":`true`,className:`size-3.5`}),e[52]=ne):ne=e[52];let re;e[53]===m?re=e[54]:(re=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`New tab`,className:`flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground outline-none transition hover:bg-muted/70 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50`,onClick:m,children:ne})}),e[53]=m,e[54]=re);let ie;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(ao,{children:`New tab`}),e[55]=ie):ie=e[55];let ae;e[56]===re?ae=e[57]:(ae=(0,Z.jsxs)(so,{children:[re,ie]}),e[56]=re,e[57]=ae);let oe;return e[58]!==G||e[59]!==K||e[60]!==q||e[61]!==ee||e[62]!==te||e[63]!==ae?(oe=(0,Z.jsxs)(`div`,{ref:G,className:K,onWheel:q,children:[ee,te,ae]}),e[58]=G,e[59]=K,e[60]=q,e[61]=ee,e[62]=te,e[63]=ae,e[64]=oe):oe=e[64],oe}function Uj(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function Wj(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var Gj=[{label:`Documentation`,href:`https://openknowledge.ai/docs`,icon:u},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:vu},{label:`Website`,href:`https://openknowledge.ai/`,icon:Oa},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:Uj},{label:`Twitter`,href:`https://x.com/inkeep`,icon:Wj}],Kj=()=>{let e=(0,$.c)(5),[t,n]=(0,Q.useState)(!1),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[(0,Z.jsx)(_,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Resources`})]})})}),(0,Z.jsx)(ao,{children:`Resources`})]}),e[0]=r):r=e[0];let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:`Resources`}),e[1]=i):i=e[1];let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(C,{align:`end`,className:`w-64 p-3`,children:[i,(0,Z.jsx)(`nav`,{"aria-label":`Resources`,children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:Gj.map(qj)})})]}),e[2]=a):a=e[2];let o;return e[3]===t?o=e[4]:(o=(0,Z.jsxs)(Qe,{open:t,onOpenChange:n,children:[r,a]}),e[3]=t,e[4]=o),o};function qj(e){let{label:t,href:n,icon:r}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Ai(e,n),onAuxClick:e=>Ai(e,n),className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(r,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t]})},n)}async function Jj(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Yj(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Yj(e)}}}function Yj(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Xj={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Zj(e){let t=(0,$.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=pn(),s=Xj[r],c=s?(o===`dark`?wn[s]:void 0)??Zt[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=Y(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(Jr,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,Z.jsx)(qr,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(ei,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function Qj(e){let{installState:t}=e;return t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null}function $j(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:`Requires ${e}.`,installAction:{label:`Install ${e} →`,url:t.installUrl},...t.hasWebFallback?{webFallback:{label:`Open in claude.ai →`,url:``}}:{}}}}return{enabled:!0,tooltip:null}}function eM(e){return jn(e)}function tM(e){return`Opened ${e} in your browser.`}var nM=`claude.ai`;async function rM(e,t=Jj){(await t(jn(e))).ok?qa.success(tM(nM)):qa.error(`Couldn't open ${nM} in your browser.`)}function iM(e){return e.onInstallSkillRequest!==void 0&&e.target.id===`claude-cowork`}function aM(e){let t=(0,$.c)(80),{target:n,installState:r,isElectronHost:i,prompt:a,onSelect:o,onInstallSkillRequest:s}=e,c=e.openExternal??Jj,l=e.onWebFallbackSuccess??sM,u=e.onWebFallbackError??oM,d;t[0]!==r||t[1]!==i||t[2]!==n?(d=$j({target:n,installState:r,isElectronHost:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=d):d=t[3];let f=d,p;t[4]!==r||t[5]!==i||t[6]!==n?(p=Qj({target:n,installState:r,isElectronHost:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=p):p=t[7];let m=p,h;t[8]!==c||t[9]!==f.tooltip?(h=()=>{f.tooltip&&c(f.tooltip.installAction.url)},t[8]=c,t[9]=f.tooltip,t[10]=h):h=t[10];let g=h,_;t[11]!==u||t[12]!==l||t[13]!==c||t[14]!==a||t[15]!==n?(_=()=>{(async()=>{let e=await c(eM(a));e.ok?l(n):u(n,e.detail??e.reason)})()},t[11]=u,t[12]=l,t[13]=c,t[14]=a,t[15]=n,t[16]=_):_=t[16];let v=_;if(f.enabled){let e;t[17]!==s||t[18]!==n?(e=iM({target:n,onInstallSkillRequest:s}),t[17]=s,t[18]=n,t[19]=e):e=t[19];let r=e,i=r&&s?s:o,a=`open-in-agent-item-${n.id}`,c=r?`Install Open Knowledge skill in ${n.displayName}`:`Open in ${n.displayName}`,l;t[20]===n.id?l=t[21]:(l=(0,Z.jsx)(Zj,{id:n.id,"aria-hidden":`true`}),t[20]=n.id,t[21]=l);let u=r?`flex-1 whitespace-nowrap`:void 0,d;t[22]!==u||t[23]!==n.displayName?(d=(0,Z.jsx)(`span`,{className:u,children:n.displayName}),t[22]=u,t[23]=n.displayName,t[24]=d):d=t[24];let f;t[25]===r?f=t[26]:(f=r?(0,Z.jsx)(We,{variant:`outline`,"aria-hidden":`true`,className:`ml-2 h-[18px] px-1.5 py-0 text-[10px]`,"data-testid":`open-in-agent-skill-install-badge`,children:`Install`}):null,t[25]=r,t[26]=f);let p;return t[27]!==d||t[28]!==f||t[29]!==i||t[30]!==a||t[31]!==c||t[32]!==l?(p=(0,Z.jsxs)(li,{onSelect:i,"data-testid":a,"aria-label":c,children:[l,d,f]}),t[27]=d,t[28]=f,t[29]=i,t[30]=a,t[31]=c,t[32]=l,t[33]=p):p=t[33],p}if(!f.tooltip){let e=m?`Open in ${n.displayName}, ${m}`:`Open in ${n.displayName}`,r=`open-in-agent-item-${n.id}`,i;t[34]===n.id?i=t[35]:(i=(0,Z.jsx)(Zj,{id:n.id,"aria-hidden":`true`}),t[34]=n.id,t[35]=i);let a;t[36]===n.displayName?a=t[37]:(a=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[36]=n.displayName,t[37]=a);let o;t[38]===m?o=t[39]:(o=m?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:m}):null,t[38]=m,t[39]=o);let s;return t[40]!==e||t[41]!==r||t[42]!==i||t[43]!==a||t[44]!==o?(s=(0,Z.jsxs)(li,{disabled:!0,"data-testid":r,"aria-label":e,children:[i,a,o]}),t[40]=e,t[41]=r,t[42]=i,t[43]=a,t[44]=o,t[45]=s):s=t[45],s}let y=m?`Open in ${n.displayName}, ${m}`:`Open in ${n.displayName}`,b=`open-in-agent-item-${n.id}`,x;t[46]===n.id?x=t[47]:(x=(0,Z.jsx)(Zj,{id:n.id,"aria-hidden":`true`,className:`mr-2`}),t[46]=n.id,t[47]=x);let S;t[48]===n.displayName?S=t[49]:(S=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[48]=n.displayName,t[49]=S);let C;t[50]===m?C=t[51]:(C=m?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:m}):null,t[50]=m,t[51]=C);let w;t[52]!==y||t[53]!==b||t[54]!==x||t[55]!==S||t[56]!==C?(w=(0,Z.jsxs)(si,{"data-testid":b,"data-row-disabled":``,"aria-label":y,children:[x,S,C]}),t[52]=y,t[53]=b,t[54]=x,t[55]=S,t[56]=C,t[57]=w):w=t[57];let T=`open-in-agent-submenu-${n.id}`,E=`open-in-agent-message-${n.id}`,D;t[58]!==f.tooltip.message||t[59]!==E?(D=(0,Z.jsx)(xa,{className:`font-normal text-muted-foreground text-xs`,"data-testid":E,children:f.tooltip.message}),t[58]=f.tooltip.message,t[59]=E,t[60]=D):D=t[60];let O;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(di,{}),t[61]=O):O=t[61];let k=`open-in-agent-install-${n.id}`,A;t[62]===f.tooltip.installAction.label?A=t[63]:(A=(0,Z.jsx)(`span`,{children:f.tooltip.installAction.label}),t[62]=f.tooltip.installAction.label,t[63]=A);let j;t[64]!==g||t[65]!==k||t[66]!==A?(j=(0,Z.jsx)(li,{onSelect:g,"data-testid":k,children:A}),t[64]=g,t[65]=k,t[66]=A,t[67]=j):j=t[67];let M;t[68]!==v||t[69]!==f.tooltip.webFallback||t[70]!==n.id?(M=f.tooltip.webFallback?(0,Z.jsxs)(li,{onSelect:v,"data-testid":`open-in-agent-web-fallback-${n.id}`,"aria-label":`${f.tooltip.webFallback.label}, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:f.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser with prompt pre-filled`})]}):null,t[68]=v,t[69]=f.tooltip.webFallback,t[70]=n.id,t[71]=M):M=t[71];let N;t[72]!==D||t[73]!==j||t[74]!==M||t[75]!==T?(N=(0,Z.jsxs)(ia,{className:`min-w-[260px]`,"data-testid":T,children:[D,O,j,M]}),t[72]=D,t[73]=j,t[74]=M,t[75]=T,t[76]=N):N=t[76];let P;return t[77]!==N||t[78]!==w?(P=(0,Z.jsxs)(wi,{children:[w,N]}),t[77]=N,t[78]=w,t[79]=P):P=t[79],P}function oM(){}function sM(){}function cM(e){let t=(0,$.c)(70),{input:n}=e,{states:r,refresh:i}=Ap(),{dispatch:a}=yp(),{skillInstalled:o,refresh:s}=ua(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),f=typeof window<`u`&&window.okDesktop!=null,p;t[0]===i?p=t[1]:(p=e=>{l(e),e&&i()},t[0]=i,t[1]=p);let m=p,h=n===null,g;t[2]===n?g=t[3]:(g=n===null?``:er(n.docContext),t[2]=n,t[3]=g);let _=g,v;t[4]!==a||t[5]!==n?(v=e=>{n!==null&&a(e.id,n)},t[4]=a,t[5]=n,t[6]=v):v=t[6];let y=v,b,x,S,C,w,T,E,D,O,k,A,j;if(t[7]!==m||t[8]!==y||t[9]!==n||t[10]!==c||t[11]!==_||t[12]!==o||t[13]!==r||t[14]!==h){let e;t[27]===r?e=t[28]:(e=e=>r[e.id]?.installed===!0,t[27]=r,t[28]=e);let i=kf.filter(e);S=r[`claude-cowork`]?.installed===!0;let a;t[29]!==n||t[30]!==_?(a=()=>{n!==null&&rM(_)},t[29]=n,t[30]=_,t[31]=a):a=t[31],C=a,x=Ca,j=c,w=m;let s;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ti,{className:`size-4`}),t[32]=s):s=t[32];let l;t[33]===h?l=t[34]:(l=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit with AI`,disabled:h,className:`text-muted-foreground`,"data-testid":`open-in-agent-trigger`,children:s})})}),t[33]=h,t[34]=l);let u;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ao,{children:`Edit with AI`}),t[35]=u):u=t[35],t[36]===l?T=t[37]:(T=(0,Z.jsxs)(so,{children:[l,u]}),t[36]=l,t[37]=T),b=ki,E=`end`,D=`min-w-[220px]`,O=`open-in-agent-menu`,t[38]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(xa,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Open in`}),t[38]=k):k=t[38];let p;t[39]!==y||t[40]!==_||t[41]!==o||t[42]!==r?(p=e=>{let t=r[e.id];return(0,Z.jsx)(aM,{target:e,installState:t,isElectronHost:f,prompt:_,onSelect:()=>y(e),onInstallSkillRequest:e.id===`claude-cowork`&&!o?()=>d(!0):void 0},e.id)},t[39]=y,t[40]=_,t[41]=o,t[42]=r,t[43]=p):p=t[43],A=i.map(p),t[7]=m,t[8]=y,t[9]=n,t[10]=c,t[11]=_,t[12]=o,t[13]=r,t[14]=h,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A,t[26]=j}else b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25],j=t[26];let M;t[44]!==S||t[45]!==C||t[46]!==n?(M=S?null:(0,Z.jsxs)(li,{onSelect:C,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(pt,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in claude.ai →`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser`})]}),t[44]=S,t[45]=C,t[46]=n,t[47]=M):M=t[47];let N;t[48]!==b||t[49]!==M||t[50]!==E||t[51]!==D||t[52]!==O||t[53]!==k||t[54]!==A?(N=(0,Z.jsxs)(b,{align:E,className:D,"data-testid":O,children:[k,A,M]}),t[48]=b,t[49]=M,t[50]=E,t[51]=D,t[52]=O,t[53]=k,t[54]=A,t[55]=N):N=t[55];let P;t[56]!==x||t[57]!==w||t[58]!==T||t[59]!==N||t[60]!==j?(P=(0,Z.jsxs)(x,{open:j,onOpenChange:w,children:[T,N]}),t[56]=x,t[57]=w,t[58]=T,t[59]=N,t[60]=j,t[61]=P):P=t[61];let F;t[62]===s?F=t[63]:(F=e=>{d(e),e||s()},t[62]=s,t[63]=F);let I;t[64]!==u||t[65]!==F?(I=(0,Z.jsx)(oa,{open:u,onOpenChange:F}),t[64]=u,t[65]=F,t[66]=I):I=t[66];let L;return t[67]!==P||t[68]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[P,I]}),t[67]=P,t[68]=I,t[69]=L):L=t[69],L}var lM=()=>{let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onClick:uM,children:[(0,Z.jsx)(Xs,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Settings`})]})}),(0,Z.jsx)(ao,{children:`Settings`})]}),e[0]=t):t=e[0],t};function uM(){window.location.hash!==`#settings`&&(window.location.hash=Af)}function dM(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime();return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)} min ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:new Date(e).toLocaleDateString()}async function fM(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}function pM(e){let t=(0,$.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(us,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(qs,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(us,{className:`size-3.5 text-emerald-500`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(qs,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Cn,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ls,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Rs,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Cn,{className:`size-3.5 text-amber-500`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(us,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function mM(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function hM(e){switch(e){case`dormant`:return`No git remote`;case`idle`:return`Synced`;case`fetching`:return`Fetching`;case`pulling`:return`Pulling`;case`pushing`:return`Pushing`;case`conflict`:return`Conflict`;case`offline`:return`Offline`;case`auth-error`:return`Sign in required`;case`disabled`:return`Sync disabled`;default:return e}}function gM(e){switch(e){case`external-changes-pending`:return`External changes pending`;case`dirty-tree`:return`Working tree has uncommitted changes`;case`detached-head`:return`Detached HEAD — checkout a branch to resume`;case`auth-error`:return`Sign in required`;case`protected-branch`:return`Protected branch — cannot push`;default:return e}}function _M(e){return e.syncEnabled?e.state===`idle`?e.ahead>0&&e.behind>0?`${e.ahead} ahead, ${e.behind} behind`:e.ahead>0?`${e.ahead} ahead`:e.behind>0?`${e.behind} behind`:`Synced`:e.state===`conflict`&&e.conflictCount>0?`${e.conflictCount} conflict${e.conflictCount===1?``:`s`}`:hM(e.state):`Sync off`}function vM(e){let t=(0,$.c)(76),{status:n,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=e,{projectLocalConfig:o,projectLocalSynced:s}=Yi(),c=o?.autoSync?.enabled??!1,{confirmOpen:u,setConfirmOpen:d,onToggleRequest:f,onConfirm:p}=Li(Ii()),m;t[0]===n?m=t[1]:(m=(0,Z.jsx)(pM,{status:n}),t[0]=n,t[1]=m);let h;t[2]===n.state?h=t[3]:(h=hM(n.state),t[2]=n.state,t[3]=h);let g;t[4]===h?g=t[5]:(g=(0,Z.jsx)(`span`,{className:`text-sm font-medium truncate`,children:h}),t[4]=h,t[5]=g);let _;t[6]!==m||t[7]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[m,g]}),t[6]=m,t[7]=g,t[8]=_):_=t[8];let v=!s,y=c?`Disable sync`:`Enable sync`,b;t[9]!==c||t[10]!==f||t[11]!==v||t[12]!==y?(b=(0,Z.jsx)(l,{checked:c,disabled:v,onCheckedChange:f,"aria-label":y}),t[9]=c,t[10]=f,t[11]=v,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[_,b]}),t[14]=_,t[15]=b,t[16]=x):x=t[16];let S;t[17]!==u||t[18]!==p||t[19]!==d?(S=(0,Z.jsx)(Xi,{open:u,onOpenChange:d,onConfirm:p}),t[17]=u,t[18]=p,t[19]=d,t[20]=S):S=t[20];let C;t[21]===n.error?C=t[22]:(C=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[21]=n.error,t[22]=C);let w;t[23]===n.pausedReason?w=t[24]:(w=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:gM(n.pausedReason)}),t[23]=n.pausedReason,t[24]=w);let T;t[25]===n.state?T=t[26]:(T=n.state===`conflict`&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:`Sync paused — resolve conflicts to resume.`}),t[25]=n.state,t[26]=T);let E;t[27]!==c||t[28]!==n.lastSyncUtc||t[29]!==n.state?(E=c&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{children:[`Last synced: `,dM(n.lastSyncUtc)]}),t[27]=c,t[28]=n.lastSyncUtc,t[29]=n.state,t[30]=E):E=t[30];let D;t[31]===n.ahead?D=t[32]:(D=n.ahead>0&&(0,Z.jsxs)(`div`,{children:[n.ahead,` commit`,n.ahead===1?``:`s`,` ahead`]}),t[31]=n.ahead,t[32]=D);let O;t[33]===n.behind?O=t[34]:(O=n.behind>0&&(0,Z.jsxs)(`div`,{children:[n.behind,` commit`,n.behind===1?``:`s`,` behind`]}),t[33]=n.behind,t[34]=O);let k;t[35]===n.conflictCount?k=t[36]:(k=n.conflictCount>0&&(0,Z.jsxs)(`div`,{children:[n.conflictCount,` file`,n.conflictCount===1?``:`s`,` conflicted`]}),t[35]=n.conflictCount,t[36]=k);let A;t[37]===c?A=t[38]:(A=!c&&(0,Z.jsx)(`div`,{children:`Sync is off — your edits will not sync to the remote repository.`}),t[37]=c,t[38]=A);let j;t[39]!==E||t[40]!==D||t[41]!==O||t[42]!==k||t[43]!==A?(j=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[E,D,O,k,A]}),t[39]=E,t[40]=D,t[41]=O,t[42]=k,t[43]=A,t[44]=j):j=t[44];let M;t[45]!==a||t[46]!==n.identityUnresolved?(M=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(uc,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:`Git identity isn't set — commits use a default author. Set yours so teammates see your name.`}),(0,Z.jsx)(X,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:`Set identity`})]})]}),t[45]=a,t[46]=n.identityUnresolved,t[47]=M):M=t[47];let N;t[48]!==c||t[49]!==n.state?(N=c&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:bM,children:`Sync now`}),t[48]=c,t[49]=n.state,t[50]=N):N=t[50];let P;t[51]!==c||t[52]!==r||t[53]!==n.state?(P=c&&n.state===`auth-error`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:r,children:`Sign in`}),t[51]=c,t[52]=r,t[53]=n.state,t[54]=P):P=t[54];let F;t[55]!==c||t[56]!==n.state?(F=c&&n.state===`offline`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:yM,children:`Retry`}),t[55]=c,t[56]=n.state,t[57]=F):F=t[57];let I;t[58]!==c||t[59]!==i||t[60]!==n.state?(I=c&&n.state===`conflict`&&i&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:i,children:`Review conflicts`}),t[58]=c,t[59]=i,t[60]=n.state,t[61]=I):I=t[61];let L;t[62]!==N||t[63]!==P||t[64]!==F||t[65]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[N,P,F,I]}),t[62]=N,t[63]=P,t[64]=F,t[65]=I,t[66]=L):L=t[66];let R;return t[67]!==C||t[68]!==w||t[69]!==T||t[70]!==j||t[71]!==M||t[72]!==L||t[73]!==x||t[74]!==S?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[x,S,C,w,T,j,M,L]}),t[67]=C,t[68]=w,t[69]=T,t[70]=j,t[71]=M,t[72]=L,t[73]=x,t[74]=S,t[75]=R):R=t[75],R}function yM(){fM(`sync`)}function bM(){fM(`sync`)}function xM(e){let t=(0,$.c)(36),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=n,{status:o,fetchError:s}=ca();if(!o){if(s){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":`Sync status unavailable`,disabled:!0,children:(0,Z.jsx)(ls,{className:`size-3.5`})})}),t[2]=e):e=t[2];let n=s===`network`?`Sync status unavailable — server unreachable.`:`Sync status unavailable — server error.`,r;return t[3]===n?r=t[4]:(r=(0,Z.jsxs)(so,{children:[e,(0,Z.jsx)(ao,{children:n})]}),t[3]=n,t[4]=r),r}return null}if(o.state===`dormant`&&!o.hasRemote||o.state===`disabled`&&!o.pausedReason)return null;let c;t[5]===o?c=t[6]:(c=mM(o),t[5]=o,t[6]=c);let l=c,u=!!o.identityUnresolved,d;t[7]===o.state?d=t[8]:(d=hM(o.state),t[7]=o.state,t[8]=d);let f=`Sync status: ${d}${u?` — git identity unset`:``}`,p;t[9]===o?p=t[10]:(p=(0,Z.jsx)(pM,{status:o}),t[9]=o,t[10]=p);let m;t[11]===l?m=t[12]:(m=l&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==l||t[14]!==u?(h=!l&&u&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[13]=l,t[14]=u,t[15]=h):h=t[15];let g;t[16]!==f||t[17]!==p||t[18]!==m||t[19]!==h?(g=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground relative`,"aria-label":f,children:[p,m,h]})})}),t[16]=f,t[17]=p,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;t[21]===o?_=t[22]:(_=_M(o),t[21]=o,t[22]=_);let v;t[23]===_?v=t[24]:(v=(0,Z.jsx)(ao,{children:_}),t[23]=_,t[24]=v);let y;t[25]!==v||t[26]!==g?(y=(0,Z.jsxs)(so,{children:[g,v]}),t[25]=v,t[26]=g,t[27]=y):y=t[27];let b;t[28]!==i||t[29]!==a||t[30]!==r||t[31]!==o?(b=(0,Z.jsx)(C,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(vM,{status:o,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a})}),t[28]=i,t[29]=a,t[30]=r,t[31]=o,t[32]=b):b=t[32];let x;return t[33]!==y||t[34]!==b?(x=(0,Z.jsxs)(Qe,{children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35],x}var SM=[{value:`light`,label:`Light`,icon:ic},{value:`dark`,label:`Dark`,icon:zs},{value:`system`,label:`System`,icon:ms}],CM=()=>{let e=(0,$.c)(16),{theme:t}=pn(),{merged:n,userBinding:r}=Yi(),i=n?.appearance?.theme??t??`system`,a;e[0]===r?a=e[1]:(a=e=>{if(e!==`light`&&e!==`dark`&&e!==`system`||!r)return;let t=r.patch({appearance:{theme:e}});t.ok||qa.error(Sn(t.error))},e[0]=r,e[1]=a);let o=a,s=i===`system`?ms:i===`dark`?zs:ic,c;e[2]===s?c=e[3]:(c=(0,Z.jsx)(s,{}),e[2]=s,e[3]=c);let l;e[4]===i?l=e[5]:(l=(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`Toggle theme (current: `,i,`)`]}),e[4]=i,e[5]=l);let u;e[6]!==c||e[7]!==l?(u=(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[c,l]})}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let d;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=SM.map(wM),e[9]=d):d=e[9];let f;e[10]!==i||e[11]!==o?(f=(0,Z.jsx)(ki,{align:`end`,children:(0,Z.jsx)(ji,{value:i,onValueChange:o,children:d})}),e[10]=i,e[11]=o,e[12]=f):f=e[12];let p;return e[13]!==u||e[14]!==f?(p=(0,Z.jsxs)(Ca,{children:[u,f]}),e[13]=u,e[14]=f,e[15]=p):p=e[15],p};function wM(e){let{value:t,label:n,icon:r}=e;return(0,Z.jsxs)(pi,{value:t,className:`capitalize`,children:[(0,Z.jsx)(r,{className:`text-muted-foreground`}),n]},t)}function TM(e){let t=(0,$.c)(49),{onSaveVersion:n,saving:r,onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}=e,{activeDocName:s,activeTarget:c}=Ue(),{state:l}=FA(),u=Lf(),d;t[0]!==s||t[1]!==u?(d=up({docName:s,workspace:u}),t[0]=s,t[1]=u,t[2]=d):d=t[2];let f=d,p=c?.kind===`asset`,m=p?c.assetPath:``,h,g;t[3]===m?(h=t[4],g=t[5]):(h=m.lastIndexOf(`/`),g=h===-1?``:m.slice(0,h),t[3]=m,t[4]=h,t[5]=g);let _=g,v;t[6]!==m||t[7]!==h?(v=h===-1?m:m.slice(h+1),t[6]=m,t[7]=h,t[8]=v):v=t[8];let y=v,b=typeof window<`u`&&window.okDesktop!=null,x=b&&l===`collapsed`&&`pl-[78px]`,S;t[9]===x?S=t[10]:(S=Y(`flex h-12 shrink-0 items-center bg-muted/20 shadow-[inset_0_-1px_0_var(--border)]`,b&&`[-webkit-app-region:drag]`,x,b&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[9]=x,t[10]=S);let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(BA,{className:Y(`-ml-1 shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`)})}),t[11]=C):C=t[11];let w=l===`expanded`?`Hide Files`:`Show Files`,T;t[12]===w?T=t[13]:(T=(0,Z.jsxs)(so,{children:[C,(0,Z.jsx)(ao,{children:w})]}),t[12]=w,t[13]=T);let E;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(yi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),t[14]=E):E=t[14];let D;t[15]!==y||t[16]!==_||t[17]!==p?(D=p?(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center gap-2 overflow-hidden text-sm`,children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center overflow-hidden`,children:[_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground/60`,children:_}),(0,Z.jsx)(`span`,{className:`shrink-0 px-2 text-muted-foreground/60`,children:`/`})]}),(0,Z.jsx)(`span`,{className:`shrink-0 font-medium text-foreground`,children:y})]})}):null,t[15]=y,t[16]=_,t[17]=p,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Hj,{}),t[19]=O):O=t[19];let k;t[20]!==D||t[21]!==T?(k=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[T,E,D,O]}),t[20]=D,t[21]=T,t[22]=k):k=t[22];let A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=Y(`flex shrink-0 items-center justify-end gap-2 px-3`,b&&`[&>*]:[-webkit-app-region:no-drag]`),t[23]=A):A=t[23];let j;t[24]!==s||t[25]!==n||t[26]!==r?(j=s&&(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Checkpoint version`,onClick:n,disabled:r,className:`text-muted-foreground`,children:(0,Z.jsx)(Ys,{className:`size-3.5`})})}),(0,Z.jsx)(ao,{children:r?`Saving`:`Checkpoint version`})]}),t[24]=s,t[25]=n,t[26]=r,t[27]=j):j=t[27];let M;t[28]!==s||t[29]!==f?(M=s&&(0,Z.jsx)(cM,{input:f}),t[28]=s,t[29]=f,t[30]=M):M=t[30];let N;t[31]!==o||t[32]!==a||t[33]!==i?(N=(0,Z.jsx)(xM,{onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}),t[31]=o,t[32]=a,t[33]=i,t[34]=N):N=t[34];let P,F,I,L,R,z;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(gj,{}),F=(0,Z.jsx)(yi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),I=(0,Z.jsx)($l,{}),L=(0,Z.jsx)(lM,{}),R=(0,Z.jsx)(Kj,{}),z=(0,Z.jsx)(CM,{}),t[35]=P,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=z):(P=t[35],F=t[36],I=t[37],L=t[38],R=t[39],z=t[40]);let B;t[41]!==j||t[42]!==M||t[43]!==N?(B=(0,Z.jsxs)(`div`,{className:A,children:[j,M,N,P,F,I,L,R,z]}),t[41]=j,t[42]=M,t[43]=N,t[44]=B):B=t[44];let V;return t[45]!==k||t[46]!==B||t[47]!==S?(V=(0,Z.jsxs)(`header`,{className:S,children:[k,B]}),t[45]=k,t[46]=B,t[47]=S,t[48]=V):V=t[48],V}function EM(){let e=(0,$.c)(32),[t,n]=om(),[r,i]=(0,Q.useState)(t),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(`auth`),[d,f]=(0,Q.useState)(j_[0].id),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_=_a(),{projectLocalConfig:v,projectLocalSynced:y}=Yi(),{activeDocName:b}=Ue(),x=!h&&_?.hasRemote===!0&&y===!0&&v!==null&&v.autoSync?.enabled===null,S,C;e[0]===b?(S=e[1],C=e[2]):(S=()=>{let e=function(e){let t=e.detail;t&&b&&Po(b,{kind:`raw-mdx`,detail:t}),i(`source`)};return window.addEventListener(Qp,e),()=>window.removeEventListener(Qp,e)},C=[b],e[0]=b,e[1]=S,e[2]=C),(0,Q.useEffect)(S,C);let w;e[3]===n?w=e[4]:(w=function(e){i(e),n(e)},e[3]=n,e[4]=w);let T=w,E;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=async function(){m(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?qa.success(`Checkpoint saved`):(console.error(`[save-version] failed:`,await e.text()),qa.error(`Checkpoint failed — try again`))}catch(e){console.error(`[save-version] failed:`,e),qa.error(`Checkpoint failed — try again`)}m(!1)},e[5]=E):E=e[5];let D=E,O;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(lm,{onOpenResolver:()=>o(!0)}),e[6]=O):O=e[6];let k,A,j;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{u(`auth`),c(!0)},A=()=>{u(`identity`),c(!0)},j=()=>o(!0),e[7]=k,e[8]=A,e[9]=j):(k=e[7],A=e[8],j=e[9]);let M;e[10]===p?M=e[11]:(M=(0,Z.jsx)(TM,{onSaveVersion:D,saving:p,onSignIn:k,onSetIdentity:A,onOpenConflictResolver:j}),e[10]=p,e[11]=M);let N;e[12]!==d||e[13]!==r||e[14]!==T?(N=(0,Z.jsx)(uA,{editorMode:r,onModeChange:T,activeTab:d,onActiveTabChange:f}),e[12]=d,e[13]=r,e[14]=T,e[15]=N):N=e[15];let P;e[16]===a?P=e[17]:(P=(0,Z.jsx)(dg,{open:a,onOpenChange:o}),e[16]=a,e[17]=P);let F=l===`identity`,I;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{c(!1)},e[18]=I):I=e[18];let L;e[19]!==s||e[20]!==F?(L=(0,Z.jsx)(Zl,{open:s,onOpenChange:c,identityPrompt:F,onSuccess:I}),e[19]=s,e[20]=F,e[21]=L):L=e[21];let R;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>g(!0),e[22]=R):R=e[22];let z;e[23]===x?z=e[24]:(z=(0,Z.jsx)(sm,{open:x,onResolved:R}),e[23]=x,e[24]=z);let B;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Yp,{}),e[25]=B):B=e[25];let V;return e[26]!==P||e[27]!==L||e[28]!==z||e[29]!==M||e[30]!==N?(V=(0,Z.jsxs)(Z.Fragment,{children:[O,M,N,P,L,z,B]}),e[26]=P,e[27]=L,e[28]=z,e[29]=M,e[30]=N,e[31]=V):V=e[31],V}var DM=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
34
|
+
`)}}}}function KD(e){try{let t=z().parseToMdast(e),n=[];return GD(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function qD(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))VD.test(n)&&t++;return t}function JD(e){let t=globalThis.Intl.Segmenter;if(!t)return qD(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function YD(e){let t=BD.test(e)?1.5:4;return Math.ceil(e.length/t)}function XD(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=Mn(e);if(!t.trim())return{words:0,chars:0,tokens:0};let n=KD(t);return n?{words:BD.test(n)?JD(n):qD(n),chars:n.length,tokens:YD(n)}:{words:0,chars:0,tokens:0}}var ZD=300;function QD(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(zD),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(zD);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(XD(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,ZD)};return n.observe(s),()=>{r=!0,n.unobserve(s),a&&clearTimeout(a)}},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function $D(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(`connecting`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(`connecting`);return}let t=e.configuration.websocketProvider.status;e.isSynced?r(`synced`):r(t===`connected`?`connected`:t===`disconnected`?`disconnected`:`connecting`);let n=e=>{let{status:t}=e;r(t===`connected`?eO:t===`disconnected`?`disconnected`:`connecting`)},i=e=>{let{state:t}=e;r(t?`synced`:`connected`)},a=()=>r(`disconnected`);return e.on(`status`,n),e.on(`synced`,i),e.on(`disconnect`,a),()=>{e.off(`status`,n),e.off(`synced`,i),e.off(`disconnect`,a)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function eO(e){return e===`synced`?`synced`:`connected`}var tO=yr;function nO(e,t={}){let n=ee(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var rO=200,iO=`Outside any block`;function aO(e){let t=(0,$.c)(5),{editor:n}=e,r=we(n),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(a.current!==null&&(window.clearTimeout(a.current),a.current=null),!n||!i.current)return;let e=r!==null&&r.ancestorChain.length>0,t;return t=e?oO(n,r):o.current?iO:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},rO),()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{ref:i,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`}),t[4]=l):l=t[4],l}function oO(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=nO(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=nO(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}function sO(){let[e]=(0,Q.useState)(Or);return e}function cO({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Yn(e.display_name),color:vr(e.id,Fn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:vr(e.id,Fn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function lO(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var uO=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&kr(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Xt(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(yn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(hn(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(tn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(rn(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push($t(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(nr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(mn(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Vn(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof nn){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof tr){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():lO(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&ir(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},dO=e=>new en({key:typeof e.pluginKey==`string`?new vn(e.pluginKey):e.pluginKey,view:t=>new uO({view:t,...e})});fr.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[dO({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var fO=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return cr(e,{textSerializers:Zn(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Xt(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(yn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(hn(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(tn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(rn(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push($t(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(nr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(mn(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=Vn(this.view,e.from,e.to);ir({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},pO=e=>new en({key:typeof e.pluginKey==`string`?new vn(e.pluginKey):e.pluginKey,view:t=>new fO({view:t,...e})});fr.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[pO({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function mO(e,t){return e??new vn(t)}var hO=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,gO=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),_O=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),vO=new Set([`children`,`className`,`style`]),yO=new Set([`tabIndex`]),bO=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),xO={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function SO(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function CO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function wO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||bO.has(e)}function TO(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function EO(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:xO[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function DO(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function OO(e){return yO.has(e)}function kO(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function AO(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function jO(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||_O.has(e)?String(t):`${t}px`}function MO(e,t){gO.has(t)||e.style.removeProperty(TO(t))}function NO(e,t,n){gO.has(t)||e.style.setProperty(TO(t),jO(t,n))}function PO(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(vO.has(r)||!wO(r)||SO(r,t[r])||SO(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=CO(r);if(a==null||a===!1){OO(r)&&AO(e,r),e.removeAttribute(o);return}if(a===!0){OO(r)&&kO(e,r,!0),e.setAttribute(o,``);return}if(OO(r)){kO(e,r,a);return}e.setAttribute(o,String(a))})}function FO(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function IO(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){MO(e,t);return}NO(e,t,a)}})}function LO(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!SO(t,n))return;let{eventName:i,options:a}=EO(t),o=t=>{n(DO(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function RO(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);hO(()=>{let i=n.current;return FO(e,i.className,t.className),IO(e,i.style,t.style),PO(e,i,t),r.current=LO(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var zO=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(mO(e,`bubbleMenu`)).current;RO(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=ae(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=dO({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,Q.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,ts.createPortal)(c,d.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,Q.useRef)(document.createElement(`div`)),d=(0,Q.useRef)(mO(e,`floatingMenu`)).current;RO(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=ae(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=pO({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,Q.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,ts.createPortal)(s,u.current)});var BO=[{name:`paragraph`,label:`Text`,icon:Ws,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:ut,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:oe,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:Te,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Se,isActive:e=>e.isActive(`list`,{ordered:!1})&&!e.isActive(`listItem`,{checked:!0})&&!e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleBulletList().run()},{name:`orderedList`,label:`Ordered List`,icon:Ve,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Xe,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:he,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:ec,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function VO(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:HO},t[0]=n,t[1]=r);let{current:i,activeStates:a}=L(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Z.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Z.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Fe,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=BO.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(li,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:e.label})]},e.name)}),t[10]=a,t[11]=n,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(ki,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==u||t[16]!==f?(p=(0,Z.jsxs)(Ca,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function HO(e){let t=Object.fromEntries(BO.map(t=>[t.name,t.isActive(e.editor)]));return{current:BO.find(e=>t[e.name])??BO[0],activeStates:t}}function UO(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`File`&&n!==`WikiEmbedFile`)return null;let r=(t.attrs.props??{}).src;return typeof r!=`string`||r.length===0?null:r}function WO(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:ie(typeof n.src==`string`?n.src:``)}function GO(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,n.rel=`noopener noreferrer`,n.style.display=`none`,document.body.appendChild(n),n.click(),n.remove()}function KO(e){let t=(0,$.c)(10),{editor:n}=e,r;if(t[0]===n?r=t[1]:(r={editor:n,selector:qO},t[0]=n,t[1]=r),L(r)===null)return null;let i;t[2]===n?i=t[3]:(i=e=>{e.preventDefault();let t=UO(n);t&&GO(t,WO(n))},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(fi,{className:`size-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Download file`,className:`text-accent-foreground`,onMouseDown:i,children:a})}),t[5]=i,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ao,{side:`bottom`,sideOffset:8,children:`Download file`}),t[7]=s):s=t[7];let c;return t[8]===o?c=t[9]:(c=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(so,{children:[o,s]})}),t[8]=o,t[9]=c),c}function qO(e){return UO(e.editor)}function JO(e){return UO(e)!==null}var YO=[{value:`left`,label:`Align left`,icon:Ae},{value:`center`,label:`Align center`,icon:qe},{value:`right`,label:`Align right`,icon:le}];function XO(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`img`&&n!==`CommonMarkImage`&&n!==`Embed`)return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function ZO(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:QO},t[0]=n,t[1]=r);let i=L(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=YO.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(a!==`img`&&a!==`CommonMarkImage`&&a!==`Embed`||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(nn.create(u.doc,s)),n.view.dispatch(u)},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(ao,{side:`bottom`,sideOffset:8,children:r})]},t)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function QO(e){return XO(e.editor)}function $O(e){return XO(e)!==null}var ek=[{name:`bold`,icon:es,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘B`},{name:`italic`,icon:As,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘I`},{name:`underline`,icon:cc,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘U`},{name:`strikethrough`,icon:rc,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘⇧X`},{name:`code`,icon:ds,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘E`},{name:`highlight`,icon:ks,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘⇧H`}];function tk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:nk},t[0]=n,t[1]=r);let i=L(r),a;t[2]!==i||t[3]!==n?(a=ek.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(ao,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:e.shortcut})]})]},e.name)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function nk(e){return Object.fromEntries(ek.map(t=>[t.name,t.isActive(e.editor)]))}function rk(e){let t=(0,$.c)(46),{editor:n}=e,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.useRef)(null),c;t[0]===n?c=t[1]:(c=n.isActive(`link`),t[0]=n,t[1]=c);let l=c,u;t[2]===n?u=t[3]:(u=n.getAttributes(`link`).href??``,t[2]=n,t[3]=u);let d=u,p,m;t[4]===n?(p=t[5],m=t[6]):(p=()=>{let e=function(){n.state.selection.empty&&i(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},m=[n],t[4]=n,t[5]=p,t[6]=m),(0,Q.useEffect)(p,m);let h,g;t[7]!==d||t[8]!==r?(h=()=>{r&&(o(d),requestAnimationFrame(()=>s.current?.focus()))},g=[r,d],t[7]=d,t[8]=r,t[9]=h,t[10]=g):(h=t[9],g=t[10]),(0,Q.useEffect)(h,g);let _;t[11]!==n||t[12]!==l||t[13]!==a?(_=function(){a.trim()?n.chain().focus().setLink({href:a.trim()}).run():l&&n.chain().focus().unsetLink().run(),i(!1)},t[11]=n,t[12]=l,t[13]=a,t[14]=_):_=t[14];let v=_,y;t[15]===n?y=t[16]:(y=function(){n.chain().focus().unsetLink().run(),i(!1)},t[15]=n,t[16]=y);let b=y,x;t[17]!==v||t[18]!==n?(x=function(e){e.key===`Enter`&&(e.preventDefault(),v()),e.key===`Escape`&&(e.preventDefault(),i(!1),n.chain().focus().run())},t[17]=v,t[18]=n,t[19]=x):x=t[19];let S=x;if(r){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>o(e.target.value),t[20]=e):e=t[20];let n;t[21]!==S||t[22]!==a?(n=(0,Z.jsx)(`input`,{ref:s,type:`url`,placeholder:`Paste link`,value:a,onChange:e,onKeyDown:S,"aria-label":`Link URL`,className:`h-5 w-44 bg-transparent text-sm border-none outline-none placeholder:text-muted-foreground`}),t[21]=S,t[22]=a,t[23]=n):n=t[23];let r;t[24]===v?r=t[25]:(r=()=>{v()},t[24]=v,t[25]=r);let i;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(hs,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[26]=i):i=t[26];let c;t[27]===r?c=t[28]:(c=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Apply link`,onClick:r,children:i}),t[27]=r,t[28]=c);let u;t[29]!==n||t[30]!==c?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1`,children:[n,c]}),t[29]=n,t[30]=c,t[31]=u):u=t[31];let p;t[32]!==d||t[33]!==l||t[34]!==b?(p=l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open link in new tab`,onMouseDown:e=>{e.preventDefault(),f(d)},children:(0,Z.jsx)(ka,{className:`size-3.5`})})}),(0,Z.jsx)(ao,{side:`bottom`,sideOffset:8,children:`Open link in new tab`})]}),(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Remove link`,onMouseDown:e=>{e.preventDefault(),b()},children:(0,Z.jsx)(et,{className:`size-3.5`})})}),(0,Z.jsx)(ao,{side:`bottom`,sideOffset:8,children:`Remove link`})]})]}),t[32]=d,t[33]=l,t[34]=b,t[35]=p):p=t[35];let m;return t[36]!==u||t[37]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[u,p]}),t[36]=u,t[37]=p,t[38]=m):m=t[38],m}let C=l?`bg-accent text-primary`:`text-accent-foreground`,w,T;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e.preventDefault(),i(!0)},T=(0,Z.jsx)(Ps,{className:`size-3.5`}),t[39]=w,t[40]=T):(w=t[39],T=t[40]);let E;t[41]===C?E=t[42]:(E=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Insert link`,className:C,onMouseDown:w,children:T})}),t[41]=C,t[42]=E);let D;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(ao,{side:`bottom`,sideOffset:8,children:[`Link`,(0,Z.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:`⌘K`})]}),t[43]=D):D=t[43];let O;return t[44]===E?O=t[45]:(O=(0,Z.jsxs)(so,{children:[E,D]}),t[44]=E,t[45]=O),O}function ik({editor:e}){if(e.isActive(`codeBlock`))return!1;if($O(e)||JO(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function ak(e){let t=(0,$.c)(22),{editor:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),s;t[0]===n?s=t[1]:(s={editor:n,selector:uk},t[0]=n,t[1]=s);let c=L(s),l;t[2]===n?l=t[3]:(l={editor:n,selector:lk},t[2]=n,t[3]=l);let u=L(l),d;t[4]!==n.state||t[5]!==n.view?(d=()=>{try{let{from:e,to:t}=n.state.selection;return Vn(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=d):d=t[6];let f;if(t[7]!==n.view.dom||t[8]!==d){let e={getBoundingClientRect:d,contextElement:n.view.dom};f=()=>{let t=r.current;t&&(o.current?.(),o.current=_n(e,t,()=>{ir(e,t,{placement:`top`,strategy:`fixed`,middleware:[hn(8),Xt(),yn({padding:8})]}).then(e=>{let{x:n,y:r}=e;t.isConnected&&(t.style.position=`fixed`,t.style.left=`${n}px`,t.style.top=`${r}px`)}).catch(ck)}))},t[7]=n.view.dom,t[8]=d,t[9]=f}else f=t[9];let p=f,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{o.current?.(),o.current=null,a(sk)},t[10]=m):m=t[10];let h=m,g;t[11]===p?g=t[12]:(g={onShow:p,onHide:h,strategy:`fixed`},t[11]=p,t[12]=g);let _;t[13]!==n||t[14]!==u||t[15]!==c||t[16]!==i?(_=c?(0,Z.jsx)(ZO,{editor:n},`${i}-img-align`):u?(0,Z.jsx)(KO,{editor:n},`${i}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(VO,{editor:n}),(0,Z.jsx)(yi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(tk,{editor:n},i),(0,Z.jsx)(yi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(rk,{editor:n},`${i}-link`)]}),t[13]=n,t[14]=u,t[15]=c,t[16]=i,t[17]=_):_=t[17];let v;return t[18]!==n||t[19]!==g||t[20]!==_?(v=(0,Z.jsx)(zO,{ref:r,editor:n,appendTo:ok,shouldShow:ik,updateDelay:250,options:g,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:_}),t[18]=n,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function ok(){return document.body}function sk(e){return e+1}function ck(){}function lk(e){return JO(e.editor)}function uk(e){return $O(e.editor)}var dk=[{name:`addRowBefore`,icon:Ne,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:O,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:et,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],fk=[{name:`addColumnBefore`,icon:Qr,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:Ti,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:et,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],pk=[{name:`toggleHeaderRow`,icon:ac,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:ps,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:Ds,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function mk({editor:e}){return e.isActive(`table`)}function hk(e){let t=(0,$.c)(14),{action:n,editor:r}=e,i=n.icon,a;t[0]!==n||t[1]!==r?(a=e=>{e.preventDefault(),n.command(r)},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(i,{className:`size-3.5`}),t[3]=i,t[4]=o);let s;t[5]!==n.label||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":n.label,className:`text-muted-foreground`,onMouseDown:a,children:o})}),t[5]=n.label,t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;t[9]===n.label?c=t[10]:(c=(0,Z.jsx)(ao,{side:`bottom`,sideOffset:8,children:n.label}),t[9]=n.label,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,Z.jsxs)(so,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function gk(e){let t=(0,$.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=dk.map(e=>(0,Z.jsx)(hk,{action:e,editor:n},e.name)),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(yi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=fk.map(e=>(0,Z.jsx)(hk,{action:e,editor:n},e.name)),t[3]=n,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(yi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=pk.map(e=>(0,Z.jsx)(hk,{action:e,editor:n},e.name)),t[6]=n,t[7]=s);let c;return t[8]!==n||t[9]!==r||t[10]!==a||t[11]!==s?(c=(0,Z.jsxs)(zO,{editor:n,shouldShow:mk,updateDelay:100,className:`flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[r,i,a,o,s]}),t[8]=n,t[9]=r,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}var _k=new WeakMap;function vk(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=Tr(e.color),n.textContent=e.name,t.append(n),t}var yk={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function bk(){let e=new jr({extensions:On});return{mdManager:e,text:q({mdManager:e}),html:G({mdManager:e}),paste:w({mdManager:e}),drop:x({mdManager:e})}}function xk(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...Ye.map(e=>e.name===`link`||e.name===`wikiLink`?e.configure({docName:t.configuration.name??``}):e),tO.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),K.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),fr.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[I]}}),fr.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[b(e,{cursorBuilder:vk})]}})]}function Sk(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{_k.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=_k.get(e);if(_k.delete(e),r==null)return;let i=performance.now();ye(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:(e,t)=>n.drop(e,t)},extensions:$u(xk(e))}}function Ck(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=hr(xk({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=F(t.document.getXmlFragment(`default`),a);return{...Sk({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var wk=e=>{let t=(0,$.c)(20),{provider:n,placeholder:r,isSourceMode:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(yk),s=sO(),{principal:c,activeDocName:l}=Ue(),u=n.configuration.name??``,[d]=(0,Q.useState)(bk),f;t[0]!==d||t[1]!==r||t[2]!==n?(f=()=>()=>({editor:new Rn(Ck({provider:n,placeholder:r,clipboard:d,ctorStart:performance.now()})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=d,t[1]=r,t[2]=n,t[3]=f):f=t[3];let[p]=(0,Q.useState)(f),m,h;if(t[4]!==p||t[5]!==u||t[6]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=se(u)??crypto.randomUUID();m=Q.use,h=He({docName:u,mountId:r,construct:p,sizeStats:e}),t[4]=p,t[5]=u,t[6]=n.document,t[7]=m,t[8]=h}else m=t[7],h=t[8];let g=m(h),_=g.editor,v,y;t[9]===g?(v=t[10],y=t[11]):(v=()=>()=>{ze(g)},y=[g],t[9]=g,t[10]=v,t[11]=y),(0,Q.useEffect)(v,y);let b;return t[12]!==l||t[13]!==u||t[14]!==_||t[15]!==s||t[16]!==i||t[17]!==c||t[18]!==n?(b=(0,Z.jsx)(Tk,{provider:n,isSourceMode:i,docName:u,activeDocName:l,identity:s,principal:c,editor:_,wrapperRef:a,flashStateRef:o}),t[12]=l,t[13]=u,t[14]=_,t[15]=s,t[16]=i,t[17]=c,t[18]=n,t[19]=b):b=t[19],b},Tk=e=>{let t=(0,$.c)(62),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u}=e,d;t[0]!==c||t[1]!==n.configuration.name?(d=()=>(be(c,n.configuration.name??null),()=>{be(c,null)}),t[0]=c,t[1]=n.configuration.name,t[2]=d):d=t[2];let f;t[3]!==c||t[4]!==n?(f=[c,n],t[3]=c,t[4]=n,t[5]=f):f=t[5],(0,Q.useEffect)(d,f);let m;t[6]!==c||t[7]!==n.configuration.name?(m=()=>{},t[6]=c,t[7]=n.configuration.name,t[8]=m):m=t[8];let h;t[9]!==c||t[10]!==n?(h=[c,n],t[9]=c,t[10]=n,t[11]=h):h=t[11],(0,Q.useEffect)(m,h);let g;t[12]!==c||t[13]!==n.configuration.name?(g=()=>{},t[12]=c,t[13]=n.configuration.name,t[14]=g):g=t[14];let _;t[15]!==c||t[16]!==n?(_=[c,n],t[15]=c,t[16]=n,t[17]=_):_=t[17],(0,Q.useEffect)(g,_);let v,b;t[18]===c?(v=t[19],b=t[20]):(v=()=>{let e=Ek,t=null,n=()=>{if(t||c.isDestroyed)return;let n=p(c);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return p(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},b=[c],t[18]=c,t[19]=v,t[20]=b),(0,Q.useEffect)(v,b);let x,C;t[21]!==u||t[22]!==n.document||t[23]!==l?(C=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},lr)};c(yk);let f=()=>{if(Wn(e),!Bn(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?Bn(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},x=[n.document,u,l],t[21]=u,t[22]=n.document,t[23]=l,t[24]=x,t[25]=C):(x=t[24],C=t[25]),(0,Q.useEffect)(C,x);let w,T;t[26]===n?(w=t[27],T=t[28]):(w=()=>{let e=window.location.hash,t=e.indexOf(`?`),r=t>=0?new URLSearchParams(e.slice(t+1)).get(`anchor`):null;if(!r)return;let i=r,a=0,o,s=!1;function c(){if(s)return;let e=document.getElementById(i);e?(e.scrollIntoView({behavior:`smooth`,block:`start`}),s=!0,n.off(`synced`,c)):a<20&&(a+=1,o=window.setTimeout(c,100))}return c(),n.on(`synced`,c),()=>{o!==void 0&&clearTimeout(o),n.off(`synced`,c)}},T=[n],t[26]=n,t[27]=w,t[28]=T),(0,Q.useEffect)(w,T);let E,D;t[29]===c?(E=t[30],D=t[31]):(E=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=p(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&r.scrollIntoView({behavior:`smooth`,block:`start`})};return window.addEventListener(Io,e),()=>window.removeEventListener(Io,e)},D=[c],t[29]=c,t[30]=E,t[31]=D),(0,Q.useEffect)(E,D);let O;t[32]!==a||t[33]!==i||t[34]!==o||t[35]!==r||t[36]!==s||t[37]!==n.awareness?(O=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:cO({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[32]=a,t[33]=i,t[34]=o,t[35]=r,t[36]=s,t[37]=n.awareness,t[38]=O):O=t[38];let k;t[39]!==a||t[40]!==i||t[41]!==o||t[42]!==r||t[43]!==s||t[44]!==n?(k=[n,i,a,o,s,r],t[39]=a,t[40]=i,t[41]=o,t[42]=r,t[43]=s,t[44]=n,t[45]=k):k=t[45],(0,Q.useEffect)(O,k);let A,j,M,N;t[46]===c?(A=t[47],j=t[48],M=t[49],N=t[50]):(A=(0,Z.jsx)(ak,{editor:c}),j=(0,Z.jsx)(gk,{editor:c}),M=(0,Z.jsx)(re,{editor:c,className:`h-full`}),N=(0,Z.jsx)(aO,{editor:c}),t[46]=c,t[47]=A,t[48]=j,t[49]=M,t[50]=N);let P;t[51]===c?P=t[52]:(P=y(c),t[51]=c,t[52]=P);let F;t[53]===P.store?F=t[54]:(F=(0,Z.jsx)(S,{store:P.store}),t[53]=P.store,t[54]=F);let I;return t[55]!==A||t[56]!==j||t[57]!==M||t[58]!==N||t[59]!==F||t[60]!==l?(I=(0,Z.jsxs)(`div`,{ref:l,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[A,j,M,N,F]}),t[55]=A,t[56]=j,t[57]=M,t[58]=N,t[59]=F,t[60]=l,t[61]=I):I=t[61],I};function Ek(){return ft()}function Dk(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(st(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var Ok=`__back-nav__`;function kk(e){return e instanceof me||e instanceof Ke||e instanceof ce||e instanceof ke||e instanceof nt||e instanceof ve?e.docName:null}function Ak(e){return e instanceof me?{title:`Couldn't load document`,summary:`"${e.docName}" took too long. Check your connection.`}:e instanceof Ke?{title:`Connection dropped`,summary:`Lost connection to "${e.docName}".`}:e instanceof ce?{title:`Document not found`,summary:`"${e.docName}" doesn't exist.`}:e instanceof ke?{title:`Couldn't open document`,summary:`Something went wrong opening "${e.docName}".`}:e instanceof nt?{title:`Server can't open documents`,summary:`This project's running server doesn't support live editing. Restart Open Knowledge to fix.`}:e instanceof ve?{title:`Cancelled`,summary:`You cancelled loading "${e.docName}".`}:{title:`Unknown error`,summary:e instanceof Error&&e.message?e.message:`An unexpected error occurred.`}}function jk(e){let t=(0,$.c)(27),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=Ak(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(rb,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-lg font-medium`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===r?v=t[13]:(v=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:`Try again`}),t[12]=r,t[13]=v);let y;t[14]!==i||t[15]!==u||t[16]!==n||t[17]!==o||t[18]!==a||t[19]!==r?(y=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Le(kk(n)??i),o(a),r(Ok))},children:`Go back`}):null,t[14]=i,t[15]=u,t[16]=n,t[17]=o,t[18]=a,t[19]=r,t[20]=y):y=t[20];let b;t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==_?(x=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[m,_,b]}),t[24]=b,t[25]=_,t[26]=x):x=t[26],x}function Mk(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(jk,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===Ok){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=e=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${Ak(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(P,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}var Nk={text:``,number:0,boolean:!1,date:``,list:[]};function Pk(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=fn(t);return{map:n,keys:an(t),parseError:r}}function Fk(e){let t=(0,$.c)(169),{provider:n}=e,[r,i]=(0,Q.useState)(null),a;t[0]===n?a=t[1]:(a=()=>Pk(n),t[0]=n,t[1]=a);let[o,s]=(0,Q.useState)(a),c,l;t[2]===n?(c=t[3],l=t[4]):(c=()=>{let e=gr(n);i(e),s(e.current());let t=e.subscribe(e=>{s(e)});return()=>{t(),e.dispose(),i(t=>t===e?null:t)}},l=[n],t[2]=n,t[3]=c,t[4]=l),(0,Q.useEffect)(c,l);let u=o.map,d=o.keys,f=o.parseError,[p,m]=(0,Q.useState)(!1),h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h={},t[5]=h):h=t[5];let[g,_]=(0,Q.useState)(h),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S={},t[6]=S):S=t[6];let[C,w]=(0,Q.useState)(S),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[7]=T):T=t[7];let[E,O]=(0,Q.useState)(T),k=n.configuration.name??``,j;t[8]===k?j=t[9]:(j=Lk(k),t[8]=k,t[9]=j);let N=ma(j),P;t[10]!==N.state.data||t[11]!==N.state.status?(P=N.state.status===`ready`?N.state.data.folder.frontmatter_defaults??{}:{},t[10]=N.state.data,t[11]=N.state.status,t[12]=P):P=t[12];let F=P,I;t[13]!==N.state.data||t[14]!==N.state.status?(I=N.state.status===`ready`?N.state.data.frontmatterSources:{},t[13]=N.state.data,t[14]=N.state.status,t[15]=I):I=t[15];let L=I,R;t[16]===r?R=t[17]:(R=function(e){if(!r)return{ok:!1,error:`Connecting`};let t=r.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=sr(t.error);return{ok:!1,error:t.error.issues[0]?.message??`Invalid patch payload`,fieldErrors:Object.keys(n).length>0?n:void 0}},t[16]=r,t[17]=R);let z=R,B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){w(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[18]=B):B=t[18];let V=B,H;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e,t){if(e.ok)return;let n=e.error??`Failed to update property`,r=e.fieldErrors??{};w(e=>{let i={...e};for(let e of t)i[e]=r[e]??n;return i}),O(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[19]=H):H=t[19];let U=H,W;t[20]===z?W=t[21]:(W=function(e,t){V(e),U(z({[e]:t}),[e])},t[20]=z,t[21]=W);let G=W,K;t[22]===z?K=t[23]:(K=function(e){V(e),U(z({[e]:null}),[e])},t[22]=z,t[23]=K);let q=K,ee;t[24]===r?ee=t[25]:(ee=function(e,t){if(!r)return{ok:!1,error:`Connecting`};if(e===t)return{ok:!0};let n=r.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=sr(n.error);return{ok:!1,error:n.error.issues[0]?.message??`Failed to rename`,fieldErrors:Object.keys(i).length>0?i:void 0}},t[24]=r,t[25]=ee);let te=ee,ne;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e,t){return`${e} ${t}`},t[26]=ne):ne=t[26];let re=ne,ie;t[27]!==r||t[28]!==d?(ie=function(e){if(!r)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let i=d.map((e,t)=>re(e,t)),a=i.indexOf(t),o=i.indexOf(n);if(a<0||o<0)return;let s=d.slice(),[c]=s.splice(a,1);if(!c)return;s.splice(o,0,c);let l=r.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[27]=r,t[28]=d,t[29]=ie):ie=t[29];let ae=ie,oe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(oe={activationConstraint:{distance:4}},t[30]=oe):oe=t[30];let se;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(se={coordinateGetter:Ci},t[31]=se):se=t[31];let ce=Pi(ci(Oi,oe),ci(xi,se)),le;t[32]!==F||t[33]!==G||t[34]!==u?(le=function(e,t){let n=u[e]??Rk(F[e]);if(n===void 0)return;_(n=>({...n,[e]:t}));let r=HE(n,t);(!Object.hasOwn(u,e)||!Ik(n,r))&&G(e,r)},t[32]=F,t[33]=G,t[34]=u,t[35]=le):le=t[35];let ue=le,de;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(de=function(){y({name:``,type:`text`,value:``,error:null}),m(!1)},t[36]=de):de=t[36];let fe=de,{addPropertySignal:pe,clearAddProperty:me}=AD(),he;t[37]!==pe||t[38]!==k?(he=pe.get(k)??0,t[37]=pe,t[38]=k,t[39]=he):he=t[39];let ge=he,_e,ve;t[40]===ge?(_e=t[41],ve=t[42]):(_e=()=>{ge>0&&(y({name:``,type:`text`,value:``,error:null}),m(!1))},ve=[ge],t[40]=ge,t[41]=_e,t[42]=ve),(0,Q.useEffect)(_e,ve);let ye,be;t[43]!==me||t[44]!==k?(ye=()=>()=>me(k),be=[k,me],t[43]=me,t[44]=k,t[45]=ye,t[46]=be):(ye=t[45],be=t[46]),(0,Q.useEffect)(ye,be);let xe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(e){y(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Nk[e];return{...t,type:e,value:n,error:null}})},t[47]=xe):xe=t[47];let Se=xe,Ce;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){y(t=>t&&{...t,value:e})},t[48]=Ce):Ce=t[48];let we=Ce,Te;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){y(t=>t&&{...t,name:e,error:null})},t[49]=Te):Te=t[49];let J=Te,Ee;t[50]!==v||t[51]!==z||t[52]!==u?(Ee=function(){if(!v)return;let e=v.name.trim();if(!e){y({...v,error:`Name is required`});return}if(e===`frontmatter`){y({...v,error:`"frontmatter" is a reserved property name`});return}if(Object.hasOwn(u,e)){y({...v,error:`Property "${e}" already exists`});return}let t=z({[e]:v.value});if(t.ok){y(null);return}let n=t.fieldErrors?.[e],r=t.error??`Failed to add property`;y({...v,error:n??r})},t[50]=v,t[51]=z,t[52]=u,t[53]=Ee):Ee=t[53];let De=Ee,Oe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){y(null)},t[54]=Oe):Oe=t[54];let ke=Oe,Ae;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=function(e){x({key:e,draft:e,error:null})},t[55]=Ae):Ae=t[55];let je=Ae,Ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){x(t=>t&&{...t,draft:e,error:null})},t[56]=Ne):Ne=t[56];let Pe=Ne,Fe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(){x(null)},t[57]=Fe):Fe=t[57];let Ie=Fe,Le;t[58]!==u||t[59]!==te||t[60]!==b?(Le=function(){if(!b)return;let e=b.draft.trim();if(!e){x(null);return}if(e===b.key){x(null);return}if(e===`frontmatter`){x({...b,error:`"frontmatter" is a reserved property name`});return}if(Object.hasOwn(u,e)){x({...b,error:`Property "${e}" already exists`});return}let t=te(b.key,e);if(t.ok){_(t=>{if(!Object.hasOwn(t,b.key))return t;let n={...t};return n[e]=n[b.key],delete n[b.key],n}),V(b.key),x(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[b.key]??t.error??`Failed to rename property`;x({...b,error:n})},t[58]=u,t[59]=te,t[60]=b,t[61]=Le):Le=t[61];let Re=Le,ze;t[62]!==u||t[63]!==d?(ze=d.length>0?d:Object.keys(u),t[62]=u,t[63]=d,t[64]=ze):ze=t[64];let Be=ze,Ve;if(t[65]!==Be){Ve=new Map;for(let e of Be)Ve.set(e,(Ve.get(e)??0)+1);t[65]=Be,t[66]=Ve}else Ve=t[66];let He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e;if(t[67]!==v||t[68]!==F||t[69]!==L||t[70]!==p||t[71]!==G||t[72]!==Re||t[73]!==Ve||t[74]!==C||t[75]!==ae||t[76]!==u||t[77]!==g||t[78]!==f||t[79]!==q||t[80]!==b||t[81]!==Be||t[82]!==E||t[83]!==ce||t[84]!==ue){$e=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(F).filter(e=>!Object.hasOwn(u,e)).sort();if(Be.length===0&&e.length===0&&!v&&!f){$e=null;break bb0}Ze=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,Qe=`property-panel`,Ue=Me,Je=!p,t[97]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=e=>m(!e),t[97]=Ye):Ye=t[97];let n=!p,r;t[98]===n?r=t[99]:(r=(0,Z.jsx)(M,{"data-expanded":n,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[98]=n,t[99]=r);let i;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{children:`Properties`}),t[100]=i):i=t[100],t[101]===r?Xe=t[102]:(Xe=(0,Z.jsx)(A,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[r,i]})}),t[101]=r,t[102]=Xe),He=D,We=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[103]===f?Ge=t[104]:(Ge=f?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Cn,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[`Frontmatter YAML is malformed; fix in source mode to recover.`,(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:f})]})]}):null,t[103]=f,t[104]=Ge);let a;if(t[105]!==Be){let e;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>re(e,t),t[107]=e):e=t[107],a=Be.map(e),t[105]=Be,t[106]=a}else a=t[106];let o;if(t[108]!==F||t[109]!==L||t[110]!==G||t[111]!==Re||t[112]!==Ve||t[113]!==C||t[114]!==u||t[115]!==g||t[116]!==q||t[117]!==b||t[118]!==Be||t[119]!==E||t[120]!==ue){let e;t[122]!==F||t[123]!==L||t[124]!==G||t[125]!==Re||t[126]!==Ve||t[127]!==C||t[128]!==u||t[129]!==g||t[130]!==q||t[131]!==b||t[132]!==E||t[133]!==ue?(e=(e,t)=>{let n=u[e];if(n===void 0)return null;let r=g[e]??bn(n),i=b?.key===e?b:null,a=(Ve.get(e)??0)>1,o=Object.hasOwn(F,e)?(0,Z.jsx)(zk,{source:L[e]??``}):void 0;return(0,Z.jsx)(WE,{sortableId:re(e,t),keyName:e,value:n,declared:r,error:C[e]??null,resetCounter:E[e]??0,isDuplicate:a,badge:o,rename:{state:i,onBegin:()=>je(e),onChangeDraft:Pe,onCommit:Re,onCancel:Ie},onCommit:t=>G(e,t),onChangeType:t=>ue(e,t),onRemove:()=>q(e)},`${e}-${t}`)},t[122]=F,t[123]=L,t[124]=G,t[125]=Re,t[126]=Ve,t[127]=C,t[128]=u,t[129]=g,t[130]=q,t[131]=b,t[132]=E,t[133]=ue,t[134]=e):e=t[134],o=Be.map(e),t[108]=F,t[109]=L,t[110]=G,t[111]=Re,t[112]=Ve,t[113]=C,t[114]=u,t[115]=g,t[116]=q,t[117]=b,t[118]=Be,t[119]=E,t[120]=ue,t[121]=o}else o=t[121];let s;t[135]!==a||t[136]!==o?(s=(0,Z.jsx)(Si,{items:a,strategy:hi,children:o}),t[135]=a,t[136]=o,t[137]=s):s=t[137],t[138]!==ae||t[139]!==ce||t[140]!==s?(Ke=(0,Z.jsx)(vi,{sensors:ce,collisionDetection:Da,onDragEnd:ae,children:s}),t[138]=ae,t[139]=ce,t[140]=s,t[141]=Ke):Ke=t[141];let c;t[142]!==F||t[143]!==L||t[144]!==G||t[145]!==C||t[146]!==E||t[147]!==ue?(c=e=>{let t=F[e],n=Rk(t),r=bn(n),i=L[e]??``;return(0,Z.jsx)(WE,{keyName:e,value:n,declared:r,error:C[e]??null,resetCounter:E[e]??0,isInherited:!0,badge:(0,Z.jsx)(ZE,{source:i}),onCommit:t=>G(e,t),onChangeType:t=>ue(e,t)},`inherited-${e}`)},t[142]=F,t[143]=L,t[144]=G,t[145]=C,t[146]=E,t[147]=ue,t[148]=c):c=t[148],qe=e.map(c)}t[67]=v,t[68]=F,t[69]=L,t[70]=p,t[71]=G,t[72]=Re,t[73]=Ve,t[74]=C,t[75]=ae,t[76]=u,t[77]=g,t[78]=f,t[79]=q,t[80]=b,t[81]=Be,t[82]=E,t[83]=ce,t[84]=ue,t[85]=He,t[86]=Ue,t[87]=We,t[88]=Ge,t[89]=Ke,t[90]=qe,t[91]=Je,t[92]=Ye,t[93]=Xe,t[94]=Ze,t[95]=Qe,t[96]=$e}else He=t[85],Ue=t[86],We=t[87],Ge=t[88],Ke=t[89],qe=t[90],Je=t[91],Ye=t[92],Xe=t[93],Ze=t[94],Qe=t[95],$e=t[96];if($e!==Symbol.for(`react.early_return_sentinel`))return $e;let et;t[149]!==v||t[150]!==De?(et=v?(0,Z.jsx)(YE,{draft:v,onChangeName:J,onChangeType:Se,onChangeValue:we,onCommit:De,onCancel:ke}):(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:fe,className:`mt-1 flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(Sa,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:`Add property`})]}),t[149]=v,t[150]=De,t[151]=et):et=t[151];let tt;t[152]!==He||t[153]!==We||t[154]!==Ge||t[155]!==Ke||t[156]!==qe||t[157]!==et?(tt=(0,Z.jsxs)(He,{className:We,children:[Ge,Ke,qe,et]}),t[152]=He,t[153]=We,t[154]=Ge,t[155]=Ke,t[156]=qe,t[157]=et,t[158]=tt):tt=t[158];let nt;t[159]!==Ue||t[160]!==Je||t[161]!==Ye||t[162]!==Xe||t[163]!==tt?(nt=(0,Z.jsxs)(Ue,{open:Je,onOpenChange:Ye,children:[Xe,tt]}),t[159]=Ue,t[160]=Je,t[161]=Ye,t[162]=Xe,t[163]=tt,t[164]=nt):nt=t[164];let rt;return t[165]!==Ze||t[166]!==Qe||t[167]!==nt?(rt=(0,Z.jsx)(`div`,{className:Ze,"data-testid":Qe,children:nt}),t[165]=Ze,t[166]=Qe,t[167]=nt,t[168]=rt):rt=t[168],rt}function Ik(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function Lk(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function Rk(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}function zk(e){let t=(0,$.c)(2),{source:n}=e,r=`Overrides default from ${n===``?`.ok/frontmatter.yml`:`${n}/.ok/frontmatter.yml`}. Remove to revert.`,i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(We,{variant:`primary`,"data-testid":`property-override-badge`,title:r,className:`text-2xs`,children:`overrides`}),t[0]=r,t[1]=i),i}var Bk=at(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Vk(e){let t=e.threshold??Bk;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Hk(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var Uk=at(`ACTIVITY_MOUNT_LIMIT`,3);function Wk(){return r(()=>import(`./SourceEditor-CJiFlEvK.js`),__vite__mapDeps([43,1,35,2,36,37,21,38,39,40,41,20,3,6,7,15,4,8,14,9,44,24]),import.meta.url)}var Gk=(0,Q.lazy)(async()=>({default:(await Wk()).SourceEditor}));function Kk(e,t,n){if(n<=0)return[];let r=e.filter(e=>!xe(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function qk(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:`Couldn't reconnect after server restart`,summary:t.reason===`clear-data-timeout`?`Local collaboration data for "${e}" could not be cleared in time. Reload to retry.`:`Local collaboration data for "${e}" could not be cleared. Reload to retry.`,actionLabel:`Reload`}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:`Reconnecting after server restart`,summary:t.phase===`clearing-local-cache`?`Clearing local collaboration data for "${e}" before reconnecting.`:`Reopening "${e}" with a fresh local collaboration cache.`}:null}function Jk(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(c,{name:`activity-pool`,children:(0,Z.jsx)(Yk,{...e})}),t[0]=e,t[1]=n),n}function Yk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=Ue(),{pages:u,loading:d}=xr(),f=Kk(c,n,Uk),p=(0,Q.useRef)(``),m=f.map(Xk).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)J(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;dt(e,t&&t.length>0?t:crypto.randomUUID())}ye(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,lt(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(tA,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function Xk(e){return e.docName}function Zk(e){let t=(0,$.c)(8),{isActive:n,children:r}=e,i=(0,Q.useRef)(null),a=(0,Q.useRef)(0),o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=i.current;if(!e)return;let t=()=>{e.scrollTop>0&&(a.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,Q.useEffect)(o,s);let c,l;t[2]===n?(c=t[3],l=t[4]):(c=()=>{if(!n)return;let e=i.current;if(!e)return;let t=a.current;if(t===0||(e.scrollTop=t,e.scrollTop===t))return;let r=!1,o=()=>{r||(r=!0,s.disconnect(),clearTimeout(c))},s=new ResizeObserver(()=>{r||!e||e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&o())});s.observe(e);let c=setTimeout(o,500);return o},l=[n],t[2]=n,t[3]=c,t[4]=l),(0,Q.useLayoutEffect)(c,l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={overflowAnchor:`auto`},t[5]=u):u=t[5];let d;return t[6]===r?d=t[7]:(d=(0,Z.jsx)(`div`,{ref:i,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:u,children:r}),t[6]=r,t[7]=d),d}function Qk(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ny,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(Gk,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function $k(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(qs,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(_e,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:eA,children:[(0,Z.jsx)(qs,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function eA(){return window.location.reload()}function tA(e){let t=(0,$.c)(45),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=qk(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=n.provider.document.getText(`source`).length,[m,h]=(0,Q.useState)(i),[g,_]=(0,Q.useState)(!i),v,y;t[3]!==i||t[4]!==m||t[5]!==g?(v=()=>{i&&!m?h(!0):!i&&!g&&_(!0)},y=[i,m,g],t[3]=i,t[4]=m,t[5]=g,t[6]=v,t[7]=y):(v=t[6],y=t[7]),(0,Q.useEffect)(v,y);let b=Vk({ytextLength:p,isSourceMode:i,visitedSource:m,visitedVisual:g}),x=(0,Q.useRef)(``),S=`${b.isLarge}-${b.renderSource}-${b.renderVisual}`,C,w;t[8]!==n.docName||t[9]!==b.isLarge||t[10]!==b.renderSource||t[11]!==b.renderVisual||t[12]!==S||t[13]!==i||t[14]!==p?(C=()=>{x.current!==S&&(x.current=S,b.isLarge&&ye(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:p,isSourceMode:i,renderSource:b.renderSource,renderVisual:b.renderVisual}))},w=[S,b.isLarge,b.renderSource,b.renderVisual,n.docName,p,i],t[8]=n.docName,t[9]=b.isLarge,t[10]=b.renderSource,t[11]=b.renderVisual,t[12]=S,t[13]=i,t[14]=p,t[15]=C,t[16]=w):(C=t[15],w=t[16]),(0,Q.useEffect)(C,w);let[T,E]=(0,Q.useState)(!1),D,O;t[17]!==n.docName||t[18]!==b.isLarge||t[19]!==b.renderSource||t[20]!==b.renderVisual||t[21]!==T||t[22]!==i||t[23]!==p?(D=()=>{Hk({isLarge:b.isLarge,renderSource:b.renderSource,renderVisual:b.renderVisual,hasEmittedFirstToggle:T})&&(ye(`ok/cold/first-toggle`,{docName:n.docName,mountId:se(n.docName),ytextLength:p,modeEnteredFirst:i?`source`:`visual`}),E(!0))},O=[T,b.isLarge,b.renderSource,b.renderVisual,n.docName,p,i],t[17]=n.docName,t[18]=b.isLarge,t[19]=b.renderSource,t[20]=b.renderVisual,t[21]=T,t[22]=i,t[23]=p,t[24]=D,t[25]=O):(D=t[24],O=t[25]),(0,Q.useEffect)(D,O);let k=r?`visible`:`hidden`,A=`editor:${n.docName}`,j;t[26]!==a||t[27]!==n||t[28]!==b.renderSource||t[29]!==b.renderVisual||t[30]!==r||t[31]!==o||t[32]!==i||t[33]!==c||t[34]!==l||t[35]!==s||t[36]!==f?(j=f?(0,Z.jsx)($k,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Mk,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(Ny,{}),children:(0,Z.jsx)(Dk,{docName:n.docName,provider:n.provider,children:(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Fk,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[b.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Qk,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,b.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(wk,{provider:n.provider,placeholder:a,isSourceMode:i},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[26]=a,t[27]=n,t[28]=b.renderSource,t[29]=b.renderVisual,t[30]=r,t[31]=o,t[32]=i,t[33]=c,t[34]=l,t[35]=s,t[36]=f,t[37]=j):j=t[37];let M;t[38]!==r||t[39]!==j?(M=(0,Z.jsx)(Zk,{isActive:r,children:j}),t[38]=r,t[39]=j,t[40]=M):M=t[40];let N;return t[41]!==M||t[42]!==k||t[43]!==A?(N=(0,Z.jsx)(Q.Activity,{mode:k,name:A,children:M}),t[41]=M,t[42]=k,t[43]=A,t[44]=N):N=t[44],N}function nA(e){let t=(0,$.c)(27),{stats:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[0]=r):r=t[0];let i;t[1]===n.words?i=t[2]:(i=n.words.toLocaleString(),t[1]=n.words,t[2]=i);let a;t[3]===i?a=t[4]:(a=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:i}),t[3]=i,t[4]=a);let o=n.words===1?`word`:`words`,s;t[5]!==a||t[6]!==o?(s=(0,Z.jsxs)(`span`,{children:[a,` `,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7];let c;t[8]===n.chars?c=t[9]:(c=n.chars.toLocaleString(),t[8]=n.chars,t[9]=c);let l;t[10]===c?l=t[11]:(l=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:c}),t[10]=c,t[11]=l);let u=n.chars===1?`char`:`chars`,d;t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{children:[l,` `,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f=n.tokens>0?`~`:``,p;t[15]===n.tokens?p=t[16]:(p=n.tokens.toLocaleString(),t[15]=n.tokens,t[16]=p);let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:p}),t[17]=p,t[18]=m);let h=n.tokens===1?`token`:`tokens`,g;t[19]!==f||t[20]!==m||t[21]!==h?(g=(0,Z.jsxs)(`span`,{children:[f,m,` `,h]}),t[19]=f,t[20]=m,t[21]=h,t[22]=g):g=t[22];let _;return t[23]!==g||t[24]!==s||t[25]!==d?(_=(0,Z.jsxs)(`section`,{"aria-label":`Document statistics`,className:`relative flex h-6 shrink-0 items-center justify-end gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[r,s,d,g]}),t[23]=g,t[24]=s,t[25]=d,t[26]=_):_=t[26],_}var rA={fill:`none`,height:24,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`},iA=e=>{let t=(0,$.c)(15),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({color:a,size:o,strokeWidth:s,absoluteStrokeWidth:n,className:c,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`currentColor`:a,u=o===void 0?24:o,d=s===void 0?2:s,f=c===void 0?``:c,p=n?Number(d)*24/Number(u):d,m;return t[8]!==r||t[9]!==f||t[10]!==l||t[11]!==i||t[12]!==u||t[13]!==p?(m=(0,Z.jsx)(`svg`,{"aria-hidden":`true`,...rA,className:f,height:u,stroke:l,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:p,width:u,...i,children:r}),t[8]=r,t[9]=f,t[10]=l,t[11]=i,t[12]=u,t[13]=p,t[14]=m):m=t[14],m},aA=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Markdown`}),r=(0,Z.jsx)(`path`,{d:`M232,48H24A16,16,0,0,0,8,64V192a16,16,0,0,0,16,16H232a16,16,0,0,0,16-16V64A16,16,0,0,0,232,48Zm0,144H24V64H232V192ZM128,104v48a8,8,0,0,1-16,0V123.31L93.66,141.66a8,8,0,0,1-11.32,0L64,123.31V152a8,8,0,0,1-16,0V104a8,8,0,0,1,13.66-5.66L88,124.69l26.34-26.35A8,8,0,0,1,128,104Zm77.66,18.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L168,132.69V104a8,8,0,0,1,16,0v28.69l10.34-10.35A8,8,0,0,1,205.66,122.34Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(iA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},oA=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Textbox`}),r=(0,Z.jsx)(`path`,{d:`M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(iA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function sA(e){let t=(0,$.c)(39),{isSourceMode:n,sourceDisabled:r,onModeChange:i,showAddPropertyButton:a,onAddProperty:o,showPanelOpen:s,onTogglePanel:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{}),t[0]=l):l=t[0];let u=n?`source`:`wysiwyg`,d;t[1]===i?d=t[2]:(d=e=>{e&&i(e)},t[1]=i,t[2]=d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(so,{children:[(0,Z.jsx)(eo,{value:`wysiwyg`,"aria-label":`Visual editor`,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:(0,Z.jsx)(io,{children:(0,Z.jsx)(oA,{className:`size-4`})})}),(0,Z.jsx)(ao,{side:`bottom`,children:`Visual`})]}),t[3]=f):f=t[3];let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(aA,{className:`size-4`}),t[4]=p):p=t[4];let m;t[5]===r?m=t[6]:(m=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(eo,{value:`source`,"aria-label":`Markdown source`,disabled:r,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:p})})}),t[5]=r,t[6]=m);let h=r?`Source mode requires a live connection — your edits are saved and will appear when you reconnect.`:`Markdown`,g;t[7]===h?g=t[8]:(g=(0,Z.jsx)(ao,{side:`bottom`,children:h}),t[7]=h,t[8]=g);let _;t[9]!==m||t[10]!==g?(_=(0,Z.jsxs)(so,{children:[m,g]}),t[9]=m,t[10]=g,t[11]=_):_=t[11];let v;t[12]!==u||t[13]!==d||t[14]!==_?(v=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(no,{type:`single`,value:u,onValueChange:d,"aria-label":`Editor mode`,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[f,_]})}),t[12]=u,t[13]=d,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==o||t[17]!==a?(y=a&&(0,Z.jsxs)(so,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`Add properties`,onClick:o,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(io,{children:(0,Z.jsx)(Is,{})})}),(0,Z.jsx)(ao,{side:`bottom`,children:`Add properties`})]}),t[16]=o,t[17]=a,t[18]=y):y=t[18];let b=s?`Show document panel`:`Hide document panel`,x;t[19]===s?x=t[20]:(x=(0,Z.jsx)(io,{children:s?(0,Z.jsx)(Us,{}):(0,Z.jsx)(Hs,{})}),t[19]=s,t[20]=x);let S;t[21]!==c||t[22]!==b||t[23]!==x?(S=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,onClick:c,"aria-label":b,asChild:!0,children:x}),t[21]=c,t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=s?`Show panel`:`Hide panel`,w;t[25]===C?w=t[26]:(w=(0,Z.jsx)(ao,{side:`bottom`,children:C}),t[25]=C,t[26]=w);let T;t[27]!==S||t[28]!==w?(T=(0,Z.jsxs)(so,{children:[S,w]}),t[27]=S,t[28]=w,t[29]=T):T=t[29];let E;t[30]!==y||t[31]!==T?(E=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex items-center justify-end gap-1`,children:[y,T]}),t[30]=y,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==v||t[34]!==E?(D=(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center px-2 py-2 bg-background`,children:[l,v,E]}),t[33]=v,t[34]=E,t[35]=D):D=t[35];let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[36]=O):O=t[36];let k;return t[37]===D?k=t[38]:(k=(0,Z.jsxs)(`div`,{"data-testid":`editor-toolbar`,className:`pointer-events-none absolute inset-x-0 top-0 z-10`,children:[D,O]}),t[37]=D,t[38]=k),k}function cA(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var lA=(0,Q.lazy)(()=>r(()=>import(`./SettingsDialog-D6nNBqeV.js`).then(e=>({default:e.SettingsDialog})),__vite__mapDeps([45,1,35,2,36,37,21,38,39,40,41,20,3,6,7,15,4,8,14,9,46,16,22,10,23]),import.meta.url));function uA(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(fA,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(dA,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(c,{name:`editor-area`,children:(0,Z.jsxs)(OD,{children:[n,r]})}),t[3]=n,t[4]=i),i}function dA(){let e=(0,$.c)(8),t=Pf(),[n,r]=(0,Q.useState)(!1),i,a;if(e[0]===t.open?(i=e[1],a=e[2]):(i=()=>{t.open&&r(!0)},a=[t.open],e[0]=t.open,e[1]=i,e[2]=a),(0,Q.useEffect)(i,a),!n)return null;let o;e[3]===t?o=e[4]:(o=e=>{e||t.close()},e[3]=t,e[4]=o);let s;return e[5]!==t.open||e[6]!==o?(s=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(lA,{open:t.open,onOpenChange:o})}),e[5]=t.open,e[6]=o,e[7]=s):s=e[7],s}function fA(e){let t=(0,$.c)(95),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a}=e,{activeDocName:o,activeProvider:s,activeTarget:c,recycleDocument:l,docPanelMode:u,docPanelExpandSignal:d}=Ue(),{openDocumentTransition:f}=$e(),{requestAddProperty:p}=AD(),m=QD(s,o),h=$D(s),g=h===`connected`||h===`synced`,_=(0,Q.useDeferredValue)(o),v=c?.kind===`missing`,y=!!o&&c?.kind!==`folder`,b=v?`Start writing to create this page`:void 0,x=Oy(),[S,C]=(0,Q.useState)(!1),{layout:w,autoCollapse:T}=ID(),E=w===`sheet`,[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(!1),A,j;t[0]!==T||t[1]!==w||t[2]!==x?(A=()=>{w===`panel`&&(T?(k.current=!1,x.current?.collapse()):k.current||x.current?.expand())},j=[T,w,x],t[0]=T,t[1]=w,t[2]=x,t[3]=A,t[4]=j):(A=t[3],j=t[4]),(0,Q.useEffect)(A,j);let M,N;t[5]!==E||t[6]!==a||t[7]!==x?(M=()=>{let e=e=>{a(e),E?O(!0):(k.current=!1,x.current?.expand())},t=lf();return t&&e(t),df(t=>{lf(),e(t)})},N=[E,a,x],t[5]=E,t[6]=a,t[7]=x,t[8]=M,t[9]=N):(M=t[8],N=t[9]),(0,Q.useEffect)(M,N);let P,F;t[10]!==d||t[11]!==E||t[12]!==x?(P=()=>{d!==0&&(E?O(!0):(k.current=!1,x.current?.expand()))},F=[d,E,x],t[10]=d,t[11]=E,t[12]=x,t[13]=P,t[14]=F):(P=t[13],F=t[14]),(0,Q.useEffect)(P,F);let I=(0,Q.useRef)(null),[L,R]=(0,Q.useState)(null),z,B;if(t[15]===o?(z=t[16],B=t[17]):(z=()=>{if(o&&o!==I.current){let e=I.current;I.current=o,R(e)}},B=[o],t[15]=o,t[16]=z,t[17]=B),(0,Q.useEffect)(z,B),c?.kind===`folder`){let e;return t[18]===c.folderPath?e=t[19]:(e=(0,Z.jsx)(xD,{folderPath:c.folderPath}),t[18]=c.folderPath,t[19]=e),e}if(c?.kind===`asset`){let e;return t[20]!==c.assetPath||t[21]!==c.mediaKind?(e=(0,Z.jsx)(My,{assetPath:c.assetPath,mediaKind:c.mediaKind}),t[20]=c.assetPath,t[21]=c.mediaKind,t[22]=e):e=t[22],e}if(!s||!o){if((typeof window<`u`?ur(window.location.hash):null)!==null){let e;return t[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ny,{}),t[23]=e):e=t[23],e}let e;return t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Cb,{}),t[24]=e):e=t[24],e}let V=n===`source`,H=!g,U=E?!D:S,W;t[25]!==o||t[26]!==p?(W=function(){o&&p(o)},t[25]=o,t[26]=p,t[27]=W):W=t[27];let G=W,K;t[28]!==S||t[29]!==E||t[30]!==x?(K=function(){E?O(pA):S?(k.current=!1,x.current?.expand()):(k.current=!0,x.current?.collapse())},t[28]=S,t[29]=E,t[30]=x,t[31]=K):K=t[31];let q=K,ee=_??o,te=L??void 0,ne;t[32]===f?ne=t[33]:(ne=e=>{let t=$n(e);window.location.hash===t?f(e):window.location.hash=t},t[32]=f,t[33]=ne);let re;t[34]!==b||t[35]!==V||t[36]!==l||t[37]!==ee||t[38]!==te||t[39]!==ne?(re=(0,Z.jsx)(Jk,{activeDocName:ee,isSourceMode:V,editorPlaceholder:b,previousDocName:te,onNavigateBack:ne,onRecycle:l}),t[34]=b,t[35]=V,t[36]=l,t[37]=ee,t[38]=te,t[39]=ne,t[40]=re):re=t[40];let ie;t[41]!==o||t[42]!==_?(ie=cA({activeDocName:o,deferredActiveDocName:_,mountResolved:o!==null&&Ze(o),syncResolved:o!==null&&ge(o)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Ny,{}),o===null?null:(0,Z.jsx)(TD,{docName:o})]}):null,t[41]=o,t[42]=_,t[43]=ie):ie=t[43];let ae;t[44]!==re||t[45]!==ie?(ae=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[re,ie]}),t[44]=re,t[45]=ie,t[46]=ae):ae=t[46];let oe=!V,se;t[47]!==V||t[48]!==r||t[49]!==G||t[50]!==U||t[51]!==H||t[52]!==oe||t[53]!==q?(se=(0,Z.jsx)(sA,{isSourceMode:V,sourceDisabled:H,onModeChange:r,showAddPropertyButton:oe,onAddProperty:G,showPanelOpen:U,onTogglePanel:q}),t[47]=V,t[48]=r,t[49]=G,t[50]=U,t[51]=H,t[52]=oe,t[53]=q,t[54]=se):se=t[54];let ce;t[55]!==ae||t[56]!==se?(ce=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[ae,se]}),t[55]=ae,t[56]=se,t[57]=ce):ce=t[57];let le;t[58]!==y||t[59]!==m?(le=y&&(0,Z.jsx)(nA,{stats:m}),t[58]=y,t[59]=m,t[60]=le):le=t[60];let ue;t[61]!==ce||t[62]!==le?(ue=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[ce,le]}),t[61]=ce,t[62]=le,t[63]=ue):ue=t[63];let de=ue;if(E){let e;t[64]===de?e=t[65]:(e=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:de}),t[64]=de,t[65]=e);let n;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(ig,{className:`sr-only`,children:(0,Z.jsx)(ag,{children:`Document panel`})}),t[66]=n):n=t[66];let r;t[67]!==o||t[68]!==i||t[69]!==u||t[70]!==V||t[71]!==a?(r=(0,Z.jsxs)(rg,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[n,(0,Z.jsx)(F_,{docName:o,isSourceMode:V,activeTab:i,onActiveTabChange:a,mode:u})]}),t[67]=o,t[68]=i,t[69]=u,t[70]=V,t[71]=a,t[72]=r):r=t[72];let s;t[73]!==D||t[74]!==r?(s=(0,Z.jsx)(eg,{open:D,onOpenChange:O,children:r}),t[73]=D,t[74]=r,t[75]=s):s=t[75];let c;return t[76]!==e||t[77]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[e,s]}),t[76]=e,t[77]=s,t[78]=c):c=t[78],c}let fe;t[79]===de?fe=t[80]:(fe=(0,Z.jsx)(MD,{minSize:`30%`,defaultSize:`75%`,children:de}),t[79]=de,t[80]=fe);let pe;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(ND,{withHandle:!0}),t[81]=pe):pe=t[81];let me;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>C(e.asPercentage===0),t[82]=me):me=t[82];let he;t[83]!==o||t[84]!==i||t[85]!==u||t[86]!==V||t[87]!==a?(he=(0,Z.jsx)(F_,{docName:o,isSourceMode:V,activeTab:i,onActiveTabChange:a,mode:u}),t[83]=o,t[84]=i,t[85]=u,t[86]=V,t[87]=a,t[88]=he):he=t[88];let _e;t[89]!==x||t[90]!==he?(_e=(0,Z.jsx)(MD,{panelRef:x,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:me,className:`flex flex-col bg-muted/20`,children:he}),t[89]=x,t[90]=he,t[91]=_e):_e=t[91];let ve;return t[92]!==fe||t[93]!==_e?(ve=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(jD,{orientation:`horizontal`,children:[fe,pe,_e]})}),t[92]=fe,t[93]=_e,t[94]=ve):ve=t[94],ve}function pA(e){return!e}var mA=1280;function hA(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(gA),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${mA-1}px)`),t=()=>{n(window.innerWidth<mA)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function gA(){return window.innerWidth<mA}function _A(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function vA(e){let{value:t,unit:n}=_A(e);return n===`rem`?t*16:t}function yA(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var bA=3600*24*7;function xA(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?SA:m,O=g===void 0?bA:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=vA(b),ee;t[6]===x?ee=t[7]:(ee=vA(x),t[6]=x,t[7]=ee);let te=ee,ne;t[8]!==E||t[9]!==k?(ne=function(e){P.current=!0,E&&(j.current=H.current?0:vA(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=ne):ne=t[10];let re=ne,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==te||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=_A(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(te,t)),u=yA(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(te,u)),f=yA(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,q,te,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=te,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function SA(){}var CA=`sidebar_state`,wA=3600*24*7,TA=`18rem`,EA=`3rem`,DA=`\\`,OA=`app-file-sidebar`,kA=`14.625rem`,AA=`22rem`,jA=`sidebar_width`,MA=/^\d+(?:\.\d+)?(?:rem|px)$/,NA=Q.createContext(null);function PA(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${jA}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return MA.test(n)?n:e}function FA(){let e=Q.use(NA);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function IA(e){let t=(0,$.c)(53),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:l,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=c===void 0?!0:c,d=l===void 0?TA:l,f=hA(),p;t[9]===d?p=t[10]:(p=()=>PA(d),t[9]=d,t[10]=p);let[m,h]=Q.useState(p),[g,_]=Q.useState(!1),v=Q.useRef(g),[y,b]=Q.useState(!1),[x,S]=Q.useState(!1),[C,w]=Q.useState(u),T=i??C,E;t[11]!==T||t[12]!==o?(E=e=>{let t=typeof e==`function`?e(T):e;o?o(t):w(t),document.cookie=`${CA}=${t}; path=/; max-age=${wA}`},t[11]=T,t[12]=o,t[13]=E):E=t[13];let D=E,O;t[14]===D?O=t[15]:(O=function(){return window.innerWidth<1280?_(RA):D(LA)},t[14]=D,t[15]=O);let k=O,A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){window.innerWidth>=1280||v.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||S(!0))},t[16]=A):A=t[16];let j=A,M;t[17]===g?M=t[18]:(M=()=>{v.current=g},t[17]=g,t[18]=M),Q.useLayoutEffect(M);let N,P;t[19]===k?(N=t[20],P=t[21]):(N=()=>{let e=e=>{e.key===DA&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),k())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},P=[k],t[19]=k,t[20]=N,t[21]=P),Q.useEffect(N,P);let F,I;t[22]!==f||t[23]!==g?(F=()=>{if(!f||!g)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||_(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},I=[f,g],t[22]=f,t[23]=g,t[24]=F,t[25]=I):(F=t[24],I=t[25]),Q.useEffect(F,I);let L=Q.useRef(f),R,z;t[26]!==f||t[27]!==T?(R=()=>{!L.current&&f&&_(T),L.current=f},z=[f,T],t[26]=f,t[27]=T,t[28]=R,t[29]=z):(R=t[28],z=t[29]),Q.useEffect(R,z);let B=f?g?`expanded`:`collapsed`:T?`expanded`:`collapsed`,V;t[30]!==y||t[31]!==f||t[32]!==T||t[33]!==g||t[34]!==D||t[35]!==x||t[36]!==B||t[37]!==k||t[38]!==m?(V={state:B,open:T,setOpen:D,isMobile:f,openMobile:g,setOpenMobile:_,toggleSidebar:k,width:m,setWidth:h,isDraggingRail:y,setIsDraggingRail:b,showPushPulse:x,setShowPushPulse:S,notifySidebarFileSelected:j},t[30]=y,t[31]=f,t[32]=T,t[33]=g,t[34]=D,t[35]=x,t[36]=B,t[37]=k,t[38]=m,t[39]=V):V=t[39];let H;t[40]!==s||t[41]!==m?(H={"--sidebar-width":m,"--sidebar-width-icon":EA,...s},t[40]=s,t[41]=m,t[42]=H):H=t[42];let U=H,W;t[43]===r?W=t[44]:(W=Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[43]=r,t[44]=W);let G;t[45]!==n||t[46]!==a||t[47]!==U||t[48]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[45]=n,t[46]=a,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;return t[50]!==V||t[51]!==G?(K=(0,Z.jsx)(NA.Provider,{value:V,children:G}),t[50]=V,t[51]=G,t[52]=K):K=t[52],K}function LA(e){return!e}function RA(e){return!e}function zA(e){let t=(0,$.c)(51),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{isMobile:d,state:f,openMobile:p,isDraggingRail:m}=FA();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Y(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}if(d){let e=p?`expanded`:`collapsed`,a=l===`floating`||l===`inset`?`p-2`:``,o;t[14]!==r||t[15]!==a?(o=Y(`fixed inset-y-0 z-30 flex h-svh w-(--sidebar-width)`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`data-[side=left]:left-0 data-[side=right]:right-0`,`group-data-[state=collapsed]:data-[side=left]:-translate-x-full`,`group-data-[state=collapsed]:data-[side=right]:translate-x-full`,a,r),t[14]=r,t[15]=a,t[16]=o):o=t[16];let s;t[17]===n?s=t[18]:(s=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[17]=n,t[18]=s);let u;t[19]!==i||t[20]!==c||t[21]!==o||t[22]!==s?(u=(0,Z.jsx)(`nav`,{id:OA,"aria-label":`File sidebar`,"data-slot":`sidebar-container`,"data-side":c,className:o,...i,children:s}),t[19]=i,t[20]=c,t[21]=o,t[22]=s,t[23]=u):u=t[23];let d;return t[24]!==e||t[25]!==c||t[26]!==u||t[27]!==l?(d=(0,Z.jsx)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":e,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-mobile":`true`,children:u}),t[24]=e,t[25]=c,t[26]=u,t[27]=l,t[28]=d):d=t[28],d}let h=f===`collapsed`?u:``,g=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[29]===g?_=t[30]:(_=Y(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[29]=g,t[30]=_);let v;t[31]===_?v=t[32]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[31]=_,t[32]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[33]!==r||t[34]!==y?(b=Y(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[33]=r,t[34]=y,t[35]=b):b=t[35];let x;t[36]===n?x=t[37]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[36]=n,t[37]=x);let S;t[38]!==i||t[39]!==c||t[40]!==x||t[41]!==b?(S=(0,Z.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[38]=i,t[39]=c,t[40]=x,t[41]=b,t[42]=S):S=t[42];let C;return t[43]!==m||t[44]!==c||t[45]!==f||t[46]!==S||t[47]!==h||t[48]!==v||t[49]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":f,"data-collapsible":h,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":m,children:[v,S]}),t[43]=m,t[44]=c,t[45]=f,t[46]=S,t[47]=h,t[48]=v,t[49]=l,t[50]=C):C=t[50],C}function BA(e){let t=(0,$.c)(16),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a,state:o}=FA(),s=o===`expanded`,c;t[4]===n?c=t[5]:(c=Y(n),t[4]=n,t[5]=c);let l;t[6]!==r||t[7]!==a?(l=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=l):l=t[8];let u,d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ct,{}),d=(0,Z.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=u,t[10]=d):(u=t[9],d=t[10]);let f;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==l?(f=(0,Z.jsxs)(X,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":s,"aria-controls":OA,className:c,onClick:l,...i,children:[u,d]}),t[11]=i,t[12]=s,t[13]=c,t[14]=l,t[15]=f):f=t[15],f}function VA(e){let t=(0,$.c)(24),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{toggleSidebar:l,setWidth:u,state:d,width:f,setIsDraggingRail:p}=FA(),m=d===`collapsed`,h;t[6]!==s||t[7]!==c||t[8]!==p||t[9]!==u||t[10]!==m||t[11]!==l||t[12]!==f?(h={direction:`right`,enableDrag:s,enableToggle:c,onResize:u,onToggle:l,currentWidth:f,isCollapsed:m,minResizeWidth:kA,maxResizeWidth:AA,setIsDraggingRail:p,widthCookieName:jA,widthCookieMaxAge:wA},t[6]=s,t[7]=c,t[8]=p,t[9]=u,t[10]=m,t[11]=l,t[12]=f,t[13]=h):h=t[13];let{dragRef:g,handleMouseDown:_}=xA(h),v;t[14]!==_||t[15]!==r?(v=e=>{r?.(e),e.defaultPrevented||_(e)},t[14]=_,t[15]=r,t[16]=v):v=t[16];let y;t[17]===n?y=t[18]:(y=Y(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[17]=n,t[18]=y);let b;return t[19]!==g||t[20]!==i||t[21]!==v||t[22]!==y?(b=(0,Z.jsx)(`button`,{ref:g,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onMouseDown:v,title:`Toggle Sidebar`,className:y,...i}),t[19]=g,t[20]=i,t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function HA(e){let t=(0,$.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onClick:i,onAnimationEnd:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{isMobile:o,openMobile:s,setOpenMobile:c,showPushPulse:l,setShowPushPulse:u}=FA(),d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==c?(d=e=>{i?.(e),!e.defaultPrevented&&(!o||!s||e.target?.closest(`[data-sidebar="trigger"]`)||c(!1))},t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=d):d=t[9];let f=d,p;t[10]!==r||t[11]!==u?(p=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&u(!1)},t[10]=r,t[11]=u,t[12]=p):p=t[12];let m=p,h=l?``:void 0,g;t[13]===n?g=t[14]:(g=Y(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`peer-data-[mobile=true]:peer-data-[state=expanded]:translate-x-(--sidebar-width)`,n),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==f||t[17]!==a||t[18]!==h||t[19]!==g?(_=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":h,onClick:f,onAnimationEnd:m,className:g,...a}),t[15]=m,t[16]=f,t[17]=a,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function UA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function GA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function KA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var JA=Pr(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function YA(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?Fr:`button`,{isMobile:m,state:h}=FA(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=Y(JA({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,Z.jsx)(io,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,Z.jsx)(ao,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,Z.jsxs)(so,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function XA(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function ZA(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var QA=1e3,$A=!1;function ej(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function tj(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:ii(i)?a=i:(a=void 0,$A||($A=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(ej({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=ZA(i),{current:c,crossDoc:l}=a?$r(a,n,Date.now()):{current:[],crossDoc:[]},u=nj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>XA(e.current,p)&&XA(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,QA);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function nj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var rj=`sync-status`;function ij(e,t){let n=(0,$.c)(4),r=(0,Q.useRef)(!1),i=(0,Q.useRef)(!1),a=(0,Q.useRef)(t),o,s;n[0]!==t||n[1]!==e?(o=()=>{a.current!==t&&(a.current=t,r.current=!1,i.current=!1),t&&(e===`synced`&&(r.current=!0),e===`disconnected`&&r.current?(i.current=!0,qa.warning(`Connection lost — keep this tab open, your edits will sync when reconnected`,{id:rj,duration:1/0})):i.current&&e===`synced`&&(i.current=!1,qa.success(`Reconnected`,{id:rj,duration:3e3})))},s=[e,t],n[0]=t,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),(0,Q.useEffect)(o,s)}var aj=4,oj=3,sj={Bird:$o,Cat:as,Dog:_s,Fish:xs,Mouse:Ks,Rabbit:Gs,Shrimp:Zs,Snail:Qs,Squirrel:nc,Turtle:oc};Object.freeze([...Object.keys(sj)]);function cj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(sj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var lj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function uj(e){let t=(0,$.c)(20),{user:n,mode:r,tabCount:i}=e,a=cj(n),o=a.kind===`animal`?sj[a.animal]:void 0,s;t[0]===n.name?s=t[1]:(s=Ln(n.name),t[0]=n.name,t[1]=s);let c=s,l;t[2]===n.color?l=t[3]:(l=Tr(n.color),t[2]=n.color,t[3]=l);let u=l,d=i>1?`${n.name} · ${i} tabs`:n.name,f=i>1?`${n.name}, ${i} concurrent tabs`:n.name,p;t[4]===n.color?p=t[5]:(p={backgroundColor:n.color},t[4]=n.color,t[5]=p);let m;t[6]!==o||t[7]!==u||t[8]!==c?(m=o?(0,Z.jsx)(o,{size:18,color:u,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:u},children:c}),t[6]=o,t[7]=u,t[8]=c,t[9]=m):m=t[9];let h;t[10]!==f||t[11]!==r||t[12]!==p||t[13]!==m?(h=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":f,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:p,children:m})}),t[10]=f,t[11]=r,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===d?g=t[16]:(g=(0,Z.jsx)(ao,{children:d}),t[15]=d,t[16]=g);let _;return t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(so,{children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function dj(e){let t=lj[e.icon];return e.displayName||t||`Agent`}function fj(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function pj(e){let t=(0,$.c)(36),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{presence:o,agentId:s}=n,c;t[0]===o?c=t[1]:(c=dj(o),t[0]=o,t[1]=c);let l=c,u=fj(o.mode),d=!r&&u,f=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,p=d&&!i?`ring-primary/40 animate-pulse`:``,m;t[2]!==f||t[3]!==p?(m=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2 cursor-pointer`,f,p].filter(Boolean),t[2]=f,t[3]=p,t[4]=m):m=t[4];let h=m.join(` `),g=r?`true`:void 0,_=i?`true`:void 0,v;t[5]!==o.mode||t[6]!==g||t[7]!==_?(v={"data-presence-badge":`agent`,"data-presence-mode":o.mode,"data-presence-crossdoc":g,"data-presence-scoped":_},t[5]=o.mode,t[6]=g,t[7]=_,t[8]=v):v=t[8];let y=v,b=r&&o.currentDoc?`Open activity panel for ${l}, editing ${o.currentDoc}`:`Open activity panel for ${l}`,x;t[9]===o.color?x=t[10]:(x={backgroundColor:o.color},t[9]=o.color,t[10]=x);let S;t[11]!==s||t[12]!==a?(S=()=>a(s),t[11]=s,t[12]=a,t[13]=S):S=t[13];let C;t[14]===o.icon?C=t[15]:(C=(0,Z.jsx)(ni,{icon:o.icon,width:16,height:16,className:`text-white`}),t[14]=o.icon,t[15]=C);let w;t[16]!==b||t[17]!==y||t[18]!==h||t[19]!==C||t[20]!==x||t[21]!==S?(w=(0,Z.jsx)(`button`,{type:`button`,...y,"aria-label":b,className:h,style:x,onClick:S,children:C}),t[16]=b,t[17]=y,t[18]=h,t[19]=C,t[20]=x,t[21]=S,t[22]=w):w=t[22];let T=w,E;t[23]===T?E=t[24]:(E=(0,Z.jsx)(io,{asChild:!0,children:T}),t[23]=T,t[24]=E);let D;t[25]===l?D=t[26]:(D=(0,Z.jsx)(`span`,{className:`font-medium`,children:l}),t[25]=l,t[26]=D);let O;t[27]!==r||t[28]!==o.currentDoc?(O=r&&o.currentDoc?(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`editing [[`,o.currentDoc,`]]`]}):null,t[27]=r,t[28]=o.currentDoc,t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==O?(k=(0,Z.jsxs)(ao,{className:`flex flex-col gap-0.5`,children:[D,O]}),t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==E||t[34]!==k?(A=(0,Z.jsxs)(so,{children:[E,k]}),t[33]=E,t[34]=k,t[35]=A):A=t[35],A}function mj(e){let t=(0,$.c)(18),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s=i?`true`:void 0,c=`${n} more ${i?`cross-doc `:``}${n===1?`participant`:`participants`}`,l;t[0]!==n||t[1]!==s||t[2]!==c?(l=(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":s,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[0]=n,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;if(t[4]!==i||t[5]!==o||t[6]!==r||t[7]!==a){let e;t[9]!==i||t[10]!==o||t[11]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(uj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(pj,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[9]=i,t[10]=o,t[11]=a,t[12]=e):e=t[12],u=r.map(e),t[4]=i,t[5]=o,t[6]=r,t[7]=a,t[8]=u}else u=t[8];let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(C,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:u})}),t[13]=u,t[14]=d);let f;return t[15]!==l||t[16]!==d?(f=(0,Z.jsxs)(Qe,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function hj(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(uj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(pj,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function gj(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Ue(),{current:s,crossDoc:c}=tj(t,r,n);ij($D(t),n);let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,aj),n;e[6]===s?n=e[7]:(n=s.slice(aj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,oj),d;e[8]===c?d=e[9]:(d=c.slice(oj),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>hj(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(mj,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border`,"aria-hidden":!0,"data-slot":`presence-divider`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 opacity-60 grayscale`,"data-presence-section":`crossdoc`,children:[u.map(e=>hj(e,p,!0,m)),f.length>0?(0,Z.jsx)(mj,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]})]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function _j(e,t){return t.trim()}function vj(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function yj(e,t){let n=_j(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function bj(e,t,n=[]){if(t.length===0&&n.length===0)return e;let r=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>Dr(e)?{...e,docName:r.get(e.docName)??e.docName}:Mr(e)||Pn(e)?{...e,path:Cj(e.path,n)}:e)}function xj(e,t,n){if(t.length===0&&!n)return e;let r=new Set(t);return e.filter(e=>Dr(e)?!r.has(e.docName)&&!wj(e.docName,n):Mr(e)||Pn(e)?!wj(e.path,n):!0)}function Sj(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function Cj(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function wj(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function Tj(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(fl,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function Ej(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(pl,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ml,{children:(0,Z.jsx)(hl,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Oj(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Y(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(gl,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function kj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Aj=Pr(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function jj(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=Y(Aj({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":a,className:o,onMouseDown:Mj,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function Mj(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Pr(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function Nj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(co,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Fj=[`.md`,`.mdx`],Ij=`group flex h-10 -mb-px min-w-28 max-w-64 shrink-0 cursor-pointer self-end items-center overflow-hidden rounded-lg border relative`,Lj=`rounded-b-none border-border border-b-background bg-background text-foreground`,Rj=`border-transparent text-muted-foreground hover:text-foreground`,zj=`flex h-full min-w-0 flex-1 cursor-pointer items-center gap-1.5 overflow-hidden px-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,Bj=`mr-1 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-muted hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:opacity-100`;function Vj(e){return Y(Bj,e?`opacity-70`:`opacity-0 group-focus-within:opacity-100 group-hover:opacity-70`)}function Hj(e,t){let n=e.lastIndexOf(`/`),r=n<0?e:e.slice(n+1),i=`${r}${t}`;return n<0?{baseName:r,extension:t,label:i,prefix:``}:{baseName:r,extension:t,label:i,prefix:`${e.slice(0,n)}/`}}function Uj(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function Wj(e){let t=$n(e);window.location.hash!==t&&(window.location.hash=t)}function Gj(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function Kj(e,t){let n=[t,...Fj].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function qj(e){let t=(0,$.c)(26),{children:n,closeTab:r,closeTabs:i,disabled:a,openTabs:o,tabId:s}=e;if(a!==void 0&&a)return n;let c;if(t[0]!==o||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>e!==s,t[3]=s,t[4]=e),c=o.filter(e),t[0]=o,t[1]=s,t[2]=c}else c=t[2];let l=c,u;t[5]===n?u=t[6]:(u=(0,Z.jsx)(Ej,{asChild:!0,children:n}),t[5]=n,t[6]=u);let d;t[7]!==r||t[8]!==s?(d=(0,Z.jsx)(Oj,{onSelect:()=>r(s),children:`Close`}),t[7]=r,t[8]=s,t[9]=d):d=t[9];let f=l.length===0,p;t[10]!==i||t[11]!==l?(p=()=>{i(l)},t[10]=i,t[11]=l,t[12]=p):p=t[12];let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsx)(Oj,{disabled:f,onSelect:p,children:`Close others`}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==i||t[17]!==o?(h=(0,Z.jsx)(Oj,{onSelect:()=>{i(o)},children:`Close all`}),t[16]=i,t[17]=o,t[18]=h):h=t[18];let g;t[19]!==d||t[20]!==m||t[21]!==h?(g=(0,Z.jsxs)(Dj,{className:`min-w-40`,children:[d,m,h]}),t[19]=d,t[20]=m,t[21]=h,t[22]=g):g=t[22];let _;return t[23]!==u||t[24]!==g?(_=(0,Z.jsxs)(Tj,{children:[u,g]}),t[23]=u,t[24]=g,t[25]=_):_=t[25],_}function Jj(){let e=(0,$.c)(65),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:c,closeTab:l,closeTabs:u,isNewTabActive:f,newTabIds:p,openNewTab:m,openTabs:h,remapTabsForRename:g}=Ue(),{pageMeta:_}=xr(),v=(0,Q.useRef)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(null),O=(0,Q.useRef)(!1),k=(0,Q.useRef)(!1),A=(0,Q.useRef)(null),j=(0,Q.useRef)(t),M;e[0]!==n||e[1]!==t||e[2]!==i?(M=n??(i?Je(i):t?Ge(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=M):M=e[3];let N=M,P;e[4]!==r||e[5]!==N||e[6]!==f||e[7]!==p||e[8]!==h?(P=f?`${r??`__new-tab__`}\u0000${h.join(`\0`)}\u0000${p.join(`\0`)}`:N?`${N}\u0000${h.join(`\0`)}`:``,e[4]=r,e[5]=N,e[6]=f,e[7]=p,e[8]=h,e[9]=P):P=e[9];let F=P,I,L;e[10]===t?(I=e[11],L=e[12]):(I=()=>{j.current=t},L=[t],e[10]=t,e[11]=I,e[12]=L),(0,Q.useEffect)(I,L);let R,z;e[13]===F?(R=e[14],z=e[15]):(R=()=>{F&&(v.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},z=[F],e[13]=F,e[14]=R,e[15]=z),(0,Q.useEffect)(R,z);let B,V;e[16]===y?(B=e[17],V=e[18]):(B=()=>{y&&(D.current?.focus(),D.current?.select())},V=[y],e[16]=y,e[17]=B,e[18]=V),(0,Q.useEffect)(B,V);let H,U;e[19]!==h||e[20]!==y?(H=()=>{!y||h.includes(Ge(y))||(k.current=!0,A.current=null,b(null),S(``),w(null),E(!1))},U=[h,y],e[19]=h,e[20]=y,e[21]=H,e[22]=U):(H=e[21],U=e[22]),(0,Q.useEffect)(H,U);let W,G,K,q,ee;if(e[23]!==a||e[24]!==N||e[25]!==s||e[26]!==l||e[27]!==u||e[28]!==T||e[29]!==h||e[30]!==_||e[31]!==g||e[32]!==C||e[33]!==x||e[34]!==y){let t=function(e){let t=e.split(`/`);k.current=!1,A.current=null,b(e),S(t[t.length-1]),w(null)},n=function(){k.current=!0,A.current=null,b(null),S(``),w(null),E(!1)},r=async function(){if(k.current){k.current=!1;return}if(O.current)return;let e=y;if(!e){n();return}let t=_j(`file`,Kj(x,_.get(e)?.docExt??`.md`)),r=e.split(`/`),i=r[r.length-1];if(t===i){n();return}if(t===A.current){D.current?.focus();return}if(!vj(t)){w(`Name can’t be empty, ".", "..", or contain / or \\`),D.current?.focus();return}let a=yj({kind:`file`,path:e,name:i},t);O.current=!0,E(!0),w(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:a})});if(k.current){E(!1),O.current=!1;return}let r=await Ie(n,`Server error (HTTP ${n.status})`);if(!r.ok){w(r.title),E(!1),O.current=!1,A.current=t,D.current?.focus();return}let i=d(gn,r.body,`rename-path:tab`,{renamed:[]}).renamed,o=j.current,c=Sj(o,i);await Promise.all(i.flatMap(e=>[s(e.fromDocName),s(e.toDocName)])),g(i),Kn([`files`,`backlinks`,`graph`]),k.current=!0,b(null),S(``),w(null),E(!1),O.current=!1,A.current=null,c&&c!==o&&Wj(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:a,normalized:t}),w(`Network error — please try again`),E(!1),O.current=!1,A.current=t,D.current?.focus()}};W=typeof window<`u`&&window.okDesktop!=null,G=v,e[40]===Symbol.for(`react.memo_cache_sentinel`)?(K=Y(`pl-2 flex h-10 min-w-0 touch-manipulation flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,W&&`[-webkit-app-region:drag]`),e[40]=K):K=e[40],q=Gj,ee=h.map(e=>{let i=je(e),o=e===N;if(i.kind===`folder`){let{baseName:t,label:n,prefix:r}=Hj(i.folderPath,`/`),s=`${r}${n}`;return(0,Z.jsx)(qj,{tabId:e,openTabs:h,closeTab:l,closeTabs:u,children:(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":o?`true`:void 0,className:Y(Ij,o?Lj:Rj,W&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":s,title:s,className:zj,onClick:()=>{a(e)},children:[(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),r?(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate`,o&&`text-muted-foreground`),children:r}):null,(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center font-medium`,r?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close ${s}`,className:Vj(o),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Ma,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let s=i.docName,c=_.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=Hj(s,c),g=`${m}${p}`,v=y===s,b=`editor-tab-rename-error-${Uj(s)}`;return(0,Z.jsx)(qj,{disabled:v,tabId:e,openTabs:h,closeTab:l,closeTabs:u,children:(0,Z.jsx)(`div`,{role:`presentation`,"data-active-tab":o?`true`:void 0,className:Y(Ij,o?Lj:Rj,v&&C&&`border-destructive`,W&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(kj,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(Pj,{ref:D,value:x,disabled:T,"aria-label":`Rename ${p}`,"aria-invalid":C?!0:void 0,"aria-describedby":C?b:void 0,"aria-busy":T||void 0,title:C??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{S(Kj(e.target.value,c)),w(null),A.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),r()):e.key===`Escape`&&(e.preventDefault(),n())},onBlur:r}),(0,Z.jsx)(jj,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(Nj,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),C?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:C}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:zj,onClick:()=>{a(e)},onDoubleClick:e=>{e.preventDefault(),e.stopPropagation(),t(s)},children:[m?(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate text-muted-foreground/60`,o&&`text-muted-foreground`),children:m}):null,(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center font-medium`,m?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close ${g}`,className:Vj(o),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Ma,{"aria-hidden":`true`,className:`size-3.5`})})]})})},e)}),e[23]=a,e[24]=N,e[25]=s,e[26]=l,e[27]=u,e[28]=T,e[29]=h,e[30]=_,e[31]=g,e[32]=C,e[33]=x,e[34]=y,e[35]=W,e[36]=G,e[37]=K,e[38]=q,e[39]=ee}else W=e[35],G=e[36],K=e[37],q=e[38],ee=e[39];let te;if(e[41]!==o||e[42]!==r||e[43]!==c||e[44]!==W||e[45]!==p){let t;e[47]!==o||e[48]!==r||e[49]!==c||e[50]!==W?(t=e=>{let t=e===r;return(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":t?`true`:void 0,className:Y(Ij,t?Lj:Rj,W&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),c(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Activate new tab`,title:`New tab`,className:zj,onClick:()=>o(e),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:`New tab`})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close new tab`,className:Vj(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(Ma,{"aria-hidden":`true`,className:`size-3.5`})})]},e)},e[47]=o,e[48]=r,e[49]=c,e[50]=W,e[51]=t):t=e[51],te=p.map(t),e[41]=o,e[42]=r,e[43]=c,e[44]=W,e[45]=p,e[46]=te}else te=e[46];let ne;e[52]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(Sa,{"aria-hidden":`true`,className:`size-3.5`}),e[52]=ne):ne=e[52];let re;e[53]===m?re=e[54]:(re=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`New tab`,className:`flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground outline-none transition hover:bg-muted/70 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50`,onClick:m,children:ne})}),e[53]=m,e[54]=re);let ie;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(ao,{children:`New tab`}),e[55]=ie):ie=e[55];let ae;e[56]===re?ae=e[57]:(ae=(0,Z.jsxs)(so,{children:[re,ie]}),e[56]=re,e[57]=ae);let oe;return e[58]!==G||e[59]!==K||e[60]!==q||e[61]!==ee||e[62]!==te||e[63]!==ae?(oe=(0,Z.jsxs)(`div`,{ref:G,className:K,onWheel:q,children:[ee,te,ae]}),e[58]=G,e[59]=K,e[60]=q,e[61]=ee,e[62]=te,e[63]=ae,e[64]=oe):oe=e[64],oe}function Yj(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function Xj(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var Zj=[{label:`Documentation`,href:`https://openknowledge.ai/docs`,icon:u},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:vu},{label:`Website`,href:`https://openknowledge.ai/`,icon:Oa},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:Yj},{label:`Twitter`,href:`https://x.com/inkeep`,icon:Xj}],Qj=()=>{let e=(0,$.c)(5),[t,n]=(0,Q.useState)(!1),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[(0,Z.jsx)(_,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Resources`})]})})}),(0,Z.jsx)(ao,{children:`Resources`})]}),e[0]=r):r=e[0];let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:`Resources`}),e[1]=i):i=e[1];let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(C,{align:`end`,className:`w-64 p-3`,children:[i,(0,Z.jsx)(`nav`,{"aria-label":`Resources`,children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:Zj.map($j)})})]}),e[2]=a):a=e[2];let o;return e[3]===t?o=e[4]:(o=(0,Z.jsxs)(Qe,{open:t,onOpenChange:n,children:[r,a]}),e[3]=t,e[4]=o),o};function $j(e){let{label:t,href:n,icon:r}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Ai(e,n),onAuxClick:e=>Ai(e,n),className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(r,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t]})},n)}async function eM(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:tM(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:tM(e)}}}function tM(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var nM={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function rM(e){let t=(0,$.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=pn(),s=nM[r],c=s?(o===`dark`?wn[s]:void 0)??Zt[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=Y(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(Jr,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,Z.jsx)(qr,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(ei,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function iM(e){let{installState:t}=e;return t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null}function aM(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:`Requires ${e}.`,installAction:{label:`Install ${e} →`,url:t.installUrl},...t.hasWebFallback?{webFallback:{label:`Open in claude.ai →`,url:``}}:{}}}}return{enabled:!0,tooltip:null}}function oM(e){return jn(e)}function sM(e){return`Opened ${e} in your browser.`}var cM=`claude.ai`;async function lM(e,t=eM){(await t(jn(e))).ok?qa.success(sM(cM)):qa.error(`Couldn't open ${cM} in your browser.`)}function uM(e){return e.onInstallSkillRequest!==void 0&&e.target.id===`claude-cowork`}function dM(e){let t=(0,$.c)(80),{target:n,installState:r,isElectronHost:i,prompt:a,onSelect:o,onInstallSkillRequest:s}=e,c=e.openExternal??eM,l=e.onWebFallbackSuccess??pM,u=e.onWebFallbackError??fM,d;t[0]!==r||t[1]!==i||t[2]!==n?(d=aM({target:n,installState:r,isElectronHost:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=d):d=t[3];let f=d,p;t[4]!==r||t[5]!==i||t[6]!==n?(p=iM({target:n,installState:r,isElectronHost:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=p):p=t[7];let m=p,h;t[8]!==c||t[9]!==f.tooltip?(h=()=>{f.tooltip&&c(f.tooltip.installAction.url)},t[8]=c,t[9]=f.tooltip,t[10]=h):h=t[10];let g=h,_;t[11]!==u||t[12]!==l||t[13]!==c||t[14]!==a||t[15]!==n?(_=()=>{(async()=>{let e=await c(oM(a));e.ok?l(n):u(n,e.detail??e.reason)})()},t[11]=u,t[12]=l,t[13]=c,t[14]=a,t[15]=n,t[16]=_):_=t[16];let v=_;if(f.enabled){let e;t[17]!==s||t[18]!==n?(e=uM({target:n,onInstallSkillRequest:s}),t[17]=s,t[18]=n,t[19]=e):e=t[19];let r=e,i=r&&s?s:o,a=`open-in-agent-item-${n.id}`,c=r?`Install Open Knowledge skill in ${n.displayName}`:`Open in ${n.displayName}`,l;t[20]===n.id?l=t[21]:(l=(0,Z.jsx)(rM,{id:n.id,"aria-hidden":`true`}),t[20]=n.id,t[21]=l);let u=r?`flex-1 whitespace-nowrap`:void 0,d;t[22]!==u||t[23]!==n.displayName?(d=(0,Z.jsx)(`span`,{className:u,children:n.displayName}),t[22]=u,t[23]=n.displayName,t[24]=d):d=t[24];let f;t[25]===r?f=t[26]:(f=r?(0,Z.jsx)(We,{variant:`outline`,"aria-hidden":`true`,className:`ml-2 h-[18px] px-1.5 py-0 text-[10px]`,"data-testid":`open-in-agent-skill-install-badge`,children:`Install`}):null,t[25]=r,t[26]=f);let p;return t[27]!==d||t[28]!==f||t[29]!==i||t[30]!==a||t[31]!==c||t[32]!==l?(p=(0,Z.jsxs)(li,{onSelect:i,"data-testid":a,"aria-label":c,children:[l,d,f]}),t[27]=d,t[28]=f,t[29]=i,t[30]=a,t[31]=c,t[32]=l,t[33]=p):p=t[33],p}if(!f.tooltip){let e=m?`Open in ${n.displayName}, ${m}`:`Open in ${n.displayName}`,r=`open-in-agent-item-${n.id}`,i;t[34]===n.id?i=t[35]:(i=(0,Z.jsx)(rM,{id:n.id,"aria-hidden":`true`}),t[34]=n.id,t[35]=i);let a;t[36]===n.displayName?a=t[37]:(a=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[36]=n.displayName,t[37]=a);let o;t[38]===m?o=t[39]:(o=m?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:m}):null,t[38]=m,t[39]=o);let s;return t[40]!==e||t[41]!==r||t[42]!==i||t[43]!==a||t[44]!==o?(s=(0,Z.jsxs)(li,{disabled:!0,"data-testid":r,"aria-label":e,children:[i,a,o]}),t[40]=e,t[41]=r,t[42]=i,t[43]=a,t[44]=o,t[45]=s):s=t[45],s}let y=m?`Open in ${n.displayName}, ${m}`:`Open in ${n.displayName}`,b=`open-in-agent-item-${n.id}`,x;t[46]===n.id?x=t[47]:(x=(0,Z.jsx)(rM,{id:n.id,"aria-hidden":`true`,className:`mr-2`}),t[46]=n.id,t[47]=x);let S;t[48]===n.displayName?S=t[49]:(S=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[48]=n.displayName,t[49]=S);let C;t[50]===m?C=t[51]:(C=m?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:m}):null,t[50]=m,t[51]=C);let w;t[52]!==y||t[53]!==b||t[54]!==x||t[55]!==S||t[56]!==C?(w=(0,Z.jsxs)(si,{"data-testid":b,"data-row-disabled":``,"aria-label":y,children:[x,S,C]}),t[52]=y,t[53]=b,t[54]=x,t[55]=S,t[56]=C,t[57]=w):w=t[57];let T=`open-in-agent-submenu-${n.id}`,E=`open-in-agent-message-${n.id}`,D;t[58]!==f.tooltip.message||t[59]!==E?(D=(0,Z.jsx)(xa,{className:`font-normal text-muted-foreground text-xs`,"data-testid":E,children:f.tooltip.message}),t[58]=f.tooltip.message,t[59]=E,t[60]=D):D=t[60];let O;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(di,{}),t[61]=O):O=t[61];let k=`open-in-agent-install-${n.id}`,A;t[62]===f.tooltip.installAction.label?A=t[63]:(A=(0,Z.jsx)(`span`,{children:f.tooltip.installAction.label}),t[62]=f.tooltip.installAction.label,t[63]=A);let j;t[64]!==g||t[65]!==k||t[66]!==A?(j=(0,Z.jsx)(li,{onSelect:g,"data-testid":k,children:A}),t[64]=g,t[65]=k,t[66]=A,t[67]=j):j=t[67];let M;t[68]!==v||t[69]!==f.tooltip.webFallback||t[70]!==n.id?(M=f.tooltip.webFallback?(0,Z.jsxs)(li,{onSelect:v,"data-testid":`open-in-agent-web-fallback-${n.id}`,"aria-label":`${f.tooltip.webFallback.label}, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:f.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser with prompt pre-filled`})]}):null,t[68]=v,t[69]=f.tooltip.webFallback,t[70]=n.id,t[71]=M):M=t[71];let N;t[72]!==D||t[73]!==j||t[74]!==M||t[75]!==T?(N=(0,Z.jsxs)(ia,{className:`min-w-[260px]`,"data-testid":T,children:[D,O,j,M]}),t[72]=D,t[73]=j,t[74]=M,t[75]=T,t[76]=N):N=t[76];let P;return t[77]!==N||t[78]!==w?(P=(0,Z.jsxs)(wi,{children:[w,N]}),t[77]=N,t[78]=w,t[79]=P):P=t[79],P}function fM(){}function pM(){}function mM(e){let t=(0,$.c)(70),{input:n}=e,{states:r,refresh:i}=Ap(),{dispatch:a}=yp(),{skillInstalled:o,refresh:s}=ua(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),f=typeof window<`u`&&window.okDesktop!=null,p;t[0]===i?p=t[1]:(p=e=>{l(e),e&&i()},t[0]=i,t[1]=p);let m=p,h=n===null,g;t[2]===n?g=t[3]:(g=n===null?``:er(n.docContext),t[2]=n,t[3]=g);let _=g,v;t[4]!==a||t[5]!==n?(v=e=>{n!==null&&a(e.id,n)},t[4]=a,t[5]=n,t[6]=v):v=t[6];let y=v,b,x,S,C,w,T,E,D,O,k,A,j;if(t[7]!==m||t[8]!==y||t[9]!==n||t[10]!==c||t[11]!==_||t[12]!==o||t[13]!==r||t[14]!==h){let e;t[27]===r?e=t[28]:(e=e=>r[e.id]?.installed===!0,t[27]=r,t[28]=e);let i=kf.filter(e);S=r[`claude-cowork`]?.installed===!0;let a;t[29]!==n||t[30]!==_?(a=()=>{n!==null&&lM(_)},t[29]=n,t[30]=_,t[31]=a):a=t[31],C=a,x=Ca,j=c,w=m;let s;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ti,{className:`size-4`}),t[32]=s):s=t[32];let l;t[33]===h?l=t[34]:(l=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit with AI`,disabled:h,className:`text-muted-foreground`,"data-testid":`open-in-agent-trigger`,children:s})})}),t[33]=h,t[34]=l);let u;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ao,{children:`Edit with AI`}),t[35]=u):u=t[35],t[36]===l?T=t[37]:(T=(0,Z.jsxs)(so,{children:[l,u]}),t[36]=l,t[37]=T),b=ki,E=`end`,D=`min-w-[220px]`,O=`open-in-agent-menu`,t[38]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(xa,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Open in`}),t[38]=k):k=t[38];let p;t[39]!==y||t[40]!==_||t[41]!==o||t[42]!==r?(p=e=>{let t=r[e.id];return(0,Z.jsx)(dM,{target:e,installState:t,isElectronHost:f,prompt:_,onSelect:()=>y(e),onInstallSkillRequest:e.id===`claude-cowork`&&!o?()=>d(!0):void 0},e.id)},t[39]=y,t[40]=_,t[41]=o,t[42]=r,t[43]=p):p=t[43],A=i.map(p),t[7]=m,t[8]=y,t[9]=n,t[10]=c,t[11]=_,t[12]=o,t[13]=r,t[14]=h,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A,t[26]=j}else b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25],j=t[26];let M;t[44]!==S||t[45]!==C||t[46]!==n?(M=S?null:(0,Z.jsxs)(li,{onSelect:C,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(pt,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in claude.ai →`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser`})]}),t[44]=S,t[45]=C,t[46]=n,t[47]=M):M=t[47];let N;t[48]!==b||t[49]!==M||t[50]!==E||t[51]!==D||t[52]!==O||t[53]!==k||t[54]!==A?(N=(0,Z.jsxs)(b,{align:E,className:D,"data-testid":O,children:[k,A,M]}),t[48]=b,t[49]=M,t[50]=E,t[51]=D,t[52]=O,t[53]=k,t[54]=A,t[55]=N):N=t[55];let P;t[56]!==x||t[57]!==w||t[58]!==T||t[59]!==N||t[60]!==j?(P=(0,Z.jsxs)(x,{open:j,onOpenChange:w,children:[T,N]}),t[56]=x,t[57]=w,t[58]=T,t[59]=N,t[60]=j,t[61]=P):P=t[61];let F;t[62]===s?F=t[63]:(F=e=>{d(e),e||s()},t[62]=s,t[63]=F);let I;t[64]!==u||t[65]!==F?(I=(0,Z.jsx)(oa,{open:u,onOpenChange:F}),t[64]=u,t[65]=F,t[66]=I):I=t[66];let L;return t[67]!==P||t[68]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[P,I]}),t[67]=P,t[68]=I,t[69]=L):L=t[69],L}var hM=()=>{let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onClick:gM,children:[(0,Z.jsx)(Xs,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Settings`})]})}),(0,Z.jsx)(ao,{children:`Settings`})]}),e[0]=t):t=e[0],t};function gM(){window.location.hash!==`#settings`&&(window.location.hash=Af)}function _M(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime();return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)} min ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:new Date(e).toLocaleDateString()}async function vM(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}function yM(e){let t=(0,$.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(us,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(qs,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(us,{className:`size-3.5 text-emerald-500`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(qs,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Cn,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ls,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Rs,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Cn,{className:`size-3.5 text-amber-500`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(us,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function bM(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function xM(e){switch(e){case`dormant`:return`No git remote`;case`idle`:return`Synced`;case`fetching`:return`Fetching`;case`pulling`:return`Pulling`;case`pushing`:return`Pushing`;case`conflict`:return`Conflict`;case`offline`:return`Offline`;case`auth-error`:return`Sign in required`;case`disabled`:return`Sync disabled`;default:return e}}function SM(e){switch(e){case`external-changes-pending`:return`External changes pending`;case`dirty-tree`:return`Working tree has uncommitted changes`;case`detached-head`:return`Detached HEAD — checkout a branch to resume`;case`auth-error`:return`Sign in required`;case`protected-branch`:return`Protected branch — cannot push`;default:return e}}function CM(e){return e.syncEnabled?e.state===`idle`?e.ahead>0&&e.behind>0?`${e.ahead} ahead, ${e.behind} behind`:e.ahead>0?`${e.ahead} ahead`:e.behind>0?`${e.behind} behind`:`Synced`:e.state===`conflict`&&e.conflictCount>0?`${e.conflictCount} conflict${e.conflictCount===1?``:`s`}`:xM(e.state):`Sync off`}function wM(e){let t=(0,$.c)(76),{status:n,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=e,{projectLocalConfig:o,projectLocalSynced:s}=Yi(),c=o?.autoSync?.enabled??!1,{confirmOpen:u,setConfirmOpen:d,onToggleRequest:f,onConfirm:p}=Li(Ii()),m;t[0]===n?m=t[1]:(m=(0,Z.jsx)(yM,{status:n}),t[0]=n,t[1]=m);let h;t[2]===n.state?h=t[3]:(h=xM(n.state),t[2]=n.state,t[3]=h);let g;t[4]===h?g=t[5]:(g=(0,Z.jsx)(`span`,{className:`text-sm font-medium truncate`,children:h}),t[4]=h,t[5]=g);let _;t[6]!==m||t[7]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[m,g]}),t[6]=m,t[7]=g,t[8]=_):_=t[8];let v=!s,y=c?`Disable sync`:`Enable sync`,b;t[9]!==c||t[10]!==f||t[11]!==v||t[12]!==y?(b=(0,Z.jsx)(l,{checked:c,disabled:v,onCheckedChange:f,"aria-label":y}),t[9]=c,t[10]=f,t[11]=v,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[_,b]}),t[14]=_,t[15]=b,t[16]=x):x=t[16];let S;t[17]!==u||t[18]!==p||t[19]!==d?(S=(0,Z.jsx)(Xi,{open:u,onOpenChange:d,onConfirm:p}),t[17]=u,t[18]=p,t[19]=d,t[20]=S):S=t[20];let C;t[21]===n.error?C=t[22]:(C=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[21]=n.error,t[22]=C);let w;t[23]===n.pausedReason?w=t[24]:(w=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:SM(n.pausedReason)}),t[23]=n.pausedReason,t[24]=w);let T;t[25]===n.state?T=t[26]:(T=n.state===`conflict`&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:`Sync paused — resolve conflicts to resume.`}),t[25]=n.state,t[26]=T);let E;t[27]!==c||t[28]!==n.lastSyncUtc||t[29]!==n.state?(E=c&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{children:[`Last synced: `,_M(n.lastSyncUtc)]}),t[27]=c,t[28]=n.lastSyncUtc,t[29]=n.state,t[30]=E):E=t[30];let D;t[31]===n.ahead?D=t[32]:(D=n.ahead>0&&(0,Z.jsxs)(`div`,{children:[n.ahead,` commit`,n.ahead===1?``:`s`,` ahead`]}),t[31]=n.ahead,t[32]=D);let O;t[33]===n.behind?O=t[34]:(O=n.behind>0&&(0,Z.jsxs)(`div`,{children:[n.behind,` commit`,n.behind===1?``:`s`,` behind`]}),t[33]=n.behind,t[34]=O);let k;t[35]===n.conflictCount?k=t[36]:(k=n.conflictCount>0&&(0,Z.jsxs)(`div`,{children:[n.conflictCount,` file`,n.conflictCount===1?``:`s`,` conflicted`]}),t[35]=n.conflictCount,t[36]=k);let A;t[37]===c?A=t[38]:(A=!c&&(0,Z.jsx)(`div`,{children:`Sync is off — your edits will not sync to the remote repository.`}),t[37]=c,t[38]=A);let j;t[39]!==E||t[40]!==D||t[41]!==O||t[42]!==k||t[43]!==A?(j=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[E,D,O,k,A]}),t[39]=E,t[40]=D,t[41]=O,t[42]=k,t[43]=A,t[44]=j):j=t[44];let M;t[45]!==a||t[46]!==n.identityUnresolved?(M=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(uc,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:`Git identity isn't set — commits use a default author. Set yours so teammates see your name.`}),(0,Z.jsx)(X,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:`Set identity`})]})]}),t[45]=a,t[46]=n.identityUnresolved,t[47]=M):M=t[47];let N;t[48]!==c||t[49]!==n.state?(N=c&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:EM,children:`Sync now`}),t[48]=c,t[49]=n.state,t[50]=N):N=t[50];let P;t[51]!==c||t[52]!==r||t[53]!==n.state?(P=c&&n.state===`auth-error`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:r,children:`Sign in`}),t[51]=c,t[52]=r,t[53]=n.state,t[54]=P):P=t[54];let F;t[55]!==c||t[56]!==n.state?(F=c&&n.state===`offline`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:TM,children:`Retry`}),t[55]=c,t[56]=n.state,t[57]=F):F=t[57];let I;t[58]!==c||t[59]!==i||t[60]!==n.state?(I=c&&n.state===`conflict`&&i&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:i,children:`Review conflicts`}),t[58]=c,t[59]=i,t[60]=n.state,t[61]=I):I=t[61];let L;t[62]!==N||t[63]!==P||t[64]!==F||t[65]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[N,P,F,I]}),t[62]=N,t[63]=P,t[64]=F,t[65]=I,t[66]=L):L=t[66];let R;return t[67]!==C||t[68]!==w||t[69]!==T||t[70]!==j||t[71]!==M||t[72]!==L||t[73]!==x||t[74]!==S?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[x,S,C,w,T,j,M,L]}),t[67]=C,t[68]=w,t[69]=T,t[70]=j,t[71]=M,t[72]=L,t[73]=x,t[74]=S,t[75]=R):R=t[75],R}function TM(){vM(`sync`)}function EM(){vM(`sync`)}function DM(e){let t=(0,$.c)(36),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=n,{status:o,fetchError:s}=ca();if(!o){if(s){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":`Sync status unavailable`,disabled:!0,children:(0,Z.jsx)(ls,{className:`size-3.5`})})}),t[2]=e):e=t[2];let n=s===`network`?`Sync status unavailable — server unreachable.`:`Sync status unavailable — server error.`,r;return t[3]===n?r=t[4]:(r=(0,Z.jsxs)(so,{children:[e,(0,Z.jsx)(ao,{children:n})]}),t[3]=n,t[4]=r),r}return null}if(o.state===`dormant`&&!o.hasRemote||o.state===`disabled`&&!o.pausedReason)return null;let c;t[5]===o?c=t[6]:(c=bM(o),t[5]=o,t[6]=c);let l=c,u=!!o.identityUnresolved,d;t[7]===o.state?d=t[8]:(d=xM(o.state),t[7]=o.state,t[8]=d);let f=`Sync status: ${d}${u?` — git identity unset`:``}`,p;t[9]===o?p=t[10]:(p=(0,Z.jsx)(yM,{status:o}),t[9]=o,t[10]=p);let m;t[11]===l?m=t[12]:(m=l&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==l||t[14]!==u?(h=!l&&u&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[13]=l,t[14]=u,t[15]=h):h=t[15];let g;t[16]!==f||t[17]!==p||t[18]!==m||t[19]!==h?(g=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground relative`,"aria-label":f,children:[p,m,h]})})}),t[16]=f,t[17]=p,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;t[21]===o?_=t[22]:(_=CM(o),t[21]=o,t[22]=_);let v;t[23]===_?v=t[24]:(v=(0,Z.jsx)(ao,{children:_}),t[23]=_,t[24]=v);let y;t[25]!==v||t[26]!==g?(y=(0,Z.jsxs)(so,{children:[g,v]}),t[25]=v,t[26]=g,t[27]=y):y=t[27];let b;t[28]!==i||t[29]!==a||t[30]!==r||t[31]!==o?(b=(0,Z.jsx)(C,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(wM,{status:o,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a})}),t[28]=i,t[29]=a,t[30]=r,t[31]=o,t[32]=b):b=t[32];let x;return t[33]!==y||t[34]!==b?(x=(0,Z.jsxs)(Qe,{children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35],x}var OM=[{value:`light`,label:`Light`,icon:ic},{value:`dark`,label:`Dark`,icon:zs},{value:`system`,label:`System`,icon:ms}],kM=()=>{let e=(0,$.c)(16),{theme:t}=pn(),{merged:n,userBinding:r}=Yi(),i=n?.appearance?.theme??t??`system`,a;e[0]===r?a=e[1]:(a=e=>{if(e!==`light`&&e!==`dark`&&e!==`system`||!r)return;let t=r.patch({appearance:{theme:e}});t.ok||qa.error(Sn(t.error))},e[0]=r,e[1]=a);let o=a,s=i===`system`?ms:i===`dark`?zs:ic,c;e[2]===s?c=e[3]:(c=(0,Z.jsx)(s,{}),e[2]=s,e[3]=c);let l;e[4]===i?l=e[5]:(l=(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`Toggle theme (current: `,i,`)`]}),e[4]=i,e[5]=l);let u;e[6]!==c||e[7]!==l?(u=(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[c,l]})}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let d;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=OM.map(AM),e[9]=d):d=e[9];let f;e[10]!==i||e[11]!==o?(f=(0,Z.jsx)(ki,{align:`end`,children:(0,Z.jsx)(ji,{value:i,onValueChange:o,children:d})}),e[10]=i,e[11]=o,e[12]=f):f=e[12];let p;return e[13]!==u||e[14]!==f?(p=(0,Z.jsxs)(Ca,{children:[u,f]}),e[13]=u,e[14]=f,e[15]=p):p=e[15],p};function AM(e){let{value:t,label:n,icon:r}=e;return(0,Z.jsxs)(pi,{value:t,className:`capitalize`,children:[(0,Z.jsx)(r,{className:`text-muted-foreground`}),n]},t)}function jM(e){let t=(0,$.c)(49),{onSaveVersion:n,saving:r,onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}=e,{activeDocName:s,activeTarget:c}=Ue(),{state:l}=FA(),u=Lf(),d;t[0]!==s||t[1]!==u?(d=up({docName:s,workspace:u}),t[0]=s,t[1]=u,t[2]=d):d=t[2];let f=d,p=c?.kind===`asset`,m=p?c.assetPath:``,h,g;t[3]===m?(h=t[4],g=t[5]):(h=m.lastIndexOf(`/`),g=h===-1?``:m.slice(0,h),t[3]=m,t[4]=h,t[5]=g);let _=g,v;t[6]!==m||t[7]!==h?(v=h===-1?m:m.slice(h+1),t[6]=m,t[7]=h,t[8]=v):v=t[8];let y=v,b=typeof window<`u`&&window.okDesktop!=null,x=b&&l===`collapsed`&&`pl-[78px]`,S;t[9]===x?S=t[10]:(S=Y(`flex h-12 shrink-0 items-center bg-muted/20 shadow-[inset_0_-1px_0_var(--border)]`,b&&`[-webkit-app-region:drag]`,x,b&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[9]=x,t[10]=S);let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(BA,{className:Y(`-ml-1 shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`)})}),t[11]=C):C=t[11];let w=l===`expanded`?`Hide Files`:`Show Files`,T;t[12]===w?T=t[13]:(T=(0,Z.jsxs)(so,{children:[C,(0,Z.jsx)(ao,{children:w})]}),t[12]=w,t[13]=T);let E;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(yi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),t[14]=E):E=t[14];let D;t[15]!==y||t[16]!==_||t[17]!==p?(D=p?(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center gap-2 overflow-hidden text-sm`,children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center overflow-hidden`,children:[_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground/60`,children:_}),(0,Z.jsx)(`span`,{className:`shrink-0 px-2 text-muted-foreground/60`,children:`/`})]}),(0,Z.jsx)(`span`,{className:`shrink-0 font-medium text-foreground`,children:y})]})}):null,t[15]=y,t[16]=_,t[17]=p,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Jj,{}),t[19]=O):O=t[19];let k;t[20]!==D||t[21]!==T?(k=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[T,E,D,O]}),t[20]=D,t[21]=T,t[22]=k):k=t[22];let A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=Y(`flex shrink-0 items-center justify-end gap-2 px-3`,b&&`[&>*]:[-webkit-app-region:no-drag]`),t[23]=A):A=t[23];let j;t[24]!==s||t[25]!==n||t[26]!==r?(j=s&&(0,Z.jsxs)(so,{children:[(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Checkpoint version`,onClick:n,disabled:r,className:`text-muted-foreground`,children:(0,Z.jsx)(Ys,{className:`size-3.5`})})}),(0,Z.jsx)(ao,{children:r?`Saving`:`Checkpoint version`})]}),t[24]=s,t[25]=n,t[26]=r,t[27]=j):j=t[27];let M;t[28]!==s||t[29]!==f?(M=s&&(0,Z.jsx)(mM,{input:f}),t[28]=s,t[29]=f,t[30]=M):M=t[30];let N;t[31]!==o||t[32]!==a||t[33]!==i?(N=(0,Z.jsx)(DM,{onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}),t[31]=o,t[32]=a,t[33]=i,t[34]=N):N=t[34];let P,F,I,L,R,z;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(gj,{}),F=(0,Z.jsx)(yi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),I=(0,Z.jsx)($l,{}),L=(0,Z.jsx)(hM,{}),R=(0,Z.jsx)(Qj,{}),z=(0,Z.jsx)(kM,{}),t[35]=P,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=z):(P=t[35],F=t[36],I=t[37],L=t[38],R=t[39],z=t[40]);let B;t[41]!==j||t[42]!==M||t[43]!==N?(B=(0,Z.jsxs)(`div`,{className:A,children:[j,M,N,P,F,I,L,R,z]}),t[41]=j,t[42]=M,t[43]=N,t[44]=B):B=t[44];let V;return t[45]!==k||t[46]!==B||t[47]!==S?(V=(0,Z.jsxs)(`header`,{className:S,children:[k,B]}),t[45]=k,t[46]=B,t[47]=S,t[48]=V):V=t[48],V}function MM(){let e=(0,$.c)(32),[t,n]=om(),[r,i]=(0,Q.useState)(t),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(`auth`),[d,f]=(0,Q.useState)(j_[0].id),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_=_a(),{projectLocalConfig:v,projectLocalSynced:y}=Yi(),{activeDocName:b}=Ue(),x=!h&&_?.hasRemote===!0&&y===!0&&v!==null&&v.autoSync?.enabled===null,S,C;e[0]===b?(S=e[1],C=e[2]):(S=()=>{let e=function(e){let t=e.detail;t&&b&&Po(b,{kind:`raw-mdx`,detail:t}),i(`source`)};return window.addEventListener(Qp,e),()=>window.removeEventListener(Qp,e)},C=[b],e[0]=b,e[1]=S,e[2]=C),(0,Q.useEffect)(S,C);let w;e[3]===n?w=e[4]:(w=function(e){i(e),n(e)},e[3]=n,e[4]=w);let T=w,E;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=async function(){m(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?qa.success(`Checkpoint saved`):(console.error(`[save-version] failed:`,await e.text()),qa.error(`Checkpoint failed — try again`))}catch(e){console.error(`[save-version] failed:`,e),qa.error(`Checkpoint failed — try again`)}m(!1)},e[5]=E):E=e[5];let D=E,O;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(lm,{onOpenResolver:()=>o(!0)}),e[6]=O):O=e[6];let k,A,j;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{u(`auth`),c(!0)},A=()=>{u(`identity`),c(!0)},j=()=>o(!0),e[7]=k,e[8]=A,e[9]=j):(k=e[7],A=e[8],j=e[9]);let M;e[10]===p?M=e[11]:(M=(0,Z.jsx)(jM,{onSaveVersion:D,saving:p,onSignIn:k,onSetIdentity:A,onOpenConflictResolver:j}),e[10]=p,e[11]=M);let N;e[12]!==d||e[13]!==r||e[14]!==T?(N=(0,Z.jsx)(uA,{editorMode:r,onModeChange:T,activeTab:d,onActiveTabChange:f}),e[12]=d,e[13]=r,e[14]=T,e[15]=N):N=e[15];let P;e[16]===a?P=e[17]:(P=(0,Z.jsx)(dg,{open:a,onOpenChange:o}),e[16]=a,e[17]=P);let F=l===`identity`,I;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{c(!1)},e[18]=I):I=e[18];let L;e[19]!==s||e[20]!==F?(L=(0,Z.jsx)(Zl,{open:s,onOpenChange:c,identityPrompt:F,onSuccess:I}),e[19]=s,e[20]=F,e[21]=L):L=e[21];let R;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>g(!0),e[22]=R):R=e[22];let z;e[23]===x?z=e[24]:(z=(0,Z.jsx)(sm,{open:x,onResolved:R}),e[23]=x,e[24]=z);let B;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Yp,{}),e[25]=B):B=e[25];let V;return e[26]!==P||e[27]!==L||e[28]!==z||e[29]!==M||e[30]!==N?(V=(0,Z.jsxs)(Z.Fragment,{children:[O,M,N,P,L,z,B]}),e[26]=P,e[27]=L,e[28]=z,e[29]=M,e[30]=N,e[31]=V):V=e[31],V}var NM=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
35
35
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
36
36
|
<path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06" fill="currentcolor"/>
|
|
37
37
|
</symbol>
|
|
@@ -48,68 +48,68 @@ This template lives in your user home (~/.ok/templates/) — deleting affects ev
|
|
|
48
48
|
<symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
|
|
49
49
|
<path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
|
|
50
50
|
</symbol>
|
|
51
|
-
</svg>`,
|
|
51
|
+
</svg>`,PM=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
|
|
52
52
|
<path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
|
|
53
53
|
<path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
|
|
54
|
-
</symbol>`,
|
|
54
|
+
</symbol>`,FM=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
|
|
55
55
|
<path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
|
|
56
|
-
</symbol>`,
|
|
56
|
+
</symbol>`,IM=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
|
|
57
57
|
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
58
58
|
<path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
|
|
59
|
-
</symbol>`,
|
|
59
|
+
</symbol>`,LM=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
|
|
60
60
|
<path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
|
|
61
|
-
</symbol>`,
|
|
61
|
+
</symbol>`,RM=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
|
|
62
62
|
<path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
|
|
63
63
|
<path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
|
|
64
|
-
</symbol>`,
|
|
64
|
+
</symbol>`,zM=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
|
|
65
65
|
<path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
|
|
66
66
|
<path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
|
|
67
67
|
<path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
|
|
68
|
-
</symbol>`,
|
|
68
|
+
</symbol>`,BM=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
|
|
69
69
|
<path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
|
|
70
|
-
</symbol>`,
|
|
70
|
+
</symbol>`,VM=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
|
|
71
71
|
<path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
|
|
72
|
-
</symbol>`,
|
|
72
|
+
</symbol>`,HM=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
|
|
73
73
|
<path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
|
|
74
74
|
<path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
|
|
75
|
-
</symbol>`,
|
|
75
|
+
</symbol>`,UM=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
|
|
76
76
|
<path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
|
|
77
77
|
<path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
|
|
78
78
|
<path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
|
|
79
|
-
</symbol>`,
|
|
79
|
+
</symbol>`,WM=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
|
|
80
80
|
<path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
|
|
81
81
|
<path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
|
|
82
|
-
</symbol>`,
|
|
82
|
+
</symbol>`,GM=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
|
|
83
83
|
<path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
|
|
84
84
|
<path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
|
|
85
|
-
</symbol>`,
|
|
85
|
+
</symbol>`,KM=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
|
|
86
86
|
<path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
|
|
87
87
|
<path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
|
|
88
|
-
</symbol>`,
|
|
88
|
+
</symbol>`,qM=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
|
|
89
89
|
<path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
|
|
90
|
-
</symbol>`,
|
|
90
|
+
</symbol>`,JM=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
|
|
91
91
|
<path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
|
|
92
|
-
</symbol>`,
|
|
92
|
+
</symbol>`,YM=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
|
|
93
93
|
<path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
|
|
94
|
-
</symbol>`,
|
|
94
|
+
</symbol>`,XM=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
|
|
95
95
|
<path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
|
|
96
|
-
</symbol>`,
|
|
96
|
+
</symbol>`,ZM=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
|
|
97
97
|
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
98
98
|
<path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
|
|
99
|
-
</symbol>`,
|
|
99
|
+
</symbol>`,QM=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
|
|
100
100
|
<path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
|
|
101
101
|
<path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
|
|
102
|
-
</symbol
|
|
102
|
+
</symbol>`,$M=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
|
|
103
103
|
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
104
104
|
<path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
|
|
105
|
-
</symbol>`,
|
|
105
|
+
</symbol>`,eN=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
|
|
106
106
|
<path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
|
|
107
|
-
</symbol>`,
|
|
107
|
+
</symbol>`,tN=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
|
|
108
108
|
<path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
|
|
109
|
-
</symbol>`,
|
|
109
|
+
</symbol>`,nN=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
|
|
110
110
|
<path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
|
|
111
111
|
<path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
|
|
112
|
-
</symbol>`,
|
|
112
|
+
</symbol>`,rN=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
|
|
113
113
|
<defs>
|
|
114
114
|
<linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
|
|
115
115
|
<stop stop-color="currentColor"/>
|
|
@@ -119,82 +119,82 @@ This template lives in your user home (~/.ok/templates/) — deleting affects ev
|
|
|
119
119
|
<path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
|
|
120
120
|
<path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
|
|
121
121
|
<path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
|
|
122
|
-
</symbol>`,
|
|
122
|
+
</symbol>`,iN=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
|
|
123
123
|
<path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
|
|
124
124
|
<path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
|
|
125
|
-
</symbol
|
|
125
|
+
</symbol>`,aN=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
|
|
126
126
|
<path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
|
|
127
|
-
</symbol>`,
|
|
127
|
+
</symbol>`,oN=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
|
|
128
128
|
<path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
|
|
129
|
-
</symbol>`,
|
|
129
|
+
</symbol>`,sN=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
|
|
130
130
|
<path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
|
|
131
131
|
<path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
|
|
132
132
|
<path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
|
|
133
133
|
<path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
|
|
134
|
-
</symbol>`,
|
|
134
|
+
</symbol>`,cN=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
|
|
135
135
|
<path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
|
|
136
136
|
<path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
|
|
137
|
-
</symbol>`,
|
|
137
|
+
</symbol>`,lN=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
|
|
138
138
|
<path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
|
|
139
139
|
<path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
|
|
140
|
-
</symbol>`,
|
|
140
|
+
</symbol>`,uN=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
|
|
141
141
|
<path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
|
|
142
|
-
</symbol>`,
|
|
142
|
+
</symbol>`,dN=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
|
|
143
143
|
<path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
|
|
144
|
-
</symbol>`,
|
|
144
|
+
</symbol>`,fN=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
|
|
145
145
|
<path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
|
|
146
|
-
</symbol>`,
|
|
146
|
+
</symbol>`,pN=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
|
|
147
147
|
<path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
|
|
148
148
|
<path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
|
|
149
|
-
</symbol>`,
|
|
149
|
+
</symbol>`,mN=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
|
|
150
150
|
<path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
|
|
151
|
-
</symbol>`,
|
|
151
|
+
</symbol>`,hN=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
|
|
152
152
|
<path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
|
|
153
153
|
<path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
|
|
154
|
-
</symbol>`,
|
|
154
|
+
</symbol>`,gN=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
|
|
155
155
|
<path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
|
|
156
156
|
<path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
|
|
157
|
-
</symbol>`,
|
|
157
|
+
</symbol>`,_N=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
|
|
158
158
|
<path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
|
|
159
|
-
</symbol>`,
|
|
159
|
+
</symbol>`,vN=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
|
|
160
160
|
<path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
|
|
161
161
|
<path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
|
|
162
|
-
</symbol>`,
|
|
162
|
+
</symbol>`,yN=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
|
|
163
163
|
<path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
|
|
164
|
-
</symbol>`,
|
|
164
|
+
</symbol>`,bN=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
|
|
165
165
|
<path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
|
|
166
|
-
</symbol>`,
|
|
166
|
+
</symbol>`,xN=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
|
|
167
167
|
<path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
|
|
168
168
|
<path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
|
|
169
|
-
</symbol>`,
|
|
169
|
+
</symbol>`,SN=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
|
|
170
170
|
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
171
171
|
<path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
|
|
172
|
-
</symbol>`,
|
|
172
|
+
</symbol>`,CN=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
|
|
173
173
|
<path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
|
|
174
|
-
</symbol>`,
|
|
174
|
+
</symbol>`,wN=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
|
|
175
175
|
<path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
|
|
176
176
|
<path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
|
|
177
177
|
<path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
|
|
178
|
-
</symbol>`,
|
|
178
|
+
</symbol>`,TN=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
|
|
179
179
|
<path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
|
|
180
180
|
<path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
|
|
181
|
-
</symbol>`,
|
|
181
|
+
</symbol>`,EN=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
|
|
182
182
|
<path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
|
|
183
183
|
<path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
|
|
184
184
|
<path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
|
|
185
|
-
</symbol>`,
|
|
185
|
+
</symbol>`,DN=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
|
|
186
186
|
<path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
|
|
187
187
|
<path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
|
|
188
|
-
</symbol>`,
|
|
188
|
+
</symbol>`,ON=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
|
|
189
189
|
<path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
|
|
190
|
-
</symbol>`,
|
|
190
|
+
</symbol>`,kN=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
|
|
191
191
|
<path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
|
|
192
192
|
<path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
|
|
193
|
-
</symbol>`,
|
|
193
|
+
</symbol>`,AN=[IM,HM,UM,WM,qM,JM,YM,ZM,QM,$M,eN,tN,nN,cN,uN,dN,_N,vN,xN,SN,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
|
|
194
194
|
<path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
|
|
195
195
|
<path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
|
|
196
|
-
</symbol>`],
|
|
197
|
-
`)}\n</svg>`)}var DN=EN(DM,wN),ON={minimal:DM,standard:DN,complete:EN(DN,TN)},kN={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},AN={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,htm:`html`,html:`html`,icns:`image`,ico:`image`,ini:`text`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},jN={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},MN=new Set([`bash`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),NN=new Set([`complete`]);function PN(e){return ON[e===`none`?`minimal`:e]}function FN(e){return`file-tree-builtin-${e}`}function IN(e){return e!==`none`&&NN.has(e)}function LN(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=kN[t.toLowerCase()];if(i!=null&&(r||MN.has(i)))return i;for(let e of n){if(r){let t=jN[e];if(t!=null)return t}let t=AN[e];if(t!=null&&(r||MN.has(t)))return t}return`default`}var RN=`file-tree-container`,zN=`data-file-tree-style`,BN=`data-file-tree-unsafe-css`,VN=`data-file-tree-scrollbar-measure`,HN=`data-file-tree-scrollbar-gutter-measured`,UN=`--trees-scrollbar-gutter-measured`,WN=`header`,GN=`context-menu`,KN=`context-menu-trigger`;function qN(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function JN(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(qN(e)?`none`:`complete`),colored:e.colored??!0}}var YN=e=>e.trim().toLowerCase(),XN=e=>e.split(`/`).at(-1)??e,ZN=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function QN(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function $N(e){let t=JN(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(YN(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=XN(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return QN(c,e);for(let[t,n]of a)if(s.includes(t))return QN(n,e);let l=ZN(n);for(let t of l){let n=i.get(t);if(n!=null)return QN(n,e)}let u=LN(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:FN(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:QN(s,e)}}}var eP=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,tP=/^0(?:\.0+)?%?$/;function nP(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function rP(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||eP.test(t))return!0;let n=nP(t);return n!=null&&tP.test(n)}function iP(e){return rP(e)?void 0:e}function aP(e){let t=e.colors??{},n=t[`sideBar.background`]??t[`editor.background`]??e.bg,r=t[`sideBar.foreground`]??t[`editor.foreground`]??e.fg,i=t[`sideBar.border`],a=t[`list.activeSelectionForeground`]??t[`sideBar.foreground`],o=n?.toLowerCase(),s=t[`list.hoverBackground`],c=s?.toLowerCase()===o?void 0:s,l=t[`list.activeSelectionBackground`],u=l?.toLowerCase()===o?t[`list.focusBackground`]??t[`editor.selectionBackground`]:l??t[`editor.selectionBackground`],d=iP(t[`list.focusOutline`])??iP(t.focusBorder),f=t[`input.background`]??n,p=t[`input.border`],m=t[`scrollbarSlider.background`],h=t[`sideBarSectionHeader.foreground`]??r,g=t[`gitDecoration.addedResourceForeground`]??t[`terminal.ansiGreen`]??t[`editorGutter.addedBackground`],_=t[`gitDecoration.modifiedResourceForeground`]??t[`terminal.ansiBlue`]??t[`editorGutter.modifiedBackground`],v=t[`gitDecoration.deletedResourceForeground`]??t[`terminal.ansiRed`]??t[`editorGutter.deletedBackground`],y=e.type===`dark`,b={colorScheme:y?`dark`:`light`,backgroundColor:n??``,color:r??``,borderColor:`var(--trees-theme-sidebar-border, light-dark(oklch(0% 0 0 / 0.15), oklch(100% 0 0 / 0.15)))`,"--trees-theme-sidebar-bg":n??``,"--trees-theme-sidebar-fg":r??``,"--trees-theme-sidebar-header-fg":h??``,"--trees-theme-list-active-selection-fg":a??r??``,"--trees-theme-list-hover-bg":c??(y?`rgba(255,255,255,0.08)`:`rgba(0,0,0,0.06)`),"--trees-theme-list-active-selection-bg":u??`transparent`,"--trees-theme-focus-ring":d??r??``,"--trees-theme-input-bg":f??``};return i!=null&&i!==``&&(b[`--trees-theme-sidebar-border`]=i),p!=null&&p!==``&&(b[`--trees-theme-input-border`]=p),m!=null&&m!==``&&(b[`--trees-theme-scrollbar-thumb`]=m),g!=null&&g!==``&&(b[`--trees-theme-git-added-fg`]=g),_!=null&&_!==``&&(b[`--trees-theme-git-modified-fg`]=_),v!=null&&v!==``&&(b[`--trees-theme-git-deleted-fg`]=v),b}var oP=5,sP=1<<oP,cP=sP*4;function lP(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function uP(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function dP(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function fP(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function pP(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function mP(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function hP(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,yP(e,t)}function gP(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=fP(e).get(t);if(i===void 0)return;let a=i>>oP;e.childVisibleChunkSums[a]+=r}function _P(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=bP(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=sP}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function vP(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>oP;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<oP}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function yP(e,t){if(t.childIds.length<cP){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/sP),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>oP]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function bP(e,t,n,r){let i=Math.min(t.childIds.length,n+sP),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var xP=7,SP=3,CP=1<<SP,wP=4;function TP(e,t,n=0){return e<<wP|n<<SP|t}function EP(e){return e.depthAndFlags>>>wP}function DP(e){return(e.depthAndFlags&CP)>>SP}function OP(e){return(e.depthAndFlags&CP)!==0}function kP(e){return e.depthAndFlags&xP}function AP(e,t){return(kP(e)&t)!==0}function jP(e,t){e.depthAndFlags|=t}function MP(e,t){e.depthAndFlags=TP(t,kP(e),DP(e))}var NP=Symbol(`benchmarkInstrumentation`);function PP(e,t){return t==null||Object.defineProperty(e,NP,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function FP(e){return e==null?null:e[NP]??null}function IP(e,t,n){return e==null?n():e.measurePhase(t,n)}function LP(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function RP(e){return e>=48&&e<=57}function zP(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!RP(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&RP(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function BP(e){let t=e.toLowerCase();return{lowerValue:t,tokens:zP(t)}}function VP(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function HP(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=VP(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function UP(e,t,n){let r=HP(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function WP(e,t){return UP(e,t,BP)}function GP(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function KP(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=GP(e,r);return a===GP(t,r)?WP(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function qP(e,t){return KP(e,t)}function JP(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=BP(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=GP(e,n);return o===GP(t,n)?UP(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function YP(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=BP(r);return e.sortKeyById[t]=i,i}function XP(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function ZP(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function QP(e){let{hasTrailingSlash:t,segments:n}=ZP(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function $P(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=ZP(e);return{requiresDirectory:t,segments:n}}var eF=``;function tF(){let e=new Map;return e.set(eF,0),{idByValue:e,valueById:[eF],sortKeyById:[BP(eF)]}}function nF(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function rF(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var iF=Symbol(`pathStorePreparedInputKind`);function aF(e,t){return e[iF]=t,e}function oF(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function sF(e,t,n){return n===`default`?qP(e,t):n(oF(e),oF(t))}function cF(){return{depthAndFlags:TP(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function lF(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function uF(e){return e.isDirectory?e.segments.length:e.segments.length-1}function dF(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function fF(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function pF(e,t={}){return yF(e,t).map(e=>e.path)}function mF(e,t={}){let n=yF(e,t);return aF({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function hF(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return aF({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function gF(e){let t=e,n=t.preparedPaths;if(t[iF]===`prepared`&&n!=null)return n;if(!dF(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function _F(e){let t=e;return t[iF]===`presorted`&&t.presortedPaths!=null||fF(t.presortedPaths)?t.presortedPaths:null}function vF(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function yF(e,t={}){let n=XP(t),r=FP(t);LP(r,`workload.inputFiles`,e.length);let i=IP(r,`store.preparePathEntries.parse`,()=>e.map(e=>QP(e)));return IP(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>sF(e,t,n.sort))),i}var bF=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[cF()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=tF();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=FP(e),this.options=XP(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,lP())}appendPaths(e){return IP(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>QP(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,IP(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return IP(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:TP(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:TP(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:TP(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=QP(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:TP(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:TP(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=QP(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(IP(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||IP(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?JP(this.lastPreparedPath,e,this.segmentSortKeyCache):sF(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=uF(e),i=n==null?0:uF(n),a=n==null?0:lF(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=nF(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:TP(EP(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),pP(i,s),s}createFileChildUnchecked(e,t){let n=nF(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:TP(EP(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),pP(r,a),a}getOrCreateDirectoryChild(e,t){let n=nF(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!OP(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:TP(EP(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),pP(r,a),this.directories.set(a,lP()),a}createDirectoryChild(e,t){let n=nF(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:TP(EP(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),pP(r,a),this.directories.set(a,lP()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!OP(n))throw Error(`Path is not a directory: "${t}"`);if(AP(n,1))throw Error(`Duplicate path: "${t}"`);jP(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,uP());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(OP(a)){let t=uP();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;OP(n)&&this.directories.set(t,lP());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),pP(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!OP(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return hP(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function xF(e,t=`closed`,n=null){let r=CF(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function SF(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function CF(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function wF(e,t){return AP(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:EP(t)<=e.defaultExpansion}function TF(e,t,n=e.snapshot.nodes[t]){return n==null||!OP(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:wF(e,n)}function EF(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!OP(r))return;let i=wF(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function DF(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function OF(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function kF(e,t){let n=DF(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function AF(e,t){let n=DF(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function jF(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function MF(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function NF(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function PF(e,t){e.directoryLoadInfoById.delete(t)}function FF(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function IF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function LF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function RF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function zF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function BF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function VF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function HF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function UF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function WF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function GF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function KF(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function qF(e,t,n){return{...n,visibleCountDelta:iI(e)-t}}function JF(e,t){let n=iI(e),r=SF();e.transactionStack.push(r);try{t()}catch(t){throw ZF(e,r,!1),t}ZF(e,r,!0,iI(e)-n)}function YF(e,t){let n=e.instrumentation;if(n==null){XF(e,t);return}IP(n,`store.events.record`,()=>XF(e,t))}function XF(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){nI(e,t);return}n.events.push(t),tI(n,t)}function ZF(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?eI(i,t):IP(n,`store.events.batch.merge`,()=>eI(i,t));return}let a=QF(t,r),o=e.instrumentation;if(o==null){nI(e,a);return}IP(o,`store.events.batch.commit`,()=>nI(e,a))}function QF(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function $F(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function eI(e,t){for(let n of t.events)e.events.push(n);$F(e,t)}function tI(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function nI(e,t){let n=e.instrumentation;if(n==null){rI(e,t);return}IP(n,`store.events.emit`,()=>rI(e,t))}function rI(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function iI(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function aI(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!OP(n)||AP(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!OP(a)?null:i}function oI(e,t){let n=t;for(;;){let t=aI(e,n);if(t==null)return n;n=t}}function sI(e,t){let n=[t],r=t;for(;;){let t=aI(e,r);if(t==null)return n;n.push(t),r=t}}function cI(e,t){let n=t==null?e.snapshot.rootId:vI(e,t);return n==null?[]:SI(e,n)}function lI(e,t){let n=QP(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=LI(e,II(e,r)),{createdNodeIds:a,directoryId:o}=CI(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=xI(e,o);if(AP(n,1))throw Error(`Path already exists: "${t}"`);jP(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=TI(e,o,n.basename),s.add(c);hI(e,o);let l=LI(e,o);return IF({affectedAncestorIds:_I(e,c),affectedNodeIds:[...s],path:t,projectionChanged:RI(i,l)})}function uI(e,t,n){let r=vI(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=xI(e,r);if(AP(i,2))throw Error(`The root node cannot be removed`);if(OP(i)&&bI(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=LI(e,a),s=PI(e,r);OI(e,a,r,i.nameId),FI(e,a),hI(e,a);let c=LI(e,a);return LF({affectedAncestorIds:_I(e,a),affectedNodeIds:s,path:t,projectionChanged:RI(o,c),recursive:n.recursive===!0})}function dI(e,t,n,r){let i=vI(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=xI(e,i);if(AP(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=MI(e,i,n),c=LI(e,a.parentId),l=LI(e,s.parentId),u=rF(e.snapshot.segmentTable,a.nameId),d=nF(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(OP(a)&&HI(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=dP(e.snapshot.nodes,bI(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&NI(e,p,o,DP(a))===`skip`)return null;let m=a.parentId;OI(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),VI(e,i),DI(e,s.parentId,i),FI(e,m),e.pathCacheVersion++,hI(e,m),s.parentId!==m&&hI(e,s.parentId);let h=LI(e,m),g=LI(e,s.parentId);return RF({affectedAncestorIds:[...new Set([..._I(e,m),..._I(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:zI([c,l],[h,g]),to:mI(e,i)})}function fI(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function pI(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function mI(e,t){let n=xI(e,t),r=fI(e,t);if(r!=null)return r;if(AP(n,2))return pI(e,t,``);let i=mI(e,n.parentId),a=rF(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return pI(e,t,OP(n)?`${o}/`:o)}function hI(e,t){let n=e.instrumentation;if(n==null){WI(e,t);return}IP(n,`store.recomputeCountsUpwardFrom`,()=>WI(e,t))}function gI(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!OP(o)){UI(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){UI(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function _I(e,t){let n=[],r=t;for(;r!=null;){let t=xI(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function vI(e,t){if(t.length===0)return e.snapshot.rootId;let n=$P(t);return yI(e,n.segments,n.requiresDirectory)}function yI(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=bI(e,r),a=dP(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=xI(e,r);return n&&!OP(i)?null:r}function bI(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function xI(e,t){let n=e.snapshot.nodes[t];if(n===void 0||AP(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function SI(e,t){let n=e.snapshot.nodes[t];if(n===void 0||AP(n,4))return[];if(!OP(n))return[mI(e,t)];if(bI(e,t).childIds.length===0)return AP(n,1)&&!AP(n,2)?[mI(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||AP(n,4)){i.pop();continue}if(!OP(n)){r.push(mI(e,t.nodeId)),i.pop();continue}let a=bI(e,t.nodeId);if(a.childIds.length===0){AP(n,1)&&!AP(n,2)&&r.push(mI(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function CI(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=nF(e.snapshot.segmentTable,i),a=bI(e,r),o=dP(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!OP(xI(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=wI(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function wI(e,t,n){let r=xI(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:TP(EP(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,lP()),DI(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function TI(e,t,n){let r=nF(e.snapshot.segmentTable,n),i=bI(e,t);if(dP(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${KI(e,t,n)}"`);let a=xI(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:TP(EP(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),DI(e,t,o),e.activeNodeCount++,o}function EI(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}kI(e,n,o)<0?i=a:r=a+1}return r}function DI(e,t,n){let r=bI(e,t),i=xI(e,n);dP(e.snapshot.nodes,r).set(i.nameId,n),gP(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=EI(e,r,n);r.childIds.splice(a,0,n),mP(r,a),yP(e.snapshot.nodes,r)}function OI(e,t,n,r){let i=bI(e,t),a=fP(i),o=a.get(n)??-1;dP(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&gP(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),mP(i,o),yP(e.snapshot.nodes,i))}function kI(e,t,n){let r=e.snapshot.options.sort;return r===`default`?AI(e,t,n):r(jI(e,t),jI(e,n))}function AI(e,t,n){let r=xI(e,t),i=xI(e,n),a=OP(r);if(a!==OP(i))return a?-1:1;let o=HP(YP(e.snapshot.segmentTable,r.nameId),YP(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=rF(e.snapshot.segmentTable,r.nameId),c=rF(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function jI(e,t){let n=xI(e,t),r=mI(e,t),i=OP(n),a=i?r.slice(0,-1):r;return{basename:rF(e.snapshot.segmentTable,n.nameId),depth:EP(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function MI(e,t,n){let r=xI(e,t),i=vI(e,n);if(i!=null){let t=xI(e,i);if(OP(t))return{basename:rF(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=$P(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=$P(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:yI(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function NI(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${mI(e,t)}"`);let i=xI(e,t);if(DP(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(OP(i)&&bI(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return PI(e,t),OI(e,a,t,o),FI(e,a),hI(e,a),`handled`}function PI(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=xI(e,t.nodeId);if(t.visitedChildren||!OP(i)){OP(i)&&e.snapshot.directories.delete(t.nodeId),jP(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),PF(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=bI(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function FI(e,t){let n=t;for(;n!=null;){let t=xI(e,n);if(!OP(t)||AP(t,2)||bI(e,n).childIds.length>0)return;jP(t,1),n=t.parentId===n?null:t.parentId}}function II(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=dP(e.snapshot.nodes,bI(e,n)).get(t);if(i==null||!OP(xI(e,i)))break;n=i}return n}function LI(e,t){let n=BI(e,t);if(n==null)return null;let r=oI(e,n),i=xI(e,r),a=n===r?null:sI(e,n).map(t=>mI(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:bI(e,r).childIds.length>0,path:mI(e,r),terminalKind:DP(i)})}function RI(e,t){return zI([e],[t])}function zI(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function BI(e,t){let n=t;for(;n!=null;){let t=xI(e,n);if(!OP(t)||AP(t,2))return null;if(!TF(e,n,t))return n;n=t.parentId}return null}function VI(e,t){let n=xI(e,t);if(MP(n,(t===e.snapshot.rootId?-1:EP(xI(e,n.parentId)))+1),!OP(n))return;let r=bI(e,t);for(let t of r.childIds)VI(e,t)}function HI(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=xI(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function UI(e,t,n=xI(e,t),r=!1){let i=e.instrumentation;if(i==null){GI(e,t,n,r);return}IP(i,`store.recomputeNodeCounts`,()=>GI(e,t,n,r))}function WI(e,t){let n=t;for(;n!=null;){let t=xI(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(UI(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&gP(bI(e,s),n,a,o),n=s}}function GI(e,t,n,r){if(!OP(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=bI(e,t);if(r){let t=e.instrumentation;t==null?hP(e.snapshot.nodes,i):IP(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>hP(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,AP(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=aI(e,t)==null?TF(e,t,n)?1+o:1:o}function KI(e,t,n){let r=mI(e,t);return r.length===0?n:`${r}${n}`}function qI(e){return e!=null&&!AP(e,4)}function JI(e,t){let n=e.snapshot.nodes[t];return!qI(n)||!OP(n)||AP(n,2)?null:n}function YI(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&qI(e.snapshot.nodes[n])&&(t+=1);return t}function XI(e){return Math.max(0,e.valueById.length-1)}function ZI(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:YI(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:XI(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function QI(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function $I(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)JI(e,n)!=null&&t.push(mI(e,n));for(let t of e.expandedDirectoryIds)JI(e,t)!=null&&n.push(mI(e,t));return{collapsedPaths:t,expandedPaths:n}}function eL(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)JI(e,n)==null||OF(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:mI(e,n)});return t}function tL(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=vI(e,n);t!=null&&EF(e,t,!0,xI(e,t))}for(let n of t.collapsedPaths){let t=vI(e,n);t!=null&&EF(e,t,!1,xI(e,t))}}function nL(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=vI(e,n.path);t!=null&&JI(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function rL(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function iL(e){let t=e.snapshot.segmentTable,n=tF();for(let r of e.snapshot.nodes)if(qI(r)){if(AP(r,2)){r.nameId=0;continue}r.nameId=nF(n,rF(t,r.nameId))}e.snapshot.segmentTable=n}function aL(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!qI(r)||!OP(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return qI(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[xI(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),hP(e.snapshot.nodes,n)}}function oL(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(qI(n))break;--t}e.snapshot.nodes.length=t+1}function sL(e){let t=$I(e),n=eL(e);IP(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>rL(e)),IP(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>iL(e)),IP(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>aL(e)),IP(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>oL(e)),IP(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>tL(e,t)),IP(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>nL(e,n)),IP(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>gI(e,e.snapshot.rootId))}function cL(e){let t=$I(e),n=eL(e),r=IP(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>cI(e)),i=PP({...e.snapshot.options},e.instrumentation),a=IP(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new bF(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,IP(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>tL(e,t)),IP(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>nL(e,n)),IP(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>gI(e,e.snapshot.rootId))}function lL(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function uL(e,t){let n=ZI(e);t===`stable`?IP(e.instrumentation,`store.cleanup.stable`,()=>sL(e)):IP(e.instrumentation,`store.cleanup.aggressive`,()=>cL(e));let r=ZI(e);return QI(t,t===`stable`,n,r)}var dL=64;function fL(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function pL(e){return xI(e,e.snapshot.rootId).visibleSubtreeCount}function mL(e,t,n,r){let i=xI(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function hL(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:PL(e,t.cursor),setSize:t.setSize,subtreeEndIndex:mL(e,t.cursor,t.index,n)}}function gL(e,t,n,r,i,a){let o=bI(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=_P(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return _L(e,u,l,r+c,i+1,s,o.childIds.length,a)}function _L(e,t,n,r,i,a,o,s){if(!OP(xI(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=OL(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=xI(e,c.terminalNodeId);if(!OP(l)||!TF(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return gL(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function vL(e,t){let n=pL(e);if(t<0||t>=n)return null;let r=gL(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>mI(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=hL(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:PL(e,r.cursor),setSize:r.setSize,subtreeEndIndex:mL(e,r.cursor,r.index,n)}}function yL(e,t,n){let r=e.instrumentation,i=pL(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return NL(e,o+1);let t=[],n=TL(e,a);for(let r=a;r<=o&&n!=null;r++){let r=PL(e,n);t.push(r),n=AL(e,n)}return t}let s=[],c=0,l=0,u=IP(r,`store.getVisibleSlice.selectFirstRow`,()=>TL(e,a));for(let t=a;t<=o&&u!=null;t++){let t=IP(r,`store.getVisibleSlice.materializeRow`,()=>PL(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=IP(r,`store.getVisibleSlice.advanceCursor`,()=>AL(e,u))}return LP(r,`workload.visibleRowsRead`,s.length),LP(r,`workload.flattenedRowsRead`,c),LP(r,`workload.flattenedSegmentsRead`,l),s}function bL(e,t=pL(e)){let n=e.instrumentation;return n==null?ML(e,t):IP(n,`store.getVisibleTreeProjection`,()=>ML(e,t))}function xL(e){return jL(bL(e))}function SL(e,t){let n=vI(e,t);if(n==null||n===e.snapshot.rootId||OP(xI(e,n))&&oI(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=xI(e,i).parentId,n=bI(e,t),s=fP(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=vP(a,n,s),t!==o){let n=xI(e,t),a=aI(e,t);if(!TF(e,t,n)&&a!==i)return null;oI(e,t)===t&&(r+=1)}i=t}return r}function CL(e,t){let n=vI(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=xI(e,n);if(!OP(r))throw Error(`Path is not a directory: "${t}"`);return TF(e,n,r)?null:(EF(e,n,!0,r),hI(e,n),zF({affectedAncestorIds:_I(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function wL(e,t){let n=vI(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=xI(e,n);if(!OP(r))throw Error(`Path is not a directory: "${t}"`);return TF(e,n,r)?(EF(e,n,!1,r),hI(e,n),BF({affectedAncestorIds:_I(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function TL(e,t){return t<0||t>=pL(e)?null:EL(e,e.snapshot.rootId,t,-1)}function EL(e,t,n,r){let i=bI(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?_P(e.snapshot.nodes,i,n):IP(a,`store.getVisibleSlice.selectChildIndex`,()=>_P(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return DL(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function DL(e,t,n,r){if(!OP(xI(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=OL(e,t,r);if(n===0)return i;let a=xI(e,i.terminalNodeId);if(!OP(a)||!TF(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return EL(e,i.terminalNodeId,n-1,i.visibleDepth)}function OL(e,t,n){return OP(xI(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:oI(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:IP(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>oI(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function kL(e,t){let n=xI(e,t);if(!OP(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:aI(e,r)!==t}function AL(e,t){let n=xI(e,t.terminalNodeId);if(OP(n)){let r=bI(e,t.terminalNodeId);if(TF(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:DL(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=xI(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=bI(e,n),o=fP(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return DL(e,s,0,i);kL(e,r)&&i--,r=n}}function jL(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function ML(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(dL);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=fL(o,y);let x,S=_;if(OP(v))S=f?oI(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:mI(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&OP(C)&&TF(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function NL(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!OP(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:mI(e,f)};continue}let h=l?oI(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=PL(e,g);let _=i[h];_!=null&&OP(_)&&TF(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function PL(e,t){let n=xI(e,t.terminalNodeId),r=OP(n)?FL(e,t):null,i=mI(e,t.terminalNodeId),a=rF(e.snapshot.segmentTable,n.nameId),o=OP(n)&&bI(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?sI(e,t.headNodeId).map(n=>{let r=xI(e,n);return{isTerminal:n===t.terminalNodeId,name:rF(e.snapshot.segmentTable,r.nameId),nodeId:n,path:mI(e,n)}}):IP(c,`store.getVisibleSlice.flatten.collectSegments`,()=>sI(e,t.headNodeId).map(n=>{let r=xI(e,n);return{isTerminal:n===t.terminalNodeId,name:rF(e.snapshot.segmentTable,r.nameId),nodeId:n,path:mI(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:OP(n)&&TF(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:OP(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function FL(e,t){if(t.headNodeId===t.terminalNodeId)return OF(e,t.terminalNodeId);let n=sI(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=OF(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function IL(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!OP(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&yP(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&OP(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,yP(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function LL(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var RL=class e{#e;constructor(e={}){let t=FP(e),n=IP(t,`store.builder.create`,()=>new bF(e));if(e.preparedInput!=null){let t=_F(e.preparedInput);t==null?n.appendPreparedPaths(gF(e.preparedInput),!1):n.appendPresortedPaths(t,vF(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(IP(t,`store.preparePathEntries`,()=>yF(r,e)))}let r=IP(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=IP(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=IP(t,`store.state.create`,()=>xF(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:IP(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||LL(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&IP(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?IP(t,`store.state.initializeOpenVisibleCounts`,()=>IL(this.#e)):IP(t,`store.state.recomputeCounts`,()=>gI(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return pF(e,t)}static prepareInput(e,t={}){return mF(e,t)}static preparePresortedInput(e){return hF(e)}list(e){return IP(this.#e.instrumentation,`store.list`,()=>cI(this.#e,e))}add(e){IP(this.#e.instrumentation,`store.add`,()=>{let t=pL(this.#e);YF(this.#e,qF(this.#e,t,lI(this.#e,e)))})}remove(e,t={}){IP(this.#e.instrumentation,`store.remove`,()=>{let n=pL(this.#e);YF(this.#e,qF(this.#e,n,uI(this.#e,e,t)))})}move(e,t,n={}){IP(this.#e.instrumentation,`store.move`,()=>{let r=pL(this.#e),i=dI(this.#e,e,t,n);i!=null&&YF(this.#e,qF(this.#e,r,i))})}batch(e){JF(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return IP(this.#e.instrumentation,`store.getVisibleCount`,()=>pL(this.#e))}getVisibleSlice(e,t){return IP(this.#e.instrumentation,`store.getVisibleSlice`,()=>yL(this.#e,e,t))}getVisibleRowContext(e){return IP(this.#e.instrumentation,`store.getVisibleRowContext`,()=>vL(this.#e,e))}getVisibleTreeProjection(){return xL(this.#e)}getVisibleTreeProjectionData(e){return bL(this.#e,e)}getVisibleIndex(e){return IP(this.#e.instrumentation,`store.getVisibleIndex`,()=>SL(this.#e,e))}getPathInfo(e){return IP(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=vI(this.#e,e);if(t==null)return null;let n=xI(this.#e,t);return{depth:EP(n),kind:OP(n)?`directory`:`file`,path:mI(this.#e,t)}})}isExpanded(e){return IP(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=xI(this.#e,t);return TF(this.#e,t,n)})}expand(e){IP(this.#e.instrumentation,`store.expand`,()=>{let t=pL(this.#e),n=CL(this.#e,e);n!=null&&YF(this.#e,qF(this.#e,t,n))})}collapse(e){IP(this.#e.instrumentation,`store.collapse`,()=>{let t=pL(this.#e),n=wL(this.#e,e);n!=null&&YF(this.#e,qF(this.#e,t,n))})}on(e,t){return FF(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return OF(this.#e,t)}markDirectoryUnloaded(e){IP(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(bI(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=pL(this.#e);AF(this.#e,t),YF(this.#e,qF(this.#e,n,VF({affectedAncestorIds:_I(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return IP(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=pL(this.#e),r=kF(this.#e,t);return YF(this.#e,qF(this.#e,n,HF({affectedAncestorIds:_I(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return IP(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||OF(this.#e,n)!==`loading`||!MF(this.#e,n,e.attemptId))return!1;let r=mI(this.#e,n);this.validateChildPatch(r,t);let i=pL(this.#e),a=[];for(let e of t.operations){zL(r,e);let t=pL(this.#e);switch(e.type){case`add`:a.push(qF(this.#e,t,lI(this.#e,e.path)));break;case`remove`:a.push(qF(this.#e,t,uI(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=dI(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(qF(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return YF(this.#e,qF(this.#e,i,UF({affectedAncestorIds:_I(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:mI(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return IP(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=pL(this.#e),r=jF(this.#e,t,e.attemptId);return YF(this.#e,qF(this.#e,n,WF({affectedAncestorIds:_I(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:mI(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return IP(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=pL(this.#e),i=NF(this.#e,n,e.attemptId,t);return YF(this.#e,qF(this.#e,r,GF({affectedAncestorIds:_I(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:mI(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return IP(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(lL(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=pL(this.#e),n=uL(this.#e,e.mode??`stable`);return YF(this.#e,qF(this.#e,t,KF({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=bI(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??BP(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=HP(YP(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!OP(xI(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=xI(this.#e,n);TF(this.#e,n,i)||(EF(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=xI(this.#e,e);if(!TF(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=vI(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!OP(xI(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!OP(xI(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=xI(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=xI(this.#e,e),r=aI(this.#e,e);if(!TF(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function zL(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var BL={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function VL(e,t){if(typeof e==`number`)return{itemHeight:t??BL.default.itemHeight,factor:e};let n=BL[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var HL=BL.default.itemHeight,UL=`@layer base, theme, unsafe;
|
|
196
|
+
</symbol>`],jN=[PM,FM,LM,RM,zM,BM,VM,GM,KM,XM,rN,iN,aN,oN,sN,lN,fN,pN,mN,hN,gN,yN,bN,CN,wN,TN,EN,DN,ON,kN];function MN(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
|
|
197
|
+
`)}\n</svg>`)}var NN=MN(NM,AN),PN={minimal:NM,standard:NN,complete:MN(NN,jN)},FN={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},IN={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,htm:`html`,html:`html`,icns:`image`,ico:`image`,ini:`text`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},LN={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},RN=new Set([`bash`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),zN=new Set([`complete`]);function BN(e){return PN[e===`none`?`minimal`:e]}function VN(e){return`file-tree-builtin-${e}`}function HN(e){return e!==`none`&&zN.has(e)}function UN(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=FN[t.toLowerCase()];if(i!=null&&(r||RN.has(i)))return i;for(let e of n){if(r){let t=LN[e];if(t!=null)return t}let t=IN[e];if(t!=null&&(r||RN.has(t)))return t}return`default`}var WN=`file-tree-container`,GN=`data-file-tree-style`,KN=`data-file-tree-unsafe-css`,qN=`data-file-tree-scrollbar-measure`,JN=`data-file-tree-scrollbar-gutter-measured`,YN=`--trees-scrollbar-gutter-measured`,XN=`header`,ZN=`context-menu`,QN=`context-menu-trigger`;function $N(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function eP(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??($N(e)?`none`:`complete`),colored:e.colored??!0}}var tP=e=>e.trim().toLowerCase(),nP=e=>e.split(`/`).at(-1)??e,rP=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function iP(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function aP(e){let t=eP(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(tP(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=nP(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return iP(c,e);for(let[t,n]of a)if(s.includes(t))return iP(n,e);let l=rP(n);for(let t of l){let n=i.get(t);if(n!=null)return iP(n,e)}let u=UN(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:VN(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:iP(s,e)}}}var oP=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,sP=/^0(?:\.0+)?%?$/;function cP(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function lP(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||oP.test(t))return!0;let n=cP(t);return n!=null&&sP.test(n)}function uP(e){return lP(e)?void 0:e}function dP(e){let t=e.colors??{},n=t[`sideBar.background`]??t[`editor.background`]??e.bg,r=t[`sideBar.foreground`]??t[`editor.foreground`]??e.fg,i=t[`sideBar.border`],a=t[`list.activeSelectionForeground`]??t[`sideBar.foreground`],o=n?.toLowerCase(),s=t[`list.hoverBackground`],c=s?.toLowerCase()===o?void 0:s,l=t[`list.activeSelectionBackground`],u=l?.toLowerCase()===o?t[`list.focusBackground`]??t[`editor.selectionBackground`]:l??t[`editor.selectionBackground`],d=uP(t[`list.focusOutline`])??uP(t.focusBorder),f=t[`input.background`]??n,p=t[`input.border`],m=t[`scrollbarSlider.background`],h=t[`sideBarSectionHeader.foreground`]??r,g=t[`gitDecoration.addedResourceForeground`]??t[`terminal.ansiGreen`]??t[`editorGutter.addedBackground`],_=t[`gitDecoration.modifiedResourceForeground`]??t[`terminal.ansiBlue`]??t[`editorGutter.modifiedBackground`],v=t[`gitDecoration.deletedResourceForeground`]??t[`terminal.ansiRed`]??t[`editorGutter.deletedBackground`],y=e.type===`dark`,b={colorScheme:y?`dark`:`light`,backgroundColor:n??``,color:r??``,borderColor:`var(--trees-theme-sidebar-border, light-dark(oklch(0% 0 0 / 0.15), oklch(100% 0 0 / 0.15)))`,"--trees-theme-sidebar-bg":n??``,"--trees-theme-sidebar-fg":r??``,"--trees-theme-sidebar-header-fg":h??``,"--trees-theme-list-active-selection-fg":a??r??``,"--trees-theme-list-hover-bg":c??(y?`rgba(255,255,255,0.08)`:`rgba(0,0,0,0.06)`),"--trees-theme-list-active-selection-bg":u??`transparent`,"--trees-theme-focus-ring":d??r??``,"--trees-theme-input-bg":f??``};return i!=null&&i!==``&&(b[`--trees-theme-sidebar-border`]=i),p!=null&&p!==``&&(b[`--trees-theme-input-border`]=p),m!=null&&m!==``&&(b[`--trees-theme-scrollbar-thumb`]=m),g!=null&&g!==``&&(b[`--trees-theme-git-added-fg`]=g),_!=null&&_!==``&&(b[`--trees-theme-git-modified-fg`]=_),v!=null&&v!==``&&(b[`--trees-theme-git-deleted-fg`]=v),b}var fP=5,pP=1<<fP,mP=pP*4;function hP(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function gP(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function _P(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function vP(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function yP(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function bP(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function xP(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,TP(e,t)}function SP(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=vP(e).get(t);if(i===void 0)return;let a=i>>fP;e.childVisibleChunkSums[a]+=r}function CP(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=EP(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=pP}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function wP(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>fP;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<fP}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function TP(e,t){if(t.childIds.length<mP){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/pP),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>fP]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function EP(e,t,n,r){let i=Math.min(t.childIds.length,n+pP),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var DP=7,OP=3,kP=1<<OP,AP=4;function jP(e,t,n=0){return e<<AP|n<<OP|t}function MP(e){return e.depthAndFlags>>>AP}function NP(e){return(e.depthAndFlags&kP)>>OP}function PP(e){return(e.depthAndFlags&kP)!==0}function FP(e){return e.depthAndFlags&DP}function IP(e,t){return(FP(e)&t)!==0}function LP(e,t){e.depthAndFlags|=t}function RP(e,t){e.depthAndFlags=jP(t,FP(e),NP(e))}var zP=Symbol(`benchmarkInstrumentation`);function BP(e,t){return t==null||Object.defineProperty(e,zP,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function VP(e){return e==null?null:e[zP]??null}function HP(e,t,n){return e==null?n():e.measurePhase(t,n)}function UP(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function WP(e){return e>=48&&e<=57}function GP(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!WP(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&WP(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function KP(e){let t=e.toLowerCase();return{lowerValue:t,tokens:GP(t)}}function qP(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function JP(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=qP(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function YP(e,t,n){let r=JP(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function XP(e,t){return YP(e,t,KP)}function ZP(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function QP(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=ZP(e,r);return a===ZP(t,r)?XP(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function $P(e,t){return QP(e,t)}function eF(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=KP(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=ZP(e,n);return o===ZP(t,n)?YP(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function tF(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=KP(r);return e.sortKeyById[t]=i,i}function nF(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function rF(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function iF(e){let{hasTrailingSlash:t,segments:n}=rF(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function aF(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=rF(e);return{requiresDirectory:t,segments:n}}var oF=``;function sF(){let e=new Map;return e.set(oF,0),{idByValue:e,valueById:[oF],sortKeyById:[KP(oF)]}}function cF(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function lF(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var uF=Symbol(`pathStorePreparedInputKind`);function dF(e,t){return e[uF]=t,e}function fF(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function pF(e,t,n){return n===`default`?$P(e,t):n(fF(e),fF(t))}function mF(){return{depthAndFlags:jP(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function hF(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function gF(e){return e.isDirectory?e.segments.length:e.segments.length-1}function _F(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function vF(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function yF(e,t={}){return TF(e,t).map(e=>e.path)}function bF(e,t={}){let n=TF(e,t);return dF({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function xF(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return dF({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function SF(e){let t=e,n=t.preparedPaths;if(t[uF]===`prepared`&&n!=null)return n;if(!_F(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function CF(e){let t=e;return t[uF]===`presorted`&&t.presortedPaths!=null||vF(t.presortedPaths)?t.presortedPaths:null}function wF(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function TF(e,t={}){let n=nF(t),r=VP(t);UP(r,`workload.inputFiles`,e.length);let i=HP(r,`store.preparePathEntries.parse`,()=>e.map(e=>iF(e)));return HP(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>pF(e,t,n.sort))),i}var EF=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[mF()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=sF();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=VP(e),this.options=nF(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,hP())}appendPaths(e){return HP(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>iF(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,HP(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return HP(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:jP(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:jP(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:jP(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=iF(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:jP(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:jP(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=iF(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(HP(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||HP(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?eF(this.lastPreparedPath,e,this.segmentSortKeyCache):pF(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=gF(e),i=n==null?0:gF(n),a=n==null?0:hF(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=cF(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:jP(MP(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),yP(i,s),s}createFileChildUnchecked(e,t){let n=cF(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:jP(MP(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),yP(r,a),a}getOrCreateDirectoryChild(e,t){let n=cF(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!PP(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:jP(MP(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),yP(r,a),this.directories.set(a,hP()),a}createDirectoryChild(e,t){let n=cF(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:jP(MP(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),yP(r,a),this.directories.set(a,hP()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!PP(n))throw Error(`Path is not a directory: "${t}"`);if(IP(n,1))throw Error(`Duplicate path: "${t}"`);LP(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,gP());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(PP(a)){let t=gP();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;PP(n)&&this.directories.set(t,hP());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),yP(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!PP(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return xP(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function DF(e,t=`closed`,n=null){let r=kF(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function OF(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function kF(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function AF(e,t){return IP(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:MP(t)<=e.defaultExpansion}function jF(e,t,n=e.snapshot.nodes[t]){return n==null||!PP(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:AF(e,n)}function MF(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!PP(r))return;let i=AF(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function NF(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function PF(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function FF(e,t){let n=NF(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function IF(e,t){let n=NF(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function LF(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function RF(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function zF(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function BF(e,t){e.directoryLoadInfoById.delete(t)}function VF(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function HF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function UF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function WF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function GF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function KF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function qF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function JF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function YF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function XF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function ZF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function QF(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function $F(e,t,n){return{...n,visibleCountDelta:uI(e)-t}}function eI(e,t){let n=uI(e),r=OF();e.transactionStack.push(r);try{t()}catch(t){throw rI(e,r,!1),t}rI(e,r,!0,uI(e)-n)}function tI(e,t){let n=e.instrumentation;if(n==null){nI(e,t);return}HP(n,`store.events.record`,()=>nI(e,t))}function nI(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){cI(e,t);return}n.events.push(t),sI(n,t)}function rI(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?oI(i,t):HP(n,`store.events.batch.merge`,()=>oI(i,t));return}let a=iI(t,r),o=e.instrumentation;if(o==null){cI(e,a);return}HP(o,`store.events.batch.commit`,()=>cI(e,a))}function iI(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function aI(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function oI(e,t){for(let n of t.events)e.events.push(n);aI(e,t)}function sI(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function cI(e,t){let n=e.instrumentation;if(n==null){lI(e,t);return}HP(n,`store.events.emit`,()=>lI(e,t))}function lI(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function uI(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function dI(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!PP(n)||IP(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!PP(a)?null:i}function fI(e,t){let n=t;for(;;){let t=dI(e,n);if(t==null)return n;n=t}}function pI(e,t){let n=[t],r=t;for(;;){let t=dI(e,r);if(t==null)return n;n.push(t),r=t}}function mI(e,t){let n=t==null?e.snapshot.rootId:wI(e,t);return n==null?[]:OI(e,n)}function hI(e,t){let n=iF(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=UI(e,HI(e,r)),{createdNodeIds:a,directoryId:o}=kI(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=DI(e,o);if(IP(n,1))throw Error(`Path already exists: "${t}"`);LP(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=jI(e,o,n.basename),s.add(c);xI(e,o);let l=UI(e,o);return HF({affectedAncestorIds:CI(e,c),affectedNodeIds:[...s],path:t,projectionChanged:WI(i,l)})}function gI(e,t,n){let r=wI(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=DI(e,r);if(IP(i,2))throw Error(`The root node cannot be removed`);if(PP(i)&&EI(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=UI(e,a),s=BI(e,r);PI(e,a,r,i.nameId),VI(e,a),xI(e,a);let c=UI(e,a);return UF({affectedAncestorIds:CI(e,a),affectedNodeIds:s,path:t,projectionChanged:WI(o,c),recursive:n.recursive===!0})}function _I(e,t,n,r){let i=wI(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=DI(e,i);if(IP(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=RI(e,i,n),c=UI(e,a.parentId),l=UI(e,s.parentId),u=lF(e.snapshot.segmentTable,a.nameId),d=cF(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(PP(a)&&JI(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=_P(e.snapshot.nodes,EI(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&zI(e,p,o,NP(a))===`skip`)return null;let m=a.parentId;PI(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),qI(e,i),NI(e,s.parentId,i),VI(e,m),e.pathCacheVersion++,xI(e,m),s.parentId!==m&&xI(e,s.parentId);let h=UI(e,m),g=UI(e,s.parentId);return WF({affectedAncestorIds:[...new Set([...CI(e,m),...CI(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:GI([c,l],[h,g]),to:bI(e,i)})}function vI(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function yI(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function bI(e,t){let n=DI(e,t),r=vI(e,t);if(r!=null)return r;if(IP(n,2))return yI(e,t,``);let i=bI(e,n.parentId),a=lF(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return yI(e,t,PP(n)?`${o}/`:o)}function xI(e,t){let n=e.instrumentation;if(n==null){XI(e,t);return}HP(n,`store.recomputeCountsUpwardFrom`,()=>XI(e,t))}function SI(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!PP(o)){YI(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){YI(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function CI(e,t){let n=[],r=t;for(;r!=null;){let t=DI(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function wI(e,t){if(t.length===0)return e.snapshot.rootId;let n=aF(t);return TI(e,n.segments,n.requiresDirectory)}function TI(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=EI(e,r),a=_P(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=DI(e,r);return n&&!PP(i)?null:r}function EI(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function DI(e,t){let n=e.snapshot.nodes[t];if(n===void 0||IP(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function OI(e,t){let n=e.snapshot.nodes[t];if(n===void 0||IP(n,4))return[];if(!PP(n))return[bI(e,t)];if(EI(e,t).childIds.length===0)return IP(n,1)&&!IP(n,2)?[bI(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||IP(n,4)){i.pop();continue}if(!PP(n)){r.push(bI(e,t.nodeId)),i.pop();continue}let a=EI(e,t.nodeId);if(a.childIds.length===0){IP(n,1)&&!IP(n,2)&&r.push(bI(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function kI(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=cF(e.snapshot.segmentTable,i),a=EI(e,r),o=_P(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!PP(DI(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=AI(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function AI(e,t,n){let r=DI(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:jP(MP(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,hP()),NI(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function jI(e,t,n){let r=cF(e.snapshot.segmentTable,n),i=EI(e,t);if(_P(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${QI(e,t,n)}"`);let a=DI(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:jP(MP(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),NI(e,t,o),e.activeNodeCount++,o}function MI(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}FI(e,n,o)<0?i=a:r=a+1}return r}function NI(e,t,n){let r=EI(e,t),i=DI(e,n);_P(e.snapshot.nodes,r).set(i.nameId,n),SP(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=MI(e,r,n);r.childIds.splice(a,0,n),bP(r,a),TP(e.snapshot.nodes,r)}function PI(e,t,n,r){let i=EI(e,t),a=vP(i),o=a.get(n)??-1;_P(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&SP(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),bP(i,o),TP(e.snapshot.nodes,i))}function FI(e,t,n){let r=e.snapshot.options.sort;return r===`default`?II(e,t,n):r(LI(e,t),LI(e,n))}function II(e,t,n){let r=DI(e,t),i=DI(e,n),a=PP(r);if(a!==PP(i))return a?-1:1;let o=JP(tF(e.snapshot.segmentTable,r.nameId),tF(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=lF(e.snapshot.segmentTable,r.nameId),c=lF(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function LI(e,t){let n=DI(e,t),r=bI(e,t),i=PP(n),a=i?r.slice(0,-1):r;return{basename:lF(e.snapshot.segmentTable,n.nameId),depth:MP(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function RI(e,t,n){let r=DI(e,t),i=wI(e,n);if(i!=null){let t=DI(e,i);if(PP(t))return{basename:lF(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=aF(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=aF(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:TI(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function zI(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${bI(e,t)}"`);let i=DI(e,t);if(NP(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(PP(i)&&EI(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return BI(e,t),PI(e,a,t,o),VI(e,a),xI(e,a),`handled`}function BI(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=DI(e,t.nodeId);if(t.visitedChildren||!PP(i)){PP(i)&&e.snapshot.directories.delete(t.nodeId),LP(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),BF(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=EI(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function VI(e,t){let n=t;for(;n!=null;){let t=DI(e,n);if(!PP(t)||IP(t,2)||EI(e,n).childIds.length>0)return;LP(t,1),n=t.parentId===n?null:t.parentId}}function HI(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=_P(e.snapshot.nodes,EI(e,n)).get(t);if(i==null||!PP(DI(e,i)))break;n=i}return n}function UI(e,t){let n=KI(e,t);if(n==null)return null;let r=fI(e,n),i=DI(e,r),a=n===r?null:pI(e,n).map(t=>bI(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:EI(e,r).childIds.length>0,path:bI(e,r),terminalKind:NP(i)})}function WI(e,t){return GI([e],[t])}function GI(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function KI(e,t){let n=t;for(;n!=null;){let t=DI(e,n);if(!PP(t)||IP(t,2))return null;if(!jF(e,n,t))return n;n=t.parentId}return null}function qI(e,t){let n=DI(e,t);if(RP(n,(t===e.snapshot.rootId?-1:MP(DI(e,n.parentId)))+1),!PP(n))return;let r=EI(e,t);for(let t of r.childIds)qI(e,t)}function JI(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=DI(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function YI(e,t,n=DI(e,t),r=!1){let i=e.instrumentation;if(i==null){ZI(e,t,n,r);return}HP(i,`store.recomputeNodeCounts`,()=>ZI(e,t,n,r))}function XI(e,t){let n=t;for(;n!=null;){let t=DI(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(YI(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&SP(EI(e,s),n,a,o),n=s}}function ZI(e,t,n,r){if(!PP(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=EI(e,t);if(r){let t=e.instrumentation;t==null?xP(e.snapshot.nodes,i):HP(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>xP(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,IP(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=dI(e,t)==null?jF(e,t,n)?1+o:1:o}function QI(e,t,n){let r=bI(e,t);return r.length===0?n:`${r}${n}`}function $I(e){return e!=null&&!IP(e,4)}function eL(e,t){let n=e.snapshot.nodes[t];return!$I(n)||!PP(n)||IP(n,2)?null:n}function tL(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&$I(e.snapshot.nodes[n])&&(t+=1);return t}function nL(e){return Math.max(0,e.valueById.length-1)}function rL(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:tL(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:nL(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function iL(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function aL(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)eL(e,n)!=null&&t.push(bI(e,n));for(let t of e.expandedDirectoryIds)eL(e,t)!=null&&n.push(bI(e,t));return{collapsedPaths:t,expandedPaths:n}}function oL(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)eL(e,n)==null||PF(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:bI(e,n)});return t}function sL(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=wI(e,n);t!=null&&MF(e,t,!0,DI(e,t))}for(let n of t.collapsedPaths){let t=wI(e,n);t!=null&&MF(e,t,!1,DI(e,t))}}function cL(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=wI(e,n.path);t!=null&&eL(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function lL(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function uL(e){let t=e.snapshot.segmentTable,n=sF();for(let r of e.snapshot.nodes)if($I(r)){if(IP(r,2)){r.nameId=0;continue}r.nameId=cF(n,lF(t,r.nameId))}e.snapshot.segmentTable=n}function dL(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!$I(r)||!PP(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return $I(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[DI(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),xP(e.snapshot.nodes,n)}}function fL(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if($I(n))break;--t}e.snapshot.nodes.length=t+1}function pL(e){let t=aL(e),n=oL(e);HP(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>lL(e)),HP(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>uL(e)),HP(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>dL(e)),HP(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>fL(e)),HP(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>sL(e,t)),HP(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>cL(e,n)),HP(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>SI(e,e.snapshot.rootId))}function mL(e){let t=aL(e),n=oL(e),r=HP(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>mI(e)),i=BP({...e.snapshot.options},e.instrumentation),a=HP(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new EF(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,HP(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>sL(e,t)),HP(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>cL(e,n)),HP(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>SI(e,e.snapshot.rootId))}function hL(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function gL(e,t){let n=rL(e);t===`stable`?HP(e.instrumentation,`store.cleanup.stable`,()=>pL(e)):HP(e.instrumentation,`store.cleanup.aggressive`,()=>mL(e));let r=rL(e);return iL(t,t===`stable`,n,r)}var _L=64;function vL(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function yL(e){return DI(e,e.snapshot.rootId).visibleSubtreeCount}function bL(e,t,n,r){let i=DI(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function xL(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:BL(e,t.cursor),setSize:t.setSize,subtreeEndIndex:bL(e,t.cursor,t.index,n)}}function SL(e,t,n,r,i,a){let o=EI(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=CP(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return CL(e,u,l,r+c,i+1,s,o.childIds.length,a)}function CL(e,t,n,r,i,a,o,s){if(!PP(DI(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=PL(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=DI(e,c.terminalNodeId);if(!PP(l)||!jF(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return SL(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function wL(e,t){let n=yL(e);if(t<0||t>=n)return null;let r=SL(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>bI(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=xL(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:BL(e,r.cursor),setSize:r.setSize,subtreeEndIndex:bL(e,r.cursor,r.index,n)}}function TL(e,t,n){let r=e.instrumentation,i=yL(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return zL(e,o+1);let t=[],n=jL(e,a);for(let r=a;r<=o&&n!=null;r++){let r=BL(e,n);t.push(r),n=IL(e,n)}return t}let s=[],c=0,l=0,u=HP(r,`store.getVisibleSlice.selectFirstRow`,()=>jL(e,a));for(let t=a;t<=o&&u!=null;t++){let t=HP(r,`store.getVisibleSlice.materializeRow`,()=>BL(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=HP(r,`store.getVisibleSlice.advanceCursor`,()=>IL(e,u))}return UP(r,`workload.visibleRowsRead`,s.length),UP(r,`workload.flattenedRowsRead`,c),UP(r,`workload.flattenedSegmentsRead`,l),s}function EL(e,t=yL(e)){let n=e.instrumentation;return n==null?RL(e,t):HP(n,`store.getVisibleTreeProjection`,()=>RL(e,t))}function DL(e){return LL(EL(e))}function OL(e,t){let n=wI(e,t);if(n==null||n===e.snapshot.rootId||PP(DI(e,n))&&fI(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=DI(e,i).parentId,n=EI(e,t),s=vP(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=wP(a,n,s),t!==o){let n=DI(e,t),a=dI(e,t);if(!jF(e,t,n)&&a!==i)return null;fI(e,t)===t&&(r+=1)}i=t}return r}function kL(e,t){let n=wI(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=DI(e,n);if(!PP(r))throw Error(`Path is not a directory: "${t}"`);return jF(e,n,r)?null:(MF(e,n,!0,r),xI(e,n),GF({affectedAncestorIds:CI(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function AL(e,t){let n=wI(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=DI(e,n);if(!PP(r))throw Error(`Path is not a directory: "${t}"`);return jF(e,n,r)?(MF(e,n,!1,r),xI(e,n),KF({affectedAncestorIds:CI(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function jL(e,t){return t<0||t>=yL(e)?null:ML(e,e.snapshot.rootId,t,-1)}function ML(e,t,n,r){let i=EI(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?CP(e.snapshot.nodes,i,n):HP(a,`store.getVisibleSlice.selectChildIndex`,()=>CP(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return NL(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function NL(e,t,n,r){if(!PP(DI(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=PL(e,t,r);if(n===0)return i;let a=DI(e,i.terminalNodeId);if(!PP(a)||!jF(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ML(e,i.terminalNodeId,n-1,i.visibleDepth)}function PL(e,t,n){return PP(DI(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:fI(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:HP(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>fI(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function FL(e,t){let n=DI(e,t);if(!PP(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:dI(e,r)!==t}function IL(e,t){let n=DI(e,t.terminalNodeId);if(PP(n)){let r=EI(e,t.terminalNodeId);if(jF(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:NL(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=DI(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=EI(e,n),o=vP(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return NL(e,s,0,i);FL(e,r)&&i--,r=n}}function LL(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function RL(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(_L);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=vL(o,y);let x,S=_;if(PP(v))S=f?fI(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:bI(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&PP(C)&&jF(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function zL(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!PP(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:bI(e,f)};continue}let h=l?fI(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=BL(e,g);let _=i[h];_!=null&&PP(_)&&jF(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function BL(e,t){let n=DI(e,t.terminalNodeId),r=PP(n)?VL(e,t):null,i=bI(e,t.terminalNodeId),a=lF(e.snapshot.segmentTable,n.nameId),o=PP(n)&&EI(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?pI(e,t.headNodeId).map(n=>{let r=DI(e,n);return{isTerminal:n===t.terminalNodeId,name:lF(e.snapshot.segmentTable,r.nameId),nodeId:n,path:bI(e,n)}}):HP(c,`store.getVisibleSlice.flatten.collectSegments`,()=>pI(e,t.headNodeId).map(n=>{let r=DI(e,n);return{isTerminal:n===t.terminalNodeId,name:lF(e.snapshot.segmentTable,r.nameId),nodeId:n,path:bI(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:PP(n)&&jF(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:PP(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function VL(e,t){if(t.headNodeId===t.terminalNodeId)return PF(e,t.terminalNodeId);let n=pI(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=PF(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function HL(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!PP(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&TP(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&PP(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,TP(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function UL(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var WL=class e{#e;constructor(e={}){let t=VP(e),n=HP(t,`store.builder.create`,()=>new EF(e));if(e.preparedInput!=null){let t=CF(e.preparedInput);t==null?n.appendPreparedPaths(SF(e.preparedInput),!1):n.appendPresortedPaths(t,wF(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(HP(t,`store.preparePathEntries`,()=>TF(r,e)))}let r=HP(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=HP(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=HP(t,`store.state.create`,()=>DF(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:HP(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||UL(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&HP(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?HP(t,`store.state.initializeOpenVisibleCounts`,()=>HL(this.#e)):HP(t,`store.state.recomputeCounts`,()=>SI(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return yF(e,t)}static prepareInput(e,t={}){return bF(e,t)}static preparePresortedInput(e){return xF(e)}list(e){return HP(this.#e.instrumentation,`store.list`,()=>mI(this.#e,e))}add(e){HP(this.#e.instrumentation,`store.add`,()=>{let t=yL(this.#e);tI(this.#e,$F(this.#e,t,hI(this.#e,e)))})}remove(e,t={}){HP(this.#e.instrumentation,`store.remove`,()=>{let n=yL(this.#e);tI(this.#e,$F(this.#e,n,gI(this.#e,e,t)))})}move(e,t,n={}){HP(this.#e.instrumentation,`store.move`,()=>{let r=yL(this.#e),i=_I(this.#e,e,t,n);i!=null&&tI(this.#e,$F(this.#e,r,i))})}batch(e){eI(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return HP(this.#e.instrumentation,`store.getVisibleCount`,()=>yL(this.#e))}getVisibleSlice(e,t){return HP(this.#e.instrumentation,`store.getVisibleSlice`,()=>TL(this.#e,e,t))}getVisibleRowContext(e){return HP(this.#e.instrumentation,`store.getVisibleRowContext`,()=>wL(this.#e,e))}getVisibleTreeProjection(){return DL(this.#e)}getVisibleTreeProjectionData(e){return EL(this.#e,e)}getVisibleIndex(e){return HP(this.#e.instrumentation,`store.getVisibleIndex`,()=>OL(this.#e,e))}getPathInfo(e){return HP(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=wI(this.#e,e);if(t==null)return null;let n=DI(this.#e,t);return{depth:MP(n),kind:PP(n)?`directory`:`file`,path:bI(this.#e,t)}})}isExpanded(e){return HP(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=DI(this.#e,t);return jF(this.#e,t,n)})}expand(e){HP(this.#e.instrumentation,`store.expand`,()=>{let t=yL(this.#e),n=kL(this.#e,e);n!=null&&tI(this.#e,$F(this.#e,t,n))})}collapse(e){HP(this.#e.instrumentation,`store.collapse`,()=>{let t=yL(this.#e),n=AL(this.#e,e);n!=null&&tI(this.#e,$F(this.#e,t,n))})}on(e,t){return VF(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return PF(this.#e,t)}markDirectoryUnloaded(e){HP(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(EI(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=yL(this.#e);IF(this.#e,t),tI(this.#e,$F(this.#e,n,qF({affectedAncestorIds:CI(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return HP(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=yL(this.#e),r=FF(this.#e,t);return tI(this.#e,$F(this.#e,n,JF({affectedAncestorIds:CI(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return HP(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||PF(this.#e,n)!==`loading`||!RF(this.#e,n,e.attemptId))return!1;let r=bI(this.#e,n);this.validateChildPatch(r,t);let i=yL(this.#e),a=[];for(let e of t.operations){GL(r,e);let t=yL(this.#e);switch(e.type){case`add`:a.push($F(this.#e,t,hI(this.#e,e.path)));break;case`remove`:a.push($F(this.#e,t,gI(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=_I(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push($F(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return tI(this.#e,$F(this.#e,i,YF({affectedAncestorIds:CI(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:bI(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return HP(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=yL(this.#e),r=LF(this.#e,t,e.attemptId);return tI(this.#e,$F(this.#e,n,XF({affectedAncestorIds:CI(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:bI(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return HP(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=yL(this.#e),i=zF(this.#e,n,e.attemptId,t);return tI(this.#e,$F(this.#e,r,ZF({affectedAncestorIds:CI(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:bI(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return HP(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(hL(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=yL(this.#e),n=gL(this.#e,e.mode??`stable`);return tI(this.#e,$F(this.#e,t,QF({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=EI(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??KP(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=JP(tF(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!PP(DI(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=DI(this.#e,n);jF(this.#e,n,i)||(MF(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=DI(this.#e,e);if(!jF(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=wI(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!PP(DI(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!PP(DI(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=DI(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=DI(this.#e,e),r=dI(this.#e,e);if(!jF(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function GL(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var KL={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function qL(e,t){if(typeof e==`number`)return{itemHeight:t??KL.default.itemHeight,factor:e};let n=KL[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var JL=KL.default.itemHeight,YL=`@layer base, theme, unsafe;
|
|
198
198
|
|
|
199
199
|
@layer base {
|
|
200
200
|
:host {
|
|
@@ -1837,17 +1837,17 @@ This template lives in your user home (~/.ok/templates/) — deleting affects ev
|
|
|
1837
1837
|
}
|
|
1838
1838
|
}
|
|
1839
1839
|
}
|
|
1840
|
-
`,
|
|
1840
|
+
`,XL=`@layer base, unsafe;`;function ZL(e){return`${XL}
|
|
1841
1841
|
@layer base {
|
|
1842
1842
|
${e}
|
|
1843
|
-
}`}function
|
|
1843
|
+
}`}function QL(e){return`${XL}
|
|
1844
1844
|
@layer unsafe {
|
|
1845
1845
|
${e}
|
|
1846
|
-
}`}var qL=new WeakMap;function JL(e){let t=qL.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(VN,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),qL.set(e,i),i}function YL(e,t){if(!e.isConnected)return;let n=JL(t);if(n==null)return;let r=t.querySelector(`style[${HN}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(HN,``),t.appendChild(i)),i.textContent=`:host { ${UN}: ${n}px; }`}var XL;function ZL(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){XL??(XL=new CSSStyleSheet,XL.replaceSync(GL(UL)));let t=!1;try{e.adoptedStyleSheets=[XL],t=!0}catch{}if(t){e.querySelector(`style[${zN}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(zN,``),t.textContent=GL(UL),e.prepend(t)}}function QL(e,t){$L(e,t),ZL(t),YL(e,t)}function $L(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});QL(this,e)}}if(customElements.define(RN,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(RN)))e instanceof HTMLElement&&QL(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var eR=e=>e.startsWith(`f::`)?e.slice(3):e;function tR(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function nR(e,t){return e===``?t:`${e}/${t}`}function rR({files:e,path:t,isFolder:n,nextBasename:r}){let i=eR(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=tR(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=nR(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function iR(e){return e.endsWith(`/`)}function aR(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function oR(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function sR(e,t){return t.includes(e)?oR(t):[e]}function cR(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function lR(e,t){return{draggedPaths:e,target:t}}function uR(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(iR(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function dR(e,t){return t.kind===`root`||t.directoryPath==null?aR(e):t.directoryPath}function fR(e,t){let n=e.map(e=>{let n=dR(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}var pR=Symbol(`FILE_TREE_RENAME_VIEW`);function mR(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var hR=512,gR=512;function _R(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function vR(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function yR(e){return vR(e).at(-1)??null}function bR(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var xR=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},SR=e=>e.toLowerCase();function CR(e){return e.endsWith(`/`)}function wR(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function TR(e){return e.endsWith(`/`)?e.slice(0,-1):e}function ER(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function DR(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function OR(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function kR(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return OR(e,t.path)?n?e:null:e;case`move`:return DR(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=kR(r,e,n),r==null)return null;return r}}}function AR(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function jR(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function MR(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!jR(RL.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function NR(e){switch(e.operation){case`add`:return{...AR(e),operation:`add`,path:e.path};case`remove`:return{...AR(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...AR(e),from:e.from,operation:`move`,to:e.to}}}function PR(e){return{...AR(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>NR(e)),operation:`batch`}}function FR(e){switch(e.operation){case`add`:case`remove`:case`move`:return NR(e);case`batch`:return PR(e);default:return null}}function IR(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=vR(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function LR(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:IR(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var RR=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=new Set;#z=0;#B;#V=0;#H=!1;#U=0;#W;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=MR({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#B=this.#se(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ae(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#R=new Set(d),this.#L=f,this.#z=1),this.#Oe(f,!1),r!=null&&this.#Se(r,!1),this.#W=this.#Fe()}destroy(){this.#W?.(),this.#W=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#pe()}focusFirstItem(){this.#ve().length>0&&this.#Me(0)}focusLastItem(){this.#U<=0||(this.#Ne(),this.#Me(this.#U-1))}focusNextItem(){this.#De(1)}focusParentItem(){if(this.#c==null)return;let e=yR(this.#c);if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t)}focusPath(e){let t=this.#B.getPathInfo(e)?.path??null;if(t==null)return;this.#Ne();let n=this.#Y(t);n>=0&&this.#Me(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Y(t);return n>=0?(this.#Me(n),this.#ve()[n]??t):null}focusPreviousItem(){this.#De(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#X(this.#c)}getFocusedPath(){return this.#c}resolveNearestVisiblePath(e){let t=this.#ve();if(this.#U===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#B.getPathInfo(e)?.path??e,r=this.#Y(n);return r>=0?t[r]??n:this.#J(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#R]}getSelectionVersion(){return this.#z}getVisibleCount(){return this.#U}getVisibleRows(e,t){if(t<e||this.#U===0)return[];let n=Math.max(0,e),r=Math.min(this.#U-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=gR){let e=[];for(let t=n;t<=r;t+=1){let n=this.#B.getVisibleRowContext(t);if(n==null)break;e.push(this.#Q(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ne(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#ye(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#B.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#ye(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#Z(o,i,a,{ancestorPaths:this.#te(a),path:s})})}return this.#B.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#Z(e,r,r,{ancestorPaths:this.#te(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#U===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#U;r+=1){let i=e+r*t,a=Math.min(this.#U-1,Math.floor(i/t)),o=this.#$(a,r)??(a>0?this.#$(a-1,r):void 0);if(o==null)break;n.push({row:this.#Q(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#B.getPathInfo(e);return t==null?null:this.#X(t.path,t)}selectAllVisiblePaths(){this.#Ne();let e=[...this.#ve()];this.#re(e,this.#c??this.#L)}selectOnlyPath(e){let t=this.#Ae(e);t!=null&&this.#re([t],t)}selectPath(e){let t=this.#Ae(e);t==null||this.#R.has(t)||this.#re([...this.#R,t])}deselectPath(e){let t=this.#Ae(e);t==null||!this.#R.has(t)||this.#re([...this.#R].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.#re([...this.#R].filter(e=>e!==t),t);return}this.#re([...this.#R,t],t)}}selectPathRange(e,t){let n=this.#Ae(e);if(n==null)return;this.#Ne();let r=this.#L,i=r==null?-1:this.#be(r),a=this.#be(n);if(i===-1||a===-1){let e=t?[...this.#R,n]:[n];this.#re(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#ve().slice(o,s+1),l=t?[...this.#R,...c]:c;this.#re(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#U-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ne();let r=this.#ve(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#R);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#re([...o],this.#L??i,!1),this.#Me(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ae(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=sR(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#re([t],t,!1),this.#je(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#we(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=lR(t.draggedPaths,n);(uR(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}cR(t.target,n)||(this.#i={...t,target:n},this.#we())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#we())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#we(),!1;let n=lR(e.draggedPaths,t);if(uR(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=fR(e.draggedPaths,t);if(r==null)return this.#we(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#B.move(e.from,e.to,{collision:e.collision})}else this.#oe(r.operations),this.#B.batch(r.operations)}catch(e){return this.#we(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#B.add(e)}remove(e,t={}){this.#B.remove(e,t)}move(e,t,n={}){this.#B.move(e,t,n)}batch(e){this.#B.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Se(e,!0)}openSearch(e=``){this.#Se(e,!0)}closeSearch(){this.#Se(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#xe(1)}focusPreviousSearchMatch(){this.#xe(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#B.getPathInfo(e);if(n==null)return!1;let r=n.path,i=CR(r),a=TR(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of vR(r))this.#B.isExpanded(e)||this.#B.expand(e);return this.#re([r],r,!1),this.#M!=null&&(this.#Se(null,!1),this.#y?.(this.#M)),this.#je(r),this.#T=r,this.#E=wR(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[pR](){return{cancel:()=>{this.#G()},commit:()=>{this.#K()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#q(e)}}}#G(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,CR(e)?{recursive:!0}:void 0);return}this.#je(e),this.#we()}#K(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,CR(e)?{recursive:!0}:void 0);return}let t=CR(e),n=rR({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:TR(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#je(e),this.#v?.(n.error),this.#we();return}if(n.sourcePath===n.destinationPath){this.#je(e),this.#we();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(ER(n.sourcePath,t),ER(n.destinationPath,t))}#q(e){this.#T==null||this.#E===e||(this.#E=e,this.#we())}resetPaths(e,t={}){let n=this.#B.list().length,r=this.#U,i=MR({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#se(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#L;this.#W?.(),this.#B=a,this.#d.clear(),this.#pe();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!_R(this.#R,u);this.#R=new Set(u),d&&(this.#z+=1),this.#L=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#Oe(o,o!=null||u.length>0||this.#L!=null),this.#W=this.#Fe(),this.#we(),this.#Te({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#U-r})}#J(e){this.#Ne();let t=yR(e),n=bR(e,t),r=null,i=null;for(let e of this.#ve()){if(yR(e)!==t)continue;let a=bR(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Y(e){let t=this.#be(e);if(t!==-1)return t;let n=vR(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#be(t);if(r!==-1)return r}return this.#ve().length>0?0:-1}#X(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#B.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#ie(r.path):this.#ae(r.path);return this.#d.set(r.path,i),i}#Z(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#R.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#Q(e){return this.#Z(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#$(e,t){let n=this.#B.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ee(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ee(n),n];return this.#a.set(e,r),r}#te(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ee(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ne(e){this.#B.collapse(e)}#re(e,t=this.#L,n=!0){let r=[...new Set(e)],i=!_R(this.#R,r),a=this.#L!==t;!i&&!a||(this.#R=new Set(r),this.#L=t,i&&(this.#z+=1),n&&this.#we())}#ie(e){return{collapse:()=>{this.#ne(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#Ee(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#B.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#Ie(e)}}}#ae(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#oe(e){let t=this.#B.list();this.#se(t).batch(e)}#se(e,t,n){return new RL({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ce(){return this.#h??=this.#B.list(),this.#h}#le(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ce()){e.add(t);for(let n of vR(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(SR),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(SR),this.#p}#pe(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#me(){return this.#de().filter(e=>this.#B.isExpanded(e))}#he(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#R)for(let n of vR(e))t.add(n);this.#ge(t)}#ge(e){this.#H=!0;try{for(let t of this.#de()){let n=e.has(t),r=this.#B.isExpanded(t);n&&!r?this.#B.expand(t):!n&&r&&this.#B.collapse(t)}}finally{this.#H=!1}}#_e(){let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#M==null||this.#M.length===0||this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#U=this.#V;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#U=n.length}#ve(){return this.#I??this.#b}#ye(e){return this.#F?.[e]??e}#be(e){return this.#P?.get(e)??this.#B.getVisibleIndex(e)??-1}#xe(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Se(e,t){let n=e==null?null:xR(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#me()),this.#M=n,n==null)this.#he(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else if(n.length===0)this.#he(!1),this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else{let e=this.#Ce();this.#Oe(e,!0)}t&&(this.#y?.(this.#M),this.#we())}}#Ce(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ce(),n=this.#ue(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#de(),s=this.#fe();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of vR(e))l.add(t),c?.add(t)}return this.#ge(l),a??this.#c}#we(){for(let e of this.#t)e()}#Te(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#Ee(e){for(let t of vR(e))this.#B.isExpanded(t)||this.#B.expand(t);this.#B.isExpanded(e)||this.#B.expand(e)}#De(e){let t=this.#U;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ne(),this.#Me(r))}#Oe(e,t=!0){let n=this.#B.getVisibleCount();this.#V=n;let r=LR(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,hR)),e,t?e=>this.#B.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#_e(),this.#s=e==null?this.#ve().length>0?0:-1:this.#Y(e),this.#c=this.#s<0?null:this.#ke(this.#s)}#ke(e){return this.#ve()[e]??(this.#F==null?this.#B.getVisibleRowContext(e)?.row.path??null:null)}#Ae(e){return this.#B.getPathInfo(e)?.path??null}#je(e){if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t,!1)}#Me(e,t=!0){let n=this.#ke(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#we()))}#Ne(){this.#l||this.#Oe(this.#c,!0)}#Pe(e){let t=kR(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=kR(this.#c,e,!0),r=[...this.#R].map(t=>kR(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=kR(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return _R(this.#R,o)||(this.#R=new Set(o),this.#z+=1),this.#L=a,n}#Fe(){return this.#B.on(`*`,e=>{if(this.#H)return;e.canonicalChanged&&(this.#d.clear(),this.#pe()),this.#i!=null&&mR(e)&&(this.#i=null);let t=mR(e)?this.#Pe(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ce():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#Oe(n,r),this.#we();let i=FR(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},zR=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function BR(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function VR(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function HR(e,t){return t?`${e}/`:e}function UR(e,t=null){let n=zR(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=BR(t.path);if(e==null)continue;let n=HR(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of VR(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var WR,GR,KR,qR,JR,YR,XR,ZR,QR,$R,ez={},tz=[],nz=Array.isArray,rz=tz.slice,iz=Object.assign;function az(e){e&&e.parentNode&&e.remove()}function oz(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?rz.call(arguments,2):n),sz(e,o,r,i,null)}function sz(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++GR,__i:-1,__u:0};return i==null&&WR.vnode!=null&&WR.vnode(a),a}function cz(e){return e.children}function lz(e,t){this.props=e,this.context=t,this.__g=0}function uz(e,t){if(t==null)return e.__?uz(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?uz(e):null}function dz(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return dz(e)}}function fz(e){(8&e.__g||!(e.__g|=8)||!KR.push(e)||JR++)&&qR==WR.debounceRendering||((qR=WR.debounceRendering)||queueMicrotask)(pz)}function pz(){for(var e,t,n,r,i,a,o,s,c=1;KR.length;)KR.length>c&&KR.sort(YR),e=KR.shift(),c=KR.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=iz({},r)).__v=r.__v+1,WR.vnode&&WR.vnode(n),xz(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??uz(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Cz(a,n,o),n.__e!=i&&dz(n)));JR=0}function mz(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||tz,b=t.length;for(c=hz(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?ez:y[m.__i]||ez,m.__i=f,_=xz(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Ez(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=gz(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function hz(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?sz(null,o,null,null,null):nz(o)?sz(cz,{children:o},null,null,null):o.constructor==null&&o.__b>0?sz(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=_z(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=uz(s)),Dz(s,s));return r}function gz(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=gz(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=uz(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function _z(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function vz(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function yz(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||vz(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||vz(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(XR,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=ZR,e.addEventListener(t,a?$R:QR,a)):e.removeEventListener(t,a?$R:QR,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function bz(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=ZR++;else if(t.u<n.l)return;return n(WR.event?WR.event(t):t)}}}function xz(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=WR.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new lz(v,x),f.constructor=M,f.render=Oz),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=iz({},f.__s)),iz(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=WR.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=iz({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===cz&&d.key==null&&(E=wz(d.props.children)),s=mz(e,nz(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)az(a[j]);Sz(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Sz(t);WR.__e(e,t,n)}else s=t.__e=Tz(n.__e,t,n,r,i,a,o,c,l,u);return(d=WR.diffed)&&d(t),128&t.__u?void 0:s}function Sz(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Sz)}function Cz(e,t,n){for(var r=0;r<n.length;r++)Ez(n[r],n[++r],n[++r]);WR.__c&&WR.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){WR.__e(e,t.__v)}})}function wz(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:nz(e)?e.map(wz):iz({},e)}function Tz(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(WR.__m&&WR.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=rz.call(e.childNodes),v=n.props||ez,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;yz(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||yz(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),mz(b==`template`?e.content:e,nz(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&uz(n,0),s,c,l),a!=null)for(u=a.length;u--;)az(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||yz(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&yz(e,u,g,v[u],i))}return e}function Ez(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){WR.__e(e,n)}}function Dz(e,t,n){var r,i;if(WR.unmount&&WR.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ez(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){WR.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Dz(r[i],t,n||typeof e.type!=`function`);n||az(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Oz(e,t,n){return this.constructor(e,n)}function kz(e,t){var n,r,i,a;t==document&&(t=document.documentElement),WR.__&&WR.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=oz(cz,null,[e]),i=[],a=[],xz(t,e,r||ez,ez,t.namespaceURI,r?null:t.firstChild?rz.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Cz(i,e,a)}function Az(e,t){e.__u|=32,kz(e,t)}WR={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw JR=0,e}},GR=0,lz.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=iz({},this.state);typeof e==`function`&&(e=e(iz({},n),this.props)),e&&iz(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),fz(this))},lz.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),fz(this))},lz.prototype.render=cz,KR=[],JR=0,YR=function(e,t){return e.__v.__b-t.__v.__b},XR=/(PointerCapture)$|Capture$/i,ZR=0,QR=bz(!1),$R=bz(!0);var jz=0;Array.isArray;function Mz(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--jz,__i:-1,__u:0,__source:i,__self:a};return WR.vnode&&WR.vnode(l),l}var Nz=16,Pz=16,Fz={};function Iz({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=Fz[e]??{width:Nz,height:Pz},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Mz(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Mz(`use`,{href:c})})}var Lz=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Rz=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},zz=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},Bz=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},Vz=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},Hz=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function Uz({children:e,marker:t,variant:n=`default`}){"use no memo";return Mz(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Mz(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Mz(`span`,{"data-truncate-fade":!0}):t})})}function Wz(e){"use no memo";let{mode:t,children:n}=e;return Mz(`div`,{children:[Mz(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Mz(`span`,{children:n}):n}),Mz(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Mz(`span`,{children:n}):n})]})}function Gz({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Mz(Wz,{mode:t,children:e},`content`),o=Mz(Uz,{marker:n,mode:t,variant:r},`marker`),s=Mz(`div`,{"data-truncate-fill":!0},`fill`);return Mz(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Mz(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function Kz({children:e,...t}){"use no memo";return Mz(Gz,{mode:`truncate`,...t,children:e})}function qz({children:e,...t}){"use no memo";return Mz(Gz,{mode:`fruncate`,...t,children:e})}function Jz({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Mz(Kz,{...s,children:t[0]}),l=Mz(qz,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Mz(`div`,{className:a,style:o});if(e.length<i)return Mz(n===`end`?qz:Kz,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Lz:r===`extension`?t=Rz:r===`leaf-path`&&(t=zz);else if(typeof r==`number`)t=Bz,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Vz:e===`first`&&(t=Hz)}else typeof r==`function`&&(t=r);t??=Lz;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Mz(Kz,{...s,..._,children:f}),l=Mz(qz,{...s,...v,children:p})}return Mz(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Mz(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Mz(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var Yz={endIndex:-1,startIndex:-1};function Xz(e,t,n){return Math.min(Math.max(e,t),n)}function Zz(e,t){return e<0||t<e?Yz:{endIndex:t,startIndex:e}}function Qz(e){return e.startIndex<0||e.endIndex<e.startIndex}function $z(e,t){return Qz(e)?0:(e.endIndex-e.startIndex+1)*t}function eB(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function tB(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function nB(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function rB(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function iB(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function aB(e,t,n){if(e.length===0||t<=0)return[];let r=iB(e),i=nB(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=rB(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function oB(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=Xz(t.scrollTop,0,o),c=t.stickyRows??aB(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=eB(s,n,t.itemHeight),m=eB(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?Yz:Zz(m,tB(u+d,n,t.itemHeight)),y=g+1,b=Qz(v)?Yz:Zz(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=$z(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:Qz(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var sB={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},cB={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},lB=`Contains git status items`;function uB(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function dB(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function fB(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}function pB(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function mB(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}var hB,gB,_B,vB,yB=Object.is,bB=0,xB=[],SB=WR,CB=SB.__b,wB=SB.__r,TB=SB.diffed,EB=SB.__c,DB=SB.unmount,OB=SB.__;function kB(e,t){SB.__h&&SB.__h(gB,e,bB||t),bB=0;var n=gB.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function AB(e){return bB=1,jB(UB,e)}function jB(e,t,n){var r=kB(hB++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):UB(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);yB(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=gB,!gB.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,yB(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};gB.__f=!0;var a=gB.shouldComponentUpdate,o=gB.componentWillUpdate;gB.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},gB.shouldComponentUpdate=i}return r.__N||r.__}function MB(e,t){var n=kB(hB++,3);!SB.__s&&HB(n.__H,t)&&(n.__=e,n.u=t,gB.__H.__h.push(n))}function NB(e,t){var n=kB(hB++,4);!SB.__s&&HB(n.__H,t)&&(n.__=e,n.u=t,gB.__h.push(n))}function PB(e){return bB=5,FB(function(){return{current:e}},[])}function FB(e,t){var n=kB(hB++,7);return HB(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function IB(e,t){return bB=8,FB(function(){return e},t)}function LB(){for(var e;e=xB.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(BB),e.__H.__h.forEach(VB),e.__H.__h=[]}catch(t){e.__H.__h=[],SB.__e(t,e.__v)}}SB.__b=function(e){gB=null,CB&&CB(e)},SB.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),OB&&OB(e,t)},SB.__r=function(e){wB&&wB(e),hB=0;var t=(gB=e.__c).__H;t&&(_B===gB?(t.__h=[],gB.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(BB),t.__h.forEach(VB),t.__h=[],hB=0)),_B=gB},SB.diffed=function(e){TB&&TB(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(xB.push(t)!==1&&vB===SB.requestAnimationFrame||((vB=SB.requestAnimationFrame)||zB)(LB)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),_B=gB=null},SB.__c=function(e,t){t.some(function(e){try{e.__h.forEach(BB),e.__h=e.__h.filter(function(e){return!e.__||VB(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],SB.__e(n,e.__v)}}),EB&&EB(e,t)},SB.unmount=function(e){DB&&DB(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{BB(e)}catch(e){t=e}}),n.__H=void 0,t&&SB.__e(t,n.__v))};var RB=typeof requestAnimationFrame==`function`;function zB(e){var t,n=function(){clearTimeout(r),RB&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);RB&&(t=requestAnimationFrame(n))}function BB(e){var t=gB,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),gB=t}function VB(e){var t=gB;e.__c=e.__(),gB=t}function HB(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!yB(t,e[n])})}function UB(e,t){return typeof t==`function`?t(e):t}function WB(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function GB(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function KB({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Mz(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function qB(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Mz(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Mz(cz,{children:[Mz(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Mz(Kz,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function JB(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function YB(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function XB(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function ZB({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=oB(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:XB(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?XB(u,1,t,o):i&&r<=0&&c.length>0?aB(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var QB=400,$B=10,eV=40,tV=18;function nV(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?rV(e,t,n):a instanceof HTMLElement?a:null}function rV(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function iV(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function aV(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function oV(){return navigator.vendor!==`Apple Computer, Inc.`}function sV(e,t){let n=e-t.top;if(n<eV)return-Math.ceil((eV-Math.max(0,n))/eV*tV);let r=t.bottom-e;return r<eV?Math.ceil((eV-Math.max(0,r))/eV*tV):0}function cV(e,t){if(e!=null){let t=sB[e];return t==null?null:{text:t,title:cB[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:lB}:null}function lV(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function uV(e){return e!=null&&`toggle`in e}function dV(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function fV(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function pV(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function mV(e,t){return e!=null&&e>0?e:t}function hV(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function gV(e,t,n,r,i=0){let a=pB({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function _V(e,t,n,r,i,a){let o=mB({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function vV(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function yV(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function bV(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function xV(e,t){return t&&bV(e)||(e.ctrlKey||e.metaKey)&&dV(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var SV=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function CV(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function wV(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function TV(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function EV(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function DV(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function OV(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function kV(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function AV(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function jV(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=AV(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function MV(e,t){return{kind:e.kind,name:YB(e),path:t}}function NV(e){return e==null?void 0:`${e}__tree`}function PV(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function FV(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function IV(e,t){if(e==null)return null;if(`text`in e)return Mz(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?FV(e.icon)?t(e.icon):{name:e.icon}:FV(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Mz(`span`,{title:e.title,children:Mz(Iz,{...n})})}function LV(e){e!=null&&WB(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function RV(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=JB(e);return Mz(cz,{children:[e.depth>0?Mz(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Mz(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Mz(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Mz(Iz,{...t(`file-tree-icon-chevron`)}):Mz(Iz,{...t(`file-tree-icon-file`,u)})}),Mz(`div`,{"data-item-section":`content`,children:e.isFlattened?qB(e,c,a):c??Mz(Jz,{minimumLength:5,split:`extension`,children:e.name})}),i?Mz(`div`,{"data-item-section":`decoration`,children:r==null?null:IV(r,t)}):null,s?Mz(`div`,{"data-item-section":`git`,children:IV(o,t)}):null,n?Mz(`div`,{"data-item-section":`action`,children:l?Mz(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Mz(Iz,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function zV(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=JB(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??lV(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=cV(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,q=K?a.getValue():``,ee=R||!K?null:Mz(KB,{ref:D,ariaLabel:`Rename ${YB(t)}`,isFlattened:t.isFlattened,value:q,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),te=RV(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:ee,showDecorativeActionAffordance:G}),ne={...dB({ariaLabel:YB(t),domId:t.isFocused?PV(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusPath(P),j(t,P,{anchorRect:TV(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusPath(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&K?Mz(`div`,{...ne,children:te}):Mz(`button`,{...ne,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:te})}function BV(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(JB(e))).map((n,r)=>zV(e,n,t.start+r))}function VV({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=HL,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=PB(null),v=PB(null),y=PB(!1),b=PB(null),x=PB(null),S=PB(null),C=PB(null),w=PB(null),T=PB(new Map),E=PB(new Map),D=PB(()=>{}),O=PB(null),k=PB(!1),A=PB(null),j=PB(null),M=PB(!1),N=PB(null),P=PB(null),F=PB(null),I=PB(null),L=PB(null),R=PB(null),z=PB(null),B=PB(null),V=PB(!1),H=PB(null),U=PB(null),W=PB(null),G=PB(null),K=FB(()=>new Map,[]),[,q]=AB(0),[ee,te]=AB(null),[ne,re]=AB(null),[ie,ae]=AB(null),[oe,se]=AB(null),[ce,le]=AB(0),[ue,de]=AB(null),fe=PB(ue);fe.current=ue;let pe=PB(null),me=PB(null),he=PB(null),ge=PB(null),_e=PB(null),ve=PB(!1),ye=()=>{me.current=null,he.current=null,ge.current=null},be=(e,t)=>{me.current=e,he.current=null,ge.current=t==null?null:{path:e,scrollTop:t}},xe=(e,t)=>{me.current=null,he.current={path:e,viewportOffset:t},ge.current=null},Se=PB(d===`retain`&&t.isSearchOpen()),[Ce,we]=AB(p);MB(()=>{p||we(!1)},[p]);let Te=PB(!1),J=IB(()=>{Te.current=!0,we(e=>e&&!1)},[]),[Ee,De]=AB(()=>ZB({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Oe,ke]=AB(!1);MB(()=>{ke(!0)},[]);let Ae=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,je=e?.contextMenu?.triggerMode??(Ae?`right-click`:`both`),Me=je===`both`||je===`button`,Ne=e?.contextMenu?.buttonVisibility??`when-needed`,Pe=je===`both`||je===`right-click`;NB(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;_e.current=t,re(t),se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(ve.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Fe=IB((e,t)=>{DV(T.current,e,t)},[]),Ie=IB((e,t)=>{DV(E.current,e,t)},[]),Le=IB(e=>{x.current=e},[]),Re=IB(e=>OV(e,E.current,T.current),[]),ze=n!=null||r!=null||i!=null,{resolveIcon:Be}=FB(()=>$N(a),[a]),Ve=t[pR](),He=Ve.getPath(),Ue=He!=null,We=t.isSearchOpen(),Ge=t.getSearchValue(),Ke=t.getFocusedPath(),qe=t.getFocusedIndex(),Je=t.isDragAndDropEnabled(),Ye=t.getDragSession(),Xe=FB(()=>Ye==null?null:new Set(Ye.draggedPaths),[Ye]),Ze=Ye?.target??null,Qe=Ye?.primaryPath??null,$e=NV(o),{overlayHeight:et,overlayRows:tt,snapshot:nt,visibleRows:rt}=Ee,it=nt.physical.viewportHeight,at=FB(()=>({end:nt.window.endIndex,start:nt.window.startIndex}),[nt.window.endIndex,nt.window.startIndex]),ot=tt,st=nt.sticky.rows,ct=nt.physical.totalHeight,lt=nt.sticky.height,ut=FB(()=>new Set(st.map(e=>JB(e.row))),[st]),dt=qe>=0&&qe>=at.start&&qe<=at.end,ft=IB((e,t)=>u?.({item:MV(e,t),row:e})??null,[u]),pt=IB(e=>WB(e==null?null:T.current.get(e)??null)?!0:WB(S.current),[]),mt=IB(e=>{pt(t.focusNearestPath(e))},[t,pt]),ht=PB(mt);ht.current=mt;let gt=PB(!0),_t=PB(()=>{}),vt=IB((t=!0)=>{let n=fe.current;n!=null&&(gt.current=gt.current&&t,de(null),e?.contextMenu?.onClose?.(),gt.current&&mt(n.path))},[e?.contextMenu,mt]);_t.current=vt;let yt=IB(e=>{let t=e==null?null:EV(S.current,e);ae(e=>e===t?e:t)},[]),bt=IB((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Re(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;be(n,e?.scrollTop??null),k.current=!0,te(e=>e===n?e:n)}i.focus(),yt(a),gt.current=!0,de({anchorRect:r?.anchorRect??null,item:MV(e,n),path:n,source:r?.source??`keyboard`})},[t,Re,yt]),xt=IB(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=pV(e,it);N.current=qe<0||e==null?null:Math.max(0,Math.min(qe*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),q(e=>e+1))}},[t,qe,s,l,it]),St=IB((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=pV(i,it),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:ZB({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,_V(i,a,s,l,u,d),D.current(),pe.current=n?e:null,!0},[t,s,c,it,h]),Ct=()=>y.current===!0||G.current!=null||V.current===!0,wt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Tt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Et=()=>{I.current!=null&&(clearTimeout(I.current),I.current=null),F.current=null},Dt=()=>{R.current?.remove(),R.current=null},Ot=()=>{Tt(P.current),P.current=null,L.current=null},kt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},At=()=>{B.current?.(),B.current=null,G.current!=null&&(clearTimeout(G.current),G.current=null),V.current=!1,H.current=null,W.current=null,U.current!=null&&(U.current.setAttribute(`draggable`,`true`),U.current.style.removeProperty(`touch-action`),U.current=null),Dt(),Et(),Ot(),z.current=null},jt=(e,n)=>{let r=S.current?.getRootNode(),i=iV(nV(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Mt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Et();return}let r=t.getItem(e.directoryPath),i=uV(r)?r:null;if(i==null||i.isExpanded()){Et();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;F.current!==a&&(Et(),F.current=a,I.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Nt=()=>{P.current=null;let e=L.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=sV(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Mt(jt(e.clientX,e.clientY)),P.current=wt(Nt)},Pt=(e,t)=>{L.current={clientX:e,clientY:t},P.current??=wt(Nt)},Ft=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(At(),Dt(),Et(),Ot(),t.startDrag(r)===!1){e.preventDefault();return}if(z.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),oV())){let t=aV(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),kt(t),R.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},It=()=>{Dt(),Et(),Ot(),z.current=null,t.cancelDrag()},Lt=(e,n,r)=>{if(G.current!=null||V.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;W.current={clientX:i.clientX,clientY:i.clientY},U.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!V.current;G.current!=null&&(clearTimeout(G.current),G.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),B.current===o&&(B.current=null),t&&(a.setAttribute(`draggable`,`true`),U.current===a&&(U.current=null),W.current=null)},s=e=>{let t=e.touches[0],n=W.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=$B*$B||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),B.current=o,G.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),U.current===a&&(U.current=null),W.current=null;return}V.current=!0,U.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),z.current=n;let e=a.getBoundingClientRect(),s=aV(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),kt(s),R.current=s,H.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=H.current;n!=null&&R.current!=null&&(R.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Mt(jt(t.clientX,t.clientY)),Pt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&jt(n.clientX,n.clientY),t.completeDrag(),At()},u=()=>{t.cancelDrag(),At()};B.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},QB)},Rt=e=>{if(ue!=null){if(e.key===`Escape`){vt(),e.preventDefault(),e.stopPropagation();return}SV.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ve.isActive()){if(e.key===`Escape`)Ve.cancel();else if(e.key===`Enter`)Ve.commit();else return;se(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){xt(Ke??void 0),e.preventDefault(),e.stopPropagation();return}if(We){if(e.key===`Escape`)M.current=!1,N.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=pV(n,it);N.current=qe<0||n==null?null:Math.max(0,Math.min(qe*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;se(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&fV(e)){t.openSearch(e.key),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ae&&bV(e),r=xV(e,Ae),i=r&&S.current!=null?GB(S.current):null,a=r?new Set(kV(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Ke&&a.has(o)){let e=C.current;be(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=uV(p)?p:null,h=u!=null&&(ut.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=OV(u,E.current,T.current);e==null||n==null?y=!1:bt(e,u)}else if((e.ctrlKey||e.metaKey)&&dV(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ut.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))be(b,v?.scrollTop??null),k.current=!0,te(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(xe(b,jV(S.current,v,i,u,s,lt,it)),k.current=!0,te(e=>e===b?e:b)):ye()}q(e=>e+1),e.preventDefault(),e.stopPropagation()};NB(()=>{if(!(!f||!We)){if(Se.current){Se.current=!1;return}WB(w.current)}},[We,f]),NB(()=>{let e=x.current;switch(uB({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:He})){case`reset`:j.current=null;return;case`reveal-canonical`:He!=null&&St(He,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(pe.current=null,j.current=He,WB(e),e.select());return}},[at.end,at.start,He,St,ut]),NB(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=GB(e)?.dataset.itemPath??null;te(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,GB(e)!=null){r();return}k.current=!1,te(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,te(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;te(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),NB(()=>{let e=S.current;e!=null&&(nt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[nt.physical.scrollTop]),NB(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=pV(n,g);let a=()=>{let e=t.getVisibleCount(),r=mV(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),De(ZB({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};D.current=a;let o=!1,l=t.subscribe(()=>{o?q(e=>e+1):o=!0,a()}),u=()=>{ve.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,le(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||ve.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),fe.current!=null&&y.current&&_t.current(),ve.current===!0){y.current=!1;return}re(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:hV(e[0]))??pV(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),NB(()=>{Ae||ue==null||vt(!1)},[vt,Ae,ue]);let zt=FB(()=>ue==null?null:`${ue.path}::${ue.source}`,[ue]);NB(()=>{if(zt==null){m?.clearSlotContent(GN);return}let t=fe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??wV(n.getBoundingClientRect()),close:e=>{_t.current(e?.restoreFocus??!0)},restoreFocus:()=>{gt.current&&ht.current(fe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(GN,i),e?.contextMenu?.onOpen?.(t.item,r),LV(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&LV(i)}),()=>{m?.clearSlotContent(GN)}},[zt,e?.contextMenu,m]),NB(()=>{ue!=null&&t.getItem(ue.path)==null&&vt()},[vt,ue,t]),NB(()=>{if(ue==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(CV(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&vt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),vt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[vt,ue]),NB(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=Ke;return}let n=Ke==null?null:T.current.get(Ke)??null,r=GB(t),i=r?.dataset.itemPath??null,a=Ue&&x.current===r,o=f&&w.current===r,c=M.current&&!We,l=N.current??0,u=pe.current,d=me.current,p=he.current,m=ge.current,h=r!=null,g=k.current||h,_=A.current!==Ke,v=d!=null&&d===Ke&&Ke!=null,y=c&&_V(e,qe,s,it,ct,l),b=u!=null&&u===Ke&&_V(e,qe,s,it,ct,lt),E=p!=null&&p.path===Ke&&_V(e,qe,s,it,ct,p.viewportOffset),O=m!=null&&m.path===Ke&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==Ke&&!v&&gV(e,qe,s,it,lt))&&D.current(),!g){A.current=Ke;return}if(a){A.current=Ke;return}if(o&&!c){A.current=Ke;return}if(n==null){c&&qe>=0&&(_V(e,qe,s,it,ct,l),D.current()),A.current=Ke;return}(_||c||u===Ke||d===Ke||p?.path===Ke||m?.path===Ke||i==null||i!==Ke)&&(WB(n),u===Ke&&(pe.current=null),d===Ke&&(me.current=null),p?.path===Ke&&(he.current=null),m?.path===Ke&&(ge.current=null),M.current=!1,N.current=null),A.current=Ke},[t,qe,Ke,dt,s,Ue,We,at,it,f,lt,ct,rt]);let Bt=qe>=0&&qe>=nt.visible.startIndex&&qe<=nt.visible.endIndex,Vt=Ke!=null&&ot.some(e=>JB(e.row)===Ke),Ht=Bt||Vt,Ut=Me&&k.current===!0&&Ht?Ke:null,Wt=oe===`pointer`?ne:null,Gt=ue?.path??_e.current??Wt??Ut??ne,Kt=ue?.source===`right-click`;NB(()=>{y.current&&ue==null||yt(Re(Gt))},[ue,Re,at,it,ce,ot,Gt,yt,rt]);let qt=IB(e=>{if(y.current||CV(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&se(e=>e===`pointer`?e:`pointer`),re(e=>e===i?e:i)},[]),Jt=IB(()=>{re(null)},[]);NB(()=>{if(!Je)return;let e=()=>{At(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),At(),t.cancelDrag()}},[t,Je]);let Yt=e=>{if(!Je||t.getDragSession()==null||V.current)return;let n=iV(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Mt(t.getDragSession()?.target??null),Pt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Xt=e=>{if(!Je||t.getDragSession()==null||V.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Et(),Ot(),t.setDragTarget(null))},Zt=e=>{!Je||t.getDragSession()==null||V.current||(e.preventDefault(),jt(e.clientX,e.clientY),t.completeDrag(),Dt(),Et(),Ot(),z.current=null)},Qt=nt.window.height,$t=nt.window.offsetTop,en=Math.min(0,it-Qt-lt),tn=ee===Ke||M.current,nn=Ke!=null&&tn&&!dt&&qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null,rn=nn==null?null:vV(qe,s,at,Qt),an=z.current,on=Qe!=null&&an!=null&&an.path===Qe&&an.index>=at.start&&an.index<=at.end,sn=Qe!=null&&an!=null&&an.path===Qe&&!on&&an.path!==nn?.path?an:null,cn=sn==null?null:vV(sn.index,s,at,Qt),ln=yV((qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null)?.ancestorPaths.at(-1)??null),un=We&&Ke!=null?PV(o,Ke,!dt):void 0,dn=ue?.path??(We?Ke:ee),fn=ue?.path??ne,pn=Re(Gt),mn=Ae&&Me&&!Kt&&!Ue&&pn!=null&&ie!=null&&Gt!=null,hn=Ae&&(mn||ue!=null),gn=ue?.anchorRect,_n=gn==null&&pn!=null&&ie!=null&&(ue!=null||mn)?ie:null,vn=gn==null?_n==null?void 0:{top:`${_n}px`}:{left:`${gn.left}px`,position:`fixed`,right:`auto`,top:`${gn.top}px`},yn=Kt?{opacity:`0`}:void 0,bn=IB((e,n,r,i)=>{let a=t.getItem(r),o=fB({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:t.isSearchOpen(),mode:i});switch(o.selection.kind){case`range`:t.selectPathRange(r,o.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(r);break;case`single`:t.selectOnlyPath(r);break}let s=e.currentTarget instanceof HTMLElement?e.currentTarget:null,c=n.index>=nt.visible.startIndex&&n.index<=nt.visible.endIndex,l=i===`flow`&&c&&s!=null&&s.dataset.itemParked!==`true`;a?.focus(),l&&(k.current=!0,te(e=>e===r?e:r),se(`focus`)),o.toggleDirectory&&uV(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&St(r,{targetOffset:`sticky-parents`})},[t,nt.visible.endIndex,nt.visible.startIndex,St]),xn=()=>{if(y.current||!Me||Gt==null||pn==null)return;let e=t.getItem(Gt);e!=null&&(yt(pn),gt.current=!0,de({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:pn.getAttribute(`aria-label`)??Gt,path:e.getPath()},path:e.getPath(),source:`button`}))},Sn={contextHoverPath:fn,contextMenuButtonTriggerEnabled:Me,contextMenuButtonVisibility:Ne,contextMenuEnabled:Ae,contextMenuRightClickEnabled:Pe,contextMenuTriggerMode:je,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Je,draggedPathSet:Xe,dragTarget:Ze,gitLaneActive:ze,gitStatusByPath:n,handleRowDragEnd:It,handleRowDragStart:Ft,handleRowTouchStart:Lt,ignoredGitDirectories:r,ignoredInheritanceCache:K,instanceId:o,itemHeight:s,onKeyDown:Rt,onRowClick:bn,openContextMenuForRow:bt,registerButton:Fe,registerRenameInput:Le,renameView:Ve,renderDecorationForRow:ft,resolveIcon:Be,shouldSuppressContextMenu:Ct,visualFocusPath:dn},Cn={...Sn,registerButton:Ie};return Mz(`div`,{ref:S,id:$e,"data-file-tree-context-menu-button-visibility":Ae&&Me?Ne:void 0,"data-file-tree-context-menu-trigger-mode":Ae?je:void 0,"data-file-tree-has-context-menu-action-lane":Ae&&Me?`true`:void 0,"data-file-tree-has-git-lane":ze?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Je?Xt:void 0,onDragOver:Je?Yt:void 0,onDrop:Je?Zt:void 0,onKeyDown:Rt,onPointerLeave:Ae?Jt:void 0,onPointerOver:Ae?qt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Mz(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:ln}}),Mz(`slot`,{name:WN,"data-type":`header-slot`}),f?Mz(`div`,{"data-file-tree-search-container":!0,"data-open":We?`true`:`false`,children:Mz(`input`,{ref:w,"aria-activedescendant":un,"aria-controls":$e,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ce?`true`:void 0,value:Ge,onBlur:()=>{d===`retain`&&!Te.current||t.closeSearch()},onFocus:J,onPointerDown:J,onInput:e=>{J();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Mz(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Oe&&ot.length>0?Mz(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Mz(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${et}px`},children:ot.map((e,t)=>zV(Cn,e.row,`sticky:${JB(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ot.length-t}`}}))})}):null,Mz(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ct}px`},children:[Mz(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${$t}px`}}),Mz(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${Qt}px`,top:`${en}px`,bottom:`${en}px`},children:[BV(Sn,at,ut),nn!=null&&rn!=null?zV(Sn,nn,`parked:${nn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:Qe===nn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${rn}px`}}):null,sn!=null&&cn!=null?zV(Sn,sn,`parked-drag:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${cn}px`}}):null]})]})]}),Ae?Mz(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":hn?`true`:`false`,style:vn,children:[Mz(`button`,{ref:v,type:`button`,"data-type":KN,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":ue==null?`false`:`true`,"data-visible":mn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),ue!=null){vt();return}xn()},tabIndex:-1,style:yn,children:Mz(Iz,{...Be(`file-tree-icon-ellipsis`)})}),ue==null?null:Mz(`slot`,{name:GN})]}):null,ue==null?null:Mz(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),vt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),vt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var HV={hydrateRoot:(e,t)=>{Az(oz(VV,t),e)},renderRoot:(e,t)=>{kz(oz(VV,t),e)},unmountRoot:e=>{kz(null,e)}};function UV(e,t){HV.renderRoot(e,t)}function WV(e,t){HV.hydrateRoot(e,t)}function GV(e){HV.unmountRoot(e)}var KV=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},qV=`__c`,JV=`__k`,YV=`__d`,XV=`__s`,ZV=/[\s\n\\/='"\0<>]/,QV=/^(xlink|xmlns|xml)([A-Z])/,$V=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,eH=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,tH=new Set([`draggable`,`spellcheck`]);function nH(e){e.__g===void 0?e[YV]=!0:e.__g|=8}function rH(e){e.__g===void 0?e[YV]=!1:e.__g&=-9}function iH(e){return e.__g===void 0?!0===e[YV]:!!(8&e.__g)}var aH=/["&<]/;function oH(e){if(e.length===0||!1===aH.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var sH={},cH=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),lH=/[A-Z]/g;function uH(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:sH[n]||(sH[n]=n.replace(lH,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||cH.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function dH(){this.__d=!0}function fH(e,t){return{__v:e,context:t,props:e.props,setState:dH,forceUpdate:dH,__d:!0,__h:[]}}function pH(e,t,n){if(!e.s){if(n instanceof mH){if(!n.s)return void(n.o=pH.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(pH.bind(null,e,t),pH.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var mH=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{pH(r,1,a(this.v))}catch(e){pH(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?pH(r,1,t?t(i):i):n?pH(r,1,n(i)):pH(r,2,i)}catch(e){pH(r,2,e)}},r},e}(),hH,gH,_H,vH,yH={},bH=Array.isArray,xH=Object.assign,SH=``,CH=`<!--$s-->`,wH=`<!--/$s-->`;function TH(e,t){var n,r=e.type,i=!0;return e[qV]?(i=!1,(n=e[qV]).state=n[XV]):n=new r(e.props,t),e[qV]=n,n.__v=e,n.props=e.props,n.context=t,nH(n),n.state??=yH,n[XV]??(n[XV]=n.state),r.getDerivedStateFromProps?n.state=xH({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[XV]===n.state?n.state:n[XV]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),_H&&_H(e),n.render(n.props,n.state,t)}function EH(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===SH)return SH;var s=typeof e;if(s!=`object`)return s==`function`?SH:s==`string`?oH(e):e+SH;if(bH(e)){var c,l=SH;i[JV]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=EH(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=SH,bH(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return SH;e.__=i,hH&&hH(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===cz){if(`tpl`in g){for(var x=SH,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!bH(C)?x+=C:x+=EH(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+oH(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=TH(e,b),y=e[qV];else{e[qV]=y=fH(e,b);for(var E=0;iH(y)&&E++<25;){rH(y),_H&&_H(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}nH(y)}if(y.getChildContext!=null&&(t=xH({},t,y.getChildContext())),T&&WR.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===cz&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return EH(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[XV]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,yH),iH(y)?(v=TH(e,t),(y=e[qV]).getChildContext!=null&&(t=xH({},t,y.getChildContext())),EH(v=v!=null&&v.type===cz&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):SH}finally{gH&&gH(e),vH&&vH(e)}}}v=v!=null&&v.type===cz&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=EH(v,t,n,r,e,a,o);return gH&&gH(e),WR.unmount&&WR.unmount(e),e._suspended?typeof D==`string`?CH+D+wH:bH(D)?(D.unshift(CH),D.push(wH),D):D.then(function(e){return CH+e+wH}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return EH(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=WR.__e;return k&&k(i,e),SH}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=EH(v,t,n,r,e,a,o);return e._suspended?CH+s+wH:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=SH;for(var N in g){var P=g[N];if(typeof(P=OH(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=uH(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(QV.test(N))N=N.replace(QV,`$1:$2`).toLowerCase();else{if(ZV.test(N))continue;N[4]!==`-`&&!tH.has(N)||P==null?n?eH.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):$V.test(N)&&(N=N.toLowerCase()):P+=SH}}P!=null&&!1!==P&&(j=!0===P||P===SH?j+` `+N:j+` `+N+`="`+(typeof P==`string`?oH(P):P+SH)+`"`)}}if(ZV.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=oH(A):A!=null&&!1!==A&&!0!==A&&(M=EH(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),gH&&gH(e),vH&&vH(e),!M&&DH.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return bH(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var DH=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function OH(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var kH=0;function AH(e){return e!=null&&e.length>0?e:(kH+=1,`pst_ft_${kH}`)}function jH({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??HL)}function MH(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function NH(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function PH(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var FH=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new KV;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=AH(a),this.#p=UR(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=VL(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new RR({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(GV(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),UV(t.wrapper,this.#w()))}setGitStatus(e){this.#p=UR(e,this.#p);let t=this.#T();t!=null&&UV(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),UV(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),WV(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),UV(r,this.#w())}#C(){return{initialViewportHeight:jH({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(WN,e());return}this.#l.setSlotHtml(WN,this.#e?.header?.html??null)}#k(e){let t=PH(e).find(e=>NH(e)),n=MH(PN(JN(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=PH(e),n=t.find(e=>NH(e)),r=t.filter(e=>e!==n),i=JN(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=MH(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=JN(this.#m);t.colored&&IN(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${BN}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(BN,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=KL(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return QL(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},IH=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function LH(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:WN,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:GN,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function RH(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function zH(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function BH(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function VH({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(n.getComposition()),d=(0,Q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Q.useCallback)(()=>{s(null)},[]),m=(0,Q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Q.useMemo)(()=>BH(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),IH(()=>{n.setComposition(g)},[g,n]),IH(()=>{if(c!=null)return r!=null&&zH(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=RH(LH(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,Z.jsx)(RN,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function HH(e){let t=(0,Q.useRef)(null);return t.current??=new FH(e),(0,Q.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}var UH=`.md`,WH=/\.(md|mdx)$/i;function GH(e,t=UH){return`${e}${t}`}function KH(e){return uU(e).replace(WH,``)}function qH(e){return Mr(e)?XH(e.path):Pn(e)?e.path:GH(e.docName,e.docExt)}function JH(e){let t=uU(e).match(WH);return t?`.${t[1].toLowerCase()}`:void 0}function YH(e){return uU(e)}function XH(e){let t=uU(e.trim());return t?`${t}/`:``}function ZH(e){return e.endsWith(`/`)?YH(e):KH(e)}function QH(e){return e.map(qH)}function $H(e){return[...e].sort().join(`\0`)}function eU(e){return $H(QH(e))}function tU(e){let t=new Set;for(let n of e){if(Mr(n)){let e=XH(n.path);e&&t.add(e)}let e=(Mr(n)||Pn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Mr(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function nU(e){if(!e)return[];let t=uU(e.replace(WH,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function rU(e){let t=e.kind===`directory`,n=t?YH(e.path):KH(e.path),r=t?void 0:JH(e.path);return{kind:t?`folder`:`file`,name:uU(lU(e.path)).replace(WH,``),path:n,treePath:aU(e.path,t),docExt:r}}function iU(e){return e.kind===`directory`?YH(e.path):e.path}function aU(e,t){return t?XH(e):WH.test(e)?e:`${e}${UH}`}function oU(e,t,n){let r=XH(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${UH}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function sU(e,t){return e===`file`?aU(t,!1):`${YH(t)}/index${UH}`}function cU(e,t){return t.kind===`root`||t.directoryPath==null?lU(e):`${t.directoryPath}${lU(e)}`}function lU(e){let t=uU(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function uU(e){return e.endsWith(`/`)?e.slice(0,-1):e}function dU(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function fU(e){let t=dU(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}function pU(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function mU(e,t,n={}){if(!e)return pU(t);let r=Hn(e);if(t&&r!==t)return pU(t);switch(e.kind){case`doc`:return pU(t??e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?pU(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function hU(e,t){if(!e)return{kind:`none`};let n=t.find(t=>qH(t)===e);if(n&&Pn(n))return{kind:`asset`,hash:_r(n.path)};let r=ZH(e);return e.endsWith(`/`)?t.some(e=>Mr(e)?e.path===r||e.path.startsWith(`${r}/`):(Pn(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Dr(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}function gU(e){let t=!1,n=!1,r=!1;async function i(){if(!r){t=!0;try{await e()}finally{t=!1,r?n=!1:n&&(n=!1,i())}}}return{request(){if(!r){if(t){n=!0;return}i()}},dispose(){r=!0,n=!1}}}function _U(e){return e?`No workspace`:null}function vU(e){let t=(0,$.c)(48),{input:n,installStates:r,dispatch:i}=e,{skillInstalled:a,refresh:o}=ua(),[s,c]=(0,Q.useState)(!1),l=n===null,u;t[0]===l?u=t[1]:(u=_U(l),t[0]=l,t[1]=u);let d=u,f,p,m,h,g,_;if(t[2]!==i||t[3]!==d||t[4]!==n||t[5]!==l||t[6]!==r||t[7]!==a){let e;t[14]===r?e=t[15]:(e=e=>r[e.id]?.installed===!0,t[14]=r,t[15]=e);let o=kf.filter(e);m=r[`claude-cowork`]?.installed===!0;let s;t[16]===n?s=t[17]:(s=n===null?``:er(n.docContext),t[16]=n,t[17]=s);let u=s,v;t[18]!==n||t[19]!==u?(v=()=>{n!==null&&rM(u)},t[18]=n,t[19]=u,t[20]=v):v=t[20],h=v,p=wi,t[21]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(si,{children:[(0,Z.jsx)(ti,{"aria-hidden":`true`}),`Open in`]}),t[21]=_):_=t[21],f=ia;let y;t[22]!==i||t[23]!==d||t[24]!==n||t[25]!==l||t[26]!==a?(y=e=>{let t=!l,r=e.id===`claude-cowork`&&t&&!a?()=>c(!0):void 0,o=iM({target:e,onInstallSkillRequest:r}),s=o?`Install Open Knowledge skill in ${e.displayName}`:d?`Open in ${e.displayName}, ${d}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(li,{disabled:!t,onSelect:()=>{n&&(o&&r?r():i(e.id,n))},"data-testid":`file-tree-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(Zj,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:Y(`flex-1`,o&&`whitespace-nowrap`),children:e.displayName}),o?(0,Z.jsx)(We,{variant:`outline`,"aria-hidden":`true`,className:`ml-2 h-[18px] px-1.5 py-0 text-[10px]`,"data-testid":`open-in-agent-skill-install-badge`,children:`Install`}):d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null]},e.id)},t[22]=i,t[23]=d,t[24]=n,t[25]=l,t[26]=a,t[27]=y):y=t[27],g=o.map(y),t[2]=i,t[3]=d,t[4]=n,t[5]=l,t[6]=r,t[7]=a,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=g,t[13]=_}else f=t[8],p=t[9],m=t[10],h=t[11],g=t[12],_=t[13];let v;t[28]!==m||t[29]!==h||t[30]!==l?(v=m?null:(0,Z.jsxs)(li,{onSelect:h,disabled:l,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(pt,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in claude.ai →`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser`})]}),t[28]=m,t[29]=h,t[30]=l,t[31]=v):v=t[31];let y;t[32]!==f||t[33]!==g||t[34]!==v?(y=(0,Z.jsxs)(f,{children:[g,v]}),t[32]=f,t[33]=g,t[34]=v,t[35]=y):y=t[35];let b;t[36]!==p||t[37]!==_||t[38]!==y?(b=(0,Z.jsxs)(p,{children:[_,y]}),t[36]=p,t[37]=_,t[38]=y,t[39]=b):b=t[39];let x;t[40]===o?x=t[41]:(x=e=>{c(e),e||o()},t[40]=o,t[41]=x);let S;t[42]!==s||t[43]!==x?(S=(0,Z.jsx)(oa,{open:s,onOpenChange:x}),t[42]=s,t[43]=x,t[44]=S):S=t[44];let C;return t[45]!==b||t[46]!==S?(C=(0,Z.jsxs)(Z.Fragment,{children:[b,S]}),t[45]=b,t[46]=S,t[47]=C):C=t[47],C}var yU=at(`HOVER_INTENT_MS`,80),bU=3,xU=20,SU=new Map,CU=new Set,wU=[],TU=new Map;function EU(e){for(TU.delete(e),TU.set(e,!0);TU.size>xU;){let e=TU.keys().next().value;if(e===void 0)break;TU.delete(e)}}function DU(e){CU.delete(e),kU()}function OU(e,t){let n=Date.now();ye(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),_t(e,t,n)}function kU(){for(;CU.size<bU&&wU.length>0;){let e=wU.shift();if(!e)break;if(!TU.has(e.docName)){CU.add(e.docName),EU(e.docName);try{let t=e.prewarm(e.docName);t&&OU(e.docName,t)}catch(t){ye(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{DU(e.docName)}}}}function AU(e,t){if(xe(e)||TU.has(e))return;let n=SU.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(SU.delete(e),CU.size>=bU){wU.push({docName:e,prewarm:t});return}EU(e),CU.add(e);try{let n=t(e);n&&OU(e,n)}catch(t){ye(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{DU(e)}},yU);SU.set(e,{timer:r,prewarm:t})}function jU(e){let t=SU.get(e);t&&(clearTimeout(t.timer),SU.delete(e))}var MU=/\.(md|mdx)$/i;function NU(e){if(window.location.hash===e)return;let{pathname:t,search:n}=window.location;window.history.replaceState(null,``,`${t}${n}${e}`)}function PU(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function FU(e){let t=e.match(MU);return t?t[0]:null}async function IU(e,t){try{await navigator.clipboard.writeText(e),qa.success(`Copied ${t}`,{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),qa.error(`Could not copy ${t}`)}}var LU=new Set([`agents`,`agent`,`claude`,`skill`]),RU=`ok-file-tree-link-decoration`,zU=`ok-file-tree-agent-decoration`;function BU(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function VU(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${BU(t)}</symbol>`}var HU=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1847
|
-
${
|
|
1848
|
-
${
|
|
1849
|
-
</svg>`,
|
|
1846
|
+
}`}var $L=new WeakMap;function eR(e){let t=$L.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(qN,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),$L.set(e,i),i}function tR(e,t){if(!e.isConnected)return;let n=eR(t);if(n==null)return;let r=t.querySelector(`style[${JN}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(JN,``),t.appendChild(i)),i.textContent=`:host { ${YN}: ${n}px; }`}var nR;function rR(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){nR??(nR=new CSSStyleSheet,nR.replaceSync(ZL(YL)));let t=!1;try{e.adoptedStyleSheets=[nR],t=!0}catch{}if(t){e.querySelector(`style[${GN}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(GN,``),t.textContent=ZL(YL),e.prepend(t)}}function iR(e,t){aR(e,t),rR(t),tR(e,t)}function aR(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});iR(this,e)}}if(customElements.define(WN,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(WN)))e instanceof HTMLElement&&iR(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var oR=e=>e.startsWith(`f::`)?e.slice(3):e;function sR(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function cR(e,t){return e===``?t:`${e}/${t}`}function lR({files:e,path:t,isFolder:n,nextBasename:r}){let i=oR(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=sR(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=cR(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function uR(e){return e.endsWith(`/`)}function dR(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function fR(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function pR(e,t){return t.includes(e)?fR(t):[e]}function mR(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function hR(e,t){return{draggedPaths:e,target:t}}function gR(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(uR(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function _R(e,t){return t.kind===`root`||t.directoryPath==null?dR(e):t.directoryPath}function vR(e,t){let n=e.map(e=>{let n=_R(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}var yR=Symbol(`FILE_TREE_RENAME_VIEW`);function bR(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var xR=512,SR=512;function CR(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function wR(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function TR(e){return wR(e).at(-1)??null}function ER(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var DR=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},OR=e=>e.toLowerCase();function kR(e){return e.endsWith(`/`)}function AR(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function jR(e){return e.endsWith(`/`)?e.slice(0,-1):e}function MR(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function NR(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function PR(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function FR(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return PR(e,t.path)?n?e:null:e;case`move`:return NR(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=FR(r,e,n),r==null)return null;return r}}}function IR(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function LR(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function RR(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!LR(WL.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function zR(e){switch(e.operation){case`add`:return{...IR(e),operation:`add`,path:e.path};case`remove`:return{...IR(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...IR(e),from:e.from,operation:`move`,to:e.to}}}function BR(e){return{...IR(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>zR(e)),operation:`batch`}}function VR(e){switch(e.operation){case`add`:case`remove`:case`move`:return zR(e);case`batch`:return BR(e);default:return null}}function HR(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=wR(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function UR(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:HR(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var WR=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=new Set;#z=0;#B;#V=0;#H=!1;#U=0;#W;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=RR({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#B=this.#se(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ae(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#R=new Set(d),this.#L=f,this.#z=1),this.#Oe(f,!1),r!=null&&this.#Se(r,!1),this.#W=this.#Fe()}destroy(){this.#W?.(),this.#W=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#pe()}focusFirstItem(){this.#ve().length>0&&this.#Me(0)}focusLastItem(){this.#U<=0||(this.#Ne(),this.#Me(this.#U-1))}focusNextItem(){this.#De(1)}focusParentItem(){if(this.#c==null)return;let e=TR(this.#c);if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t)}focusPath(e){let t=this.#B.getPathInfo(e)?.path??null;if(t==null)return;this.#Ne();let n=this.#Y(t);n>=0&&this.#Me(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Y(t);return n>=0?(this.#Me(n),this.#ve()[n]??t):null}focusPreviousItem(){this.#De(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#X(this.#c)}getFocusedPath(){return this.#c}resolveNearestVisiblePath(e){let t=this.#ve();if(this.#U===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#B.getPathInfo(e)?.path??e,r=this.#Y(n);return r>=0?t[r]??n:this.#J(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#R]}getSelectionVersion(){return this.#z}getVisibleCount(){return this.#U}getVisibleRows(e,t){if(t<e||this.#U===0)return[];let n=Math.max(0,e),r=Math.min(this.#U-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=SR){let e=[];for(let t=n;t<=r;t+=1){let n=this.#B.getVisibleRowContext(t);if(n==null)break;e.push(this.#Q(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ne(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#ye(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#B.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#ye(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#Z(o,i,a,{ancestorPaths:this.#te(a),path:s})})}return this.#B.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#Z(e,r,r,{ancestorPaths:this.#te(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#U===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#U;r+=1){let i=e+r*t,a=Math.min(this.#U-1,Math.floor(i/t)),o=this.#$(a,r)??(a>0?this.#$(a-1,r):void 0);if(o==null)break;n.push({row:this.#Q(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#B.getPathInfo(e);return t==null?null:this.#X(t.path,t)}selectAllVisiblePaths(){this.#Ne();let e=[...this.#ve()];this.#re(e,this.#c??this.#L)}selectOnlyPath(e){let t=this.#Ae(e);t!=null&&this.#re([t],t)}selectPath(e){let t=this.#Ae(e);t==null||this.#R.has(t)||this.#re([...this.#R,t])}deselectPath(e){let t=this.#Ae(e);t==null||!this.#R.has(t)||this.#re([...this.#R].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.#re([...this.#R].filter(e=>e!==t),t);return}this.#re([...this.#R,t],t)}}selectPathRange(e,t){let n=this.#Ae(e);if(n==null)return;this.#Ne();let r=this.#L,i=r==null?-1:this.#be(r),a=this.#be(n);if(i===-1||a===-1){let e=t?[...this.#R,n]:[n];this.#re(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#ve().slice(o,s+1),l=t?[...this.#R,...c]:c;this.#re(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#U-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ne();let r=this.#ve(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#R);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#re([...o],this.#L??i,!1),this.#Me(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ae(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=pR(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#re([t],t,!1),this.#je(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#we(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=hR(t.draggedPaths,n);(gR(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}mR(t.target,n)||(this.#i={...t,target:n},this.#we())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#we())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#we(),!1;let n=hR(e.draggedPaths,t);if(gR(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=vR(e.draggedPaths,t);if(r==null)return this.#we(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#B.move(e.from,e.to,{collision:e.collision})}else this.#oe(r.operations),this.#B.batch(r.operations)}catch(e){return this.#we(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#B.add(e)}remove(e,t={}){this.#B.remove(e,t)}move(e,t,n={}){this.#B.move(e,t,n)}batch(e){this.#B.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Se(e,!0)}openSearch(e=``){this.#Se(e,!0)}closeSearch(){this.#Se(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#xe(1)}focusPreviousSearchMatch(){this.#xe(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#B.getPathInfo(e);if(n==null)return!1;let r=n.path,i=kR(r),a=jR(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of wR(r))this.#B.isExpanded(e)||this.#B.expand(e);return this.#re([r],r,!1),this.#M!=null&&(this.#Se(null,!1),this.#y?.(this.#M)),this.#je(r),this.#T=r,this.#E=AR(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[yR](){return{cancel:()=>{this.#G()},commit:()=>{this.#K()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#q(e)}}}#G(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,kR(e)?{recursive:!0}:void 0);return}this.#je(e),this.#we()}#K(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,kR(e)?{recursive:!0}:void 0);return}let t=kR(e),n=lR({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:jR(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#je(e),this.#v?.(n.error),this.#we();return}if(n.sourcePath===n.destinationPath){this.#je(e),this.#we();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(MR(n.sourcePath,t),MR(n.destinationPath,t))}#q(e){this.#T==null||this.#E===e||(this.#E=e,this.#we())}resetPaths(e,t={}){let n=this.#B.list().length,r=this.#U,i=RR({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#se(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#L;this.#W?.(),this.#B=a,this.#d.clear(),this.#pe();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!CR(this.#R,u);this.#R=new Set(u),d&&(this.#z+=1),this.#L=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#Oe(o,o!=null||u.length>0||this.#L!=null),this.#W=this.#Fe(),this.#we(),this.#Te({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#U-r})}#J(e){this.#Ne();let t=TR(e),n=ER(e,t),r=null,i=null;for(let e of this.#ve()){if(TR(e)!==t)continue;let a=ER(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Y(e){let t=this.#be(e);if(t!==-1)return t;let n=wR(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#be(t);if(r!==-1)return r}return this.#ve().length>0?0:-1}#X(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#B.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#ie(r.path):this.#ae(r.path);return this.#d.set(r.path,i),i}#Z(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#R.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#Q(e){return this.#Z(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#$(e,t){let n=this.#B.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ee(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ee(n),n];return this.#a.set(e,r),r}#te(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ee(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ne(e){this.#B.collapse(e)}#re(e,t=this.#L,n=!0){let r=[...new Set(e)],i=!CR(this.#R,r),a=this.#L!==t;!i&&!a||(this.#R=new Set(r),this.#L=t,i&&(this.#z+=1),n&&this.#we())}#ie(e){return{collapse:()=>{this.#ne(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#Ee(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#B.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#Ie(e)}}}#ae(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#oe(e){let t=this.#B.list();this.#se(t).batch(e)}#se(e,t,n){return new WL({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ce(){return this.#h??=this.#B.list(),this.#h}#le(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ce()){e.add(t);for(let n of wR(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(OR),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(OR),this.#p}#pe(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#me(){return this.#de().filter(e=>this.#B.isExpanded(e))}#he(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#R)for(let n of wR(e))t.add(n);this.#ge(t)}#ge(e){this.#H=!0;try{for(let t of this.#de()){let n=e.has(t),r=this.#B.isExpanded(t);n&&!r?this.#B.expand(t):!n&&r&&this.#B.collapse(t)}}finally{this.#H=!1}}#_e(){let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#M==null||this.#M.length===0||this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#U=this.#V;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#U=n.length}#ve(){return this.#I??this.#b}#ye(e){return this.#F?.[e]??e}#be(e){return this.#P?.get(e)??this.#B.getVisibleIndex(e)??-1}#xe(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Se(e,t){let n=e==null?null:DR(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#me()),this.#M=n,n==null)this.#he(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else if(n.length===0)this.#he(!1),this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else{let e=this.#Ce();this.#Oe(e,!0)}t&&(this.#y?.(this.#M),this.#we())}}#Ce(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ce(),n=this.#ue(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#de(),s=this.#fe();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of wR(e))l.add(t),c?.add(t)}return this.#ge(l),a??this.#c}#we(){for(let e of this.#t)e()}#Te(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#Ee(e){for(let t of wR(e))this.#B.isExpanded(t)||this.#B.expand(t);this.#B.isExpanded(e)||this.#B.expand(e)}#De(e){let t=this.#U;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ne(),this.#Me(r))}#Oe(e,t=!0){let n=this.#B.getVisibleCount();this.#V=n;let r=UR(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,xR)),e,t?e=>this.#B.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#_e(),this.#s=e==null?this.#ve().length>0?0:-1:this.#Y(e),this.#c=this.#s<0?null:this.#ke(this.#s)}#ke(e){return this.#ve()[e]??(this.#F==null?this.#B.getVisibleRowContext(e)?.row.path??null:null)}#Ae(e){return this.#B.getPathInfo(e)?.path??null}#je(e){if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t,!1)}#Me(e,t=!0){let n=this.#ke(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#we()))}#Ne(){this.#l||this.#Oe(this.#c,!0)}#Pe(e){let t=FR(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=FR(this.#c,e,!0),r=[...this.#R].map(t=>FR(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=FR(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return CR(this.#R,o)||(this.#R=new Set(o),this.#z+=1),this.#L=a,n}#Fe(){return this.#B.on(`*`,e=>{if(this.#H)return;e.canonicalChanged&&(this.#d.clear(),this.#pe()),this.#i!=null&&bR(e)&&(this.#i=null);let t=bR(e)?this.#Pe(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ce():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#Oe(n,r),this.#we();let i=VR(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},GR=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function KR(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function qR(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function JR(e,t){return t?`${e}/`:e}function YR(e,t=null){let n=GR(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=KR(t.path);if(e==null)continue;let n=JR(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of qR(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var XR,ZR,QR,$R,ez,tz,nz,rz,iz,az,oz={},sz=[],cz=Array.isArray,lz=sz.slice,uz=Object.assign;function dz(e){e&&e.parentNode&&e.remove()}function fz(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?lz.call(arguments,2):n),pz(e,o,r,i,null)}function pz(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++ZR,__i:-1,__u:0};return i==null&&XR.vnode!=null&&XR.vnode(a),a}function mz(e){return e.children}function hz(e,t){this.props=e,this.context=t,this.__g=0}function gz(e,t){if(t==null)return e.__?gz(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?gz(e):null}function _z(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return _z(e)}}function vz(e){(8&e.__g||!(e.__g|=8)||!QR.push(e)||ez++)&&$R==XR.debounceRendering||(($R=XR.debounceRendering)||queueMicrotask)(yz)}function yz(){for(var e,t,n,r,i,a,o,s,c=1;QR.length;)QR.length>c&&QR.sort(tz),e=QR.shift(),c=QR.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=uz({},r)).__v=r.__v+1,XR.vnode&&XR.vnode(n),Dz(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??gz(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,kz(a,n,o),n.__e!=i&&_z(n)));ez=0}function bz(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||sz,b=t.length;for(c=xz(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?oz:y[m.__i]||oz,m.__i=f,_=Dz(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Mz(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=Sz(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function xz(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?pz(null,o,null,null,null):cz(o)?pz(mz,{children:o},null,null,null):o.constructor==null&&o.__b>0?pz(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=Cz(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=gz(s)),Nz(s,s));return r}function Sz(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=Sz(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=gz(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Cz(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function wz(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Tz(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||wz(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||wz(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(nz,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=rz,e.addEventListener(t,a?az:iz,a)):e.removeEventListener(t,a?az:iz,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Ez(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=rz++;else if(t.u<n.l)return;return n(XR.event?XR.event(t):t)}}}function Dz(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=XR.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new hz(v,x),f.constructor=M,f.render=Pz),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=uz({},f.__s)),uz(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=XR.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=uz({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===mz&&d.key==null&&(E=Az(d.props.children)),s=bz(e,cz(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)dz(a[j]);Oz(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Oz(t);XR.__e(e,t,n)}else s=t.__e=jz(n.__e,t,n,r,i,a,o,c,l,u);return(d=XR.diffed)&&d(t),128&t.__u?void 0:s}function Oz(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Oz)}function kz(e,t,n){for(var r=0;r<n.length;r++)Mz(n[r],n[++r],n[++r]);XR.__c&&XR.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){XR.__e(e,t.__v)}})}function Az(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:cz(e)?e.map(Az):uz({},e)}function jz(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(XR.__m&&XR.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=lz.call(e.childNodes),v=n.props||oz,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;Tz(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||Tz(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),bz(b==`template`?e.content:e,cz(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&gz(n,0),s,c,l),a!=null)for(u=a.length;u--;)dz(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Tz(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Tz(e,u,g,v[u],i))}return e}function Mz(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){XR.__e(e,n)}}function Nz(e,t,n){var r,i;if(XR.unmount&&XR.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Mz(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){XR.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Nz(r[i],t,n||typeof e.type!=`function`);n||dz(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Pz(e,t,n){return this.constructor(e,n)}function Fz(e,t){var n,r,i,a;t==document&&(t=document.documentElement),XR.__&&XR.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=fz(mz,null,[e]),i=[],a=[],Dz(t,e,r||oz,oz,t.namespaceURI,r?null:t.firstChild?lz.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),kz(i,e,a)}function Iz(e,t){e.__u|=32,Fz(e,t)}XR={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw ez=0,e}},ZR=0,hz.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=uz({},this.state);typeof e==`function`&&(e=e(uz({},n),this.props)),e&&uz(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),vz(this))},hz.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),vz(this))},hz.prototype.render=mz,QR=[],ez=0,tz=function(e,t){return e.__v.__b-t.__v.__b},nz=/(PointerCapture)$|Capture$/i,rz=0,iz=Ez(!1),az=Ez(!0);var Lz=0;Array.isArray;function Rz(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Lz,__i:-1,__u:0,__source:i,__self:a};return XR.vnode&&XR.vnode(l),l}var zz=16,Bz=16,Vz={};function Hz({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=Vz[e]??{width:zz,height:Bz},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Rz(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Rz(`use`,{href:c})})}var Uz=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Wz=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},Gz=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},Kz=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},qz=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},Jz=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function Yz({children:e,marker:t,variant:n=`default`}){"use no memo";return Rz(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Rz(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Rz(`span`,{"data-truncate-fade":!0}):t})})}function Xz(e){"use no memo";let{mode:t,children:n}=e;return Rz(`div`,{children:[Rz(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Rz(`span`,{children:n}):n}),Rz(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Rz(`span`,{children:n}):n})]})}function Zz({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Rz(Xz,{mode:t,children:e},`content`),o=Rz(Yz,{marker:n,mode:t,variant:r},`marker`),s=Rz(`div`,{"data-truncate-fill":!0},`fill`);return Rz(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Rz(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function Qz({children:e,...t}){"use no memo";return Rz(Zz,{mode:`truncate`,...t,children:e})}function $z({children:e,...t}){"use no memo";return Rz(Zz,{mode:`fruncate`,...t,children:e})}function eB({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Rz(Qz,{...s,children:t[0]}),l=Rz($z,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Rz(`div`,{className:a,style:o});if(e.length<i)return Rz(n===`end`?$z:Qz,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Uz:r===`extension`?t=Wz:r===`leaf-path`&&(t=Gz);else if(typeof r==`number`)t=Kz,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=qz:e===`first`&&(t=Jz)}else typeof r==`function`&&(t=r);t??=Uz;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Rz(Qz,{...s,..._,children:f}),l=Rz($z,{...s,...v,children:p})}return Rz(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Rz(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Rz(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var tB={endIndex:-1,startIndex:-1};function nB(e,t,n){return Math.min(Math.max(e,t),n)}function rB(e,t){return e<0||t<e?tB:{endIndex:t,startIndex:e}}function iB(e){return e.startIndex<0||e.endIndex<e.startIndex}function aB(e,t){return iB(e)?0:(e.endIndex-e.startIndex+1)*t}function oB(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function sB(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function cB(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function lB(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function uB(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function dB(e,t,n){if(e.length===0||t<=0)return[];let r=uB(e),i=cB(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=lB(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function fB(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=nB(t.scrollTop,0,o),c=t.stickyRows??dB(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=oB(s,n,t.itemHeight),m=oB(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?tB:rB(m,sB(u+d,n,t.itemHeight)),y=g+1,b=iB(v)?tB:rB(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=aB(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:iB(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var pB={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},mB={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},hB=`Contains git status items`;function gB(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function _B(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function vB(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}function yB(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function bB(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}var xB,SB,CB,wB,TB=Object.is,EB=0,DB=[],OB=XR,kB=OB.__b,AB=OB.__r,jB=OB.diffed,MB=OB.__c,NB=OB.unmount,PB=OB.__;function FB(e,t){OB.__h&&OB.__h(SB,e,EB||t),EB=0;var n=SB.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function IB(e){return EB=1,LB(YB,e)}function LB(e,t,n){var r=FB(xB++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):YB(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);TB(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=SB,!SB.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,TB(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};SB.__f=!0;var a=SB.shouldComponentUpdate,o=SB.componentWillUpdate;SB.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},SB.shouldComponentUpdate=i}return r.__N||r.__}function RB(e,t){var n=FB(xB++,3);!OB.__s&&JB(n.__H,t)&&(n.__=e,n.u=t,SB.__H.__h.push(n))}function zB(e,t){var n=FB(xB++,4);!OB.__s&&JB(n.__H,t)&&(n.__=e,n.u=t,SB.__h.push(n))}function BB(e){return EB=5,VB(function(){return{current:e}},[])}function VB(e,t){var n=FB(xB++,7);return JB(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function HB(e,t){return EB=8,VB(function(){return e},t)}function UB(){for(var e;e=DB.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(KB),e.__H.__h.forEach(qB),e.__H.__h=[]}catch(t){e.__H.__h=[],OB.__e(t,e.__v)}}OB.__b=function(e){SB=null,kB&&kB(e)},OB.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),PB&&PB(e,t)},OB.__r=function(e){AB&&AB(e),xB=0;var t=(SB=e.__c).__H;t&&(CB===SB?(t.__h=[],SB.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(KB),t.__h.forEach(qB),t.__h=[],xB=0)),CB=SB},OB.diffed=function(e){jB&&jB(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(DB.push(t)!==1&&wB===OB.requestAnimationFrame||((wB=OB.requestAnimationFrame)||GB)(UB)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),CB=SB=null},OB.__c=function(e,t){t.some(function(e){try{e.__h.forEach(KB),e.__h=e.__h.filter(function(e){return!e.__||qB(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],OB.__e(n,e.__v)}}),MB&&MB(e,t)},OB.unmount=function(e){NB&&NB(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{KB(e)}catch(e){t=e}}),n.__H=void 0,t&&OB.__e(t,n.__v))};var WB=typeof requestAnimationFrame==`function`;function GB(e){var t,n=function(){clearTimeout(r),WB&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);WB&&(t=requestAnimationFrame(n))}function KB(e){var t=SB,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),SB=t}function qB(e){var t=SB;e.__c=e.__(),SB=t}function JB(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!TB(t,e[n])})}function YB(e,t){return typeof t==`function`?t(e):t}function XB(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function ZB(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function QB({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Rz(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function $B(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Rz(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Rz(mz,{children:[Rz(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Rz(Qz,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function eV(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function tV(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function nV(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function rV({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=fB(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:nV(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?nV(u,1,t,o):i&&r<=0&&c.length>0?dB(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var iV=400,aV=10,oV=40,sV=18;function cV(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?lV(e,t,n):a instanceof HTMLElement?a:null}function lV(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function uV(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function dV(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function fV(){return navigator.vendor!==`Apple Computer, Inc.`}function pV(e,t){let n=e-t.top;if(n<oV)return-Math.ceil((oV-Math.max(0,n))/oV*sV);let r=t.bottom-e;return r<oV?Math.ceil((oV-Math.max(0,r))/oV*sV):0}function mV(e,t){if(e!=null){let t=pB[e];return t==null?null:{text:t,title:mB[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:hB}:null}function hV(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function gV(e){return e!=null&&`toggle`in e}function _V(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function vV(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function yV(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function bV(e,t){return e!=null&&e>0?e:t}function xV(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function SV(e,t,n,r,i=0){let a=yB({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function CV(e,t,n,r,i,a){let o=bB({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function wV(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function TV(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function EV(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function DV(e,t){return t&&EV(e)||(e.ctrlKey||e.metaKey)&&_V(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var OV=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function kV(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function AV(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function jV(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function MV(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function NV(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function PV(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function FV(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function IV(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function LV(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=IV(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function RV(e,t){return{kind:e.kind,name:tV(e),path:t}}function zV(e){return e==null?void 0:`${e}__tree`}function BV(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function VV(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function HV(e,t){if(e==null)return null;if(`text`in e)return Rz(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?VV(e.icon)?t(e.icon):{name:e.icon}:VV(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Rz(`span`,{title:e.title,children:Rz(Hz,{...n})})}function UV(e){e!=null&&XB(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function WV(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=eV(e);return Rz(mz,{children:[e.depth>0?Rz(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Rz(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Rz(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Rz(Hz,{...t(`file-tree-icon-chevron`)}):Rz(Hz,{...t(`file-tree-icon-file`,u)})}),Rz(`div`,{"data-item-section":`content`,children:e.isFlattened?$B(e,c,a):c??Rz(eB,{minimumLength:5,split:`extension`,children:e.name})}),i?Rz(`div`,{"data-item-section":`decoration`,children:r==null?null:HV(r,t)}):null,s?Rz(`div`,{"data-item-section":`git`,children:HV(o,t)}):null,n?Rz(`div`,{"data-item-section":`action`,children:l?Rz(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Rz(Hz,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function GV(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=eV(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??hV(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=mV(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,q=K?a.getValue():``,ee=R||!K?null:Rz(QB,{ref:D,ariaLabel:`Rename ${tV(t)}`,isFlattened:t.isFlattened,value:q,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),te=WV(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:ee,showDecorativeActionAffordance:G}),ne={..._B({ariaLabel:tV(t),domId:t.isFocused?BV(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusPath(P),j(t,P,{anchorRect:jV(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusPath(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&K?Rz(`div`,{...ne,children:te}):Rz(`button`,{...ne,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:te})}function KV(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(eV(e))).map((n,r)=>GV(e,n,t.start+r))}function qV({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=JL,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=BB(null),v=BB(null),y=BB(!1),b=BB(null),x=BB(null),S=BB(null),C=BB(null),w=BB(null),T=BB(new Map),E=BB(new Map),D=BB(()=>{}),O=BB(null),k=BB(!1),A=BB(null),j=BB(null),M=BB(!1),N=BB(null),P=BB(null),F=BB(null),I=BB(null),L=BB(null),R=BB(null),z=BB(null),B=BB(null),V=BB(!1),H=BB(null),U=BB(null),W=BB(null),G=BB(null),K=VB(()=>new Map,[]),[,q]=IB(0),[ee,te]=IB(null),[ne,re]=IB(null),[ie,ae]=IB(null),[oe,se]=IB(null),[ce,le]=IB(0),[ue,de]=IB(null),fe=BB(ue);fe.current=ue;let pe=BB(null),me=BB(null),he=BB(null),ge=BB(null),_e=BB(null),ve=BB(!1),ye=()=>{me.current=null,he.current=null,ge.current=null},be=(e,t)=>{me.current=e,he.current=null,ge.current=t==null?null:{path:e,scrollTop:t}},xe=(e,t)=>{me.current=null,he.current={path:e,viewportOffset:t},ge.current=null},Se=BB(d===`retain`&&t.isSearchOpen()),[Ce,we]=IB(p);RB(()=>{p||we(!1)},[p]);let Te=BB(!1),J=HB(()=>{Te.current=!0,we(e=>e&&!1)},[]),[Ee,De]=IB(()=>rV({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Oe,ke]=IB(!1);RB(()=>{ke(!0)},[]);let Ae=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,je=e?.contextMenu?.triggerMode??(Ae?`right-click`:`both`),Me=je===`both`||je===`button`,Ne=e?.contextMenu?.buttonVisibility??`when-needed`,Pe=je===`both`||je===`right-click`;zB(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;_e.current=t,re(t),se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(ve.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Fe=HB((e,t)=>{NV(T.current,e,t)},[]),Ie=HB((e,t)=>{NV(E.current,e,t)},[]),Le=HB(e=>{x.current=e},[]),Re=HB(e=>PV(e,E.current,T.current),[]),ze=n!=null||r!=null||i!=null,{resolveIcon:Be}=VB(()=>aP(a),[a]),Ve=t[yR](),He=Ve.getPath(),Ue=He!=null,We=t.isSearchOpen(),Ge=t.getSearchValue(),Ke=t.getFocusedPath(),qe=t.getFocusedIndex(),Je=t.isDragAndDropEnabled(),Ye=t.getDragSession(),Xe=VB(()=>Ye==null?null:new Set(Ye.draggedPaths),[Ye]),Ze=Ye?.target??null,Qe=Ye?.primaryPath??null,$e=zV(o),{overlayHeight:et,overlayRows:tt,snapshot:nt,visibleRows:rt}=Ee,it=nt.physical.viewportHeight,at=VB(()=>({end:nt.window.endIndex,start:nt.window.startIndex}),[nt.window.endIndex,nt.window.startIndex]),ot=tt,st=nt.sticky.rows,ct=nt.physical.totalHeight,lt=nt.sticky.height,ut=VB(()=>new Set(st.map(e=>eV(e.row))),[st]),dt=qe>=0&&qe>=at.start&&qe<=at.end,ft=HB((e,t)=>u?.({item:RV(e,t),row:e})??null,[u]),pt=HB(e=>XB(e==null?null:T.current.get(e)??null)?!0:XB(S.current),[]),mt=HB(e=>{pt(t.focusNearestPath(e))},[t,pt]),ht=BB(mt);ht.current=mt;let gt=BB(!0),_t=BB(()=>{}),vt=HB((t=!0)=>{let n=fe.current;n!=null&&(gt.current=gt.current&&t,de(null),e?.contextMenu?.onClose?.(),gt.current&&mt(n.path))},[e?.contextMenu,mt]);_t.current=vt;let yt=HB(e=>{let t=e==null?null:MV(S.current,e);ae(e=>e===t?e:t)},[]),bt=HB((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Re(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;be(n,e?.scrollTop??null),k.current=!0,te(e=>e===n?e:n)}i.focus(),yt(a),gt.current=!0,de({anchorRect:r?.anchorRect??null,item:RV(e,n),path:n,source:r?.source??`keyboard`})},[t,Re,yt]),xt=HB(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=yV(e,it);N.current=qe<0||e==null?null:Math.max(0,Math.min(qe*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),q(e=>e+1))}},[t,qe,s,l,it]),St=HB((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=yV(i,it),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:rV({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,CV(i,a,s,l,u,d),D.current(),pe.current=n?e:null,!0},[t,s,c,it,h]),Ct=()=>y.current===!0||G.current!=null||V.current===!0,wt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Tt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Et=()=>{I.current!=null&&(clearTimeout(I.current),I.current=null),F.current=null},Dt=()=>{R.current?.remove(),R.current=null},Ot=()=>{Tt(P.current),P.current=null,L.current=null},kt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},At=()=>{B.current?.(),B.current=null,G.current!=null&&(clearTimeout(G.current),G.current=null),V.current=!1,H.current=null,W.current=null,U.current!=null&&(U.current.setAttribute(`draggable`,`true`),U.current.style.removeProperty(`touch-action`),U.current=null),Dt(),Et(),Ot(),z.current=null},jt=(e,n)=>{let r=S.current?.getRootNode(),i=uV(cV(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Mt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Et();return}let r=t.getItem(e.directoryPath),i=gV(r)?r:null;if(i==null||i.isExpanded()){Et();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;F.current!==a&&(Et(),F.current=a,I.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Nt=()=>{P.current=null;let e=L.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=pV(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Mt(jt(e.clientX,e.clientY)),P.current=wt(Nt)},Pt=(e,t)=>{L.current={clientX:e,clientY:t},P.current??=wt(Nt)},Ft=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(At(),Dt(),Et(),Ot(),t.startDrag(r)===!1){e.preventDefault();return}if(z.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),fV())){let t=dV(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),kt(t),R.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},It=()=>{Dt(),Et(),Ot(),z.current=null,t.cancelDrag()},Lt=(e,n,r)=>{if(G.current!=null||V.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;W.current={clientX:i.clientX,clientY:i.clientY},U.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!V.current;G.current!=null&&(clearTimeout(G.current),G.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),B.current===o&&(B.current=null),t&&(a.setAttribute(`draggable`,`true`),U.current===a&&(U.current=null),W.current=null)},s=e=>{let t=e.touches[0],n=W.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=aV*aV||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),B.current=o,G.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),U.current===a&&(U.current=null),W.current=null;return}V.current=!0,U.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),z.current=n;let e=a.getBoundingClientRect(),s=dV(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),kt(s),R.current=s,H.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=H.current;n!=null&&R.current!=null&&(R.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Mt(jt(t.clientX,t.clientY)),Pt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&jt(n.clientX,n.clientY),t.completeDrag(),At()},u=()=>{t.cancelDrag(),At()};B.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},iV)},Rt=e=>{if(ue!=null){if(e.key===`Escape`){vt(),e.preventDefault(),e.stopPropagation();return}OV.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ve.isActive()){if(e.key===`Escape`)Ve.cancel();else if(e.key===`Enter`)Ve.commit();else return;se(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){xt(Ke??void 0),e.preventDefault(),e.stopPropagation();return}if(We){if(e.key===`Escape`)M.current=!1,N.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=yV(n,it);N.current=qe<0||n==null?null:Math.max(0,Math.min(qe*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;se(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&vV(e)){t.openSearch(e.key),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ae&&EV(e),r=DV(e,Ae),i=r&&S.current!=null?ZB(S.current):null,a=r?new Set(FV(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Ke&&a.has(o)){let e=C.current;be(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=gV(p)?p:null,h=u!=null&&(ut.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=PV(u,E.current,T.current);e==null||n==null?y=!1:bt(e,u)}else if((e.ctrlKey||e.metaKey)&&_V(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ut.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))be(b,v?.scrollTop??null),k.current=!0,te(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(xe(b,LV(S.current,v,i,u,s,lt,it)),k.current=!0,te(e=>e===b?e:b)):ye()}q(e=>e+1),e.preventDefault(),e.stopPropagation()};zB(()=>{if(!(!f||!We)){if(Se.current){Se.current=!1;return}XB(w.current)}},[We,f]),zB(()=>{let e=x.current;switch(gB({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:He})){case`reset`:j.current=null;return;case`reveal-canonical`:He!=null&&St(He,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(pe.current=null,j.current=He,XB(e),e.select());return}},[at.end,at.start,He,St,ut]),zB(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=ZB(e)?.dataset.itemPath??null;te(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,ZB(e)!=null){r();return}k.current=!1,te(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,te(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;te(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),zB(()=>{let e=S.current;e!=null&&(nt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[nt.physical.scrollTop]),zB(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=yV(n,g);let a=()=>{let e=t.getVisibleCount(),r=bV(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),De(rV({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};D.current=a;let o=!1,l=t.subscribe(()=>{o?q(e=>e+1):o=!0,a()}),u=()=>{ve.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,le(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||ve.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),fe.current!=null&&y.current&&_t.current(),ve.current===!0){y.current=!1;return}re(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:xV(e[0]))??yV(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),zB(()=>{Ae||ue==null||vt(!1)},[vt,Ae,ue]);let zt=VB(()=>ue==null?null:`${ue.path}::${ue.source}`,[ue]);zB(()=>{if(zt==null){m?.clearSlotContent(ZN);return}let t=fe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??AV(n.getBoundingClientRect()),close:e=>{_t.current(e?.restoreFocus??!0)},restoreFocus:()=>{gt.current&&ht.current(fe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(ZN,i),e?.contextMenu?.onOpen?.(t.item,r),UV(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&UV(i)}),()=>{m?.clearSlotContent(ZN)}},[zt,e?.contextMenu,m]),zB(()=>{ue!=null&&t.getItem(ue.path)==null&&vt()},[vt,ue,t]),zB(()=>{if(ue==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(kV(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&vt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),vt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[vt,ue]),zB(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=Ke;return}let n=Ke==null?null:T.current.get(Ke)??null,r=ZB(t),i=r?.dataset.itemPath??null,a=Ue&&x.current===r,o=f&&w.current===r,c=M.current&&!We,l=N.current??0,u=pe.current,d=me.current,p=he.current,m=ge.current,h=r!=null,g=k.current||h,_=A.current!==Ke,v=d!=null&&d===Ke&&Ke!=null,y=c&&CV(e,qe,s,it,ct,l),b=u!=null&&u===Ke&&CV(e,qe,s,it,ct,lt),E=p!=null&&p.path===Ke&&CV(e,qe,s,it,ct,p.viewportOffset),O=m!=null&&m.path===Ke&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==Ke&&!v&&SV(e,qe,s,it,lt))&&D.current(),!g){A.current=Ke;return}if(a){A.current=Ke;return}if(o&&!c){A.current=Ke;return}if(n==null){c&&qe>=0&&(CV(e,qe,s,it,ct,l),D.current()),A.current=Ke;return}(_||c||u===Ke||d===Ke||p?.path===Ke||m?.path===Ke||i==null||i!==Ke)&&(XB(n),u===Ke&&(pe.current=null),d===Ke&&(me.current=null),p?.path===Ke&&(he.current=null),m?.path===Ke&&(ge.current=null),M.current=!1,N.current=null),A.current=Ke},[t,qe,Ke,dt,s,Ue,We,at,it,f,lt,ct,rt]);let Bt=qe>=0&&qe>=nt.visible.startIndex&&qe<=nt.visible.endIndex,Vt=Ke!=null&&ot.some(e=>eV(e.row)===Ke),Ht=Bt||Vt,Ut=Me&&k.current===!0&&Ht?Ke:null,Wt=oe===`pointer`?ne:null,Gt=ue?.path??_e.current??Wt??Ut??ne,Kt=ue?.source===`right-click`;zB(()=>{y.current&&ue==null||yt(Re(Gt))},[ue,Re,at,it,ce,ot,Gt,yt,rt]);let qt=HB(e=>{if(y.current||kV(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&se(e=>e===`pointer`?e:`pointer`),re(e=>e===i?e:i)},[]),Jt=HB(()=>{re(null)},[]);zB(()=>{if(!Je)return;let e=()=>{At(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),At(),t.cancelDrag()}},[t,Je]);let Yt=e=>{if(!Je||t.getDragSession()==null||V.current)return;let n=uV(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Mt(t.getDragSession()?.target??null),Pt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Xt=e=>{if(!Je||t.getDragSession()==null||V.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Et(),Ot(),t.setDragTarget(null))},Zt=e=>{!Je||t.getDragSession()==null||V.current||(e.preventDefault(),jt(e.clientX,e.clientY),t.completeDrag(),Dt(),Et(),Ot(),z.current=null)},Qt=nt.window.height,$t=nt.window.offsetTop,en=Math.min(0,it-Qt-lt),tn=ee===Ke||M.current,nn=Ke!=null&&tn&&!dt&&qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null,rn=nn==null?null:wV(qe,s,at,Qt),an=z.current,on=Qe!=null&&an!=null&&an.path===Qe&&an.index>=at.start&&an.index<=at.end,sn=Qe!=null&&an!=null&&an.path===Qe&&!on&&an.path!==nn?.path?an:null,cn=sn==null?null:wV(sn.index,s,at,Qt),ln=TV((qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null)?.ancestorPaths.at(-1)??null),un=We&&Ke!=null?BV(o,Ke,!dt):void 0,dn=ue?.path??(We?Ke:ee),fn=ue?.path??ne,pn=Re(Gt),mn=Ae&&Me&&!Kt&&!Ue&&pn!=null&&ie!=null&&Gt!=null,hn=Ae&&(mn||ue!=null),gn=ue?.anchorRect,_n=gn==null&&pn!=null&&ie!=null&&(ue!=null||mn)?ie:null,vn=gn==null?_n==null?void 0:{top:`${_n}px`}:{left:`${gn.left}px`,position:`fixed`,right:`auto`,top:`${gn.top}px`},yn=Kt?{opacity:`0`}:void 0,bn=HB((e,n,r,i)=>{let a=t.getItem(r),o=vB({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:t.isSearchOpen(),mode:i});switch(o.selection.kind){case`range`:t.selectPathRange(r,o.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(r);break;case`single`:t.selectOnlyPath(r);break}let s=e.currentTarget instanceof HTMLElement?e.currentTarget:null,c=n.index>=nt.visible.startIndex&&n.index<=nt.visible.endIndex,l=i===`flow`&&c&&s!=null&&s.dataset.itemParked!==`true`;a?.focus(),l&&(k.current=!0,te(e=>e===r?e:r),se(`focus`)),o.toggleDirectory&&gV(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&St(r,{targetOffset:`sticky-parents`})},[t,nt.visible.endIndex,nt.visible.startIndex,St]),xn=()=>{if(y.current||!Me||Gt==null||pn==null)return;let e=t.getItem(Gt);e!=null&&(yt(pn),gt.current=!0,de({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:pn.getAttribute(`aria-label`)??Gt,path:e.getPath()},path:e.getPath(),source:`button`}))},Sn={contextHoverPath:fn,contextMenuButtonTriggerEnabled:Me,contextMenuButtonVisibility:Ne,contextMenuEnabled:Ae,contextMenuRightClickEnabled:Pe,contextMenuTriggerMode:je,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Je,draggedPathSet:Xe,dragTarget:Ze,gitLaneActive:ze,gitStatusByPath:n,handleRowDragEnd:It,handleRowDragStart:Ft,handleRowTouchStart:Lt,ignoredGitDirectories:r,ignoredInheritanceCache:K,instanceId:o,itemHeight:s,onKeyDown:Rt,onRowClick:bn,openContextMenuForRow:bt,registerButton:Fe,registerRenameInput:Le,renameView:Ve,renderDecorationForRow:ft,resolveIcon:Be,shouldSuppressContextMenu:Ct,visualFocusPath:dn},Cn={...Sn,registerButton:Ie};return Rz(`div`,{ref:S,id:$e,"data-file-tree-context-menu-button-visibility":Ae&&Me?Ne:void 0,"data-file-tree-context-menu-trigger-mode":Ae?je:void 0,"data-file-tree-has-context-menu-action-lane":Ae&&Me?`true`:void 0,"data-file-tree-has-git-lane":ze?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Je?Xt:void 0,onDragOver:Je?Yt:void 0,onDrop:Je?Zt:void 0,onKeyDown:Rt,onPointerLeave:Ae?Jt:void 0,onPointerOver:Ae?qt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Rz(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:ln}}),Rz(`slot`,{name:XN,"data-type":`header-slot`}),f?Rz(`div`,{"data-file-tree-search-container":!0,"data-open":We?`true`:`false`,children:Rz(`input`,{ref:w,"aria-activedescendant":un,"aria-controls":$e,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ce?`true`:void 0,value:Ge,onBlur:()=>{d===`retain`&&!Te.current||t.closeSearch()},onFocus:J,onPointerDown:J,onInput:e=>{J();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Rz(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Oe&&ot.length>0?Rz(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Rz(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${et}px`},children:ot.map((e,t)=>GV(Cn,e.row,`sticky:${eV(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ot.length-t}`}}))})}):null,Rz(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ct}px`},children:[Rz(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${$t}px`}}),Rz(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${Qt}px`,top:`${en}px`,bottom:`${en}px`},children:[KV(Sn,at,ut),nn!=null&&rn!=null?GV(Sn,nn,`parked:${nn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:Qe===nn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${rn}px`}}):null,sn!=null&&cn!=null?GV(Sn,sn,`parked-drag:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${cn}px`}}):null]})]})]}),Ae?Rz(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":hn?`true`:`false`,style:vn,children:[Rz(`button`,{ref:v,type:`button`,"data-type":QN,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":ue==null?`false`:`true`,"data-visible":mn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),ue!=null){vt();return}xn()},tabIndex:-1,style:yn,children:Rz(Hz,{...Be(`file-tree-icon-ellipsis`)})}),ue==null?null:Rz(`slot`,{name:ZN})]}):null,ue==null?null:Rz(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),vt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),vt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var JV={hydrateRoot:(e,t)=>{Iz(fz(qV,t),e)},renderRoot:(e,t)=>{Fz(fz(qV,t),e)},unmountRoot:e=>{Fz(null,e)}};function YV(e,t){JV.renderRoot(e,t)}function XV(e,t){JV.hydrateRoot(e,t)}function ZV(e){JV.unmountRoot(e)}var QV=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},$V=`__c`,eH=`__k`,tH=`__d`,nH=`__s`,rH=/[\s\n\\/='"\0<>]/,iH=/^(xlink|xmlns|xml)([A-Z])/,aH=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,oH=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,sH=new Set([`draggable`,`spellcheck`]);function cH(e){e.__g===void 0?e[tH]=!0:e.__g|=8}function lH(e){e.__g===void 0?e[tH]=!1:e.__g&=-9}function uH(e){return e.__g===void 0?!0===e[tH]:!!(8&e.__g)}var dH=/["&<]/;function fH(e){if(e.length===0||!1===dH.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var pH={},mH=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),hH=/[A-Z]/g;function gH(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:pH[n]||(pH[n]=n.replace(hH,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||mH.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function _H(){this.__d=!0}function vH(e,t){return{__v:e,context:t,props:e.props,setState:_H,forceUpdate:_H,__d:!0,__h:[]}}function yH(e,t,n){if(!e.s){if(n instanceof bH){if(!n.s)return void(n.o=yH.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(yH.bind(null,e,t),yH.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var bH=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{yH(r,1,a(this.v))}catch(e){yH(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?yH(r,1,t?t(i):i):n?yH(r,1,n(i)):yH(r,2,i)}catch(e){yH(r,2,e)}},r},e}(),xH,SH,CH,wH,TH={},EH=Array.isArray,DH=Object.assign,OH=``,kH=`<!--$s-->`,AH=`<!--/$s-->`;function jH(e,t){var n,r=e.type,i=!0;return e[$V]?(i=!1,(n=e[$V]).state=n[nH]):n=new r(e.props,t),e[$V]=n,n.__v=e,n.props=e.props,n.context=t,cH(n),n.state??=TH,n[nH]??(n[nH]=n.state),r.getDerivedStateFromProps?n.state=DH({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[nH]===n.state?n.state:n[nH]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),CH&&CH(e),n.render(n.props,n.state,t)}function MH(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===OH)return OH;var s=typeof e;if(s!=`object`)return s==`function`?OH:s==`string`?fH(e):e+OH;if(EH(e)){var c,l=OH;i[eH]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=MH(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=OH,EH(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return OH;e.__=i,xH&&xH(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===mz){if(`tpl`in g){for(var x=OH,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!EH(C)?x+=C:x+=MH(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+fH(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=jH(e,b),y=e[$V];else{e[$V]=y=vH(e,b);for(var E=0;uH(y)&&E++<25;){lH(y),CH&&CH(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}cH(y)}if(y.getChildContext!=null&&(t=DH({},t,y.getChildContext())),T&&XR.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===mz&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return MH(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[nH]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,TH),uH(y)?(v=jH(e,t),(y=e[$V]).getChildContext!=null&&(t=DH({},t,y.getChildContext())),MH(v=v!=null&&v.type===mz&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):OH}finally{SH&&SH(e),wH&&wH(e)}}}v=v!=null&&v.type===mz&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=MH(v,t,n,r,e,a,o);return SH&&SH(e),XR.unmount&&XR.unmount(e),e._suspended?typeof D==`string`?kH+D+AH:EH(D)?(D.unshift(kH),D.push(AH),D):D.then(function(e){return kH+e+AH}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return MH(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=XR.__e;return k&&k(i,e),OH}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=MH(v,t,n,r,e,a,o);return e._suspended?kH+s+AH:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=OH;for(var N in g){var P=g[N];if(typeof(P=PH(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=gH(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(iH.test(N))N=N.replace(iH,`$1:$2`).toLowerCase();else{if(rH.test(N))continue;N[4]!==`-`&&!sH.has(N)||P==null?n?oH.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):aH.test(N)&&(N=N.toLowerCase()):P+=OH}}P!=null&&!1!==P&&(j=!0===P||P===OH?j+` `+N:j+` `+N+`="`+(typeof P==`string`?fH(P):P+OH)+`"`)}}if(rH.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=fH(A):A!=null&&!1!==A&&!0!==A&&(M=MH(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),SH&&SH(e),wH&&wH(e),!M&&NH.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return EH(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var NH=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function PH(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var FH=0;function IH(e){return e!=null&&e.length>0?e:(FH+=1,`pst_ft_${FH}`)}function LH({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??JL)}function RH(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function zH(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function BH(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var VH=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new QV;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=IH(a),this.#p=YR(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=qL(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new WR({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(ZV(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),YV(t.wrapper,this.#w()))}setGitStatus(e){this.#p=YR(e,this.#p);let t=this.#T();t!=null&&YV(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),YV(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),XV(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),YV(r,this.#w())}#C(){return{initialViewportHeight:LH({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(XN,e());return}this.#l.setSlotHtml(XN,this.#e?.header?.html??null)}#k(e){let t=BH(e).find(e=>zH(e)),n=RH(BN(eP(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=BH(e),n=t.find(e=>zH(e)),r=t.filter(e=>e!==n),i=eP(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=RH(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=eP(this.#m);t.colored&&HN(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${KN}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(KN,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=QL(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return iR(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},HH=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function UH(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:XN,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:ZN,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function WH(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function GH(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function KH(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function qH({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(n.getComposition()),d=(0,Q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Q.useCallback)(()=>{s(null)},[]),m=(0,Q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Q.useMemo)(()=>KH(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),HH(()=>{n.setComposition(g)},[g,n]),HH(()=>{if(c!=null)return r!=null&&GH(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=WH(UH(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,Z.jsx)(WN,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function JH(e){let t=(0,Q.useRef)(null);return t.current??=new VH(e),(0,Q.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}var YH=`.md`,XH=/\.(md|mdx)$/i;function ZH(e,t=YH){return`${e}${t}`}function QH(e){return gU(e).replace(XH,``)}function $H(e){return Mr(e)?nU(e.path):Pn(e)?e.path:ZH(e.docName,e.docExt)}function eU(e){let t=gU(e).match(XH);return t?`.${t[1].toLowerCase()}`:void 0}function tU(e){return gU(e)}function nU(e){let t=gU(e.trim());return t?`${t}/`:``}function rU(e){return e.endsWith(`/`)?tU(e):QH(e)}function iU(e){return e.map($H)}function aU(e){return[...e].sort().join(`\0`)}function oU(e){return aU(iU(e))}function sU(e){let t=new Set;for(let n of e){if(Mr(n)){let e=nU(n.path);e&&t.add(e)}let e=(Mr(n)||Pn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Mr(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function cU(e){if(!e)return[];let t=gU(e.replace(XH,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function lU(e){let t=e.kind===`directory`,n=t?tU(e.path):QH(e.path),r=t?void 0:eU(e.path);return{kind:t?`folder`:`file`,name:gU(hU(e.path)).replace(XH,``),path:n,treePath:dU(e.path,t),docExt:r}}function uU(e){return e.kind===`directory`?tU(e.path):e.path}function dU(e,t){return t?nU(e):XH.test(e)?e:`${e}${YH}`}function fU(e,t,n){let r=nU(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${YH}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function pU(e,t){return e===`file`?dU(t,!1):`${tU(t)}/index${YH}`}function mU(e,t){return t.kind===`root`||t.directoryPath==null?hU(e):`${t.directoryPath}${hU(e)}`}function hU(e){let t=gU(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function gU(e){return e.endsWith(`/`)?e.slice(0,-1):e}function _U(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function vU(e){let t=_U(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}function yU(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function bU(e,t,n={}){if(!e)return yU(t);let r=Hn(e);if(t&&r!==t)return yU(t);switch(e.kind){case`doc`:return yU(t??e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?yU(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function xU(e,t){if(!e)return{kind:`none`};let n=t.find(t=>$H(t)===e);if(n&&Pn(n))return{kind:`asset`,hash:_r(n.path)};let r=rU(e);return e.endsWith(`/`)?t.some(e=>Mr(e)?e.path===r||e.path.startsWith(`${r}/`):(Pn(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Dr(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}function SU(e){return e?.isDirectory()?e:null}function CU(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function wU(e,t,n,r){let i=(0,$.c)(6),a,o;i[0]!==n||i[1]!==t||i[2]!==e||i[3]!==r?(a=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=SU(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}CU(e,o),o.focus(),i()},o=[n,t,e,r],i[0]=n,i[1]=t,i[2]=e,i[3]=r,i[4]=a,i[5]=o):(a=i[4],o=i[5]),(0,Q.useEffect)(a,o)}function TU(e){let t=!1,n=!1,r=!1;async function i(){if(!r){t=!0;try{await e()}finally{t=!1,r?n=!1:n&&(n=!1,i())}}}return{request(){if(!r){if(t){n=!0;return}i()}},dispose(){r=!0,n=!1}}}function EU(e){return e?`No workspace`:null}function DU(e){let t=(0,$.c)(48),{input:n,installStates:r,dispatch:i}=e,{skillInstalled:a,refresh:o}=ua(),[s,c]=(0,Q.useState)(!1),l=n===null,u;t[0]===l?u=t[1]:(u=EU(l),t[0]=l,t[1]=u);let d=u,f,p,m,h,g,_;if(t[2]!==i||t[3]!==d||t[4]!==n||t[5]!==l||t[6]!==r||t[7]!==a){let e;t[14]===r?e=t[15]:(e=e=>r[e.id]?.installed===!0,t[14]=r,t[15]=e);let o=kf.filter(e);m=r[`claude-cowork`]?.installed===!0;let s;t[16]===n?s=t[17]:(s=n===null?``:er(n.docContext),t[16]=n,t[17]=s);let u=s,v;t[18]!==n||t[19]!==u?(v=()=>{n!==null&&lM(u)},t[18]=n,t[19]=u,t[20]=v):v=t[20],h=v,p=wi,t[21]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(si,{children:[(0,Z.jsx)(ti,{"aria-hidden":`true`}),`Open in`]}),t[21]=_):_=t[21],f=ia;let y;t[22]!==i||t[23]!==d||t[24]!==n||t[25]!==l||t[26]!==a?(y=e=>{let t=!l,r=e.id===`claude-cowork`&&t&&!a?()=>c(!0):void 0,o=uM({target:e,onInstallSkillRequest:r}),s=o?`Install Open Knowledge skill in ${e.displayName}`:d?`Open in ${e.displayName}, ${d}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(li,{disabled:!t,onSelect:()=>{n&&(o&&r?r():i(e.id,n))},"data-testid":`file-tree-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(rM,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:Y(`flex-1`,o&&`whitespace-nowrap`),children:e.displayName}),o?(0,Z.jsx)(We,{variant:`outline`,"aria-hidden":`true`,className:`ml-2 h-[18px] px-1.5 py-0 text-[10px]`,"data-testid":`open-in-agent-skill-install-badge`,children:`Install`}):d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null]},e.id)},t[22]=i,t[23]=d,t[24]=n,t[25]=l,t[26]=a,t[27]=y):y=t[27],g=o.map(y),t[2]=i,t[3]=d,t[4]=n,t[5]=l,t[6]=r,t[7]=a,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=g,t[13]=_}else f=t[8],p=t[9],m=t[10],h=t[11],g=t[12],_=t[13];let v;t[28]!==m||t[29]!==h||t[30]!==l?(v=m?null:(0,Z.jsxs)(li,{onSelect:h,disabled:l,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(pt,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in claude.ai →`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser`})]}),t[28]=m,t[29]=h,t[30]=l,t[31]=v):v=t[31];let y;t[32]!==f||t[33]!==g||t[34]!==v?(y=(0,Z.jsxs)(f,{children:[g,v]}),t[32]=f,t[33]=g,t[34]=v,t[35]=y):y=t[35];let b;t[36]!==p||t[37]!==_||t[38]!==y?(b=(0,Z.jsxs)(p,{children:[_,y]}),t[36]=p,t[37]=_,t[38]=y,t[39]=b):b=t[39];let x;t[40]===o?x=t[41]:(x=e=>{c(e),e||o()},t[40]=o,t[41]=x);let S;t[42]!==s||t[43]!==x?(S=(0,Z.jsx)(oa,{open:s,onOpenChange:x}),t[42]=s,t[43]=x,t[44]=S):S=t[44];let C;return t[45]!==b||t[46]!==S?(C=(0,Z.jsxs)(Z.Fragment,{children:[b,S]}),t[45]=b,t[46]=S,t[47]=C):C=t[47],C}var OU=at(`HOVER_INTENT_MS`,80),kU=3,AU=20,jU=new Map,MU=new Set,NU=[],PU=new Map;function FU(e){for(PU.delete(e),PU.set(e,!0);PU.size>AU;){let e=PU.keys().next().value;if(e===void 0)break;PU.delete(e)}}function IU(e){MU.delete(e),RU()}function LU(e,t){let n=Date.now();ye(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),_t(e,t,n)}function RU(){for(;MU.size<kU&&NU.length>0;){let e=NU.shift();if(!e)break;if(!PU.has(e.docName)){MU.add(e.docName),FU(e.docName);try{let t=e.prewarm(e.docName);t&&LU(e.docName,t)}catch(t){ye(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{IU(e.docName)}}}}function zU(e,t){if(xe(e)||PU.has(e))return;let n=jU.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(jU.delete(e),MU.size>=kU){NU.push({docName:e,prewarm:t});return}FU(e),MU.add(e);try{let n=t(e);n&&LU(e,n)}catch(t){ye(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{IU(e)}},OU);jU.set(e,{timer:r,prewarm:t})}function BU(e){let t=jU.get(e);t&&(clearTimeout(t.timer),jU.delete(e))}var VU=/\.(md|mdx)$/i;function HU(e){if(window.location.hash===e)return;let{pathname:t,search:n}=window.location;window.history.replaceState(null,``,`${t}${n}${e}`)}function UU(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function WU(e){let t=e.match(VU);return t?t[0]:null}async function GU(e,t){try{await navigator.clipboard.writeText(e),qa.success(`Copied ${t}`,{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),qa.error(`Could not copy ${t}`)}}var KU=new Set([`agents`,`agent`,`claude`,`skill`]),qU=`ok-file-tree-link-decoration`,JU=`ok-file-tree-agent-decoration`;function YU(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function XU(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${YU(t)}</symbol>`}var ZU=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1847
|
+
${XU(qU,Ms)}
|
|
1848
|
+
${XU(JU,rs)}
|
|
1849
|
+
</svg>`,QU=`
|
|
1850
1850
|
[data-item-selected='true'] [data-icon-token='markdown'] {
|
|
1851
1851
|
color: var(--trees-selected-fg);
|
|
1852
1852
|
}
|
|
1853
|
-
`;function WU(e){return{...aP({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`}}function GU(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&LU.has(t)}function KU(e){return e===`darwin`?`Reveal in Finder`:e===`win32`?`Reveal in File Explorer`:`Open Containing Folder`}function qU(e){let t=(0,$.c)(14),{item:n,workspace:r,onClose:i}=e,a=typeof window<`u`?window.okDesktop:void 0;if(!a)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=KU(a.platform),t[0]=o):o=t[0];let s=o,c=r?null:`No workspace`,l=!r,u;t[1]!==n||t[2]!==i||t[3]!==r?(u=()=>{if(!r)return;i();let e=cp(r.contentDir,iU(n),r.pathSeparator);a.shell.showItemInFolder(e)},t[1]=n,t[2]=i,t[3]=r,t[4]=u):u=t[4];let d=c?`${s}, ${c}`:s,f,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(fe,{"aria-hidden":`true`}),p=(0,Z.jsx)(`span`,{className:`flex-1`,children:s}),t[5]=f,t[6]=p):(f=t[5],p=t[6]);let m;t[7]===c?m=t[8]:(m=c?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:c}):null,t[7]=c,t[8]=m);let h;return t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==m?(h=(0,Z.jsxs)(li,{disabled:l,onSelect:u,"aria-label":d,children:[f,p,m]}),t[9]=l,t[10]=u,t[11]=d,t[12]=m,t[13]=h):h=t[13],h}function JU(e){return e?.isDirectory()?e:null}function YU(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function XU(e){return rU({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e})}function ZU(e,t){return e!==t&&e.startsWith(t)}function QU(e,t){let n=[...new Set(e)].filter(e=>!t(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>ZU(e,t))).map(XU)}function $U(e,t){return e===t||e.startsWith(`${t}/`)}function eW(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function tW(e,t,n){let r=new Set,i=new Set;for(let a of e){if(a.kind===`file`){r.add(a.path);continue}i.add(a.path);for(let e of t)Dr(e)&&e.docName.startsWith(`${a.path}/`)&&r.add(e.docName);for(let e of n){let t=YH(e);$U(t,a.path)&&i.add(t)}}return{docNames:r,folderPaths:i}}function nW(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:$U(t.createdPath,e.path)}function rW(e){let t=(0,$.c)(85),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,onStartCreating:l,onStartCreatingFromTemplate:u,onDelete:d,onExpandSubtree:f,onCollapseSubtree:p,isAsset:h,isAssetTreePath:g}=e,_,v,y,b,x;if(t[0]!==h||t[1]!==g||t[2]!==n||t[3]!==s||t[4]!==c){x=rU(n),y=n.kind===`directory`,_=!h&&c!==null,v=y?`Hide files in this folder`:`Hide this file`;let e=s.getSelectedPaths();b=e.includes(x.treePath)?QU(e,g):[],t[0]=h,t[1]=g,t[2]=n,t[3]=s,t[4]=c,t[5]=_,t[6]=v,t[7]=y,t[8]=b,t[9]=x}else _=t[5],v=t[6],y=t[7],b=t[8],x=t[9];let S=b,C;t[10]!==S||t[11]!==x?(C=S.length>1?S:[x],t[10]=S,t[11]=x,t[12]=C):C=t[12];let w=C,T=w.length>1?`Delete ${w.length} Items`:`Delete`,E;t[13]!==y||t[14]!==n.path||t[15]!==a?(E=y?null:up({docName:KH(n.path),workspace:a}),t[13]=y,t[14]=n.path,t[15]=a,t[16]=E):E=t[16];let D=E,O;t[17]===r?O=t[18]:(O=()=>r.close({restoreFocus:!1}),t[17]=r,t[18]=O);let k=O,A;t[19]===r?A=t[20]:(A=()=>r.close(),t[19]=r,t[20]=A);let j=A,M;t[21]===j?M=t[22]:(M=e=>{e||j()},t[21]=j,t[22]=M);let N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[23]=N):N=t[23];let P;t[24]!==i||t[25]!==j||t[26]!==k||t[27]!==y||t[28]!==n.path||t[29]!==p||t[30]!==f||t[31]!==l||t[32]!==u?(P=y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(li,{disabled:i,onSelect:()=>{k(),l(`file`,YH(n.path))},children:[(0,Z.jsx)(tc,{"aria-hidden":`true`}),`New File`]}),(0,Z.jsxs)(li,{disabled:i,onSelect:()=>{k(),u(YH(n.path))},children:[(0,Z.jsx)(ys,{"aria-hidden":`true`}),`New from template`]}),(0,Z.jsxs)(li,{disabled:i,onSelect:()=>{k(),l(`folder`,YH(n.path))},children:[(0,Z.jsx)(ws,{"aria-hidden":`true`}),`New Folder`]}),(0,Z.jsx)(di,{}),(0,Z.jsxs)(li,{onSelect:()=>{j(),f(n.path)},children:[(0,Z.jsx)(lc,{"aria-hidden":`true`}),`Expand All`]}),(0,Z.jsxs)(li,{onSelect:()=>{j(),p(n.path)},children:[(0,Z.jsx)(Ss,{"aria-hidden":`true`}),`Collapse All`]}),(0,Z.jsx)(di,{})]}):null,t[24]=i,t[25]=j,t[26]=k,t[27]=y,t[28]=n.path,t[29]=p,t[30]=f,t[31]=l,t[32]=u,t[33]=P):P=t[33];let F;t[34]!==i||t[35]!==k||t[36]!==h||t[37]!==n.path||t[38]!==s?(F=h?null:(0,Z.jsxs)(li,{disabled:i,onSelect:()=>{k(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Re,{"aria-hidden":`true`}),`Rename`]}),t[34]=i,t[35]=k,t[36]=h,t[37]=n.path,t[38]=s,t[39]=F):F=t[39];let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsxs)(si,{children:[(0,Z.jsx)(U,{"aria-hidden":`true`}),`Copy Path`]}),t[40]=I):I=t[40];let L=!a,R;t[41]!==j||t[42]!==n||t[43]!==a?(R=()=>{a&&(j(),IU(cp(a.contentDir,iU(n),a.pathSeparator),`full path`))},t[41]=j,t[42]=n,t[43]=a,t[44]=R):R=t[44];let z;t[45]!==L||t[46]!==R?(z=(0,Z.jsx)(li,{disabled:L,onSelect:R,children:`Full Path`}),t[45]=L,t[46]=R,t[47]=z):z=t[47];let B;t[48]!==j||t[49]!==n?(B=(0,Z.jsx)(li,{onSelect:()=>{j(),IU(iU(n),`relative path`)},children:`Relative Path`}),t[48]=j,t[49]=n,t[50]=B):B=t[50];let V;t[51]!==z||t[52]!==B?(V=(0,Z.jsxs)(wi,{children:[I,(0,Z.jsxs)(ia,{children:[z,B]})]}),t[51]=z,t[52]=B,t[53]=V):V=t[53];let H;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(di,{}),t[54]=H):H=t[54];let W;t[55]!==j||t[56]!==n||t[57]!==a?(W=(0,Z.jsx)(qU,{item:n,workspace:a,onClose:j}),t[55]=j,t[56]=n,t[57]=a,t[58]=W):W=t[58];let G;t[59]!==o||t[60]!==D||t[61]!==h||t[62]!==y?(G=!y&&!h&&(0,Z.jsx)(vU,{input:D,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),t[59]=o,t[60]=D,t[61]=h,t[62]=y,t[63]=G):G=t[63];let K;t[64]!==i||t[65]!==_||t[66]!==j||t[67]!==T||t[68]!==w||t[69]!==v||t[70]!==h||t[71]!==c||t[72]!==d||t[73]!==x?(K=h?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(di,{}),(0,Z.jsxs)(li,{"data-testid":`file-tree-menu-hide`,disabled:!_,onSelect:()=>{if(!c)return;j();let e=fU(x),t=qi(Vi(Gi(c.current()),e));c.patch(t)},children:[(0,Z.jsx)(m,{"aria-hidden":`true`}),v]}),(0,Z.jsx)(di,{}),(0,Z.jsxs)(li,{variant:`destructive`,disabled:i,onSelect:()=>{j(),d(w)},children:[(0,Z.jsx)(et,{"aria-hidden":`true`}),T]})]}),t[64]=i,t[65]=_,t[66]=j,t[67]=T,t[68]=w,t[69]=v,t[70]=h,t[71]=c,t[72]=d,t[73]=x,t[74]=K):K=t[74];let q;t[75]!==V||t[76]!==W||t[77]!==G||t[78]!==K||t[79]!==P||t[80]!==F?(q=(0,Z.jsxs)(ki,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:[P,F,V,H,W,G,K]}),t[75]=V,t[76]=W,t[77]=G,t[78]=K,t[79]=P,t[80]=F,t[81]=q):q=t[81];let ee;return t[82]!==q||t[83]!==M?(ee=(0,Z.jsxs)(Ca,{open:!0,modal:!1,onOpenChange:M,children:[N,q]}),t[82]=q,t[83]=M,t[84]=ee):ee=t[84],ee}function iW(e){let t=(0,$.c)(176),{ref:n}=e,{activeDocName:r,activeTarget:i,closeTabs:a,closeTab:o,closeDocument:s,closeAndClearForRename:c,isNewTabActive:l,openTarget:u,prewarm:f,remapTabsForRename:p}=Ue(),{notifySidebarFileSelected:m}=FA(),{resolvedTheme:h}=pn(),{addPage:g}=xr(),_;t[0]!==m||t[1]!==u?(_=function(e){u({kind:`doc`,target:e,docName:e},{tabBehavior:`replace-active`}),NU($n(e)),m()},t[0]=m,t[1]=u,t[2]=_):_=t[2];let v=_,y;t[3]!==m||t[4]!==u?(y=function(e){let t=In(e);u({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),NU(t),m()},t[3]=m,t[4]=u,t[5]=y):y=t[5];let b=y,x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[6]=x):x=t[6];let[S,C]=(0,Q.useState)(x),[w,T]=(0,Q.useState)(!0),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),I=(0,Q.useRef)(S),L;t[7]!==S||t[8]!==b||t[9]!==v||t[10]!==m?(L=function(e,t){let n=hU(e,t===void 0?S:t);if(n.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,ZH(e));return}if(n.kind===`asset`){window.location.hash=n.hash,m();return}if(n.kind===`folder`){b(n.path);return}v(n.path)},t[7]=S,t[8]=b,t[9]=v,t[10]=m,t[11]=L):L=t[11];let R=L,z=(0,Q.useRef)(r),B;t[12]===S?B=t[13]:(B=new Set(S.filter(Pn).map(yW)),t[12]=S,t[13]=B);let V=B,H=(0,Q.useRef)(V),U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(U=[],t[14]=U):U=t[14];let W=(0,Q.useRef)(U),G=(0,Q.useRef)(null),K=(0,Q.useRef)(vW),q=(0,Q.useRef)(null),ee=(0,Q.useRef)(null),te=(0,Q.useRef)(!1),ne=(0,Q.useRef)(null),re=(0,Q.useRef)(null),ie=(0,Q.useRef)(_W),ae=(0,Q.useRef)(gW),oe=(0,Q.useRef)(hW),se=(0,Q.useRef)(mW),ce=(0,Q.useRef)(i),{selectedFilePath:le,selectedFolderPath:de,navigationPath:fe}=mU(i,l?null:r),pe=le?GH(le,S.find(e=>Dr(e)&&e.docName===le)?.docExt):de?XH(de):i?.kind===`asset`?i.assetPath:null,me=Ap().states,{dispatch:he}=yp(),ge;t[15]!==he||t[16]!==me?(ge={installStates:me,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:he},t[15]=he,t[16]=me,t[17]=ge):ge=t[17];let _e=ge,{okignoreBinding:ve}=Yi(),ye;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>ne.current===null,t[18]=ye):ye=t[18];let be=ye,xe;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(xe=[],t[19]=xe):xe=t[19];let Se;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Se={set:`complete`,spriteSheet:HU},t[20]=Se):Se=t[20];let Ce;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Ce={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[21]=Ce):Ce=t[21];let we;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(we={canDrag:be,canDrop:be,onDropComplete:e=>se.current(e),onDropError:pW},t[22]=we):we=t[22];let Te;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Te={paths:xe,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:Se,unsafeCSS:UU,composition:Ce,dragAndDrop:we,renaming:{canRename:be,onRename:e=>ae.current(e),onError:e=>oe.current(e)},onSelectionChange:e=>ie.current(e),renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=I.current.find(e=>Dr(e)&&GH(e.docName,e.docExt)===t.path);return n?.isSymlink?{icon:RU,title:n.targetPath?`Symlink to ${n.targetPath}`:`Symlink`}:GU(t.path)?{icon:zU,title:`Agent configuration file`}:null}},t[23]=Te):Te=t[23];let{model:J}=HH(Te),Ee;t[24]===J?Ee=t[25]:(Ee=function(e){let t=J.getItem(e)??J.getItem(XH(e));return t?.isDirectory()?XH(YH(t.getPath())):e},t[24]=J,t[25]=Ee);let De=Ee,Oe,ke;t[26]===S?(Oe=t[27],ke=t[28]):(ke=QH(S),Oe=$H(ke),t[26]=S,t[27]=Oe,t[28]=ke);let Ae=Oe,je=(0,Q.useRef)(ke),Me;t[29]===S?Me=t[30]:(Me=tU(S),t[29]=S,t[30]=Me);let Ne=Me,Pe=(0,Q.useRef)(Ne),Fe=de?nU(XH(de)).slice(0,-1):nU(pe??fe),Le=Fe.join(`\0`),Re;if(t[31]!==J){let e=()=>{let e=new Set;for(let t of Pe.current)JU(J.getItem(t))?.isExpanded()&&e.add(t);return e};Re=t=>{let n=new Set(tU(t??I.current)),r=e();for(let e of W.current)r.add(e);return[...r].filter(e=>n.has(e))},t[31]=J,t[32]=Re}else Re=t[32];let ze=Re,Be;t[33]!==ze||t[34]!==J?(Be=e=>{let t=QH(e??I.current);J.resetPaths(t,{initialExpandedPaths:ze(e)})},t[33]=ze,t[34]=J,t[35]=Be):Be=t[35];let Ve=Be,He;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(He=e=>{q.current=eU(e)},t[36]=He):He=t[36];let We=He,Ge;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=e=>H.current.has(e),t[37]=Ge):Ge=t[37];let Ke=Ge,qe=function(e){let t=PU(e);if(!t||FU(t))return!1;let n=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||Ke(n))return!1;let r=FU(n);if(!r)return!1;let i=XH(t);if(!Pe.current.includes(i))return!1;let a=`${t}${r}`;return je.current.includes(a)?!1:(ht({sourcePath:n,destinationPath:a,isFolder:!1}),J.move(n,a),!0)},Je;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Je=e=>{let t=e??G.current;!t||G.current!==t||(t.disposeCommitListener(),G.current=null)},t[38]=Je):Je=t[38];let Ye=Je,Xe;t[39]!==Ye||t[40]!==s||t[41]!==o||t[42]!==Ve?(Xe=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,i=n.restoreLocation??r;Ye(e),r&&k(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=await Ie(t,`Failed to clean up pending ${e.kind}`);if(n.ok)return;let i=`${n.title} - ${e.kind} "${e.createdPath}" still exists on disk`;r?qa.error(i):console.warn(`[FileTree] cleanup pending create failed: ${i}`),r&&(k(null),Ve());return}}catch(t){console.warn(`[FileTree] cleanup pending create failed:`,t),r&&qa.error(`Network error - ${e.kind} "${e.createdPath}" still exists on disk`),r&&(k(null),Ve());return}r&&(e.kind===`file`?s(e.createdPath):o(tt(e.createdPath))),r&&C(t=>{let n=xj(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return We(n),n}),Kn([`files`,`backlinks`,`graph`]),i&&(window.location.hash=e.previousHash),r&&k(null)},t[39]=Ye,t[40]=s,t[41]=o,t[42]=Ve,t[43]=Xe):Xe=t[43];let Ze=Xe,Qe,$e;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=()=>()=>{let e=G.current;e&&K.current(e,{restoreLocation:!1,updateUi:!1}).catch(fW)},$e=[],t[44]=Qe,t[45]=$e):(Qe=t[44],$e=t[45]),(0,Q.useEffect)(Qe,$e);let et,nt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>{let e=!0,t=gU(async function(){try{let t=await Ie(await fetch(`/api/documents`),`Failed to load documents`);if(!e)return;if(!t.ok)D(t.title);else{let e=Gn.safeParse(t.body);e.success?(C(e.data.documents),D(null)):D(`Documents response did not match expected shape.`)}}catch(t){let n=t;e&&D(`Could not reach server`),console.warn(`[FileTree] fetch failed:`,n)}e&&T(!1)});t.request();let n=()=>{document.visibilityState===`visible`&&t.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=mr(e=>{e.includes(`files`)&&t.request()});return()=>{e=!1,t.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},nt=[],t[46]=et,t[47]=nt):(et=t[46],nt=t[47]),(0,Q.useEffect)(et,nt);let rt,it;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(rt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=d(Dn,n,`workspace`,null);r&&F({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(dW),()=>{e=!1}},it=[],t[48]=rt,t[49]=it):(rt=t[48],it=t[49]),(0,Q.useEffect)(rt,it);let at;t[50]!==ze||t[51]!==J||t[52]!==Ae?(at=()=>{if(q.current===Ae){q.current=null;return}J.resetPaths(je.current,{initialExpandedPaths:ze()})},t[50]=ze,t[51]=J,t[52]=Ae,t[53]=at):at=t[53];let ot;t[54]!==J||t[55]!==Ae?(ot=[J,Ae],t[54]=J,t[55]=Ae,t[56]=ot):ot=t[56],(0,Q.useEffect)(at,ot);let st,ct;t[57]!==Le||t[58]!==pe||t[59]!==J?(st=()=>{let e=()=>{queueMicrotask(()=>{te.current=!1})};if(te.current=!0,!pe){for(let e of J.getSelectedPaths())J.getItem(e)?.deselect();e();return}let t=Le?Le.split(`\0`):[];for(let e of t){let t=JU(J.getItem(e));t&&!t.isExpanded()&&t.expand()}let n=J.getItem(pe);if(!n){e();return}YU(J,n),n.focus(),e()},ct=[Le,pe,J],t[57]=Le,t[58]=pe,t[59]=J,t[60]=st,t[61]=ct):(st=t[60],ct=t[61]),(0,Q.useEffect)(st,ct);let lt,ut;t[62]===J?(lt=t[63],ut=t[64]):(lt=()=>J.subscribe(()=>{if(!J.isSearchOpen())for(let e of W.current){let t=JU(J.getItem(e));t&&!t.isExpanded()&&t.expand()}}),ut=[J],t[62]=J,t[63]=lt,t[64]=ut),(0,Q.useEffect)(lt,ut);let dt,ft;t[65]===J?(dt=t[66],ft=t[67]):(dt=()=>J.onMutation(`remove`,e=>{let t=G.current;!t||e.path!==t.renamePath||K.current(t)}),ft=[J],t[65]=J,t[66]=dt,t[67]=ft),(0,Q.useEffect)(dt,ft);let pt;t[68]!==g||t[69]!==c||t[70]!==b||t[71]!==p?(pt=async(e,t,n)=>{let r=t===void 0?[]:t,i=n?.docName??z.current,a=Sj(i,e),o=n?.folderPath??(ce.current?.kind===`folder`?ce.current.folderPath:null),s=o?ue(o,r):null;await Promise.all(e.flatMap(e=>[c(e.fromDocName),c(e.toDocName)]));for(let t of e)g(t.toDocName);p(e,r),C(t=>{let n=bj(t,e,r);return We(n),n}),o&&s&&s!==o?b(s):a&&a!==i&&(window.location.hash=$n(a)),Kn([`files`,`backlinks`,`graph`])},t[68]=g,t[69]=c,t[70]=b,t[71]=p,t[72]=pt):pt=t[72];let mt=pt;async function ht(e){let t=aU(e.sourcePath,e.isFolder),n=aU(e.destinationPath,e.isFolder);k(t),D(null);try{if(!e.isFolder&&Ke(t)){qa.error(`Assets cannot be renamed from the sidebar`),Ve(),Ye(),k(null);return}let r=e.isFolder?{kind:`folder`,fromPath:YH(t),toPath:YH(n)}:{kind:`file`,fromPath:KH(t),toPath:KH(n)},i={docName:z.current,folderPath:ce.current?.kind===`folder`?ce.current.folderPath:null},a=await Ie(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)}),`Failed to rename path`);if(!a.ok){qa.error(a.title),D(a.title),Ve();let e=G.current;e&&e.renamePath===t?await Ze(e):Ye(),k(null);return}await mt(d(gn,a.body,`rename-path`,{renamed:[]}).renamed,e.isFolder?[{fromPath:YH(t),toPath:YH(n)}]:[],i),Ye(),k(null)}catch(e){console.warn(`[FileTree] rename failed:`,e),qa.error(`Network error — please try again`),D(`Network error — please try again`),Ve();let n=G.current;n&&n.renamePath===t?await Ze(n):Ye(),k(null)}}let gt;t[73]!==mt||t[74]!==Ve?(gt=async function(e){let t=e.draggedPaths.map(t=>{let n=cU(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(uW);if(t.length!==0){if(t.some(e=>Ke(e.sourcePath))){qa.error(`Assets cannot be moved from the sidebar`),Ve();return}k(t[0]?.sourcePath??null),D(null);try{let e=[],n=[],r={docName:z.current,folderPath:ce.current?.kind===`folder`?ce.current.folderPath:null};for(let r of t){let t=r.sourcePath.endsWith(`/`),i=t?{kind:`folder`,fromPath:YH(r.sourcePath),toPath:YH(r.destinationTreePath)}:{kind:`file`,fromPath:KH(r.sourcePath),toPath:KH(r.destinationTreePath)},a=await Ie(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),`Failed to move`);if(!a.ok){qa.error(a.title),D(a.title),Ve(),k(null);return}let o=d(gn,a.body,`rename-path:drop`,{renamed:[]});e=e.concat(o.renamed),t&&n.push({fromPath:YH(r.sourcePath),toPath:YH(r.destinationTreePath)})}await mt(e,n,r),k(null)}catch(e){console.warn(`[FileTree] move failed:`,e),qa.error(`Network error — please try again`),Ve(),k(null)}}},t[73]=mt,t[74]=Ve,t[75]=gt):gt=t[75];let _t=gt,vt;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(vt=function(e){N({parentDir:e})},t[76]=vt):vt=t[76];let yt=vt,bt;t[77]!==Ze||t[78]!==Ye||t[79]!==J||t[80]!==b||t[81]!==v||t[82]!==Ve||t[83]!==ke?(bt=async function(e,t){if(ne.current)return;let n=G.current;n&&Ye(n);try{let n=oU(e,t,[...ke,...Pe.current]);k(n.renamePath),ne.current=n.renamePath;let r=window.location.hash,i;if(e===`file`){let e=sU(`file`,n.addPath),t=await Ie(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create file`);if(!t.ok){qa.error(t.title),D(t.title),k(null),ne.current=null;return}let r=KH(e),a=d(Sr,t.body,`create-page`,{docName:r}).docName;i=a;let o=e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`;C(e=>{if(e.some(e=>Dr(e)&&e.docName===a))return e;let t=[...e,{kind:`document`,docName:a,docExt:o,modified:new Date().toISOString(),size:0}];return We(t),t}),Kn([`files`,`backlinks`,`graph`]),v(a)}else{let e=YH(n.addPath),t=await Ie(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create folder`);if(!t.ok){qa.error(t.title),D(t.title),k(null),ne.current=null;return}i=d(pr,t.body,`create-folder`,{path:e}).path,C(e=>{if(e.some(e=>Mr(e)&&e.path===i))return e;let t=[...e,{kind:`folder`,path:i,modified:new Date().toISOString(),size:0}];return We(t),t}),Kn([`files`]),b(i)}let a=!1,o=e=>{if(e.key!==`Enter`)return;let t=G.current;!t||t.renamePath!==n.renamePath||queueMicrotask(()=>Ye(t))};document.addEventListener(`keydown`,o,!0),G.current={kind:e,renamePath:n.renamePath,createdPath:i,previousHash:r,disposeCommitListener:()=>{a||(a=!0,document.removeEventListener(`keydown`,o,!0))}},k(null),ne.current=null,J.add(n.addPath),J.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),qa.error(`Could not start creating a new item`);let t=G.current;t?await Ze(t):Ye(),k(null),ne.current=null,Ve()}},t[77]=Ze,t[78]=Ye,t[79]=J,t[80]=b,t[81]=v,t[82]=Ve,t[83]=ke,t[84]=bt):bt=t[84];let xt=bt,St;t[85]===J?St=t[86]:(St=function(e){let t=XH(e);(0,Q.startTransition)(()=>{for(let e of Pe.current)if(e===t||e.startsWith(t)){let t=JU(J.getItem(e));t&&t.expand()}})},t[85]=J,t[86]=St);let Ct=St,wt;t[87]===J?wt=t[88]:(wt=function(e){let t=XH(e),n=new Set(W.current);(0,Q.startTransition)(()=>{for(let e of[...Pe.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=JU(J.getItem(e));t&&t.collapse()}})},t[87]=J,t[88]=wt);let Tt=wt,Et;t[89]!==R||t[90]!==Fe||t[91]!==r||t[92]!==i||t[93]!==V||t[94]!==O||t[95]!==Ze||t[96]!==S||t[97]!==Ne||t[98]!==_t||t[99]!==ht||t[100]!==De||t[101]!==qe||t[102]!==ke?(Et=()=>{I.current=S,z.current=r,ce.current=i,H.current=V,ne.current=O,je.current=ke,Pe.current=Ne,W.current=Fe,K.current=Ze,ie.current=e=>{if(te.current||e.length!==1)return;let t=e[0];t&&R(De(t),S)},oe.current=e=>{qe(e)||qa.error(e)},ae.current=ht,se.current=_t},t[89]=R,t[90]=Fe,t[91]=r,t[92]=i,t[93]=V,t[94]=O,t[95]=Ze,t[96]=S,t[97]=Ne,t[98]=_t,t[99]=ht,t[100]=De,t[101]=qe,t[102]=ke,t[103]=Et):Et=t[103],(0,Q.useLayoutEffect)(Et);let Dt,Ot;t[104]===J?(Dt=t[105],Ot=t[106]):(Dt=()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.altKey||e.key.toLowerCase()!==`a`||eW(e.target))return;let t=re.current,n=e.target,r=document.activeElement,i=n instanceof Node&&t?.contains(n),a=r instanceof Node&&t?.contains(r);if(!i&&!a)return;let o=new Set([...Pe.current,...je.current]);te.current=!0;for(let e of o)!e||H.current.has(e)||J.getItem(e)?.select();queueMicrotask(()=>{te.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Ot=[J],t[104]=J,t[105]=Dt,t[106]=Ot),(0,Q.useEffect)(Dt,Ot);let kt,At;t[107]!==S.length||t[108]!==w?(kt=()=>{if(w||S.length===0)return;let e=re.current?.querySelector(RN)?.shadowRoot;if(!e)return;let t=lW,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},At=[w,S.length],t[107]=S.length,t[108]=w,t[109]=kt,t[110]=At):(kt=t[109],At=t[110]),(0,Q.useEffect)(kt,At);let jt;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(jt={folderCount:0,expandedCount:0},t[111]=jt):jt=t[111];let Mt=(0,Q.useRef)(jt),Nt=(0,Q.useRef)(xt),Pt=(0,Q.useRef)(yt),Ft;t[112]===xt?Ft=t[113]:(Ft=()=>{Nt.current=xt,Pt.current=yt},t[112]=xt,t[113]=Ft),(0,Q.useEffect)(Ft);let It,Lt;t[114]===J?(It=t[115],Lt=t[116]):(It=()=>({startCreating(e,t){Nt.current(e,t)},startCreatingFromTemplate(e){Pt.current(e)},expandAll(){(0,Q.startTransition)(()=>{for(let e of Pe.current){let t=JU(J.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(W.current);(0,Q.startTransition)(()=>{for(let t of[...Pe.current].reverse()){if(e.has(t))continue;let n=JU(J.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Pe.current,t=0;for(let n of e)JU(J.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Mt.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Mt.current=i,i},subscribe(e){return J.subscribe(e)}}),Lt=[J],t[114]=J,t[115]=It,t[116]=Lt),(0,Q.useImperativeHandle)(n,It,Lt);let Rt;t[117]!==Ye||t[118]!==c||t[119]!==a||t[120]!==J||t[121]!==Ve?(Rt=async function(e){let t=e[0];if(t){k(t.path),j(null);try{let t=tW(e,I.current,Pe.current),n=[],r=[],i=[];for(let t of e){k(t.path);let e=await Ie(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:t.kind,path:t.path})}),`Failed to delete path`);if(!e.ok){let t=tW(i,I.current,Pe.current),o=new Set([...t.docNames,...n]),s=new Set([...t.folderPaths,...r]);a([...[...o].map(cW),...[...s].map(sW)]),await Promise.all([...o].map(e=>c(e))),qa.error(e.title),k(null),Ve(),Kn([`files`,`backlinks`,`graph`]);return}let o=d(Er,e.body,`delete-path`,{deletedDocNames:[]});n.push(...o.deletedDocNames),t.kind===`folder`&&r.push(t.path),i.push(t)}let o=G.current;o&&e.some(e=>nW(e,o))&&(o.kind===`file`?t.docNames.add(o.createdPath):t.folderPaths.add(o.createdPath),Ye(o));let s=new Set([...t.docNames,...n]),l=new Set([...t.folderPaths,...r]);a([...[...s].map(oW),...[...l].map(aW)]),await Promise.all([...s].map(e=>c(e)));for(let t of e){let e=t.kind===`folder`?XH(t.path):GH(t.path,t.docExt);J.getItem(e)&&J.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}C(e=>{let t=xj(e,[...s]);for(let e of l)t=xj(t,[],e);return We(t),t}),Kn([`files`,`backlinks`,`graph`]),k(null)}catch(e){console.warn(`[FileTree] delete failed:`,e),qa.error(`Network error — please try again`),k(null),Ve()}}},t[117]=Ye,t[118]=c,t[119]=a,t[120]=J,t[121]=Ve,t[122]=Rt):Rt=t[122];let zt=Rt,Bt;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(Bt=function(){let e=ee.current;e&&jU(e),ee.current=null},t[123]=Bt):Bt=t[123];let Vt=Bt,Ht;t[124]===f?Ht=t[125]:(Ht=function(e){let t=bW(e.nativeEvent);if(!t||t.endsWith(`/`)){Vt();return}let n=KH(t),r=I.current.find(e=>qH(e)===t);if(r&&Pn(r)){Vt();return}ee.current!==n&&(Vt(),ee.current=n,AU(n,e=>f(e)))},t[124]=f,t[125]=Ht);let Ut=Ht,Wt;t[126]!==R||t[127]!==J||t[128]!==b?(Wt=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=xW(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?XH(n):n;if(J.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=YH(r);if(window.location.hash===In(e))return;queueMicrotask(()=>b(e));return}let i=KH(r);window.location.hash!==$n(i)&&queueMicrotask(()=>R(r))},t[126]=R,t[127]=J,t[128]=b,t[129]=Wt):Wt=t[129];let Gt=Wt;if(w){let e;return t[130]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(CW,{}),t[130]=e):e=t[130],e}if(S.length===0){if(E){let e;return t[131]===E?e=t[132]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/50 text-sm`,children:E})}),t[131]=E,t[132]=e),e}let e;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:`No files yet.`}),t[133]=e):e=t[133];let n;return t[134]===xt?n=t[135]:(n=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:()=>xt(`file`,``),children:`Create your first file`})]}),t[134]=xt,t[135]=n),n}let Kt=O!==null,qt=A?.targets[0]??null,Jt;t[136]===E?Jt=t[137]:(Jt=E&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:E}),t[136]=E,t[137]=Jt);let Yt;t[138]===h?Yt=t[139]:(Yt=WU(h),t[138]=h,t[139]=Yt);let Xt;t[140]!==Kt||t[141]!==V||t[142]!==Tt||t[143]!==Ct||t[144]!==_e||t[145]!==J||t[146]!==ve||t[147]!==xt||t[148]!==P?(Xt=(e,t)=>(0,Z.jsx)(rW,{item:e,context:t,anyActionBusy:Kt,workspace:P,handoff:_e,model:J,okignoreBinding:ve,onStartCreating:xt,onStartCreatingFromTemplate:yt,onDelete:e=>j({targets:e}),onExpandSubtree:Ct,onCollapseSubtree:Tt,isAsset:V.has(e.path),isAssetTreePath:Ke}),t[140]=Kt,t[141]=V,t[142]=Tt,t[143]=Ct,t[144]=_e,t[145]=J,t[146]=ve,t[147]=xt,t[148]=P,t[149]=Xt):Xt=t[149];let Zt;t[150]!==Gt||t[151]!==Ut||t[152]!==J||t[153]!==Jt||t[154]!==Yt||t[155]!==Xt?(Zt=(0,Z.jsx)(`div`,{ref:re,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(VH,{header:Jt,model:J,style:Yt,onClickCapture:Gt,onMouseMove:Ut,onMouseLeave:Vt,renderContextMenu:Xt})}),t[150]=Gt,t[151]=Ut,t[152]=J,t[153]=Jt,t[154]=Yt,t[155]=Xt,t[156]=Zt):Zt=t[156];let Qt=!!A,$t;t[157]===O?$t=t[158]:($t=e=>{!e&&!O&&j(null)},t[157]=O,t[158]=$t);let en;t[159]!==O||t[160]!==A||t[161]!==zt||t[162]!==qt?(en=A&&qt&&(0,Z.jsx)(zi,{itemName:A.targets.length===1?`${qt.name}${qt.kind===`file`?qt.docExt??`.md`:`/`}`:void 0,isSubmitting:O!==null,onDelete:()=>zt(A.targets),customTitle:A.targets.length>1?`Delete selected items`:void 0,customDescription:A.targets.length>1?`Are you sure you want to delete ${A.targets.length} selected items? Folders and all files inside them will be deleted. This action cannot be undone.`:qt.kind===`folder`?`Are you sure you want to delete ${qt.name}/ and all files inside? This action cannot be undone.`:void 0}),t[159]=O,t[160]=A,t[161]=zt,t[162]=qt,t[163]=en):en=t[163];let tn;t[164]!==Qt||t[165]!==$t||t[166]!==en?(tn=(0,Z.jsx)(Ga,{open:Qt,onOpenChange:$t,children:en}),t[164]=Qt,t[165]=$t,t[166]=en,t[167]=tn):tn=t[167];let nn=M!==null,rn;t[168]===Symbol.for(`react.memo_cache_sentinel`)?(rn=e=>{e||N(null)},t[168]=rn):rn=t[168];let an=M?.parentDir??``,on;t[169]!==nn||t[170]!==an?(on=(0,Z.jsx)(wf,{open:nn,onOpenChange:rn,kind:`file`,initialDir:an}),t[169]=nn,t[170]=an,t[171]=on):on=t[171];let sn;return t[172]!==Zt||t[173]!==tn||t[174]!==on?(sn=(0,Z.jsxs)(Z.Fragment,{children:[Zt,tn,on]}),t[172]=Zt,t[173]=tn,t[174]=on,t[175]=sn):sn=t[175],sn}function aW(e){return tt(e)}function oW(e){return Ge(e)}function sW(e){return tt(e)}function cW(e){return Ge(e)}function lW(e){return e.endsWith(`/`)?e.slice(0,-1):e}function uW(e){return!!e}function dW(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function fW(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function pW(e){qa.error(e)}function mW(){}function hW(e){return qa.error(e)}function gW(){}function _W(){}async function vW(){}function yW(e){return qH(e)}function bW(e){return xW(e)?.dataset.itemPath??null}function xW(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var SW=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function CW(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":`Loading files`,children:SW.map(wW)}),e[0]=t):t=e[0],t}function wW(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(na,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(na,{className:`h-3 ${e}`})]},t)}var TW=(e,t,n)=>gc(e,t,n,`ProjectSwitcher`);function EW(e){let t=(0,$.c)(59),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!1),c;t[1]!==n.project||t[2]!==o?(c=()=>{if(!o)return;let e=!1;return TW(async()=>{let t=await n.project.listRecent();e||a(t)},`Failed to load recent projects.`),()=>{e=!0}},t[1]=n.project,t[2]=o,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==o?(l=[o,n],t[4]=n,t[5]=o,t[6]=l):l=t[6],(0,Q.useEffect)(c,l);let u;t[7]===n.project?u=t[8]:(u=e=>{s(!1),TW(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`)},t[7]=n.project,t[8]=u);let d=u,f;t[9]!==n.dialog||t[10]!==n.project?(f=()=>{s(!1),TW(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},`Failed to open folder.`)},t[9]=n.dialog,t[10]=n.project,t[11]=f):f=t[11];let p=f,m;t[12]===n.navigator?m=t[13]:(m=()=>{s(!1),TW(()=>n.navigator.open(),`Failed to open Project Navigator.`)},t[12]=n.navigator,t[13]=m);let h=m,g=n.config.projectPath,_,v,y,b,x,S,C,w,T,E,D;if(t[14]!==n.config.projectName||t[15]!==g||t[16]!==o||t[17]!==d||t[18]!==i){let e;t[30]===g?e=t[31]:(e=e=>e.path!==g,t[30]=g,t[31]=e);let r=i.filter(e);v=Ca,S=o,C=s;let a;t[32]===n.config.projectName?a=t[33]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[32]=n.config.projectName,t[33]=a);let c;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(ss,{"aria-hidden":`true`,className:`opacity-60`}),t[34]=c):c=t[34],t[35]===a?w=t[36]:(w=(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsxs)(YA,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:`Open project menu`,children:[a,c]})}),t[35]=a,t[36]=w),_=ki,T=`start`,E=`top`,D=`min-w-[260px]`,y=`project-switcher-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(xa,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Recent projects`}),t[37]=b):b=t[37],x=r.length===0?(0,Z.jsx)(xa,{className:`font-normal text-muted-foreground text-xs`,children:`No other recent projects.`}):r.slice(0,10).map(e=>(0,Z.jsxs)(li,{disabled:e.missing,onSelect:()=>d(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Z.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]},e.path)),t[14]=n.config.projectName,t[15]=g,t[16]=o,t[17]=d,t[18]=i,t[19]=_,t[20]=v,t[21]=y,t[22]=b,t[23]=x,t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=D}else _=t[19],v=t[20],y=t[21],b=t[22],x=t[23],S=t[24],C=t[25],w=t[26],T=t[27],E=t[28],D=t[29];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(di,{}),t[38]=O):O=t[38];let k;t[39]===p?k=t[40]:(k=(0,Z.jsx)(li,{onSelect:p,"data-testid":`project-switcher-open-folder`,children:`Open folder`}),t[39]=p,t[40]=k);let A;t[41]===h?A=t[42]:(A=(0,Z.jsx)(li,{onSelect:h,"data-testid":`project-switcher-switch-project`,children:`Switch Project`}),t[41]=h,t[42]=A);let j;t[43]!==_||t[44]!==y||t[45]!==b||t[46]!==x||t[47]!==k||t[48]!==A||t[49]!==T||t[50]!==E||t[51]!==D?(j=(0,Z.jsxs)(_,{align:T,side:E,className:D,"data-testid":y,children:[b,x,O,k,A]}),t[43]=_,t[44]=y,t[45]=b,t[46]=x,t[47]=k,t[48]=A,t[49]=T,t[50]=E,t[51]=D,t[52]=j):j=t[52];let M;return t[53]!==v||t[54]!==S||t[55]!==C||t[56]!==w||t[57]!==j?(M=(0,Z.jsxs)(v,{open:S,onOpenChange:C,children:[w,j]}),t[53]=v,t[54]=S,t[55]=C,t[56]=w,t[57]=j,t[58]=M):M=t[58],M}function DW(e){let t=(0,$.c)(33),{notice:n,onDismiss:r}=e,i=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ma,{"aria-hidden":`true`,className:`size-3`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":`Dismiss notice`,onClick:r,children:a}),t[1]=r,t[2]=o);let s=o;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-2 text-xs text-muted-foreground ${i}`,a;t[3]===n.body?a=t[4]:(a=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[3]=n.body,t[4]=a);let o;t[5]!==s||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a,s]}),t[5]=s,t[6]=a,t[7]=o):o=t[7];let c;t[8]===n.action?c=t[9]:(c=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[8]=n.action,t[9]=c);let l;t[10]===n.secondaryAction?l=t[11]:(l=()=>{n.secondaryAction?.onClick()},t[10]=n.secondaryAction,t[11]=l);let u;t[12]!==n.secondaryAction.label||t[13]!==l?(u=(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:l,children:n.secondaryAction.label}),t[12]=n.secondaryAction.label,t[13]=l,t[14]=u):u=t[14];let d;t[15]!==c||t[16]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[c,u]}),t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==d||t[19]!==e||t[20]!==r||t[21]!==o?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,d]}),t[18]=d,t[19]=e,t[20]=r,t[21]=o,t[22]=f):f=t[22],f}let c=`update-notice-${n.id}`,l=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${i}`,u;t[23]===n.body?u=t[24]:(u=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[23]=n.body,t[24]=u);let d;t[25]===n.action?d=t[26]:(d=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[25]=n.action,t[26]=d);let f;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":c,className:l,children:[u,d,s]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=f):f=t[32],f}function OW(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function kW(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Ed,Td,Td),n;e[0]===t?n=e[1]:(n=OW(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{wd(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(DW,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}var AW={folderCount:0,expandedCount:0};function jW(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(c,{name:`file-sidebar`,children:(0,Z.jsx)(NW,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var MW=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(ao,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(so,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function NW(e){let t=(0,$.c)(42),{onOpenSearch:n}=e,[r,i]=(0,Q.useState)(null),{activeDocName:a,activeTarget:o}=Ue(),s;t[0]!==a||t[1]!==o?(s=o?.kind===`folder`||o?.kind===`folder-index`?o.folderPath:Jn(a),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c=s,l=typeof window<`u`&&window.okDesktop!=null,{state:u}=FA(),d=u===`expanded`,f=u===`collapsed`,[p,m]=(0,Q.useState)(AW),h,g;t[3]===r?(h=t[4],g=t[5]):(h=()=>{if(r!==null)return m(r.getFolderState()),r.subscribe(()=>{m(r.getFolderState())})},g=[r],t[3]=r,t[4]=h,t[5]=g),(0,Q.useEffect)(h,g);let _=p.folderCount>0,v=_&&p.expandedCount===p.folderCount,y=p.expandedCount===0,b=l&&f&&`opacity-0`,x;t[6]===b?x=t[7]:(x=Y(`flex-row h-12 items-center py-0 px-3`,l?`justify-end`:`justify-between`,l&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,b,l&&`[-webkit-app-region:drag]`),t[6]=b,t[7]=x);let S;t[8]===d?S=t[9]:(S=d&&!l?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:`Files`}):null,t[8]=d,t[9]=S);let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=Y(`flex items-center gap-1`,l&&`[&>*]:[-webkit-app-region:no-drag]`),t[10]=C):C=t[10];let w;t[11]===n?w=t[12]:(w=(0,Z.jsx)(MW,{icon:rt,label:`Search`,onClick:n}),t[11]=n,t[12]=w);let T;t[13]!==v||t[14]!==_||t[15]!==y||t[16]!==r?(T=_?(0,Z.jsxs)(Ca,{children:[(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsx)(MW,{icon:Fs,label:`Tree View Options`})}),(0,Z.jsxs)(ki,{align:`end`,children:[v?null:(0,Z.jsxs)(li,{onSelect:()=>r?.expandAll(),children:[(0,Z.jsx)(lc,{"aria-hidden":`true`}),`Expand All`]}),y?null:(0,Z.jsxs)(li,{onSelect:()=>r?.collapseAll(),children:[(0,Z.jsx)(Ss,{"aria-hidden":`true`}),`Collapse All`]})]})]}):null,t[13]=v,t[14]=_,t[15]=y,t[16]=r,t[17]=T):T=t[17];let E;t[18]!==c||t[19]!==r?(E=(0,Z.jsx)(MW,{icon:tc,label:`New File`,onClick:()=>r?.startCreating(`file`,c)}),t[18]=c,t[19]=r,t[20]=E):E=t[20];let D;t[21]!==c||t[22]!==r?(D=(0,Z.jsx)(MW,{icon:ys,label:`New from template`,onClick:()=>r?.startCreatingFromTemplate(c)}),t[21]=c,t[22]=r,t[23]=D):D=t[23];let O;t[24]!==c||t[25]!==r?(O=(0,Z.jsx)(MW,{icon:ws,label:`New Folder`,onClick:()=>r?.startCreating(`folder`,c)}),t[24]=c,t[25]=r,t[26]=O):O=t[26];let k;t[27]!==E||t[28]!==D||t[29]!==O||t[30]!==w||t[31]!==T?(k=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,O]}),t[27]=E,t[28]=D,t[29]=O,t[30]=w,t[31]=T,t[32]=k):k=t[32];let A;t[33]!==k||t[34]!==x||t[35]!==S?(A=(0,Z.jsxs)(UA,{className:x,children:[S,k]}),t[33]=k,t[34]=x,t[35]=S,t[36]=A):A=t[36];let j;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(GA,{children:(0,Z.jsx)(iW,{ref:i})}),t[37]=j):j=t[37];let M,N;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(WA,{className:`px-0`,children:[typeof window<`u`&&window.okDesktop?(0,Z.jsx)(KA,{children:(0,Z.jsx)(qA,{children:(0,Z.jsx)(EW,{bridge:window.okDesktop})})}):null,(0,Z.jsx)(kW,{})]}),N=(0,Z.jsx)(VA,{enableToggle:!1}),t[38]=M,t[39]=N):(M=t[38],N=t[39]);let P;return t[40]===A?P=t[41]:(P=(0,Z.jsxs)(zA,{variant:`inset`,children:[A,j,M,N]}),t[40]=A,t[41]=P),P}function PW(){let e=(0,$.c)(17),t=Gt(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Ue(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new E,i=new ot({url:n,name:ln,document:e,onStateless:e=>{let{payload:t}=e;yt(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:BW,onConfigValidationRejected:zW,onConfigIgnoreNestedError:RW,onUnknown:LW})},onClose:IW,onDisconnect:FW}),a=mr(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=pe(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Kn([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function FW(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function IW(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function LW(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function RW(e){pa(e)}function zW(e){ga(e)}function BW(e){Kn([e.ch])}var VW=`#install-claude-desktop`;function HW(e){return e===`#settings`||e===VW}function UW(e,t){return`${[...e].sort().join(`\0`)}\u0001${[...t].sort().join(`\0`)}`}function WW(){let e=(0,$.c)(18),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=Ue(),{openTargetTransition:i}=$e(),{folderPaths:a,loading:o,pages:s}=xr(),c=(0,Q.useRef)(null),l;e[0]!==a||e[1]!==s?(l=UW(s,a),e[0]=a,e[1]=s,e[2]=l):l=e[2];let u=l,d,f;e[3]!==a||e[4]!==o||e[5]!==s||e[6]!==n||e[7]!==r||e[8]!==u?(d=()=>{o||!r||c.current===u||(c.current=u,n({pages:s,folderPaths:a}))},f=[a,o,s,n,r,u],e[3]=a,e[4]=o,e[5]=s,e[6]=n,e[7]=r,e[8]=u,e[9]=d,e[10]=f):(d=e[9],f=e[10]),(0,Q.useEffect)(d,f);let p,m;return e[11]!==t||e[12]!==a||e[13]!==o||e[14]!==i||e[15]!==s?(p=()=>{e();function e(){if(HW(window.location.hash))return;let e=Cr(window.location.hash);if(e){let t=Tn(e.split(`.`).pop()??``);ye(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=ur(window.location.hash);if(!n){ye(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(o){ye(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=ar(n,{pages:s,folderPaths:a});if(r.kind===`missing`&&/\/+$/.test(n.trim())){ye(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}ye(`ok/nav/hash-change`,{docName:n,kind:r.kind}),i(r)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},m=[t,a,o,i,s],e[11]=t,e[12]=a,e[13]=o,e[14]=i,e[15]=s,e[16]=p,e[17]=m):(p=e[16],m=e[17]),(0,Q.useEffect)(p,m),null}function GW(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(typeof window<`u`&&window.location.hash===VW),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===VW&&n(!0)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e){if(n(e),!e&&window.location.hash===VW){let{pathname:e,search:t}=window.location;window.history.replaceState(null,``,`${e}${t}`)}},e[2]=a):a=e[2];let o=a,s;return e[3]===t?s=e[4]:(s=(0,Z.jsx)(oa,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function KW(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(qW,t),null}function qW(){let e=function(e){let t=e.target;jf({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Af))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function JW(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=Ue(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Jn(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Sf({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(wf,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function YW(){let e=(0,$.c)(13),t=typeof window<`u`?window.okDesktop??null:null,[n,r]=(0,Q.useState)(!1),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(qp,{}),e[0]=i):i=e[0];let a,o,s,l,u,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(PW,{}),o=(0,Z.jsx)(WW,{}),s=(0,Z.jsx)(JW,{}),l=(0,Z.jsx)(KW,{}),u=(0,Z.jsx)(GW,{}),d=(0,Z.jsx)(xu,{}),e[1]=a,e[2]=o,e[3]=s,e[4]=l,e[5]=u,e[6]=d):(a=e[1],o=e[2],s=e[3],l=e[4],u=e[5],d=e[6]);let f;e[7]===n?f=e[8]:(f=(0,Z.jsx)(Bp,{bridge:t,open:n,onOpenChange:r}),e[7]=n,e[8]=f);let p;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(jW,{onOpenSearch:()=>r(!0)}),e[9]=p):p=e[9];let m;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsxs)(IA,{className:`h-screen overflow-hidden`,children:[p,(0,Z.jsx)(HA,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(EM,{})})]}),e[10]=m):m=e[10];let h;return e[11]===f?h=e[12]:(h=(0,Z.jsx)(c,{name:`app`,children:(0,Z.jsx)(it,{children:(0,Z.jsxs)(oi,{children:[i,(0,Z.jsxs)(dr,{children:[a,o,s,l,u,d,f,m]})]})})}),e[11]=f,e[12]=h),h}Lo(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&Au({apiOrigin:window.okDesktop.config.apiOrigin}),Ju()&&ed(),Dd(),typeof window<`u`&&Nu({bridge:window.okDesktop}),typeof window<`u`&&Za({bridge:window.okDesktop}),typeof window<`u`&&lo({bridge:window.okDesktop}),typeof window<`u`&&Fu({bridge:window.okDesktop});var XW=new Ko({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),ZW=document.getElementById(`root`);if(!ZW)throw Error(`Root element not found`);var QW=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,ns.createRoot)(ZW).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(Rt,{client:XW,children:(0,Z.jsxs)(on,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(oo,{children:QW&&window.okDesktop?(0,Z.jsx)(Tu,{bridge:window.okDesktop}):(0,Z.jsx)(YW,{})}),(0,Z.jsx)(ku,{richColors:!0,closeButton:!0})]})})}));
|
|
1853
|
+
`;function $U(e){return{...dP({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`}}function eW(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&KU.has(t)}function tW(e){return e===`darwin`?`Reveal in Finder`:e===`win32`?`Reveal in File Explorer`:`Open Containing Folder`}function nW(e){let t=(0,$.c)(14),{item:n,workspace:r,onClose:i}=e,a=typeof window<`u`?window.okDesktop:void 0;if(!a)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=tW(a.platform),t[0]=o):o=t[0];let s=o,c=r?null:`No workspace`,l=!r,u;t[1]!==n||t[2]!==i||t[3]!==r?(u=()=>{if(!r)return;i();let e=cp(r.contentDir,uU(n),r.pathSeparator);a.shell.showItemInFolder(e)},t[1]=n,t[2]=i,t[3]=r,t[4]=u):u=t[4];let d=c?`${s}, ${c}`:s,f,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(fe,{"aria-hidden":`true`}),p=(0,Z.jsx)(`span`,{className:`flex-1`,children:s}),t[5]=f,t[6]=p):(f=t[5],p=t[6]);let m;t[7]===c?m=t[8]:(m=c?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:c}):null,t[7]=c,t[8]=m);let h;return t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==m?(h=(0,Z.jsxs)(li,{disabled:l,onSelect:u,"aria-label":d,children:[f,p,m]}),t[9]=l,t[10]=u,t[11]=d,t[12]=m,t[13]=h):h=t[13],h}function rW(e){return lU({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e})}function iW(e,t){return e!==t&&e.startsWith(t)}function aW(e,t){let n=[...new Set(e)].filter(e=>!t(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>iW(e,t))).map(rW)}function oW(e,t){return e===t||e.startsWith(`${t}/`)}function sW(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function cW(e,t,n){let r=new Set,i=new Set;for(let a of e){if(a.kind===`file`){r.add(a.path);continue}i.add(a.path);for(let e of t)Dr(e)&&e.docName.startsWith(`${a.path}/`)&&r.add(e.docName);for(let e of n){let t=tU(e);oW(t,a.path)&&i.add(t)}}return{docNames:r,folderPaths:i}}function lW(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:oW(t.createdPath,e.path)}function uW(e){let t=(0,$.c)(85),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,onStartCreating:l,onStartCreatingFromTemplate:u,onDelete:d,onExpandSubtree:f,onCollapseSubtree:p,isAsset:h,isAssetTreePath:g}=e,_,v,y,b,x;if(t[0]!==h||t[1]!==g||t[2]!==n||t[3]!==s||t[4]!==c){x=lU(n),y=n.kind===`directory`,_=!h&&c!==null,v=y?`Hide files in this folder`:`Hide this file`;let e=s.getSelectedPaths();b=e.includes(x.treePath)?aW(e,g):[],t[0]=h,t[1]=g,t[2]=n,t[3]=s,t[4]=c,t[5]=_,t[6]=v,t[7]=y,t[8]=b,t[9]=x}else _=t[5],v=t[6],y=t[7],b=t[8],x=t[9];let S=b,C;t[10]!==S||t[11]!==x?(C=S.length>1?S:[x],t[10]=S,t[11]=x,t[12]=C):C=t[12];let w=C,T=w.length>1?`Delete ${w.length} Items`:`Delete`,E;t[13]!==y||t[14]!==n.path||t[15]!==a?(E=y?null:up({docName:QH(n.path),workspace:a}),t[13]=y,t[14]=n.path,t[15]=a,t[16]=E):E=t[16];let D=E,O;t[17]===r?O=t[18]:(O=()=>r.close({restoreFocus:!1}),t[17]=r,t[18]=O);let k=O,A;t[19]===r?A=t[20]:(A=()=>r.close(),t[19]=r,t[20]=A);let j=A,M;t[21]===j?M=t[22]:(M=e=>{e||j()},t[21]=j,t[22]=M);let N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[23]=N):N=t[23];let P;t[24]!==i||t[25]!==j||t[26]!==k||t[27]!==y||t[28]!==n.path||t[29]!==p||t[30]!==f||t[31]!==l||t[32]!==u?(P=y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(li,{disabled:i,onSelect:()=>{k(),l(`file`,tU(n.path))},children:[(0,Z.jsx)(tc,{"aria-hidden":`true`}),`New File`]}),(0,Z.jsxs)(li,{disabled:i,onSelect:()=>{k(),u(tU(n.path))},children:[(0,Z.jsx)(ys,{"aria-hidden":`true`}),`New from template`]}),(0,Z.jsxs)(li,{disabled:i,onSelect:()=>{k(),l(`folder`,tU(n.path))},children:[(0,Z.jsx)(ws,{"aria-hidden":`true`}),`New Folder`]}),(0,Z.jsx)(di,{}),(0,Z.jsxs)(li,{onSelect:()=>{j(),f(n.path)},children:[(0,Z.jsx)(lc,{"aria-hidden":`true`}),`Expand All`]}),(0,Z.jsxs)(li,{onSelect:()=>{j(),p(n.path)},children:[(0,Z.jsx)(Ss,{"aria-hidden":`true`}),`Collapse All`]}),(0,Z.jsx)(di,{})]}):null,t[24]=i,t[25]=j,t[26]=k,t[27]=y,t[28]=n.path,t[29]=p,t[30]=f,t[31]=l,t[32]=u,t[33]=P):P=t[33];let F;t[34]!==i||t[35]!==k||t[36]!==h||t[37]!==n.path||t[38]!==s?(F=h?null:(0,Z.jsxs)(li,{disabled:i,onSelect:()=>{k(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Re,{"aria-hidden":`true`}),`Rename`]}),t[34]=i,t[35]=k,t[36]=h,t[37]=n.path,t[38]=s,t[39]=F):F=t[39];let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsxs)(si,{children:[(0,Z.jsx)(U,{"aria-hidden":`true`}),`Copy Path`]}),t[40]=I):I=t[40];let L=!a,R;t[41]!==j||t[42]!==n||t[43]!==a?(R=()=>{a&&(j(),GU(cp(a.contentDir,uU(n),a.pathSeparator),`full path`))},t[41]=j,t[42]=n,t[43]=a,t[44]=R):R=t[44];let z;t[45]!==L||t[46]!==R?(z=(0,Z.jsx)(li,{disabled:L,onSelect:R,children:`Full Path`}),t[45]=L,t[46]=R,t[47]=z):z=t[47];let B;t[48]!==j||t[49]!==n?(B=(0,Z.jsx)(li,{onSelect:()=>{j(),GU(uU(n),`relative path`)},children:`Relative Path`}),t[48]=j,t[49]=n,t[50]=B):B=t[50];let V;t[51]!==z||t[52]!==B?(V=(0,Z.jsxs)(wi,{children:[I,(0,Z.jsxs)(ia,{children:[z,B]})]}),t[51]=z,t[52]=B,t[53]=V):V=t[53];let H;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(di,{}),t[54]=H):H=t[54];let W;t[55]!==j||t[56]!==n||t[57]!==a?(W=(0,Z.jsx)(nW,{item:n,workspace:a,onClose:j}),t[55]=j,t[56]=n,t[57]=a,t[58]=W):W=t[58];let G;t[59]!==o||t[60]!==D||t[61]!==h||t[62]!==y?(G=!y&&!h&&(0,Z.jsx)(DU,{input:D,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),t[59]=o,t[60]=D,t[61]=h,t[62]=y,t[63]=G):G=t[63];let K;t[64]!==i||t[65]!==_||t[66]!==j||t[67]!==T||t[68]!==w||t[69]!==v||t[70]!==h||t[71]!==c||t[72]!==d||t[73]!==x?(K=h?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(di,{}),(0,Z.jsxs)(li,{"data-testid":`file-tree-menu-hide`,disabled:!_,onSelect:()=>{if(!c)return;j();let e=vU(x),t=qi(Vi(Gi(c.current()),e));c.patch(t)},children:[(0,Z.jsx)(m,{"aria-hidden":`true`}),v]}),(0,Z.jsx)(di,{}),(0,Z.jsxs)(li,{variant:`destructive`,disabled:i,onSelect:()=>{j(),d(w)},children:[(0,Z.jsx)(et,{"aria-hidden":`true`}),T]})]}),t[64]=i,t[65]=_,t[66]=j,t[67]=T,t[68]=w,t[69]=v,t[70]=h,t[71]=c,t[72]=d,t[73]=x,t[74]=K):K=t[74];let q;t[75]!==V||t[76]!==W||t[77]!==G||t[78]!==K||t[79]!==P||t[80]!==F?(q=(0,Z.jsxs)(ki,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:[P,F,V,H,W,G,K]}),t[75]=V,t[76]=W,t[77]=G,t[78]=K,t[79]=P,t[80]=F,t[81]=q):q=t[81];let ee;return t[82]!==q||t[83]!==M?(ee=(0,Z.jsxs)(Ca,{open:!0,modal:!1,onOpenChange:M,children:[N,q]}),t[82]=q,t[83]=M,t[84]=ee):ee=t[84],ee}function dW(e){let t=(0,$.c)(171),{ref:n}=e,{activeDocName:r,activeTarget:i,closeTabs:a,closeTab:o,closeDocument:s,closeAndClearForRename:c,isNewTabActive:l,openTarget:u,prewarm:f,remapTabsForRename:p}=Ue(),{notifySidebarFileSelected:m}=FA(),{resolvedTheme:h}=pn(),{addPage:g}=xr(),_;t[0]!==m||t[1]!==u?(_=function(e){u({kind:`doc`,target:e,docName:e},{tabBehavior:`replace-active`}),HU($n(e)),m()},t[0]=m,t[1]=u,t[2]=_):_=t[2];let v=_,y;t[3]!==m||t[4]!==u?(y=function(e){let t=In(e);u({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),HU(t),m()},t[3]=m,t[4]=u,t[5]=y):y=t[5];let b=y,x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[6]=x):x=t[6];let[S,C]=(0,Q.useState)(x),[w,T]=(0,Q.useState)(!0),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),I=(0,Q.useRef)(S),L;t[7]!==S||t[8]!==b||t[9]!==v||t[10]!==m?(L=function(e,t){let n=xU(e,t===void 0?S:t);if(n.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,rU(e));return}if(n.kind===`asset`){window.location.hash=n.hash,m();return}if(n.kind===`folder`){b(n.path);return}v(n.path)},t[7]=S,t[8]=b,t[9]=v,t[10]=m,t[11]=L):L=t[11];let R=L,z=(0,Q.useRef)(r),B;t[12]===S?B=t[13]:(B=new Set(S.filter(Pn).map(EW)),t[12]=S,t[13]=B);let V=B,H=(0,Q.useRef)(V),U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(U=[],t[14]=U):U=t[14];let W=(0,Q.useRef)(U),G=(0,Q.useRef)(null),K=(0,Q.useRef)(TW),q=(0,Q.useRef)(null),ee=(0,Q.useRef)(null),te=(0,Q.useRef)(!1),ne=(0,Q.useRef)(null),re=(0,Q.useRef)(null),ie=(0,Q.useRef)(wW),ae=(0,Q.useRef)(CW),oe=(0,Q.useRef)(SW),se=(0,Q.useRef)(xW),ce=(0,Q.useRef)(i),{selectedFilePath:le,selectedFolderPath:de,navigationPath:fe}=bU(i,l?null:r),pe=le?ZH(le,S.find(e=>Dr(e)&&e.docName===le)?.docExt):de?nU(de):i?.kind===`asset`?i.assetPath:null,me=Ap().states,{dispatch:he}=yp(),ge;t[15]!==he||t[16]!==me?(ge={installStates:me,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:he},t[15]=he,t[16]=me,t[17]=ge):ge=t[17];let _e=ge,{okignoreBinding:ve}=Yi(),ye;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>ne.current===null,t[18]=ye):ye=t[18];let be=ye,xe;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(xe=[],t[19]=xe):xe=t[19];let Se;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Se={set:`complete`,spriteSheet:ZU},t[20]=Se):Se=t[20];let Ce;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Ce={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[21]=Ce):Ce=t[21];let we;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(we={canDrag:be,canDrop:be,onDropComplete:e=>se.current(e),onDropError:bW},t[22]=we):we=t[22];let Te;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Te={paths:xe,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:Se,unsafeCSS:QU,composition:Ce,dragAndDrop:we,renaming:{canRename:be,onRename:e=>ae.current(e),onError:e=>oe.current(e)},onSelectionChange:e=>ie.current(e),renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=I.current.find(e=>Dr(e)&&ZH(e.docName,e.docExt)===t.path);return n?.isSymlink?{icon:qU,title:n.targetPath?`Symlink to ${n.targetPath}`:`Symlink`}:eW(t.path)?{icon:JU,title:`Agent configuration file`}:null}},t[23]=Te):Te=t[23];let{model:J}=JH(Te),Ee;t[24]===J?Ee=t[25]:(Ee=function(e){let t=J.getItem(e)??J.getItem(nU(e));return t?.isDirectory()?nU(tU(t.getPath())):e},t[24]=J,t[25]=Ee);let De=Ee,Oe,ke;t[26]===S?(Oe=t[27],ke=t[28]):(ke=iU(S),Oe=aU(ke),t[26]=S,t[27]=Oe,t[28]=ke);let Ae=Oe,je=(0,Q.useRef)(ke),Me;t[29]===S?Me=t[30]:(Me=sU(S),t[29]=S,t[30]=Me);let Ne=Me,Pe=(0,Q.useRef)(Ne),Fe=de?cU(nU(de)).slice(0,-1):cU(pe??fe),Le=Fe.join(`\0`),Re;if(t[31]!==J){let e=()=>{let e=new Set;for(let t of Pe.current)SU(J.getItem(t))?.isExpanded()&&e.add(t);return e};Re=t=>{let n=new Set(sU(t??I.current)),r=e();for(let e of W.current)r.add(e);return[...r].filter(e=>n.has(e))},t[31]=J,t[32]=Re}else Re=t[32];let ze=Re,Be;t[33]!==ze||t[34]!==J?(Be=e=>{let t=iU(e??I.current);J.resetPaths(t,{initialExpandedPaths:ze(e)})},t[33]=ze,t[34]=J,t[35]=Be):Be=t[35];let Ve=Be,He;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(He=e=>{q.current=oU(e)},t[36]=He):He=t[36];let We=He,Ge;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=e=>H.current.has(e),t[37]=Ge):Ge=t[37];let Ke=Ge,qe=function(e){let t=UU(e);if(!t||WU(t))return!1;let n=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||Ke(n))return!1;let r=WU(n);if(!r)return!1;let i=nU(t);if(!Pe.current.includes(i))return!1;let a=`${t}${r}`;return je.current.includes(a)?!1:(pt({sourcePath:n,destinationPath:a,isFolder:!1}),J.move(n,a),!0)},Je;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Je=e=>{let t=e??G.current;!t||G.current!==t||(t.disposeCommitListener(),G.current=null)},t[38]=Je):Je=t[38];let Ye=Je,Xe;t[39]!==Ye||t[40]!==s||t[41]!==o||t[42]!==Ve?(Xe=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,i=n.restoreLocation??r;Ye(e),r&&k(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=await Ie(t,`Failed to clean up pending ${e.kind}`);if(n.ok)return;let i=`${n.title} - ${e.kind} "${e.createdPath}" still exists on disk`;r?qa.error(i):console.warn(`[FileTree] cleanup pending create failed: ${i}`),r&&(k(null),Ve());return}}catch(t){console.warn(`[FileTree] cleanup pending create failed:`,t),r&&qa.error(`Network error - ${e.kind} "${e.createdPath}" still exists on disk`),r&&(k(null),Ve());return}r&&(e.kind===`file`?s(e.createdPath):o(tt(e.createdPath))),r&&C(t=>{let n=xj(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return We(n),n}),Kn([`files`,`backlinks`,`graph`]),i&&(window.location.hash=e.previousHash),r&&k(null)},t[39]=Ye,t[40]=s,t[41]=o,t[42]=Ve,t[43]=Xe):Xe=t[43];let Ze=Xe,Qe,$e;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=()=>()=>{let e=G.current;e&&K.current(e,{restoreLocation:!1,updateUi:!1}).catch(yW)},$e=[],t[44]=Qe,t[45]=$e):(Qe=t[44],$e=t[45]),(0,Q.useEffect)(Qe,$e);let et,nt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>{let e=!0,t=TU(async function(){try{let t=await Ie(await fetch(`/api/documents`),`Failed to load documents`);if(!e)return;if(!t.ok)D(t.title);else{let e=Gn.safeParse(t.body);e.success?(C(e.data.documents),D(null)):D(`Documents response did not match expected shape.`)}}catch(t){let n=t;e&&D(`Could not reach server`),console.warn(`[FileTree] fetch failed:`,n)}e&&T(!1)});t.request();let n=()=>{document.visibilityState===`visible`&&t.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=mr(e=>{e.includes(`files`)&&t.request()});return()=>{e=!1,t.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},nt=[],t[46]=et,t[47]=nt):(et=t[46],nt=t[47]),(0,Q.useEffect)(et,nt);let rt,it;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(rt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=d(Dn,n,`workspace`,null);r&&F({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(vW),()=>{e=!1}},it=[],t[48]=rt,t[49]=it):(rt=t[48],it=t[49]),(0,Q.useEffect)(rt,it);let at;t[50]!==ze||t[51]!==J||t[52]!==Ae?(at=()=>{if(q.current===Ae){q.current=null;return}J.resetPaths(je.current,{initialExpandedPaths:ze()})},t[50]=ze,t[51]=J,t[52]=Ae,t[53]=at):at=t[53];let ot;t[54]!==J||t[55]!==Ae?(ot=[J,Ae],t[54]=J,t[55]=Ae,t[56]=ot):ot=t[56],(0,Q.useEffect)(at,ot),wU(J,pe,Le,te);let st,ct;t[57]===J?(st=t[58],ct=t[59]):(st=()=>J.subscribe(()=>{if(!J.isSearchOpen())for(let e of W.current){let t=SU(J.getItem(e));t&&!t.isExpanded()&&t.expand()}}),ct=[J],t[57]=J,t[58]=st,t[59]=ct),(0,Q.useEffect)(st,ct);let lt,ut;t[60]===J?(lt=t[61],ut=t[62]):(lt=()=>J.onMutation(`remove`,e=>{let t=G.current;!t||e.path!==t.renamePath||K.current(t)}),ut=[J],t[60]=J,t[61]=lt,t[62]=ut),(0,Q.useEffect)(lt,ut);let dt;t[63]!==g||t[64]!==c||t[65]!==b||t[66]!==p?(dt=async(e,t,n)=>{let r=t===void 0?[]:t,i=n?.docName??z.current,a=Sj(i,e),o=n?.folderPath??(ce.current?.kind===`folder`?ce.current.folderPath:null),s=o?ue(o,r):null;await Promise.all(e.flatMap(e=>[c(e.fromDocName),c(e.toDocName)]));for(let t of e)g(t.toDocName);p(e,r),C(t=>{let n=bj(t,e,r);return We(n),n}),o&&s&&s!==o?b(s):a&&a!==i&&(window.location.hash=$n(a)),Kn([`files`,`backlinks`,`graph`])},t[63]=g,t[64]=c,t[65]=b,t[66]=p,t[67]=dt):dt=t[67];let ft=dt;async function pt(e){let t=dU(e.sourcePath,e.isFolder),n=dU(e.destinationPath,e.isFolder);k(t),D(null);try{if(!e.isFolder&&Ke(t)){qa.error(`Assets cannot be renamed from the sidebar`),Ve(),Ye(),k(null);return}let r=e.isFolder?{kind:`folder`,fromPath:tU(t),toPath:tU(n)}:{kind:`file`,fromPath:QH(t),toPath:QH(n)},i={docName:z.current,folderPath:ce.current?.kind===`folder`?ce.current.folderPath:null},a=await Ie(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)}),`Failed to rename path`);if(!a.ok){qa.error(a.title),D(a.title),Ve();let e=G.current;e&&e.renamePath===t?await Ze(e):Ye(),k(null);return}await ft(d(gn,a.body,`rename-path`,{renamed:[]}).renamed,e.isFolder?[{fromPath:tU(t),toPath:tU(n)}]:[],i),Ye(),k(null)}catch(e){console.warn(`[FileTree] rename failed:`,e),qa.error(`Network error — please try again`),D(`Network error — please try again`),Ve();let n=G.current;n&&n.renamePath===t?await Ze(n):Ye(),k(null)}}let mt;t[68]!==ft||t[69]!==Ve?(mt=async function(e){let t=e.draggedPaths.map(t=>{let n=mU(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(_W);if(t.length!==0){if(t.some(e=>Ke(e.sourcePath))){qa.error(`Assets cannot be moved from the sidebar`),Ve();return}k(t[0]?.sourcePath??null),D(null);try{let e=[],n=[],r={docName:z.current,folderPath:ce.current?.kind===`folder`?ce.current.folderPath:null};for(let r of t){let t=r.sourcePath.endsWith(`/`),i=t?{kind:`folder`,fromPath:tU(r.sourcePath),toPath:tU(r.destinationTreePath)}:{kind:`file`,fromPath:QH(r.sourcePath),toPath:QH(r.destinationTreePath)},a=await Ie(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),`Failed to move`);if(!a.ok){qa.error(a.title),D(a.title),Ve(),k(null);return}let o=d(gn,a.body,`rename-path:drop`,{renamed:[]});e=e.concat(o.renamed),t&&n.push({fromPath:tU(r.sourcePath),toPath:tU(r.destinationTreePath)})}await ft(e,n,r),k(null)}catch(e){console.warn(`[FileTree] move failed:`,e),qa.error(`Network error — please try again`),Ve(),k(null)}}},t[68]=ft,t[69]=Ve,t[70]=mt):mt=t[70];let ht=mt,gt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(gt=function(e){N({parentDir:e})},t[71]=gt):gt=t[71];let _t=gt,vt;t[72]!==Ze||t[73]!==Ye||t[74]!==J||t[75]!==b||t[76]!==v||t[77]!==Ve||t[78]!==ke?(vt=async function(e,t){if(ne.current)return;let n=G.current;n&&Ye(n);try{let n=fU(e,t,[...ke,...Pe.current]);k(n.renamePath),ne.current=n.renamePath;let r=window.location.hash,i;if(e===`file`){let e=pU(`file`,n.addPath),t=await Ie(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create file`);if(!t.ok){qa.error(t.title),D(t.title),k(null),ne.current=null;return}let r=QH(e),a=d(Sr,t.body,`create-page`,{docName:r}).docName;i=a;let o=e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`;C(e=>{if(e.some(e=>Dr(e)&&e.docName===a))return e;let t=[...e,{kind:`document`,docName:a,docExt:o,modified:new Date().toISOString(),size:0}];return We(t),t}),Kn([`files`,`backlinks`,`graph`]),v(a)}else{let e=tU(n.addPath),t=await Ie(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create folder`);if(!t.ok){qa.error(t.title),D(t.title),k(null),ne.current=null;return}i=d(pr,t.body,`create-folder`,{path:e}).path,C(e=>{if(e.some(e=>Mr(e)&&e.path===i))return e;let t=[...e,{kind:`folder`,path:i,modified:new Date().toISOString(),size:0}];return We(t),t}),Kn([`files`]),b(i)}let a=!1,o=e=>{if(e.key!==`Enter`)return;let t=G.current;!t||t.renamePath!==n.renamePath||queueMicrotask(()=>Ye(t))};document.addEventListener(`keydown`,o,!0),G.current={kind:e,renamePath:n.renamePath,createdPath:i,previousHash:r,disposeCommitListener:()=>{a||(a=!0,document.removeEventListener(`keydown`,o,!0))}},k(null),ne.current=null,J.add(n.addPath),J.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),qa.error(`Could not start creating a new item`);let t=G.current;t?await Ze(t):Ye(),k(null),ne.current=null,Ve()}},t[72]=Ze,t[73]=Ye,t[74]=J,t[75]=b,t[76]=v,t[77]=Ve,t[78]=ke,t[79]=vt):vt=t[79];let yt=vt,bt;t[80]===J?bt=t[81]:(bt=function(e){let t=nU(e);(0,Q.startTransition)(()=>{for(let e of Pe.current)if(e===t||e.startsWith(t)){let t=SU(J.getItem(e));t&&t.expand()}})},t[80]=J,t[81]=bt);let xt=bt,St;t[82]===J?St=t[83]:(St=function(e){let t=nU(e),n=new Set(W.current);(0,Q.startTransition)(()=>{for(let e of[...Pe.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=SU(J.getItem(e));t&&t.collapse()}})},t[82]=J,t[83]=St);let Ct=St,wt;t[84]!==R||t[85]!==Fe||t[86]!==r||t[87]!==i||t[88]!==V||t[89]!==O||t[90]!==Ze||t[91]!==S||t[92]!==Ne||t[93]!==ht||t[94]!==pt||t[95]!==De||t[96]!==qe||t[97]!==ke?(wt=()=>{I.current=S,z.current=r,ce.current=i,H.current=V,ne.current=O,je.current=ke,Pe.current=Ne,W.current=Fe,K.current=Ze,ie.current=e=>{if(te.current||e.length!==1)return;let t=e[0];t&&R(De(t),S)},oe.current=e=>{qe(e)||qa.error(e)},ae.current=pt,se.current=ht},t[84]=R,t[85]=Fe,t[86]=r,t[87]=i,t[88]=V,t[89]=O,t[90]=Ze,t[91]=S,t[92]=Ne,t[93]=ht,t[94]=pt,t[95]=De,t[96]=qe,t[97]=ke,t[98]=wt):wt=t[98],(0,Q.useLayoutEffect)(wt);let Tt,Et;t[99]===J?(Tt=t[100],Et=t[101]):(Tt=()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.altKey||e.key.toLowerCase()!==`a`||sW(e.target))return;let t=re.current,n=e.target,r=document.activeElement,i=n instanceof Node&&t?.contains(n),a=r instanceof Node&&t?.contains(r);if(!i&&!a)return;let o=new Set([...Pe.current,...je.current]);te.current=!0;for(let e of o)!e||H.current.has(e)||J.getItem(e)?.select();queueMicrotask(()=>{te.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Et=[J],t[99]=J,t[100]=Tt,t[101]=Et),(0,Q.useEffect)(Tt,Et);let Dt,Ot;t[102]!==S.length||t[103]!==w?(Dt=()=>{if(w||S.length===0)return;let e=re.current?.querySelector(WN)?.shadowRoot;if(!e)return;let t=gW,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Ot=[w,S.length],t[102]=S.length,t[103]=w,t[104]=Dt,t[105]=Ot):(Dt=t[104],Ot=t[105]),(0,Q.useEffect)(Dt,Ot);let kt;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(kt={folderCount:0,expandedCount:0},t[106]=kt):kt=t[106];let At=(0,Q.useRef)(kt),jt=(0,Q.useRef)(yt),Mt=(0,Q.useRef)(_t),Nt;t[107]===yt?Nt=t[108]:(Nt=()=>{jt.current=yt,Mt.current=_t},t[107]=yt,t[108]=Nt),(0,Q.useEffect)(Nt);let Pt,Ft;t[109]===J?(Pt=t[110],Ft=t[111]):(Pt=()=>({startCreating(e,t){jt.current(e,t)},startCreatingFromTemplate(e){Mt.current(e)},expandAll(){(0,Q.startTransition)(()=>{for(let e of Pe.current){let t=SU(J.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(W.current);(0,Q.startTransition)(()=>{for(let t of[...Pe.current].reverse()){if(e.has(t))continue;let n=SU(J.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Pe.current,t=0;for(let n of e)SU(J.getItem(n))?.isExpanded()&&t++;let n=e.length,r=At.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return At.current=i,i},subscribe(e){return J.subscribe(e)}}),Ft=[J],t[109]=J,t[110]=Pt,t[111]=Ft),(0,Q.useImperativeHandle)(n,Pt,Ft);let It;t[112]!==Ye||t[113]!==c||t[114]!==a||t[115]!==J||t[116]!==Ve?(It=async function(e){let t=e[0];if(t){k(t.path),j(null);try{let t=cW(e,I.current,Pe.current),n=[],r=[],i=[];for(let t of e){k(t.path);let e=await Ie(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:t.kind,path:t.path})}),`Failed to delete path`);if(!e.ok){let t=cW(i,I.current,Pe.current),o=new Set([...t.docNames,...n]),s=new Set([...t.folderPaths,...r]);a([...[...o].map(hW),...[...s].map(mW)]),await Promise.all([...o].map(e=>c(e))),qa.error(e.title),k(null),Ve(),Kn([`files`,`backlinks`,`graph`]);return}let o=d(Er,e.body,`delete-path`,{deletedDocNames:[]});n.push(...o.deletedDocNames),t.kind===`folder`&&r.push(t.path),i.push(t)}let o=G.current;o&&e.some(e=>lW(e,o))&&(o.kind===`file`?t.docNames.add(o.createdPath):t.folderPaths.add(o.createdPath),Ye(o));let s=new Set([...t.docNames,...n]),l=new Set([...t.folderPaths,...r]);a([...[...s].map(pW),...[...l].map(fW)]),await Promise.all([...s].map(e=>c(e)));for(let t of e){let e=t.kind===`folder`?nU(t.path):ZH(t.path,t.docExt);J.getItem(e)&&J.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}C(e=>{let t=xj(e,[...s]);for(let e of l)t=xj(t,[],e);return We(t),t}),Kn([`files`,`backlinks`,`graph`]),k(null)}catch(e){console.warn(`[FileTree] delete failed:`,e),qa.error(`Network error — please try again`),k(null),Ve()}}},t[112]=Ye,t[113]=c,t[114]=a,t[115]=J,t[116]=Ve,t[117]=It):It=t[117];let Lt=It,Rt;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=function(){let e=ee.current;e&&BU(e),ee.current=null},t[118]=Rt):Rt=t[118];let zt=Rt,Bt;t[119]===f?Bt=t[120]:(Bt=function(e){let t=DW(e.nativeEvent);if(!t||t.endsWith(`/`)){zt();return}let n=QH(t),r=I.current.find(e=>$H(e)===t);if(r&&Pn(r)){zt();return}ee.current!==n&&(zt(),ee.current=n,zU(n,e=>f(e)))},t[119]=f,t[120]=Bt);let Vt=Bt,Ht;t[121]!==R||t[122]!==J||t[123]!==b?(Ht=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=OW(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?nU(n):n;if(J.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=tU(r);if(window.location.hash===In(e))return;queueMicrotask(()=>b(e));return}let i=QH(r);window.location.hash!==$n(i)&&queueMicrotask(()=>R(r))},t[121]=R,t[122]=J,t[123]=b,t[124]=Ht):Ht=t[124];let Ut=Ht;if(w){let e;return t[125]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(AW,{}),t[125]=e):e=t[125],e}if(S.length===0){if(E){let e;return t[126]===E?e=t[127]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/50 text-sm`,children:E})}),t[126]=E,t[127]=e),e}let e;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:`No files yet.`}),t[128]=e):e=t[128];let n;return t[129]===yt?n=t[130]:(n=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:()=>yt(`file`,``),children:`Create your first file`})]}),t[129]=yt,t[130]=n),n}let Wt=O!==null,Gt=A?.targets[0]??null,Kt;t[131]===E?Kt=t[132]:(Kt=E&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:E}),t[131]=E,t[132]=Kt);let qt;t[133]===h?qt=t[134]:(qt=$U(h),t[133]=h,t[134]=qt);let Jt;t[135]!==Wt||t[136]!==V||t[137]!==Ct||t[138]!==xt||t[139]!==_e||t[140]!==J||t[141]!==ve||t[142]!==yt||t[143]!==P?(Jt=(e,t)=>(0,Z.jsx)(uW,{item:e,context:t,anyActionBusy:Wt,workspace:P,handoff:_e,model:J,okignoreBinding:ve,onStartCreating:yt,onStartCreatingFromTemplate:_t,onDelete:e=>j({targets:e}),onExpandSubtree:xt,onCollapseSubtree:Ct,isAsset:V.has(e.path),isAssetTreePath:Ke}),t[135]=Wt,t[136]=V,t[137]=Ct,t[138]=xt,t[139]=_e,t[140]=J,t[141]=ve,t[142]=yt,t[143]=P,t[144]=Jt):Jt=t[144];let Yt;t[145]!==Ut||t[146]!==Vt||t[147]!==J||t[148]!==Kt||t[149]!==qt||t[150]!==Jt?(Yt=(0,Z.jsx)(`div`,{ref:re,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(qH,{header:Kt,model:J,style:qt,onClickCapture:Ut,onMouseMove:Vt,onMouseLeave:zt,renderContextMenu:Jt})}),t[145]=Ut,t[146]=Vt,t[147]=J,t[148]=Kt,t[149]=qt,t[150]=Jt,t[151]=Yt):Yt=t[151];let Xt=!!A,Zt;t[152]===O?Zt=t[153]:(Zt=e=>{!e&&!O&&j(null)},t[152]=O,t[153]=Zt);let Qt;t[154]!==O||t[155]!==A||t[156]!==Lt||t[157]!==Gt?(Qt=A&&Gt&&(0,Z.jsx)(zi,{itemName:A.targets.length===1?`${Gt.name}${Gt.kind===`file`?Gt.docExt??`.md`:`/`}`:void 0,isSubmitting:O!==null,onDelete:()=>Lt(A.targets),customTitle:A.targets.length>1?`Delete selected items`:void 0,customDescription:A.targets.length>1?`Are you sure you want to delete ${A.targets.length} selected items? Folders and all files inside them will be deleted. This action cannot be undone.`:Gt.kind===`folder`?`Are you sure you want to delete ${Gt.name}/ and all files inside? This action cannot be undone.`:void 0}),t[154]=O,t[155]=A,t[156]=Lt,t[157]=Gt,t[158]=Qt):Qt=t[158];let $t;t[159]!==Xt||t[160]!==Zt||t[161]!==Qt?($t=(0,Z.jsx)(Ga,{open:Xt,onOpenChange:Zt,children:Qt}),t[159]=Xt,t[160]=Zt,t[161]=Qt,t[162]=$t):$t=t[162];let en=M!==null,tn;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(tn=e=>{e||N(null)},t[163]=tn):tn=t[163];let nn=M?.parentDir??``,rn;t[164]!==en||t[165]!==nn?(rn=(0,Z.jsx)(wf,{open:en,onOpenChange:tn,kind:`file`,initialDir:nn}),t[164]=en,t[165]=nn,t[166]=rn):rn=t[166];let an;return t[167]!==Yt||t[168]!==$t||t[169]!==rn?(an=(0,Z.jsxs)(Z.Fragment,{children:[Yt,$t,rn]}),t[167]=Yt,t[168]=$t,t[169]=rn,t[170]=an):an=t[170],an}function fW(e){return tt(e)}function pW(e){return Ge(e)}function mW(e){return tt(e)}function hW(e){return Ge(e)}function gW(e){return e.endsWith(`/`)?e.slice(0,-1):e}function _W(e){return!!e}function vW(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function yW(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function bW(e){qa.error(e)}function xW(){}function SW(e){return qa.error(e)}function CW(){}function wW(){}async function TW(){}function EW(e){return $H(e)}function DW(e){return OW(e)?.dataset.itemPath??null}function OW(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var kW=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function AW(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":`Loading files`,children:kW.map(jW)}),e[0]=t):t=e[0],t}function jW(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(na,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(na,{className:`h-3 ${e}`})]},t)}var MW=(e,t,n)=>gc(e,t,n,`ProjectSwitcher`);function NW(e){let t=(0,$.c)(59),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!1),c;t[1]!==n.project||t[2]!==o?(c=()=>{if(!o)return;let e=!1;return MW(async()=>{let t=await n.project.listRecent();e||a(t)},`Failed to load recent projects.`),()=>{e=!0}},t[1]=n.project,t[2]=o,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==o?(l=[o,n],t[4]=n,t[5]=o,t[6]=l):l=t[6],(0,Q.useEffect)(c,l);let u;t[7]===n.project?u=t[8]:(u=e=>{s(!1),MW(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`)},t[7]=n.project,t[8]=u);let d=u,f;t[9]!==n.dialog||t[10]!==n.project?(f=()=>{s(!1),MW(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},`Failed to open folder.`)},t[9]=n.dialog,t[10]=n.project,t[11]=f):f=t[11];let p=f,m;t[12]===n.navigator?m=t[13]:(m=()=>{s(!1),MW(()=>n.navigator.open(),`Failed to open Project Navigator.`)},t[12]=n.navigator,t[13]=m);let h=m,g=n.config.projectPath,_,v,y,b,x,S,C,w,T,E,D;if(t[14]!==n.config.projectName||t[15]!==g||t[16]!==o||t[17]!==d||t[18]!==i){let e;t[30]===g?e=t[31]:(e=e=>e.path!==g,t[30]=g,t[31]=e);let r=i.filter(e);v=Ca,S=o,C=s;let a;t[32]===n.config.projectName?a=t[33]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[32]=n.config.projectName,t[33]=a);let c;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(ss,{"aria-hidden":`true`,className:`opacity-60`}),t[34]=c):c=t[34],t[35]===a?w=t[36]:(w=(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsxs)(YA,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:`Open project menu`,children:[a,c]})}),t[35]=a,t[36]=w),_=ki,T=`start`,E=`top`,D=`min-w-[260px]`,y=`project-switcher-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(xa,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Recent projects`}),t[37]=b):b=t[37],x=r.length===0?(0,Z.jsx)(xa,{className:`font-normal text-muted-foreground text-xs`,children:`No other recent projects.`}):r.slice(0,10).map(e=>(0,Z.jsxs)(li,{disabled:e.missing,onSelect:()=>d(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Z.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]},e.path)),t[14]=n.config.projectName,t[15]=g,t[16]=o,t[17]=d,t[18]=i,t[19]=_,t[20]=v,t[21]=y,t[22]=b,t[23]=x,t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=D}else _=t[19],v=t[20],y=t[21],b=t[22],x=t[23],S=t[24],C=t[25],w=t[26],T=t[27],E=t[28],D=t[29];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(di,{}),t[38]=O):O=t[38];let k;t[39]===p?k=t[40]:(k=(0,Z.jsx)(li,{onSelect:p,"data-testid":`project-switcher-open-folder`,children:`Open folder`}),t[39]=p,t[40]=k);let A;t[41]===h?A=t[42]:(A=(0,Z.jsx)(li,{onSelect:h,"data-testid":`project-switcher-switch-project`,children:`Switch Project`}),t[41]=h,t[42]=A);let j;t[43]!==_||t[44]!==y||t[45]!==b||t[46]!==x||t[47]!==k||t[48]!==A||t[49]!==T||t[50]!==E||t[51]!==D?(j=(0,Z.jsxs)(_,{align:T,side:E,className:D,"data-testid":y,children:[b,x,O,k,A]}),t[43]=_,t[44]=y,t[45]=b,t[46]=x,t[47]=k,t[48]=A,t[49]=T,t[50]=E,t[51]=D,t[52]=j):j=t[52];let M;return t[53]!==v||t[54]!==S||t[55]!==C||t[56]!==w||t[57]!==j?(M=(0,Z.jsxs)(v,{open:S,onOpenChange:C,children:[w,j]}),t[53]=v,t[54]=S,t[55]=C,t[56]=w,t[57]=j,t[58]=M):M=t[58],M}function PW(e){let t=(0,$.c)(33),{notice:n,onDismiss:r}=e,i=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ma,{"aria-hidden":`true`,className:`size-3`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":`Dismiss notice`,onClick:r,children:a}),t[1]=r,t[2]=o);let s=o;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-2 text-xs text-muted-foreground ${i}`,a;t[3]===n.body?a=t[4]:(a=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[3]=n.body,t[4]=a);let o;t[5]!==s||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a,s]}),t[5]=s,t[6]=a,t[7]=o):o=t[7];let c;t[8]===n.action?c=t[9]:(c=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[8]=n.action,t[9]=c);let l;t[10]===n.secondaryAction?l=t[11]:(l=()=>{n.secondaryAction?.onClick()},t[10]=n.secondaryAction,t[11]=l);let u;t[12]!==n.secondaryAction.label||t[13]!==l?(u=(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:l,children:n.secondaryAction.label}),t[12]=n.secondaryAction.label,t[13]=l,t[14]=u):u=t[14];let d;t[15]!==c||t[16]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[c,u]}),t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==d||t[19]!==e||t[20]!==r||t[21]!==o?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,d]}),t[18]=d,t[19]=e,t[20]=r,t[21]=o,t[22]=f):f=t[22],f}let c=`update-notice-${n.id}`,l=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${i}`,u;t[23]===n.body?u=t[24]:(u=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[23]=n.body,t[24]=u);let d;t[25]===n.action?d=t[26]:(d=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[25]=n.action,t[26]=d);let f;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":c,className:l,children:[u,d,s]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=f):f=t[32],f}function FW(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function IW(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Ed,Td,Td),n;e[0]===t?n=e[1]:(n=FW(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{wd(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(PW,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}var LW={folderCount:0,expandedCount:0};function RW(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(c,{name:`file-sidebar`,children:(0,Z.jsx)(BW,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var zW=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(io,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(ao,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(so,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function BW(e){let t=(0,$.c)(42),{onOpenSearch:n}=e,[r,i]=(0,Q.useState)(null),{activeDocName:a,activeTarget:o}=Ue(),s;t[0]!==a||t[1]!==o?(s=o?.kind===`folder`||o?.kind===`folder-index`?o.folderPath:Jn(a),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c=s,l=typeof window<`u`&&window.okDesktop!=null,{state:u}=FA(),d=u===`expanded`,f=u===`collapsed`,[p,m]=(0,Q.useState)(LW),h,g;t[3]===r?(h=t[4],g=t[5]):(h=()=>{if(r!==null)return m(r.getFolderState()),r.subscribe(()=>{m(r.getFolderState())})},g=[r],t[3]=r,t[4]=h,t[5]=g),(0,Q.useEffect)(h,g);let _=p.folderCount>0,v=_&&p.expandedCount===p.folderCount,y=p.expandedCount===0,b=l&&f&&`opacity-0`,x;t[6]===b?x=t[7]:(x=Y(`flex-row h-12 items-center py-0 px-3`,l?`justify-end`:`justify-between`,l&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,b,l&&`[-webkit-app-region:drag]`),t[6]=b,t[7]=x);let S;t[8]===d?S=t[9]:(S=d&&!l?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:`Files`}):null,t[8]=d,t[9]=S);let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=Y(`flex items-center gap-1`,l&&`[&>*]:[-webkit-app-region:no-drag]`),t[10]=C):C=t[10];let w;t[11]===n?w=t[12]:(w=(0,Z.jsx)(zW,{icon:rt,label:`Search`,onClick:n}),t[11]=n,t[12]=w);let T;t[13]!==v||t[14]!==_||t[15]!==y||t[16]!==r?(T=_?(0,Z.jsxs)(Ca,{children:[(0,Z.jsx)(ra,{asChild:!0,children:(0,Z.jsx)(zW,{icon:Fs,label:`Tree View Options`})}),(0,Z.jsxs)(ki,{align:`end`,children:[v?null:(0,Z.jsxs)(li,{onSelect:()=>r?.expandAll(),children:[(0,Z.jsx)(lc,{"aria-hidden":`true`}),`Expand All`]}),y?null:(0,Z.jsxs)(li,{onSelect:()=>r?.collapseAll(),children:[(0,Z.jsx)(Ss,{"aria-hidden":`true`}),`Collapse All`]})]})]}):null,t[13]=v,t[14]=_,t[15]=y,t[16]=r,t[17]=T):T=t[17];let E;t[18]!==c||t[19]!==r?(E=(0,Z.jsx)(zW,{icon:tc,label:`New File`,onClick:()=>r?.startCreating(`file`,c)}),t[18]=c,t[19]=r,t[20]=E):E=t[20];let D;t[21]!==c||t[22]!==r?(D=(0,Z.jsx)(zW,{icon:ys,label:`New from template`,onClick:()=>r?.startCreatingFromTemplate(c)}),t[21]=c,t[22]=r,t[23]=D):D=t[23];let O;t[24]!==c||t[25]!==r?(O=(0,Z.jsx)(zW,{icon:ws,label:`New Folder`,onClick:()=>r?.startCreating(`folder`,c)}),t[24]=c,t[25]=r,t[26]=O):O=t[26];let k;t[27]!==E||t[28]!==D||t[29]!==O||t[30]!==w||t[31]!==T?(k=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,O]}),t[27]=E,t[28]=D,t[29]=O,t[30]=w,t[31]=T,t[32]=k):k=t[32];let A;t[33]!==k||t[34]!==x||t[35]!==S?(A=(0,Z.jsxs)(UA,{className:x,children:[S,k]}),t[33]=k,t[34]=x,t[35]=S,t[36]=A):A=t[36];let j;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(GA,{children:(0,Z.jsx)(dW,{ref:i})}),t[37]=j):j=t[37];let M,N;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(WA,{className:`px-0`,children:[typeof window<`u`&&window.okDesktop?(0,Z.jsx)(KA,{children:(0,Z.jsx)(qA,{children:(0,Z.jsx)(NW,{bridge:window.okDesktop})})}):null,(0,Z.jsx)(IW,{})]}),N=(0,Z.jsx)(VA,{enableToggle:!1}),t[38]=M,t[39]=N):(M=t[38],N=t[39]);let P;return t[40]===A?P=t[41]:(P=(0,Z.jsxs)(zA,{variant:`inset`,children:[A,j,M,N]}),t[40]=A,t[41]=P),P}function VW(){let e=(0,$.c)(17),t=Gt(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Ue(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new E,i=new ot({url:n,name:ln,document:e,onStateless:e=>{let{payload:t}=e;yt(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:qW,onConfigValidationRejected:KW,onConfigIgnoreNestedError:GW,onUnknown:WW})},onClose:UW,onDisconnect:HW}),a=mr(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=pe(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Kn([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function HW(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function UW(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function WW(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function GW(e){pa(e)}function KW(e){ga(e)}function qW(e){Kn([e.ch])}var JW=`#install-claude-desktop`;function YW(e){return e===`#settings`||e===JW}function XW(e,t){return`${[...e].sort().join(`\0`)}\u0001${[...t].sort().join(`\0`)}`}function ZW(){let e=(0,$.c)(18),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=Ue(),{openTargetTransition:i}=$e(),{folderPaths:a,loading:o,pages:s}=xr(),c=(0,Q.useRef)(null),l;e[0]!==a||e[1]!==s?(l=XW(s,a),e[0]=a,e[1]=s,e[2]=l):l=e[2];let u=l,d,f;e[3]!==a||e[4]!==o||e[5]!==s||e[6]!==n||e[7]!==r||e[8]!==u?(d=()=>{o||!r||c.current===u||(c.current=u,n({pages:s,folderPaths:a}))},f=[a,o,s,n,r,u],e[3]=a,e[4]=o,e[5]=s,e[6]=n,e[7]=r,e[8]=u,e[9]=d,e[10]=f):(d=e[9],f=e[10]),(0,Q.useEffect)(d,f);let p,m;return e[11]!==t||e[12]!==a||e[13]!==o||e[14]!==i||e[15]!==s?(p=()=>{e();function e(){if(YW(window.location.hash))return;let e=Cr(window.location.hash);if(e){let t=Tn(e.split(`.`).pop()??``);ye(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=ur(window.location.hash);if(!n){ye(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(o){ye(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=ar(n,{pages:s,folderPaths:a});if(r.kind===`missing`&&/\/+$/.test(n.trim())){ye(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}ye(`ok/nav/hash-change`,{docName:n,kind:r.kind}),i(r)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},m=[t,a,o,i,s],e[11]=t,e[12]=a,e[13]=o,e[14]=i,e[15]=s,e[16]=p,e[17]=m):(p=e[16],m=e[17]),(0,Q.useEffect)(p,m),null}function QW(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(typeof window<`u`&&window.location.hash===JW),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===JW&&n(!0)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e){if(n(e),!e&&window.location.hash===JW){let{pathname:e,search:t}=window.location;window.history.replaceState(null,``,`${e}${t}`)}},e[2]=a):a=e[2];let o=a,s;return e[3]===t?s=e[4]:(s=(0,Z.jsx)(oa,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function $W(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(eG,t),null}function eG(){let e=function(e){let t=e.target;jf({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Af))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function tG(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=Ue(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Jn(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Sf({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(wf,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function nG(){let e=(0,$.c)(13),t=typeof window<`u`?window.okDesktop??null:null,[n,r]=(0,Q.useState)(!1),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(qp,{}),e[0]=i):i=e[0];let a,o,s,l,u,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(VW,{}),o=(0,Z.jsx)(ZW,{}),s=(0,Z.jsx)(tG,{}),l=(0,Z.jsx)($W,{}),u=(0,Z.jsx)(QW,{}),d=(0,Z.jsx)(xu,{}),e[1]=a,e[2]=o,e[3]=s,e[4]=l,e[5]=u,e[6]=d):(a=e[1],o=e[2],s=e[3],l=e[4],u=e[5],d=e[6]);let f;e[7]===n?f=e[8]:(f=(0,Z.jsx)(Bp,{bridge:t,open:n,onOpenChange:r}),e[7]=n,e[8]=f);let p;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(RW,{onOpenSearch:()=>r(!0)}),e[9]=p):p=e[9];let m;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsxs)(IA,{className:`h-screen overflow-hidden`,children:[p,(0,Z.jsx)(HA,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(MM,{})})]}),e[10]=m):m=e[10];let h;return e[11]===f?h=e[12]:(h=(0,Z.jsx)(c,{name:`app`,children:(0,Z.jsx)(it,{children:(0,Z.jsxs)(oi,{children:[i,(0,Z.jsxs)(dr,{children:[a,o,s,l,u,d,f,m]})]})})}),e[11]=f,e[12]=h),h}Lo(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&Au({apiOrigin:window.okDesktop.config.apiOrigin}),Ju()&&ed(),Dd(),typeof window<`u`&&Nu({bridge:window.okDesktop}),typeof window<`u`&&Za({bridge:window.okDesktop}),typeof window<`u`&&lo({bridge:window.okDesktop}),typeof window<`u`&&Fu({bridge:window.okDesktop});var rG=new Ko({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),iG=document.getElementById(`root`);if(!iG)throw Error(`Root element not found`);var aG=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,ns.createRoot)(iG).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(Rt,{client:rG,children:(0,Z.jsxs)(on,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(oo,{children:aG&&window.okDesktop?(0,Z.jsx)(Tu,{bridge:window.okDesktop}):(0,Z.jsx)(nG,{})}),(0,Z.jsx)(ku,{richColors:!0,closeButton:!0})]})})}));
|