@inkeep/open-knowledge 0.12.0-beta.14 → 0.12.0-beta.16

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.
Files changed (31) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +5 -5
  4. package/dist/constants-LYTkNwGp.mjs +2 -0
  5. package/dist/{dist-DtdRtabl.mjs → dist-D7myPw4s.mjs} +4 -4
  6. package/dist/{dist-kEYk7308.mjs → dist-GL5zcXSU.mjs} +1 -1
  7. package/dist/index.mjs +1 -1
  8. package/dist/init-CQ1uWx-G.mjs +1 -0
  9. package/dist/{init-DAuset3t.mjs → init-mCZ3XQ1R.mjs} +4 -4
  10. package/dist/loader-BKje-0vK.mjs +1 -0
  11. package/dist/{loader-CaLEJbcQ.mjs → loader-B_EDN7s4.mjs} +2 -2
  12. package/dist/preview-CiO0g9mW.mjs +1 -0
  13. package/dist/{preview-b2rfnpjL.mjs → preview-DuxBWllB.mjs} +2 -2
  14. package/dist/public/assets/{index-D6s4l6eX.css → index-BXgWyDFu.css} +1 -1
  15. package/dist/public/assets/{index-BxMKAgUQ.js → index-CEtMQRxi.js} +73 -73
  16. package/dist/public/index.html +2 -2
  17. package/dist/{repair-launch-json-Bisx03pf.mjs → repair-launch-json-CfUZnvkR.mjs} +2 -2
  18. package/dist/{repair-mcp-configs-3etDglgV.mjs → repair-mcp-configs-tF1J1wYs.mjs} +2 -2
  19. package/dist/repair-skills-BSA3PyS7.mjs +1 -0
  20. package/dist/{repair-skills-BCUJOnkF.mjs → repair-skills-uHQb0hCn.mjs} +2 -2
  21. package/dist/{src-CmFWAq4o.mjs → src-C4WXOsUI.mjs} +2 -2
  22. package/dist/start-B3JYhwpU.mjs +1 -0
  23. package/dist/{start-MXkiMrR1.mjs → start-_DhBxzcl.mjs} +2 -2
  24. package/dist/{write-project-skill-BOmI_IcM.mjs → write-project-skill-DnuutHfZ.mjs} +2 -2
  25. package/package.json +1 -1
  26. package/dist/constants-BkXmZuXM.mjs +0 -2
  27. package/dist/init-TKxHSMWv.mjs +0 -1
  28. package/dist/loader-B0LEWbj7.mjs +0 -1
  29. package/dist/preview-CWoKWF6e.mjs +0 -1
  30. package/dist/repair-skills-BOGjGitt.mjs +0 -1
  31. package/dist/start-DiBErYZV.mjs +0 -1
@@ -23,9 +23,9 @@ Error generating stack: `+e.message+`
23
23
  `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function ev(e,t){return`${e}\u0000${t}`}function tv(e,t,n){let r=zi(e).body,i=zi(t).body;return r===i?``:Q_(n,r,i,``,``,{context:3})}function nv(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=yt(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=ev(t,r),a=n.get(e);if(a===void 0){let o=await fetch(`/api/history/${r}?docName=${encodeURIComponent(t)}`);if(i)return;if(!o.ok){s({status:`error`,diff:null});return}let c=await o.json();if(i)return;a=c.content??``,n.set(e,a)}if(i)return;let o=c.current?.document.getText(`source`).toString()??``,l=tv(a,o,t);if(i)return;s({status:`ready`,diff:l})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,err:e}),s({status:`error`,diff:null}))}})(),()=>{i=!0}},d=[e,t,n],r[3]=n,r[4]=t,r[5]=e,r[6]=u,r[7]=d):(u=r[6],d=r[7]),(0,Q.useEffect)(u,d),o}var rv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-DgtknSgX.js`),__vite__mapDeps([18,1,6,19]),import.meta.url)).ActivityPanelDiffView}));function iv(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Y._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Y._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Y._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Y._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Y._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function av(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function ov(e){return e.slice(0,7)}function sv(e){return e.type===`upstream`?Y._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?Y._({id:`B2DrPb`}):e.author}function cv(e){let t=(0,$.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsx)(fa,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(va,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ua,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(ha,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Ca,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(xa,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(ya,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function lv(e){let t=(0,$.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Be,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=oi(i),t[1]=i,t[2]=a);let o=a,s=r?ui[o]??Fi[o]:Fi[o],c;t[3]!==s||t[4]!==i?(c=s??Lr(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Z.jsx)(cv,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(hl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Vc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(tu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ya,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Vc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(tu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function uv(e){let t=(0,$.c)(23),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r),p=n.length;if(n.length===0)return null;let m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f(dv),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(le,{className:`size-3`}):(0,Z.jsx)(Os,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?Y._({id:`OKQe56`,values:{entryCount:p}}):Y._({id:`k9jDvw`,values:{entryCount:p}}),t[3]=p,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==d||t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[6]=d,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==a||t[12]!==s||t[13]!==n||t[14]!==d||t[15]!==c||t[16]!==i||t[17]!==u||t[18]!==l?(v=d&&n.map(e=>(0,Z.jsx)(Cv,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[10]=o,t[11]=a,t[12]=s,t[13]=n,t[14]=d,t[15]=c,t[16]=i,t[17]=u,t[18]=l,t[19]=v):v=t[19];let y;return t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22],y}function dv(e){return!e}function fv(e){return e.checkpoint?e.checkpoint.kind:`save`}function pv(e){let t=fv(e);if(t===`save`)return Y._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${mv(n)})`:``;return t===`bridge-merge-loss`?Y._({id:`uZAG7T`,values:{sizeSuffix:r}}):Y._({id:`_4rAQI`,values:{sizeSuffix:r}})}function mv(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function hv(e){return e.type===`checkpoint`?fv(e)===`save`?`version`:`auto-save`:`wip`}function gv(e){let t=hv(e);return t===`version`?Y._({id:`RFQ1Yx`}):t===`auto-save`?Y._({id:`9Uv1CD`}):Y._({id:`Yea-K5`})}function _v(e){let t=hv(e);return t===`version`?Y._({id:`gg3Rpy`}):t===`auto-save`?Y._({id:`PXXeW8`}):Y._({id:`Pyp1NA`})}function vv(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function yv(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,c;t[0]===n?(o=t[1],c=t[2]):([o,...c]=n,t[0]=n,t[1]=o,t[2]=c);let l=c.length,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=u):u=t[3];let d;t[4]===o?d=t[5]:(d=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[u,o]}),t[4]=o,t[5]=d);let f;t[6]!==r||t[7]!==c?(f=r&&c.map(xv),t[6]=r,t[7]=c,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==d||t[11]!==f?(p=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[d,f]}),t[9]=a,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m;t[13]!==r||t[14]!==l||t[15]!==a||t[16]!==c.length?(m=c.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(bv)},children:[r?(0,Z.jsx)(le,{className:`size-3`}):(0,Z.jsx)(Os,{className:`size-3`}),r?(0,Z.jsx)(s,{id:`vLyv1R`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:l}})]}),t[13]=r,t[14]=l,t[15]=a,t[16]=c.length,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function bv(e){return!e}function xv(e,t){return(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function Sv(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=nv(n,r,i),l;t[0]===c.status?l=t[1]:(l=c.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Ce,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`38foVZ`})]}),t[0]=c.status,t[1]=l);let u;t[2]===c.status?u=t[3]:(u=c.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(s,{id:`vvWZnu`})}),t[2]=c.status,t[3]=u);let d;t[4]!==a||t[5]!==c.diff||t[6]!==c.status?(d=c.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Ce,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(rv,{diff:c.diff,viewType:a})}),t[4]=a,t[5]=c.diff,t[6]=c.status,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[l,u,d]}),t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function Cv(e){let t=(0,$.c)(130),{entry:n,prominent:r,isDark:a,diffLayout:o,cache:c,docName:l,expanded:u,onToggleExpanded:d,onRestoreSuccess:f}=e,p=r===void 0?!1:r,{_:m}=i(),h;t[0]===n.timestamp?h=t[1]:(h=iv(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=sv(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=av(n.timestamp),t[4]=n.timestamp,t[5]=y);let b=y,x;t[6]===n.sha?x=t[7]:(x=ov(n.sha),t[6]=n.sha,t[7]=x);let S=x,C=n.contributors.flatMap(wv),w;t[8]===n?w=t[9]:(w=vv(n),t[8]=n,t[9]=w);let T=w,[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(null),j=(0,Q.useId)(),M,N;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>A.current?.abort(),N=[],t[10]=M,t[11]=N):(M=t[10],N=t[11]),(0,Q.useEffect)(M,N);let P;t[12]!==n.sha||t[13]!==d?(P=()=>d(n.sha),t[12]=n.sha,t[13]=d,t[14]=P):P=t[14];let F=P,I;t[15]===D?I=t[16]:(I=function(){A.current?.abort(),A.current=null,k(!1),D(!1)},t[15]=D,t[16]=I);let L=I,R;t[17]!==m||t[18]!==l||t[19]!==n.sha||t[20]!==f||t[21]!==D?(R=async function(){k(!0);let e=new AbortController;A.current=e;let t=function(){e.signal.aborted||k(!1),A.current===e&&(A.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:l,commitSha:n.sha}),signal:e.signal})}catch(r){let i=r;!e.signal.aborted&&!(i instanceof DOMException&&i.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:l,sha:n.sha,err:i}),X.error(m({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)D(!1),f();else{let e=`HTTP ${r.status}`;try{let t=Yr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:l,sha:n.sha,status:r.status,detail:e}),X.error(m({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=m,t[18]=l,t[19]=n.sha,t[20]=f,t[21]=D,t[22]=R):R=t[22];let z=R,B;t[23]!==n||t[24]!==a||t[25]!==p?(B=p?(()=>{let e=fv(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Pi,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(ol,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(rl,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(lv,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=B):B=t[26];let V=B,H=u?j:void 0,U=u?`bg-muted`:`hover:bg-muted/80`,ee;t[27]===U?ee=t[28]:(ee=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,U],t[27]=U,t[28]=ee);let te=ee.join(` `),W;t[29]===F?W=t[30]:(W=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),F())},t[29]=F,t[30]=W);let ne;t[31]===V?ne=t[32]:(ne=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:V}),t[31]=V,t[32]=ne);let re;t[33]!==v||t[34]!==n||t[35]!==p?(re=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:pv(n)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:v})]}):(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:v}),t[33]=v,t[34]=n,t[35]=p,t[36]=re):re=t[36];let G;t[37]!==n.timestamp||t[38]!==g?(G=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:g}),t[37]=n.timestamp,t[38]=g,t[39]=G):G=t[39];let ie;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=ie):ie=t[40];let K;t[41]===n?K=t[42]:(K=gv(n),t[41]=n,t[42]=K);let q;t[43]===D?q=t[44]:(q=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=q);let ae;t[45]===O?ae=t[46]:(ae=O?(0,Z.jsx)(Ce,{className:`size-3 animate-spin`}):(0,Z.jsx)(pa,{className:`size-3`}),t[45]=O,t[46]=ae);let oe;t[47]!==O||t[48]!==K||t[49]!==q||t[50]!==ae?(oe=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":K,disabled:O,onClick:q,children:ae})}),t[47]=O,t[48]=K,t[49]=q,t[50]=ae,t[51]=oe):oe=t[51];let se;t[52]===n?se=t[53]:(se=gv(n),t[52]=n,t[53]=se);let ce;t[54]===se?ce=t[55]:(ce=(0,Z.jsx)(Ar,{side:`top`,children:se}),t[54]=se,t[55]=ce);let le;t[56]!==oe||t[57]!==ce?(le=(0,Z.jsxs)(pr,{children:[oe,ce]}),t[56]=oe,t[57]=ce,t[58]=le):le=t[58];let ue;t[59]!==re||t[60]!==G||t[61]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[re,G,ie,le]}),t[59]=re,t[60]=G,t[61]=le,t[62]=ue):ue=t[62];let de;t[63]===T?de=t[64]:(de=T.length>0&&(0,Z.jsx)(yv,{summaries:T}),t[63]=T,t[64]=de);let fe=C.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:C.join(`, `),children:C.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),pe;t[65]!==ue||t[66]!==de||t[67]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ue,de,fe]}),t[65]=ue,t[66]=de,t[67]=fe,t[68]=pe):pe=t[68];let me;t[69]!==u||t[70]!==F||t[71]!==H||t[72]!==te||t[73]!==W||t[74]!==ne||t[75]!==pe?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":H,"data-testid":`timeline-entry-expand`,className:te,onClick:F,onKeyDown:W,children:[ne,pe]}),t[69]=u,t[70]=F,t[71]=H,t[72]=te,t[73]=W,t[74]=ne,t[75]=pe,t[76]=me):me=t[76];let he;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(he=u&&(0,Z.jsx)(Sv,{sha:n.sha,docName:l,cache:c,diffLayout:o,panelId:j}),t[77]=c,t[78]=o,t[79]=j,t[80]=l,t[81]=n.sha,t[82]=u,t[83]=he):he=t[83];let ge;t[84]!==me||t[85]!==he?(ge=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[me,he]}),t[84]=me,t[85]=he,t[86]=ge):ge=t[86];let _e;t[87]!==L||t[88]!==D?(_e=e=>{e?D(!0):L()},t[87]=L,t[88]=D,t[89]=_e):_e=t[89];let ve;t[90]===n?ve=t[91]:(ve=_v(n),t[90]=n,t[91]=ve);let ye;t[92]===ve?ye=t[93]:(ye=(0,Z.jsx)(bs,{children:ve}),t[92]=ve,t[93]=ye);let be;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(be={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=be):be=t[98];let xe;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(xe={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=xe):xe=t[99];let Se;t[100]===be?Se=t[101]:(Se=(0,Z.jsx)(vs,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:be,components:xe})}),t[100]=be,t[101]=Se);let we;t[102]!==ye||t[103]!==Se?(we=(0,Z.jsxs)(ws,{children:[ye,Se]}),t[102]=ye,t[103]=Se,t[104]=we):we=t[104];let Te;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=Te):Te=t[105];let Ee;t[106]===L?Ee=t[107]:(Ee=(0,Z.jsx)(sa,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:L,children:Te}),t[106]=L,t[107]=Ee);let De;t[108]===z?De=t[109]:(De=()=>z(),t[108]=z,t[109]=De);let Oe;t[110]===O?Oe=t[111]:(Oe=O?(0,Z.jsx)(Ce,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=Oe);let ke;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=ke):ke=t[112];let Ae;t[113]!==O||t[114]!==De||t[115]!==Oe?(Ae=(0,Z.jsxs)(sa,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:De,children:[Oe,ke]}),t[113]=O,t[114]=De,t[115]=Oe,t[116]=Ae):Ae=t[116];let je;t[117]!==Ee||t[118]!==Ae?(je=(0,Z.jsxs)(Cs,{children:[Ee,Ae]}),t[117]=Ee,t[118]=Ae,t[119]=je):je=t[119];let Me;t[120]!==we||t[121]!==je?(Me=(0,Z.jsxs)(xs,{children:[we,je]}),t[120]=we,t[121]=je,t[122]=Me):Me=t[122];let Ne;t[123]!==E||t[124]!==_e||t[125]!==Me?(Ne=(0,Z.jsx)(Ts,{open:E,onOpenChange:_e,children:Me}),t[123]=E,t[124]=_e,t[125]=Me,t[126]=Ne):Ne=t[126];let Pe;return t[127]!==ge||t[128]!==Ne?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[ge,Ne]}),t[127]=ge,t[128]=Ne,t[129]=Pe):Pe=t[129],Pe}function wv(e){return e.docs}function Tv(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=Li(),d=u===`dark`,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(null),[b]=(0,Q.useState)(kv),[x,S]=(0,Q.useState)(Ov),C;t[1]===b?C=t[2]:(C=()=>{S(new Set),b.clear()},t[1]=b,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){S(new Set)},t[6]=D):D=t[6];let O=D,k,A;t[7]!==l||t[8]!==n?(k=()=>{if(!n){m([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){v(l({id:`brCtGB`}));return}let r=await t.json();if(e)return;m(r.entries??[]),v(null)}catch(t){let n=t;if(e)return;v(l({id:`brCtGB`})),console.error(`[timeline]`,n)}};return g(!0),t().finally(()=>{e||g(!1)}),y.current=setInterval(t,1e4),()=>{e=!0,y.current&&clearInterval(y.current)}},A=[n,l],t[7]=l,t[8]=n,t[9]=k,t[10]=A):(k=t[9],A=t[10]),(0,Q.useEffect)(k,A);let j,M,N,P,F,I,L,R;if(t[11]!==l||t[12]!==b||t[13]!==r||t[14]!==n||t[15]!==p||t[16]!==_||t[17]!==x||t[18]!==d||t[19]!==h||t[20]!==a||t[21]!==o||t[22]!==c){let e=[],i=[],u=!1;for(let t of p)t.type===`checkpoint`?(i.length>0&&(e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u}),i=[]),e.push({kind:`checkpoint`,entry:t}),u=!0):i.push(t);i.length>0&&e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u});let f;t[31]===p?f=t[32]:(f=p.some(Dv),t[31]=p,t[32]=f);let m=!f,g=!h&&!_&&p.length>0;F=`flex h-full flex-col`;let v;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(An,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[33]=v):v=t[33];let y;t[34]!==l||t[35]!==r||t[36]!==g||t[37]!==a?(y=g&&(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsxs)(_s,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":l({id:`XvPJaT`}),variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(hs,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(zl,{className:`size-3.5`})}),(0,Z.jsx)(hs,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)($c,{className:`size-3.5`})})]})}),(0,Z.jsx)(Ar,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[34]=l,t[35]=r,t[36]=g,t[37]=a,t[38]=y):y=t[38];let S;t[39]===l?S=t[40]:(S=l({id:`IrYrzq`}),t[39]=l,t[40]=S);let C;t[41]===c?C=t[42]:(C=c?(0,Z.jsx)(Ce,{className:`size-4 animate-spin`}):(0,Z.jsx)(Bl,{className:`size-4`}),t[41]=c,t[42]=C);let w;t[43]!==o||t[44]!==c||t[45]!==S||t[46]!==C?(w=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-sm`,onClick:o,disabled:c,"aria-label":S,className:`text-muted-foreground`,"data-testid":`timeline-save-version`,children:C})}),t[43]=o,t[44]=c,t[45]=S,t[46]=C,t[47]=w):w=t[47];let T;t[48]===c?T=t[49]:(T=(0,Z.jsx)(Ar,{children:c?(0,Z.jsx)(s,{id:`uF9ruK`}):(0,Z.jsx)(s,{id:`IrYrzq`})}),t[48]=c,t[49]=T);let D;t[50]!==w||t[51]!==T?(D=(0,Z.jsxs)(pr,{children:[w,T]}),t[50]=w,t[51]=T,t[52]=D):D=t[52],t[53]!==y||t[54]!==D?(I=(0,Z.jsxs)(Dn,{children:[v,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,D]})]}),t[53]=y,t[54]=D,t[55]=I):I=t[55],L=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[56]!==l||t[57]!==h?(R=h&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":l({id:`o49mDZ`}),children:[1,2,3].map(Ev)}),t[56]=l,t[57]=h,t[58]=R):R=t[58],t[59]!==_||t[60]!==h?(j=!h&&_&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:_})}),t[59]=_,t[60]=h,t[61]=j):j=t[61],t[62]!==p.length||t[63]!==_||t[64]!==h?(M=!h&&!_&&p.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Ta25TG`})})}),t[62]=p.length,t[63]=_,t[64]=h,t[65]=M):M=t[65],t[66]!==b||t[67]!==r||t[68]!==n||t[69]!==p||t[70]!==_||t[71]!==x||t[72]!==m||t[73]!==d||t[74]!==h?(N=!h&&!_&&m&&p.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:p.map(e=>(0,Z.jsx)(Cv,{entry:e,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.sha),onToggleExpanded:E,onRestoreSuccess:O},e.sha))}),t[66]=b,t[67]=r,t[68]=n,t[69]=p,t[70]=_,t[71]=x,t[72]=m,t[73]=d,t[74]=h,t[75]=N):N=t[75],P=!h&&!_&&!m&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:e.map((e,t)=>e.kind===`checkpoint`?(0,Z.jsx)(Cv,{entry:e.entry,prominent:!0,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.entry.sha),onToggleExpanded:E,onRestoreSuccess:O},e.entry.sha):(0,Z.jsx)(uv,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,isDark:d,diffLayout:r,cache:b,docName:n,expandedShas:x,onToggleExpanded:E,onRestoreSuccess:O},e.entries[0]?.sha??`wip-${t}`))}),t[11]=l,t[12]=b,t[13]=r,t[14]=n,t[15]=p,t[16]=_,t[17]=x,t[18]=d,t[19]=h,t[20]=a,t[21]=o,t[22]=c,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=F,t[28]=I,t[29]=L,t[30]=R}else j=t[23],M=t[24],N=t[25],P=t[26],F=t[27],I=t[28],L=t[29],R=t[30];let z;t[76]!==j||t[77]!==M||t[78]!==N||t[79]!==P||t[80]!==L||t[81]!==R?(z=(0,Z.jsxs)(`div`,{className:L,children:[R,j,M,N,P]}),t[76]=j,t[77]=M,t[78]=N,t[79]=P,t[80]=L,t[81]=R,t[82]=z):z=t[82];let B;return t[83]!==F||t[84]!==I||t[85]!==z?(B=(0,Z.jsxs)(`div`,{className:F,children:[I,z]}),t[83]=F,t[84]=I,t[85]=z,t[86]=B):B=t[86],B}function Ev(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Pa,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(Pa,{className:`h-3 w-28`}),(0,Z.jsx)(Pa,{className:`h-3 w-40`})]})]},e)}function Dv(e){return e.type===`checkpoint`}function Ov(){return new Set}function kv(){return new ma(32)}var Av=[{id:`outline`,icon:Cl},{id:`links`,icon:Ke},{id:`graph`,icon:El},{id:`timeline`,icon:Qc}];function jv(e){return e===`outline`?Y._({id:`dD7NPy`}):e===`links`?Y._({id:`Rj01Fz`}):e===`graph`?Y._({id:`x2fr_j`}):Y._({id:`cklVjM`})}function Mv(){return n(()=>import(`./GraphPanel-PYMXWVsg.js`),__vite__mapDeps([20,1,21,6,3,7,22,23,12,13,24,25,26,27,28,29,30,31,32,33]),import.meta.url)}var Nv=(0,Q.lazy)(async()=>({default:(await Mv()).GraphPanel})),Pv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BWmb9zCZ.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function Fv(e){let t=(0,$.c)(20),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c,onSaveVersion:l,saving:u}=e,{_:d}=i(),[f,p]=(0,Q.useState)(`unified`),m=Oh(),h,g,_;if(t[0]!==d||t[1]!==a||t[2]!==c||t[3]!==o||t[4]!==m){let e=m?Av.filter(Lv):Av;h=e.some(e=>e.id===a)?a:`outline`,g=c===`doc`&&e.length>1,_=g?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(_s,{type:`single`,variant:`outline`,value:h,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:e.map(Iv)})}):null,t[0]=d,t[1]=a,t[2]=c,t[3]=o,t[4]=m,t[5]=h,t[6]=g,t[7]=_}else h=t[5],g=t[6],_=t[7];let v;t[8]!==f||t[9]!==n||t[10]!==h||t[11]!==r||t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==g?(v=c===`doc`?(0,Z.jsxs)(`div`,{...g?{role:`tabpanel`,id:`panel-${h}`,"aria-labelledby":`tab-${h}`}:{},className:`min-h-0 flex-1`,children:[h===`outline`&&(0,Z.jsx)(gc,{docName:n,isSourceMode:r}),h===`links`&&(0,Z.jsx)(E_,{docName:n}),h===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-lCAuQ`})}),children:(0,Z.jsx)(Nv,{activeDocName:n})}),h===`timeline`&&(0,Z.jsx)(Tv,{docName:n,diffLayout:f,onDiffLayoutChange:p,onSaveVersion:l,saving:u})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(Pv,{})})}),t[8]=f,t[9]=n,t[10]=h,t[11]=r,t[12]=c,t[13]=l,t[14]=u,t[15]=g,t[16]=v):v=t[16];let y;return t[17]!==_||t[18]!==v?(y=(0,Z.jsxs)(Z.Fragment,{children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19],y}function Iv(e){let{id:t,icon:n}=e,r=jv(t);return(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(hs,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(Gn,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Ar,{side:`bottom`,children:r})]},t)}function Lv(e){return e.id===`outline`}function Rv(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function zv(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Bv(e){return e/100*window.innerHeight}function Vv(e){return e/100*window.innerWidth}function Hv(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Uv({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Hv(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=zv(t,i);break;case`em`:r=Rv(t,i);break;case`vh`:r=Bv(i);break;case`vw`:r=Vv(i);break}return r}function Wv(e){return parseFloat(e.toFixed(3))}function Gv({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Kv(e){let{panels:t}=e,n=Gv({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Wv(Uv({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Wv(Uv({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Wv(Uv({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Wv(Uv({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function qv(e,t=`Assertion error`){if(!e)throw Error(t)}function Jv(e,t){return Array.from(t).sort(e===`horizontal`?Yv:Xv)}function Yv(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Xv(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Zv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Qv(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function $v({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Qv(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return qv(i,`No rect found`),i}var ey;function ty(){return ey===void 0&&(ey=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),ey}function ny(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Jv(n,Array.from(t.children).filter(Zv).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,$v({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=ty()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:Gv({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var ry=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},iy=new Map,ay=new ry;function oy(e){iy=new Map(iy),iy.delete(e)}function sy(e,t){for(let[t]of iy)if(t.id===e)return t}function cy(e,t){for(let[t,n]of iy)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ly(){return iy}function uy(e,t){return ay.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function dy(e,t){let n=iy.get(e);iy=new Map(iy),iy.set(e,t),ay.emit(`groupChange`,{group:e,prev:n,next:t})}function fy(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Qv(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function py(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function my(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:by(e),b:by(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();qv(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:yy(vy(n.a)),b:yy(vy(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var hy=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function gy(e){let t=getComputedStyle(xy(e)??e).display;return t===`flex`||t===`inline-flex`}function _y(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||gy(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||hy.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function vy(e){let t=e.length;for(;t--;){let n=e[t];if(qv(n,`Missing node`),_y(n))return n}return null}function yy(e){return e&&Number(getComputedStyle(e).zIndex)||0}function by(e){let t=[];for(;e;)t.push(e),e=xy(e);return t}function xy(e){let{parentNode:t}=e;return py(t)?t.host:t}function Sy(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Cy({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Zv(n)||n.contains(e)||e.contains(n))return!0;if(my(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Sy(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function wy(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=ny(r),a=fy(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Cy({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Ty(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Ey(e,t,n=0){return Math.abs(Wv(e)-Wv(t))<=n}function Dy(e,t){return Ey(e,t)?0:e>t?1:-1}function Oy({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(Dy(r,c)<0)if(a){let e=(i+c)/2;r=Dy(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Wv(r),r}function ky({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ey(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;qv(u!=null,`Invalid first pivot index`),qv(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];qv(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(qv(n!=null,`Previous layout not found for panel index ${t}`),Ey(n,i)){let t=o-n;Dy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];qv(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(qv(n!=null,`Previous layout not found for panel index ${t}`),Ey(n,o)){let t=n-i;Dy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];qv(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Dy(i,c)<0)if(e>0){let t=c-o,n=t/2;Dy(i+e,c)<0&&(e=Dy(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Dy(i-e,c)<0&&(e=Dy(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];qv(e!=null,`Previous layout not found for panel index ${r}`);let a=Oy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];qv(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Oy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Ey(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Ty(c,l))return i;{let t=e<0?d:u,r=s[t];qv(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Oy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Ey(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];qv(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Oy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Ey(i,s)||(t-=s-i,l[r]=s),Ey(t,0))break;e>0?r--:r++}}}if(!Ey(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Ay(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Dy(e[n],t[n])!==0)return!1;return!0}function jy({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Ey(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];qv(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];qv(i!=null,`No layout data found for index ${e}`);let o=r[e];qv(o!=null,`No layout data found for index ${e}`);let s=Oy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Ey(a,0))for(let e=0;e<t.length;e++){let n=r[e];qv(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Oy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Ey(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function My({groupId:e,panelId:t}){let n=()=>{let t=ly();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=jy({layout:ky({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});Ay(l,p)||dy(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Ey(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Gv({group:t});o(Wv(Uv({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Ny(e){e.defaultPrevented||wy(e,ly()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=My({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Py(e){let t=ly();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Fy({groupId:e}){let t=()=>{let t=ly();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=jy({layout:e,panelConstraints:r});return n?o:(Ay(o,c)||dy(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Iy(e,t){let n=Py(e),r=cy(n.id,!0),i=n.separators.find(t=>t.element===e);qv(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);qv(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Fy({groupId:n.id}).getLayout(),c=jy({layout:ky({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Ay(s,c)||dy(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Ly(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Py(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Iy(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Iy(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Iy(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Iy(t,-5);break;case`End`:e.preventDefault(),Iy(t,100);break;case`Enter`:{e.preventDefault();let n=Py(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=cy(n.id,!0),o=n.separators.find(e=>e.element===t);qv(o,`Matching separator not found`);let s=a.get(o);qv(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(qv(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Iy(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Py(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);qv(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Iy(t,-100);break}}var Ry={cursorFlags:0,state:`inactive`},zy=new ry;function By(){return Ry}function Vy(e){return zy.addListener(`change`,e)}function Hy(e){let t=Ry,n={...Ry};n.cursorFlags=e,Ry=n,zy.emit(`change`,{prev:t,next:n})}function Uy(e){let t=Ry;Ry=e,zy.emit(`change`,{prev:t,next:e})}function Wy(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ly(),n=wy(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Uy({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Gy=e=>e,Ky=()=>{},qy=1,Jy=2,Yy=4,Xy=8,Zy=3,Qy=12,$y;function eb(){return $y===void 0&&($y=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&($y=!0)),$y}function tb({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&eb()){let t=(e&qy)!==0,n=(e&Jy)!==0,r=(e&Yy)!==0,i=(e&Xy)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return eb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var nb=new WeakMap;function rb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=nb.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=By();switch(r.state){case`active`:case`hover`:{let e=tb({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}nb.set(e,{prevStyle:t,styleSheet:n})}function ib({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=ky({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Ay(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?qy:Jy;break;case`vertical`:s|=d<0?Yy:Xy;break}}else dy(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Zy:c|=s&Zy,t.movementY===0?c|=o&Qy:c|=s&Qy,Hy(c),rb(e)}function ab(e){let t=ly(),n=By();switch(n.state){case`active`:ib({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function ob(e){if(e.defaultPrevented)return;let t=By(),n=ly();switch(t.state){case`active`:if(e.buttons===0){Uy({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=cy(e.group.id,!0);dy(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}ib({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=wy(e,n);r.length===0?t.state!==`inactive`&&Uy({cursorFlags:0,state:`inactive`}):Uy({cursorFlags:0,hitRegions:r,state:`hover`}),rb(e.currentTarget);break}}}function sb(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(By().state){case`hover`:Uy({cursorFlags:0,state:`inactive`})}}function cb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=By();switch(t.state){case`active`:Uy({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(rb(e.currentTarget),t.hitRegions.forEach(e=>{let t=cy(e.group.id,!0);dy(e.group,t)}),e.preventDefault())}}function lb(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Wv(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Wv((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function ub(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Gv({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Wv(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function db(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function fb({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=Wv(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=Wv((r[e]??0)/a*l);else{let e=Wv(l/c.length);for(let t of c)u[t]=e}return u}function pb(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var mb=new Map;function hb(e){let t=!0;qv(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=Gv({group:e});if(t===0)return;let n=cy(e.id);if(!n)return;let r=Kv(e),i=n.defaultLayoutDeferred?lb(r):n.layout,a=jy({layout:fb({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Ay(n.layout,a)&&db(n.derivedPanelConstraints,r)&&n.groupSize===t)return;dy(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else ub(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{qv(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=Gv({group:e}),s=Kv(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(pb(e.panels,l)||(l=void 0));let u=jy({layout:e.mutableState.layouts[c]??l??lb(s),panelConstraints:s}),d=e.element.ownerDocument;mb.set(d,(mb.get(d)??0)+1);let f=new Map;return ny(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),dy(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{qv(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,Ly)}),mb.get(d)===1&&(d.addEventListener(`dblclick`,Ny,!0),d.addEventListener(`pointerdown`,Wy,!0),d.addEventListener(`pointerleave`,ab),d.addEventListener(`pointermove`,ob),d.addEventListener(`pointerout`,sb),d.addEventListener(`pointerup`,cb,!0)),function(){t=!1,mb.set(d,Math.max(0,(mb.get(d)??0)-1)),oy(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Ly)}),mb.get(d)||(d.removeEventListener(`dblclick`,Ny,!0),d.removeEventListener(`pointerdown`,Wy,!0),d.removeEventListener(`pointerleave`,ab),d.removeEventListener(`pointermove`,ob),d.removeEventListener(`pointerout`,sb),d.removeEventListener(`pointerup`,cb,!0)),a.disconnect()}}function gb(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function _b(e){let t=(0,Q.useId)();return`${e??t}`}var vb=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function yb(e){let t=(0,Q.useRef)(e);return vb(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function bb(...e){return yb(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function xb(e){let t=(0,Q.useRef)({...e});return vb(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Sb=(0,Q.createContext)(null);function Cb(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Gy});(0,Q.useImperativeHandle)(t,()=>n.current,[]),vb(()=>{Object.assign(n.current,Fy({groupId:e}))})}function wb({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=yb(e=>{Ay(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=yb(e=>{Ay(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=_b(s),v=(0,Q.useRef)(null),[y,b]=gb(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=bb(v,a);Cb(_,o);let C=yb((e,t)=>{let r=By(),i=sy(e),a=cy(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=xb({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Jv(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Jv(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=sy(_),i=cy(_);r&&i&&dy(r,{...i,derivedPanelConstraints:Kv(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,Q.useRef)(null);return vb(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=hb(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=cy(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=uy(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Ey(t.collapsedSize,i[t.panelId]),a=Ey(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=By().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(Sb.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}wb.displayName=`Group`;function Tb(){let e=(0,Q.useContext)(Sb);return qv(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Eb(e,t){let{id:n}=Tb(),r=(0,Q.useRef)({collapse:Ky,expand:Ky,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ky});(0,Q.useImperativeHandle)(t,()=>r.current,[]),vb(()=>{Object.assign(r.current,My({groupId:n,panelId:e}))})}function Db({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=_b(c),_=xb({disabled:a}),v=(0,Q.useRef)(null),y=bb(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Tb(),T=d!==null,E=yb((e,t,n)=>{d?.(e,c,n)});vb(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Eb(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>uy(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Ob,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Db.displayName=`Panel`;var Ob={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function kb(){return(0,Q.useRef)(null)}function Ab({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=jy({layout:ky({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=jy({layout:ky({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function jb({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=_b(a),l=xb({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=bb(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Tb(),x=v===`horizontal`?`vertical`:`horizontal`;vb(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Vy(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=uy(_,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Ab({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}jb.displayName=`Separator`;var Mb={name:`toml`,startState:function(){return{inString:!1,stringType:``,lhs:!0,inArray:0}},token:function(e,t){let n;if(!t.inString&&(n=e.match(/^('''|"""|'|")/))&&(t.stringType=n[0],t.inString=!0),e.sol()&&!t.inString&&t.inArray===0&&(t.lhs=!0),t.inString){for(;t.inString;)if(e.match(t.stringType))t.inString=!1;else if(e.peek()===`\\`)e.next(),e.next();else if(e.eol())break;else e.match(/^.[^\\\"\']*/);return t.lhs?`property`:`string`}else if(t.inArray&&e.peek()===`]`)return e.next(),t.inArray--,`bracket`;else if(t.lhs&&e.peek()===`[`&&e.skipTo(`]`))return e.next(),e.peek()===`]`&&e.next(),`atom`;else if(e.peek()===`#`)return e.skipToEnd(),`comment`;else if(e.eatSpace())return null;else if(t.lhs&&e.eatWhile(function(e){return e!=`=`&&e!=` `}))return`property`;else if(t.lhs&&e.peek()===`=`)return e.next(),t.lhs=!1,null;else if(!t.lhs&&e.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return`atom`;else if(!t.lhs&&(e.match(`true`)||e.match(`false`)))return`atom`;else if(!t.lhs&&e.peek()===`[`)return t.inArray++,e.next(),`bracket`;else if(!t.lhs&&e.match(/^\-?\d+(?:\.\d+)?/))return`number`;else e.eatSpace()||e.next();return null},languageData:{commentTokens:{line:`#`}}},Nb=h({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Pb=an({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Fb(e){switch(e.toLowerCase()){case`json`:case`canvas`:return pc().language;case`toml`:return lc.define(Mb);default:return null}}function Ib(e){let t=(0,$.c)(5),{_:n}=i(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`loading`},t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),s,c;return t[1]!==n||t[2]!==e?(s=()=>{let t=!1,r=new AbortController;return o({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:r.signal}).then(async e=>{if(!e.ok){let t=e.status;throw Error(n(t===413?{id:`C_WGy8`}:t===404?{id:`s0IDhW`}:t===400?{id:`N1mdmS`}:{id:`96w9hU`,values:{status:t}}))}return e.text()}).then(e=>{t||o({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||o({status:`error`,message:e instanceof Error?e.message:n({id:`ig5vUe`})})}),()=>{t=!0,r.abort()}},c=[e,n],t[1]=n,t[2]=e,t[3]=s,t[4]=c):(s=t[3],c=t[4]),(0,Q.useEffect)(s,c),a}function Lb(e){let t=(0,$.c)(28),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:c}=Li(),l=Ib(n),u=l.status===`loaded`?l.content:null,d,f;if(t[0]!==i||t[1]!==u||t[2]!==c?(d=()=>{if(!a.current||u===null)return;let e=Fb(i),t=c===`dark`?Nb:Pb,n=[Tc,...e?[e]:[],ac.editable.of(!0),Ys.readOnly.of(!0),ac.lineWrapping,t],r=new ac({state:Ys.create({doc:u,extensions:n}),parent:a.current});return o.current=r,()=>{r.destroy(),o.current=null}},f=[u,i,c],t[0]=i,t[1]=u,t[2]=c,t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f),l.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Md709y`,values:{fileName:r}})}),t[5]=r,t[6]=e);let n;return t[7]!==i||t[8]!==r||t[9]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loading`,"data-text-viewer-extension":i,children:e}),t[7]=i,t[8]=r,t[9]=e,t[10]=n):n=t[10],n}if(l.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(s,{id:`qdBUHP`,values:{fileName:r}})}),t[11]=r,t[12]=e);let a;t[13]===l.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:l.message}),t[13]=l.message,t[14]=a);let o;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`9npOH9`}),t[15]=o):o=t[15];let c;t[16]===n?c=t[17]:(c=(0,Z.jsx)(`a`,{href:n,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:o}),t[16]=n,t[17]=c);let u;return t[18]!==i||t[19]!==r||t[20]!==e||t[21]!==a||t[22]!==c?(u=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`error`,"data-text-viewer-extension":i,children:[e,a,c]}),t[18]=i,t[19]=r,t[20]=e,t[21]=a,t[22]=c,t[23]=u):u=t[23],u}let p;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[24]=p):p=t[24];let m;return t[25]!==i||t[26]!==r?(m=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":i,children:p}),t[25]=i,t[26]=r,t[27]=m):m=t[27],m}function Rb(e){return Si(`/api/asset?path=${encodeURIComponent(e)}`)}function zb(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Bb(e){let t=(0,$.c)(31),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=Rb(n),t[0]=n,t[1]=o);let c=o,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p,m;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){m=Symbol.for(`react.early_return_sentinel`);bb0:{if(p=u.includes(`.`)?u.split(`.`).pop()??``:``,f=p.length>0?p.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[13]!==u||t[14]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(Fe,{src:c,title:u,fillContainer:!0})}),t[13]=u,t[14]=c,t[15]=e):e=t[15];let n;t[16]!==u||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[16]=u,t[17]=e,t[18]=n):n=t[18],m=n;break bb0}if(d===`text`){let e;t[19]===n?e=t[20]:(e=zb(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(Lb,{src:e,fileName:u,extension:p.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else d=t[9],f=t[10],p=t[11],m=t[12];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[21]!==n||t[22]!==d||t[23]!==f||t[24]!==u||t[25]!==p||t[26]!==c?(h=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(zt,{src:c,alt:u,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 text-center`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-md border bg-muted font-medium text-muted-foreground text-sm`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:u}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(sa,{variant:`outline`,size:`sm`,onClick:()=>{V({url:c,projectRelPath:n,ext:p.toLowerCase(),title:u,forceOsDelegation:!1})},children:(0,Z.jsx)(s,{id:`9npOH9`})}),(0,Z.jsx)(sa,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:(0,Z.jsx)(s,{id:`Ruuu3v`})})]})]})}),t[21]=n,t[22]=d,t[23]=f,t[24]=u,t[25]=p,t[26]=c,t[27]=h):h=t[27];let g;return t[28]!==u||t[29]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:h}),t[28]=u,t[29]=h,t[30]=g):g=t[30],g}function Vb(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(Pa,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Pa,{className:`h-4 w-full`}),(0,Z.jsx)(Pa,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}var Hb={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Ub(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}=Li(),s=Hb[r],c=s?(o===`dark`?ui[s]:void 0)??Fi[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=ea(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)(fa,{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)(da,{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)(va,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function Wb(e){let{installState:t}=e;return t.installed===null?Y._({id:`IA6JW2`}):t.installed===!1?Y._({id:`5SwVv1`}):null}function Gb(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:Y._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:Y._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:Y._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function Kb(e){return _r(e)}function qb(e){return Y._({id:`h_HYHD`,values:{displayName:e}})}var Jb=`claude.ai`;async function Yb(e,t=tg){(await t(_r(e))).ok?X.success(qb(Jb)):X.error(Y._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:Jb}}))}function Xb(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??tg,u=e.onWebFallbackSuccess??Qb,d=e.onWebFallbackError??Zb,{displayName:f}=r,p,m,h,g,_,v,y,b,x,S;if(t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==c||t[4]!==d||t[5]!==u||t[6]!==l||t[7]!==s||t[8]!==r||t[9]!==f){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Gb({target:r,installState:a,isElectronHost:o}),i=Wb({target:r,installState:a,isElectronHost:o}),C=()=>{e.tooltip&&l(e.tooltip.installAction.url)},w;t[20]!==d||t[21]!==u||t[22]!==l||t[23]!==s||t[24]!==r?(w=()=>{(async()=>{let e=await l(Kb(s));e.ok?u(r):d(r,e.detail??e.reason)})()},t[20]=d,t[21]=u,t[22]=l,t[23]=s,t[24]=r,t[25]=w):w=t[25];let T=w;if(e.enabled){let e=`open-in-agent-item-${r.id}`,i;t[26]!==n||t[27]!==f?(i=n({id:`NnQapF`,values:{targetDisplayName:f}}),t[26]=n,t[27]=f,t[28]=i):i=t[28];let a;t[29]===r.id?a=t[30]:(a=(0,Z.jsx)(Ub,{id:r.id,"aria-hidden":`true`}),t[29]=r.id,t[30]=a);let o;t[31]===r.displayName?o=t[32]:(o=(0,Z.jsx)(`span`,{children:r.displayName}),t[31]=r.displayName,t[32]=o);let s;t[33]!==c||t[34]!==i||t[35]!==a||t[36]!==o||t[37]!==e?(s=(0,Z.jsxs)($o,{onSelect:c,"data-testid":e,"aria-label":i,children:[a,o]}),t[33]=c,t[34]=i,t[35]=a,t[36]=o,t[37]=e,t[38]=s):s=t[38],S=s;break bb0}if(!e.tooltip){let e=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),a;t[39]===r.id?a=t[40]:(a=(0,Z.jsx)(Ub,{id:r.id,"aria-hidden":`true`}),t[39]=r.id,t[40]=a);let o;t[41]===r.displayName?o=t[42]:(o=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[41]=r.displayName,t[42]=o),S=(0,Z.jsxs)($o,{disabled:!0,"data-testid":`open-in-agent-item-${r.id}`,"aria-label":e,children:[a,o,i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null]});break bb0}let E=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),D=e.tooltip.webFallback?.label??``;m=Ko;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(Ub,{id:r.id,"aria-hidden":`true`,className:`mr-2`}),t[43]=r.id,t[44]=k);let A;t[45]===r.displayName?A=t[46]:(A=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[45]=r.displayName,t[46]=A);let j;t[47]===i?j=t[48]:(j=i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null,t[47]=i,t[48]=j),t[49]!==E||t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==O?(x=(0,Z.jsxs)(Oo,{"data-testid":O,"data-row-disabled":``,"aria-label":E,children:[k,A,j]}),t[49]=E,t[50]=k,t[51]=A,t[52]=j,t[53]=O,t[54]=x):x=t[54],p=es,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(Fo,{className:`font-normal text-muted-foreground text-xs`,"data-testid":`open-in-agent-message-${r.id}`,children:e.tooltip.message}),t[55]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(To,{}),t[55]=v):v=t[55],y=(0,Z.jsx)($o,{onSelect:C,"data-testid":`open-in-agent-install-${r.id}`,children:(0,Z.jsx)(`span`,{children:e.tooltip.installAction.label})}),b=e.tooltip.webFallback?(0,Z.jsxs)($o,{onSelect:T,"data-testid":`open-in-agent-web-fallback-${r.id}`,"aria-label":n({id:`lsOFZR`,values:{webFallbackLabel:D}}),children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:e.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:n({id:`Z9BoIy`})})]}):null}t[0]=n,t[1]=a,t[2]=o,t[3]=c,t[4]=d,t[5]=u,t[6]=l,t[7]=s,t[8]=r,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[56]!==p||t[57]!==h||t[58]!==g||t[59]!==_||t[60]!==v||t[61]!==y||t[62]!==b?(C=(0,Z.jsxs)(p,{className:h,"data-testid":g,children:[_,v,y,b]}),t[56]=p,t[57]=h,t[58]=g,t[59]=_,t[60]=v,t[61]=y,t[62]=b,t[63]=C):C=t[63];let w;return t[64]!==m||t[65]!==x||t[66]!==C?(w=(0,Z.jsxs)(m,{children:[x,C]}),t[64]=m,t[65]=x,t[66]=C,t[67]=w):w=t[67],w}function Zb(){}function Qb(){}function $b(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=jg(),{dispatch:a}=bg(),o=No(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=sg({workspace:o});t[7]===n?s=t[8]:(s=ea(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=Ch.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(ex,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{ug(t),i()}},t.id)}),t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`div`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function ex(e){let t=(0,$.c)(17),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(Ub,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===r?f=t[8]:(f=r===`missing`?(0,Z.jsx)(ms,{"aria-hidden":`true`,className:`size-3`}):null,t[7]=r,t[8]=f);let p;t[9]!==c||t[10]!==f?(p=(0,Z.jsxs)(`p`,{className:`inline-flex items-center gap-1 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,f]}),t[9]=c,t[10]=f,t[11]=p):p=t[11];let m;return t[12]!==s||t[13]!==o||t[14]!==d||t[15]!==p?(m=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-row items-center justify-between gap-4 rounded-xl border border-border/60 bg-card p-4 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[d,p]}),t[12]=s,t[13]=o,t[14]=d,t[15]=p,t[16]=m):m=t[16],m}var tx=3100,nx=3;function rx(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??nx;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var ix={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},ax=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function ox(e,t={}){let n=t.rng??Math.random,r=t.colors??ax,i=ix[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var sx=1.8,cx=90,lx=16,ux=380,dx=.025,fx=.1,px=.18,mx=400,hx=9.2736,gx=18.1799,_x=14.5244,vx={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function yx(e,t){let{halfWidth:n,apexLift:r}=vx[t];return`M${e-n} ${_x+.3} Q${e} ${_x-r}, ${e+n} ${_x+.3}`}function bx(e){let t=1.5,n=.3;return`M${e-t} ${_x-n} Q${e} ${_x+1.4}, ${e+t} ${_x-n}`}var xx=15,Sx=15;function Cx(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function wx(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=rx(g,t);_(n),y(Ox),S(ox(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},tx)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(Dx),S(ox(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},tx))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/ux)),C=Math.max(-1,Math.min(1,b/ux)),w=S*lx,T=-C*lx,E=0,D=0;if(x>=1){let e=Math.min(x/cx,1)*sx;E=y/x*e,D=b/x*e}let O=Math.abs(T-r)<.01&&Math.abs(w-i)<.01&&Math.abs(E-a)<.01&&Math.abs(D-o)<.01;if(!m&&O)return;l(),r+=(T-r)*fx,i+=(w-i)*fx,u.style.transform=`perspective(${mx}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*px,o+=(D-o)*px;let k=i*dx,A=-r*dx,j=a+k,M=o+A;h.current.x=j,h.current.y=M,p.current?.setAttribute(`transform`,`translate(${j.toFixed(3)} ${M.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=ea(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=ea(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let ee=(F||T)&&`ok-blob-eye-hidden`,te;t[22]===ee?te=t[23]:(te=ea(`ok-blob-eye`,ee),t[22]=ee,t[23]=te);let W;t[24]===te?W=t[25]:(W=(0,Z.jsx)(`ellipse`,{cx:hx,cy:_x,rx:1.2722,ry:1.9083,className:te}),t[24]=te,t[25]=W);let ne=(F||T)&&`ok-blob-eye-hidden`,re;t[26]===ne?re=t[27]:(re=ea(`ok-blob-eye ok-blob-eye-right`,ne),t[26]=ne,t[27]=re);let G;t[28]===re?G=t[29]:(G=(0,Z.jsx)(`ellipse`,{cx:gx,cy:_x,rx:1.2722,ry:1.9083,className:re}),t[28]=re,t[29]=G);let ie;t[30]===I?ie=t[31]:(ie=yx(hx,I),t[30]=I,t[31]=ie);let K=(!F||T)&&`ok-blob-eye-hidden`,q;t[32]===K?q=t[33]:(q=ea(`ok-blob-happy-eye`,K),t[32]=K,t[33]=q);let ae;t[34]!==ie||t[35]!==q?(ae=(0,Z.jsx)(`path`,{d:ie,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:q}),t[34]=ie,t[35]=q,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=yx(gx,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=ea(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:bx(hx),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:bx(gx),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==W||t[47]!==G||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[W,G,ae,le,ue]}),t[46]=W,t[47]=G,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(Tx)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:Ex,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function Tx(e){return(0,Z.jsx)(`circle`,{cx:xx+e.originDx,cy:Sx+e.originDy,r:e.size,className:`ok-blob-firework`,style:Cx(e)},e.id)}function Ex(e){return e.preventDefault()}function Dx(e){return e+1}function Ox(e){return e+1}function kx(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(wx,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Ax(){let e=(0,$.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Us(`command-palette`),e[0]=t):t=e[0];let n=t,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(D,{children:n}),e[1]=r):r=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[r,` `,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A1taO8`})})]}),e[2]=i):i=e[2],i}var jx=`open-knowledge:create-top-level-file`;function Mx(e={}){window.dispatchEvent(new CustomEvent(jx,{detail:e}))}function Nx(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(jx,t),()=>window.removeEventListener(jx,t)}function Px(e){let t=(0,$.c)(33),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=bh(),c=ss(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Us(`new-item`),t[3]=p):p=t[3];let m=p,h;t[4]===a?h=t[5]:(h=a({id:`FOGD7m`}),t[4]=a,t[5]=h);let g;t[6]===a?g=t[7]:(g=a({id:`LMbgDK`}),t[6]=a,t[7]=g);let _;t[8]!==n||t[9]!==h||t[10]!==g?(_=(0,Z.jsx)(kx,{title:h,subtitle:g,celebrateSignal:n}),t[8]=n,t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Lx,{shortcutLabel:m,onClick:Ix}),t[12]=v):v=t[12];let y;t[13]!==u||t[14]!==f||t[15]!==d?(y=d||f||u.length>0?(0,Z.jsx)(Rx,{templates:u,loading:d,error:f,onSelect:Fx}):null,t[13]=u,t[14]=f,t[15]=d,t[16]=y):y=t[16];let b;t[17]===o?b=t[18]:(b=o?null:(0,Z.jsx)(Bx,{}),t[17]=o,t[18]=b);let x,S;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(At,{"aria-hidden":`true`,className:`size-3`}),x=(0,Z.jsx)(s,{id:`IajAbS`}),t[19]=x,t[20]=S):(x=t[19],S=t[20]);let C;t[21]===r?C=t[22]:(C=(0,Z.jsxs)(sa,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[S,x]}),t[21]=r,t[22]=C);let w;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Ax,{}),t[23]=w):w=t[23];let T;t[24]===C?T=t[25]:(T=(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[C,w]}),t[24]=C,t[25]=T);let E;t[26]!==T||t[27]!==y||t[28]!==b?(E=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,y,b,T]}),t[26]=T,t[27]=y,t[28]=b,t[29]=E):E=t[29];let D;return t[30]!==E||t[31]!==_?(D=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[_,E]}),t[30]=E,t[31]=_,t[32]=D):D=t[32],D}function Fx(e,t){return Mx({template:{folder:e,name:t}})}function Ix(){return Mx({initialDir:``})}function Lx(e){let t=(0,$.c)(7),{shortcutLabel:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(cl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i,(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:(0,Z.jsx)(s,{id:`HdkSiO`})})]}),t[1]=a):a=t[1];let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(D,{children:n}),t[2]=n,t[3]=o);let c;return t[4]!==r||t[5]!==o?(c=(0,Z.jsxs)(sa,{type:`button`,variant:`ghost`,onClick:r,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-xl border border-border/60 bg-card p-4 text-left transition-colors hover:bg-muted/50 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,children:[a,o]}),t[4]=r,t[5]=o,t[6]=c):c=t[6],c}function Rx(e){let t=(0,$.c)(25),{templates:n,loading:r,error:a,onSelect:o}=e,{_:c}=i(),l;t[0]===c?l=t[1]:(l=c({id:`_8quCH`}),t[0]=c,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`_8quCH`})}),t[2]=u):u=t[2];let d;t[3]!==c||t[4]!==a||t[5]!==r||t[6]!==n?(d=r||a?null:(0,Z.jsx)(P,{className:`text-2xs`,variant:`gray`,"aria-label":c({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=c,t[4]=a,t[5]=r,t[6]=n,t[7]=d):d=t[7];let f;t[8]===d?f=t[9]:(f=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[u,d]}),t[8]=d,t[9]=f);let p;t[10]===c?p=t[11]:(p=c({id:`irFGwu`}),t[10]=c,t[11]=p);let m;t[12]!==a||t[13]!==r||t[14]!==o||t[15]!==n?(m=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Hl89Qd`})}):a?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(s,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(zx,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>o(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=a,t[13]=r,t[14]=o,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==r||t[18]!==p||t[19]!==m?(h=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":p,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:m})}),t[17]=r,t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==l||t[22]!==f||t[23]!==h?(g=(0,Z.jsxs)(`section`,{"aria-label":l,className:`flex w-full flex-col gap-3`,children:[f,h]}),t[21]=l,t[22]=f,t[23]=h,t[24]=g):g=t[24],g}function zx(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:a}=e,{_:o}=i(),s;t[0]!==n.name||t[1]!==n.title?(s=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=s):s=t[2];let c=s,l=`${n.name}.md`,u=n.source_folder===``,d;t[3]!==o||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==r?(d=o(u?{id:`89TtiD`,values:{displayTitle:c,fileName:l}}:{id:`0_J12R`,values:{displayTitle:c,fileName:l,targetLabel:r}}),t[3]=o,t[4]=c,t[5]=l,t[6]=u,t[7]=r,t[8]=d):d=t[8];let f=d,p;t[9]===c?p=t[10]:(p=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:c}),t[9]=c,t[10]=p);let m;t[11]===l?m=t[12]:(m=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g=`shrink-0 font-mono text-1sm ${u?`text-muted-foreground/70`:`text-muted-foreground`}`,_;t[16]!==g||t[17]!==r?(_=(0,Z.jsx)(`span`,{className:g,children:r}),t[16]=g,t[17]=r,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==a||t[21]!==h||t[22]!==_?(v=(0,Z.jsxs)(sa,{type:`button`,variant:`ghost`,onClick:a,"aria-label":f,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[h,_]}),t[19]=f,t[20]=a,t[21]=h,t[22]=_,t[23]=v):v=t[23],v}function Bx(){let e=(0,$.c)(6),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`27ANM6`}),e[0]=t,e[1]=n);let r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`header`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`27ANM6`})}),a=(0,Z.jsx)($b,{}),e[2]=r,e[3]=a):(r=e[2],a=e[3]);let o;return e[4]===n?o=e[5]:(o=(0,Z.jsxs)(`section`,{"aria-label":n,className:`flex w-full flex-col gap-3`,children:[r,a]}),e[4]=n,e[5]=o),o}function Vx(){let e=(0,$.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(void 0),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(0),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(void 0),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(Gx);if(e)return;let r=t.ok?fi.safeParse(n):null;r?.success?(o(Kx(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=Kr(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(u.current)}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(){clearTimeout(u.current),u.current=setTimeout(()=>c(Wx),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(Ux);if(!e.ok)return;let n=fi.safeParse(t);n.success&&o(Kx(n.data.documents))}).catch(Hx)},e[2]=p):p=e[2];let m=p,h=a!==null,g=a===0,_;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){n(e),e||i(void 0)},e[3]=_):_=e[3];let v=_,y;e[4]!==s||e[5]!==g||e[6]!==h?(y=h?g?(0,Z.jsx)(qx,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(Px,{celebrateSignal:s,onAddStarterPack:()=>{n(!0)}}):null,e[4]=s,e[5]=g,e[6]=h,e[7]=y):y=e[7];let b;e[8]!==r||e[9]!==t?(b=(0,Z.jsx)(hh,{open:t,onOpenChange:v,onSeedApplied:m,initialPackId:r}),e[8]=r,e[9]=t,e[10]=b):b=e[10];let x;return e[11]!==y||e[12]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 sm:px-12 md:px-16 subtle-scrollbar`,children:[y,b]}),e[11]=y,e[12]=b,e[13]=x):x=e[13],x}function Hx(){}function Ux(){return null}function Wx(e){return e+1}function Gx(){return null}function Kx(e){return Mr(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function qx(e){let t=(0,$.c)(16),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`ZmGmNh`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`W8uemY`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(kx,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===r?u=t[9]:(u=(0,Z.jsx)(ch,{onPackSelect:r}),t[8]=r,t[9]=u);let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(sa,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:Jx,children:(0,Z.jsx)(s,{id:`ensWZc`,components:{0:(0,Z.jsx)(Qo,{"aria-hidden":`true`,className:`size-3`})}})}),t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[u,d]}),t[11]=u,t[12]=f);let p;return t[13]!==l||t[14]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p}function Jx(){return Mx()}function Yx(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function Xx(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:a}=e,{_:o}=i(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(Qx,{}),(0,Z.jsx)(Pa,{className:`h-7 w-full`}),(0,Z.jsx)(Pa,{className:`h-7 w-full`}),(0,Z.jsx)(Pa,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.frontmatterLocal?m=t[4]:(m=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=m);let h=m,g;t[5]===r.data.folder.path?g=t[6]:(g=Yx(r.data.folder.path),t[5]=r.data.folder.path,t[6]=g);let _=g,v;t[7]===h?v=t[8]:(v=Object.keys(h),t[7]=h,t[8]=v);let y=v,b;t[9]!==o||t[10]!==n||t[11]!==a?(b=async function(e,t){let r=await Ya(n,{[e]:t});if(!r.ok){let{error:e}=r;X.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},t[9]=o,t[10]=n,t[11]=a,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==n||t[15]!==a?(S=async function(e){let t=await Ya(n,{[e]:null});if(!t.ok){let{error:e}=t;X.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},t[13]=o,t[14]=n,t[15]=a,t[16]=S):S=t[16];let C=S,w;t[17]!==x||t[18]!==h?(w=function(e,t){let n=h[e];x(e,qa(n,t))},t[17]=x,t[18]=h,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[20]=E):E=t[20];let D=E,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Va[e];return{...t,type:e,value:n,error:null}})},t[21]=O):O=t[21];let k=O,A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){d(t=>t&&{...t,value:e})},t[22]=A):A=t[22];let j=A,M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){d(t=>t&&{...t,name:e,error:null})},t[23]=M):M=t[23];let N=M,P;t[24]!==o||t[25]!==u||t[26]!==n||t[27]!==a||t[28]!==h?(P=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(Un(u.value)){d({...u,error:o({id:`hXUWyd`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=await Ya(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[24]=o,t[25]=u,t[26]=n,t[27]=a,t[28]=h,t[29]=P):P=t[29];let F=P,I;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){p({key:e,draft:e,error:null})},t[30]=I):I=t[30];let L=I,R;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(t=>t&&{...t,draft:e,error:null})},t[31]=R):R=t[31];let z=R,B;t[32]!==o||t[33]!==n||t[34]!==a||t[35]!==h||t[36]!==f?(B=async function(){if(!f)return;let e=f.draft.trim();if(!e){p({...f,error:o({id:`8_brI5`})});return}if(e===f.key){p(null);return}if(Object.hasOwn(h,e)){p({...f,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=h[f.key],r=await Ya(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},t[32]=o,t[33]=n,t[34]=a,t[35]=h,t[36]=f,t[37]=B):B=t[37];let V=B,H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(){p(null)},t[38]=H):H=t[38];let U=H,ee=!c,te;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(te=e=>l(!e),t[39]=te):te=t[39];let W=`size-3 transition-transform ${c?``:`rotate-90`}`,ne;t[40]===W?ne=t[41]:(ne=(0,Z.jsx)(Os,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=ne);let re;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=re):re=t[42];let G;t[43]===ne?G=t[44]:(G=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[ne,re]}),t[43]=ne,t[44]=G);let ie;t[45]===_?ie=t[46]:(ie=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:Zx,children:_}),t[45]=_,t[46]=ie);let K;t[47]!==G||t[48]!==ie?(K=(0,Z.jsxs)(js,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[G,ie]}),t[47]=G,t[48]=ie,t[49]=K):K=t[49];let q;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hSBIG-`})}),t[50]=q):q=t[50];let ae;t[51]!==u||t[52]!==x||t[53]!==V||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(ae=y.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`4c_a6S`})}):y.map(e=>{let t=h[e];return(0,Z.jsx)(to,{keyName:e,value:t,declared:ao(t,$n(t)),rename:{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:z,onCommit:V,onCancel:U},badge:null,onCommit:t=>void x(e,t),onChangeType:t=>T(e,t),onRemove:()=>void C(e)},e)}),t[51]=u,t[52]=x,t[53]=V,t[54]=y,t[55]=h,t[56]=C,t[57]=f,t[58]=T,t[59]=ae):ae=t[59];let oe;t[60]!==u||t[61]!==F?(oe=u?(0,Z.jsx)(Za,{draft:u,onChangeName:N,onChangeType:k,onChangeValue:j,onCommit:()=>void F(),onCancel:()=>d(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(sa,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>D(),className:`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)(At,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=F,t[62]=oe):oe=t[62];let se;t[63]!==ae||t[64]!==oe?(se=(0,Z.jsx)(As,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[q,ae,oe]})}),t[63]=ae,t[64]=oe,t[65]=se):se=t[65];let ce;return t[66]!==ee||t[67]!==K||t[68]!==se?(ce=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Ms,{open:ee,onOpenChange:te,children:[K,se]})}),t[66]=ee,t[67]=K,t[68]=se,t[69]=ce):ce=t[69],ce}function Zx(e){return e.stopPropagation()}function Qx(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(dl,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function $x(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Y._({id:`xOTzt5`}):t<3600?Y._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Y._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Y._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function eS(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function tS(e){let t=e.message,n=t.indexOf(`: `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+2);switch(r){case`template-create`:return{Icon:Ao,label:Y._({id:`QR5SP1`}),detail:eS(i)};case`template-edit`:return{Icon:I,label:Y._({id:`-LHLx7`}),detail:eS(i)};case`template-delete`:return{Icon:g,label:Y._({id:`_gkGSK`}),detail:eS(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:Hc,label:Y._({id:`KPW5WC`}),detail:`${eS(e??``)} → ${eS(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:dl,label:Y._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:dl,label:Y._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:dl,label:Y._({id:`ZQLDTl`}),detail:``};default:return{Icon:_l,label:r.replace(/-/g,` `),detail:eS(i)}}}function nS(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Y._({id:`B2DrPb`}):e.author||Y._({id:`Ef7StM`})}function rS(e){let t=(0,$.c)(15),{folderPath: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,c]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(!1),d,f;if(t[1]===n?(d=t[2],f=t[3]):(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){u(!0),c(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),u(!1),c(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),u(!0),c(!1))}};c(!0),t();let r=Wi(t);return()=>{e=!0,r()}},f=[n],t[1]=n,t[2]=d,t[3]=f),(0,Q.useEffect)(d,f),l||!o&&i.length===0)return null;let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XJOV1Y`})}),t[4]=p):p=t[4];let m;t[5]===i.length?m=t[6]:(m=i.length>0?(0,Z.jsx)(P,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=m);let h;t[7]===m?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[p,m]}),t[7]=m,t[8]=h);let g;t[9]!==i||t[10]!==o?(g=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(Pa,{className:`h-8 w-full`}),(0,Z.jsx)(Pa,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(iS)})}),t[9]=i,t[10]=o,t[11]=g):g=t[11];let _;return t[12]!==h||t[13]!==g?(_=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function iS(e){let{Icon:t,label:n,detail:r}=tS(e);return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm`,children:[(0,Z.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:n}),r?(0,Z.jsx)(`code`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(tu,{className:`size-3`,"aria-hidden":!0}),nS(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:$x(e.timestamp)})]},e.sha)}function aS(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function oS(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=aS(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function sS(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function cS(e,t){let n=e===``?``:`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:oS(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:sS(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:oS(e,t.pageTitles),children:a}}function lS(e){let t=(0,$.c)(44),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})})}),(0,Z.jsx)(Pa,{className:`h-12 w-full`}),(0,Z.jsx)(Pa,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let h;t[3]===r.data.folder.templates_available?h=t[4]:(h=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})}),t[5]=_):_=t[5];let v;t[6]===g.length?v=t[7]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,(0,Z.jsx)(P,{className:`text-xs`,variant:`secondary`,children:g.length})]}),t[6]=g.length,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(sa,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(At,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[8]=y):y=t[8];let b;t[9]===v?b=t[10]:(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[v,y]}),t[9]=v,t[10]=b);let x;t[11]===g?x=t[12]:(x=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:g.map(e=>(0,Z.jsx)(ja,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Fa,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=g,t[12]=x);let S;t[13]!==b||t[14]!==x?(S=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[b,x]}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e||c(null)},t[16]=C):C=t[16];let w;t[17]!==o||t[18]!==n||t[19]!==i?(w=(0,Z.jsx)($a,{folderPath:n,template:o,onOpenChange:C,onSaved:i}),t[17]=o,t[18]=n,t[19]=i,t[20]=w):w=t[20];let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||u(null)},t[21]=T):T=t[21];let E;t[22]!==l||t[23]!==i?(E=(0,Z.jsx)(Ro,{template:l,onOpenChange:T,onDeleted:i}),t[22]=l,t[23]=i,t[24]=E):E=t[24];let D;t[25]===g?D=t[26]:(D=new Set(g.map(uS)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Io,{folderPath:n,existingNames:D,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=D,t[31]=O):O=t[31];let k=d!==null,A;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||f(null)},t[32]=A):A=t[32];let j=d??void 0,M;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(M=(0,Z.jsx)(Gm,{open:k,onOpenChange:A,kind:`file`,initialDir:n,initialTemplate:j,folderConfig:a}),t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==E||t[39]!==O||t[40]!==M||t[41]!==S||t[42]!==w?(N=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,M]}),t[38]=E,t[39]=O,t[40]=M,t[41]=S,t[42]=w,t[43]=N):N=t[43],N}function uS(e){return e.name}function dS(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=ea(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=ea(`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 fS(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=ea(`[&_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 pS(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=ea(`[&_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 mS(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=ea(`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 hS(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=ea(`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 gS(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=ea(`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 _S(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Y._({id:`xOTzt5`});if(r<60)return Y._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Y._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Y._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function vS(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 yS(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)(fe,{className:`ml-1 size-3`}):(0,Z.jsx)(S,{className:`ml-1 size-3`}):(0,Z.jsx)(Uc,{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)(sa,{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 bS(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=si(),d=uo(n),{state:f,refresh:p}=d,[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(`name`),[v,y]=(0,Q.useState)(`asc`);if(o){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(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)(Pa,{className:`size-5 rounded`}),(0,Z.jsx)(Pa,{className:`h-7 w-48`})]}),(0,Z.jsx)(Pa,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Pa,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(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:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Pa,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(CS)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(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":e,children:a}),t[5]=e,t[6]=o),o}let b,x,S,C,w,T,E,D,O,k,A;if(t[7]!==r||t[8]!==f||t[9]!==d||t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==l||t[14]!==c||t[15]!==p||t[16]!==v||t[17]!==g){let e=cS(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=vS(e.children,g,v),o=e.title||(n===``?r({id:`3aeN7X`}):e.title),m;t[29]===g?m=t[30]:(m=function(e){e===g?y(SS):(_(e),y(`asc`))},t[29]=g,t[30]=m);let j=m;A=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(mt,{className:`size-5 text-muted-foreground`}),t[31]=M):M=t[31];let N=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:o})]}),P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(sa,{onClick:()=>h(!0),children:[(0,Z.jsx)(At,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[32]=P):P=t[32],t[33]===N?E=t[34]:(E=(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:[N,P]})}),t[33]=N,t[34]=E),t[35]!==f||t[36]!==n||t[37]!==p?(D=(0,Z.jsx)(Xx,{folderPath:n,state:f,onChange:p}),t[35]=f,t[36]=n,t[37]=p,t[38]=D):D=t[38],t[39]!==f||t[40]!==d||t[41]!==n||t[42]!==p?(O=(0,Z.jsx)(lS,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[39]=f,t[40]=d,t[41]=n,t[42]=p,t[43]=O):O=t[43],t[44]===n?k=t[45]:(k=(0,Z.jsx)(rS,{folderPath:n}),t[44]=n,t[45]=k),w=`rounded-lg border`,x=dS;let F=g===`name`?v===`asc`?`ascending`:`descending`:`none`,I;t[46]===r?I=t[47]:(I=r({id:`6YtxFj`}),t[46]=r,t[47]=I);let L;t[48]!==j||t[49]!==v||t[50]!==g||t[51]!==I?(L=(0,Z.jsx)(yS,{label:I,sortKey:`name`,activeKey:g,activeDir:v,onSort:j}),t[48]=j,t[49]=v,t[50]=g,t[51]=I,t[52]=L):L=t[52];let R;t[53]!==F||t[54]!==L?(R=(0,Z.jsx)(hS,{"aria-sort":F,children:L}),t[53]=F,t[54]=L,t[55]=R):R=t[55];let z=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,B;t[56]===r?B=t[57]:(B=r({id:`tgWuMB`}),t[56]=r,t[57]=B);let V;t[58]!==j||t[59]!==v||t[60]!==g||t[61]!==B?(V=(0,Z.jsx)(yS,{label:B,sortKey:`modified`,activeKey:g,activeDir:v,onSort:j}),t[58]=j,t[59]=v,t[60]=g,t[61]=B,t[62]=V):V=t[62];let H;t[63]!==z||t[64]!==V?(H=(0,Z.jsx)(hS,{className:`w-32`,"aria-sort":z,children:V}),t[63]=z,t[64]=V,t[65]=H):H=t[65],t[66]!==R||t[67]!==H?(C=(0,Z.jsx)(fS,{children:(0,Z.jsxs)(mS,{children:[R,H]})}),t[66]=R,t[67]=H,t[68]=C):C=t[68],b=pS,S=i.length?i.map(xS):(0,Z.jsx)(mS,{children:(0,Z.jsx)(gS,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Pkw7J9`})})}),t[7]=r,t[8]=f,t[9]=d,t[10]=n,t[11]=a,t[12]=u,t[13]=l,t[14]=c,t[15]=p,t[16]=v,t[17]=g,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k,t[28]=A}else b=t[18],x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],O=t[26],k=t[27],A=t[28];let j;t[69]!==b||t[70]!==S?(j=(0,Z.jsx)(b,{children:S}),t[69]=b,t[70]=S,t[71]=j):j=t[71];let M;t[72]!==x||t[73]!==j||t[74]!==C?(M=(0,Z.jsxs)(x,{children:[C,j]}),t[72]=x,t[73]=j,t[74]=C,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==w?(N=(0,Z.jsx)(`div`,{className:w,children:M}),t[76]=M,t[77]=w,t[78]=N):N=t[78];let P;t[79]!==N||t[80]!==T||t[81]!==E||t[82]!==D||t[83]!==O||t[84]!==k?(P=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,k,N]}),t[79]=N,t[80]=T,t[81]=E,t[82]=D,t[83]=O,t[84]=k,t[85]=P):P=t[85];let F;t[86]!==P||t[87]!==A?(F=(0,Z.jsx)(`div`,{className:A,children:P}),t[86]=P,t[87]=A,t[88]=F):F=t[88];let I;t[89]!==m||t[90]!==d||t[91]!==n?(I=(0,Z.jsx)(Gm,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[89]=m,t[90]=d,t[91]=n,t[92]=I):I=t[92];let L;return t[93]!==F||t[94]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[F,I]}),t[93]=F,t[94]=I,t[95]=L):L=t[95],L}function xS(e){return(0,Z.jsxs)(mS,{children:[(0,Z.jsx)(gS,{children:(0,Z.jsxs)(`a`,{href:yr(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)(pl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Kt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(gS,{className:`text-muted-foreground`,children:e.kind===`file`?_S(e.modified):`—`})]},e.path)}function SS(e){return e===`asc`?`desc`:`asc`}function CS(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)(Pa,{className:`size-4 rounded`}),(0,Z.jsx)(Pa,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Pa,{className:`h-4 w-16`})})]},e)}function wS(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?c.current?.focus():l.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(sl,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(s,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,Z.jsx)(`h2`,{ref:l,id:`large-file-title`,tabIndex:p,className:`text-2xl font-light text-balance outline-none`,children:m}),t[5]=p,t[6]=h);let g;t[7]===r?g=t[8]:(g=Ri(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Ri(i),t[9]=i,t[10]=_);let v;t[11]!==n||t[12]!==g||t[13]!==_?(v=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_GBioJ`,values:{0:g,1:_,docName:n}})}),t[11]=n,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,v]}),t[15]=h,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==a||t[19]!==o?(b=o?(0,Z.jsxs)(sa,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(ga,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[f,y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function TS(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(ES),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>F(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 c;t[2]===n?c=t[3]:(c=function(){ne(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]=c);let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A67Uwj`})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(s,{id:`dEgA5A`}),t[5]=d):d=t[5];let f;return t[6]===l?f=t[7]:(f=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[u,(0,Z.jsx)(sa,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:l,children:d})]}),t[6]=l,t[7]=f),f}function ES(){return new Set}var DS=(0,Q.createContext)(null);function OS(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(kS),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)(DS,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function kS(){return new Map}function AS(){let e=(0,Q.use)(DS);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function jS(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var MS=jS(()=>n(()=>import(`./SettingsDialogBody-YOvgrn38.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([44,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,45,8,16,11,13,23,46]),import.meta.url));function NS(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(s,{id:`hwFOFD`})}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:o})]}),t[4]=o,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(sa,{variant:`default`,onClick:PS,children:(0,Z.jsx)(s,{id:`HpK_8d`})}),t[6]=u):u=t[6];let d;return t[7]===l?d=t[8]:(d=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[l,u]}),t[7]=l,t[8]=d),d}function PS(){return window.location.reload()}function FS(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(re,{fallbackRender:LS,onError:IS,children:n}),t[0]=n,t[1]=r),r}function IS(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function LS(e){return(0,Z.jsx)(NS,{...e})}function RS(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function zS(e){let t=(0,$.c)(86),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=yt(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=be(),{desktopPresent:f}=Na(),[p,m]=(0,Q.useState)(`preferences`),h,g;t[0]===n?(h=t[1],g=t[2]):(h=()=>{n&&m(`preferences`)},g=[n],t[0]=n,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=o!==null,v;t[3]===a?v=t[4]:(v=a({id:`7PzzBU`}),t[3]=a,t[4]=v);let y;t[5]===a?y=t[6]:(y=a({id:`Q6hhn8`}),t[5]=a,t[6]=y);let b;t[7]===y?b=t[8]:(b={id:`preferences`,label:y},t[7]=y,t[8]=b);let x;t[9]===a?x=t[10]:(x=a({id:`4KmEoC`}),t[9]=a,t[10]=x);let S;t[11]===x?S=t[12]:(S={id:`hotkeys`,label:x},t[11]=x,t[12]=S);let C;t[13]===a?C=t[14]:(C=a({id:`AeXO77`}),t[13]=a,t[14]=C);let w;t[15]===C?w=t[16]:(w={id:`account`,label:C},t[15]=C,t[16]=w);let T;t[17]!==b||t[18]!==S||t[19]!==w?(T=[b,S,w],t[17]=b,t[18]=S,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==T||t[22]!==v?(E={id:`user`,label:v,enabled:!0,items:T},t[21]=T,t[22]=v,t[23]=E):E=t[23];let D;t[24]===a?D=t[25]:(D=a({id:`ZWyHmq`}),t[24]=a,t[25]=D);let O;t[26]===a?O=t[27]:(O=a({id:`Nu4DdT`}),t[26]=a,t[27]=O);let k;t[28]===O?k=t[29]:(k={id:`sync`,label:O},t[28]=O,t[29]=k);let A;t[30]===a?A=t[31]:(A=a({id:`A1taO8`}),t[30]=a,t[31]=A);let j;t[32]===A?j=t[33]:(j={id:`search`,label:A},t[32]=A,t[33]=j);let M;t[34]===a?M=t[35]:(M=a({id:`iTylMl`}),t[34]=a,t[35]=M);let N;t[36]===M?N=t[37]:(N={id:`project-templates`,label:M},t[36]=M,t[37]=N);let P;t[38]===a?P=t[39]:(P=a({id:`3zyg_A`}),t[38]=a,t[39]=P);let F;t[40]===P?F=t[41]:(F={id:`okignore`,label:P},t[40]=P,t[41]=F);let I;t[42]===a?I=t[43]:(I=a({id:`cs4mps`}),t[42]=a,t[43]=I);let L;t[44]===I?L=t[45]:(L={id:`sharing`,label:I},t[44]=I,t[45]=L);let R;t[46]!==k||t[47]!==j||t[48]!==N||t[49]!==F||t[50]!==L?(R=[k,j,N,F,L],t[46]=k,t[47]=j,t[48]=N,t[49]=F,t[50]=L,t[51]=R):R=t[51];let z;t[52]!==_||t[53]!==D||t[54]!==R?(z={id:`project`,label:D,enabled:_,items:R},t[52]=_,t[53]=D,t[54]=R,t[55]=z):z=t[55];let B;t[56]===a?B=t[57]:(B=a({id:`nbfdhU`}),t[56]=a,t[57]=B);let V;t[58]!==a||t[59]!==f?(V=[],t[58]=a,t[59]=f,t[60]=V):V=t[60];let H;t[61]!==B||t[62]!==V?(H={id:`integrations`,label:B,enabled:!0,items:V},t[61]=B,t[62]=V,t[63]=H):H=t[63];let U;t[64]!==E||t[65]!==z||t[66]!==H?(U=[E,z,H],t[64]=E,t[65]=z,t[66]=H,t[67]=U):U=t[67];let ee=U,te;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(bs,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[68]=te):te=t[68];let W;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(vs,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[69]=W):W=t[69];let ne;t[70]!==p||t[71]!==ee?(ne=(0,Z.jsx)(BS,{groups:ee,activeId:p,onSelect:m}),t[70]=p,t[71]=ee,t[72]=ne):ne=t[72];let re;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(US,{}),t[73]=re):re=t[73];let G=l?c:null,ie;t[74]!==p||t[75]!==u||t[76]!==d||t[77]!==G?(ie=(0,Z.jsx)(`section`,{"aria-labelledby":`settings-dialog-title`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:(0,Z.jsx)(FS,{children:(0,Z.jsx)(Q.Suspense,{fallback:re,children:(0,Z.jsx)(MS,{activeId:p,userBinding:G,okignoreBinding:u,okignoreSynced:d})})})}),t[74]=p,t[75]=u,t[76]=d,t[77]=G,t[78]=ie):ie=t[78];let K;t[79]!==ne||t[80]!==ie?(K=(0,Z.jsxs)(xs,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[te,W,ne,ie]}),t[79]=ne,t[80]=ie,t[81]=K):K=t[81];let q;return t[82]!==r||t[83]!==n||t[84]!==K?(q=(0,Z.jsx)(Ts,{open:n,onOpenChange:r,children:K}),t[82]=r,t[83]=n,t[84]=K,t[85]=q):q=t[85],q}function BS(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:a}=e,{_:o}=i(),s;t[0]===o?s=t[1]:(s=o({id:`y1t8bQ`}),t[0]=o,t[1]=s);let c;if(t[2]!==r||t[3]!==n||t[4]!==a){let e;t[6]!==r||t[7]!==a?(e=e=>(0,Z.jsx)(HS,{group:e,activeId:r,onSelect:a},e.id),t[6]=r,t[7]=a,t[8]=e):e=t[8],c=n.map(e),t[2]=r,t[3]=n,t[4]=a,t[5]=c}else c=t[5];let l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(VS,{}),t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==c?(u=(0,Z.jsxs)(`nav`,{"aria-label":s,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:[c,l]}),t[10]=s,t[11]=c,t[12]=u):u=t[12],u}function VS(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=RS(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:ea(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(s,{id:`_PACVa`}),(0,Z.jsx)(ms,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function HS(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,c=n.enabled?void 0:o,l=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,u;t[0]===l?u=t[1]:(u=ea(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,l),t[0]=l,t[1]=u);let d;t[2]!==n.label||t[3]!==a||t[4]!==c||t[5]!==u?(d=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":c,className:u,children:n.label}),t[2]=n.label,t[3]=a,t[4]=c,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.enabled?(f=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(s,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=f):f=t[9];let p;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:ea(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],p=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=p}else p=t[15];let m;t[21]!==a||t[22]!==p?(m=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:p}),t[21]=a,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==d||t[25]!==f||t[26]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[d,f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=h):h=t[27],h}function US(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`GsBUCk`})}),n=(0,Z.jsx)(Pa,{className:`h-5 w-32`}),r=(0,Z.jsx)(Pa,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Pa,{className:`h-9 w-full`}),(0,Z.jsx)(Pa,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function WS(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=ea(`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)(wb,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function GS(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)(Db,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function KS(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=ea(`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)(jb,{"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}function qS(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=ea(`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 JS=la(`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 YS(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=ea(JS({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:XS,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function XS(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}la(`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 ZS(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=ea(`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 QS(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=ea(`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)(ks,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $S(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:a,replaceOpen:o,caseSensitive:c,wholeWord:l,current:u,total:d,onQueryChange:f,onReplacementChange:p,onReplaceOpenChange:m,onCaseSensitiveChange:h,onWholeWordChange:g,onNext:_,onPrevious:v,onReplaceCurrent:y,onReplaceAll:b,onClose:x}=e,{_:S}=i(),C=r.length>0,w=d>0,T;t[0]!==S||t[1]!==u||t[2]!==w||t[3]!==C||t[4]!==d?(T=C?w?`${u} / ${d}`:S({id:`Ev2r9A`}):``,t[0]=S,t[1]=u,t[2]=w,t[3]=C,t[4]=d,t[5]=T):T=t[5];let E=T,D;t[6]!==x||t[7]!==_||t[8]!==v?(D=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?v():_()):e.key===`Escape`&&(e.preventDefault(),x())},t[6]=x,t[7]=_,t[8]=v,t[9]=D):D=t[9];let O=D,k;t[10]!==x||t[11]!==y?(k=function(e){e.key===`Enter`?(e.preventDefault(),y()):e.key===`Escape`&&(e.preventDefault(),x())},t[10]=x,t[11]=y,t[12]=k):k=t[12];let A=k,j;t[13]===S?j=t[14]:(j=S({id:`MVxpbf`}),t[13]=S,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(s,{id:`KujtjC`})}),t[15]=M):M=t[15];let N;t[16]===f?N=t[17]:(N=e=>f(e.target.value),t[16]=f,t[17]=N);let P;t[18]===S?P=t[19]:(P=S({id:`KujtjC`}),t[18]=S,t[19]=P);let F;t[20]!==n||t[21]!==O||t[22]!==r||t[23]!==N||t[24]!==P?(F=(0,Z.jsx)(QS,{ref:n,id:`ok-find-input`,value:r,onChange:N,onKeyDown:O,placeholder:P,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=O,t[22]=r,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]===S?I=t[27]:(I=S({id:`-8PP0T`}),t[26]=S,t[27]=I);let L;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Yc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(gs,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":I,pressed:c,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:L})}),t[29]=c,t[30]=h,t[31]=I,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`-8PP0T`})}),t[33]=z):z=t[33];let B;t[34]===R?B=t[35]:(B=(0,Z.jsxs)(pr,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(nu,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(gs,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":V,pressed:l,onPressedChange:g,className:`size-6 min-w-6 px-0`,children:H})}),t[39]=g,t[40]=V,t[41]=l,t[42]=U):U=t[42];let ee;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=ee):ee=t[43];let te;t[44]===U?te=t[45]:(te=(0,Z.jsxs)(pr,{children:[U,ee]}),t[44]=U,t[45]=te);let W;t[46]!==B||t[47]!==te?(W=(0,Z.jsxs)(YS,{align:`inline-end`,className:`gap-0.5`,children:[B,te]}),t[46]=B,t[47]=te,t[48]=W):W=t[48];let ne;t[49]!==W||t[50]!==F?(ne=(0,Z.jsxs)(qS,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,W]}),t[49]=W,t[50]=F,t[51]=ne):ne=t[51];let re;t[52]===E?re=t[53]:(re=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:E}),t[52]=E,t[53]=re);let G;t[54]===S?G=t[55]:(G=S({id:`oqB2ez`}),t[54]=S,t[55]=G);let ie=!w,K;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)($t,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=K):K=t[56];let q;t[57]!==v||t[58]!==G||t[59]!==ie?(q=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":G,disabled:ie,onClick:v,children:K})}),t[57]=v,t[58]=G,t[59]=ie,t[60]=q):q=t[60];let ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=ae):ae=t[61];let oe;t[62]===q?oe=t[63]:(oe=(0,Z.jsxs)(pr,{children:[q,ae]}),t[62]=q,t[63]=oe);let se;t[64]===S?se=t[65]:(se=S({id:`SiUUCS`}),t[64]=S,t[65]=se);let ce=!w,ue;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(le,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ue):ue=t[66];let de;t[67]!==_||t[68]!==se||t[69]!==ce?(de=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":se,disabled:ce,onClick:_,children:ue})}),t[67]=_,t[68]=se,t[69]=ce,t[70]=de):de=t[70];let fe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=fe):fe=t[71];let pe;t[72]===de?pe=t[73]:(pe=(0,Z.jsxs)(pr,{children:[de,fe]}),t[72]=de,t[73]=pe);let me=o?`secondary`:`ghost`,he;t[74]!==S||t[75]!==o?(he=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=he):he=t[76];let ge=o?`ok-replace-input`:void 0,_e;t[77]!==m||t[78]!==o?(_e=()=>m(!o),t[77]=m,t[78]=o,t[79]=_e):_e=t[79];let ve;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsx)(Rl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=ve):ve=t[80];let ye;t[81]!==o||t[82]!==me||t[83]!==he||t[84]!==ge||t[85]!==_e?(ye=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{type:`button`,variant:me,size:`icon-sm`,"aria-label":he,"aria-expanded":o,"aria-controls":ge,onClick:_e,children:ve})}),t[81]=o,t[82]=me,t[83]=he,t[84]=ge,t[85]=_e,t[86]=ye):ye=t[86];let be;t[87]===o?be=t[88]:(be=(0,Z.jsx)(Ar,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=be);let xe;t[89]!==ye||t[90]!==be?(xe=(0,Z.jsxs)(pr,{children:[ye,be]}),t[89]=ye,t[90]=be,t[91]=xe):xe=t[91];let Se;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(Se=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(s,{id:`fqSfXY`})}),(0,Z.jsx)(ks,{id:`ok-replace-input`,value:a,onChange:e=>p(e.target.value),onKeyDown:A,placeholder:S({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Rl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Ll,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`dr1vFs`})})]})]}):null,t[92]=S,t[93]=A,t[94]=w,t[95]=b,t[96]=y,t[97]=p,t[98]=o,t[99]=a,t[100]=Se):Se=t[100];let Ce;t[101]===S?Ce=t[102]:(Ce=S({id:`wJo9oS`}),t[101]=S,t[102]=Ce);let we;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(ys,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=we):we=t[103];let Te;t[104]!==x||t[105]!==Ce?(Te=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Ce,onClick:x,children:we})}),t[104]=x,t[105]=Ce,t[106]=Te):Te=t[106];let Ee;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Ee):Ee=t[107];let De;t[108]===Te?De=t[109]:(De=(0,Z.jsxs)(pr,{children:[Te,Ee]}),t[108]=Te,t[109]=De);let Oe;return t[110]!==ne||t[111]!==re||t[112]!==oe||t[113]!==pe||t[114]!==j||t[115]!==xe||t[116]!==Se||t[117]!==De?(Oe=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":j,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[M,ne,re,oe,pe,xe,Se,De]}),t[110]=ne,t[111]=re,t[112]=oe,t[113]=pe,t[114]=j,t[115]=xe,t[116]=Se,t[117]=De,t[118]=Oe):Oe=t[118],Oe}var eC={current:0,total:0},tC=120,nC=100;function rC(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?_(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(M,n,iC)}function iC(){return null}function aC(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
24
24
  `,`
25
25
  `).trim();return i.length===0||i.length>tC||i.includes(`
26
- `)?null:i}function oC(e){let t=nt(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function sC(e,t){return e.current===t.current&&e.total===t.total}function cC(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(eC)}function lC(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=_e(e);if(!t)return;let n=t.dom.querySelector(`.ok-find-match-active`);n instanceof HTMLElement&&n.scrollIntoView({block:`center`,inline:`nearest`,behavior:`auto`})})}function uC(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=rC(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useRef)(n),c=(0,Q.useRef)(0),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={open:!1,replaceOpen:!1,query:``,replacement:``,caseSensitive:!1,wholeWord:!1,activeIndex:0},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(eC),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(fC))},h=[n],t[1]=n,t[2]=m,t[3]=h),(0,Q.useEffect)(m,h);let g,_;t[4]===u.activeIndex?(g=t[5],_=t[6]):(g=()=>{c.current=u.activeIndex},_=[u.activeIndex],t[4]=u.activeIndex,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v,y;t[7]===i?(v=t[8],y=t[9]):(v=()=>{let e=o.current;e&&e!==i&&!e.isDestroyed&&e.commands.clearFindMatches(),o.current=i},y=[i],t[7]=i,t[8]=v,t[9]=y),(0,Q.useEffect)(v,y);let b,x;t[10]===u.open?(b=t[11],x=t[12]):(b=()=>{if(!u.open||!a.current)return;let e=requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()});return()=>cancelAnimationFrame(e)},x=[u.open],t[10]=u.open,t[11]=b,t[12]=x),(0,Q.useEffect)(b,x);let S,C;t[13]!==u.open||t[14]!==r?(S=()=>{!u.open||!r||d(dC)},C=[u.open,r],t[13]=u.open,t[14]=r,t[15]=S,t[16]=C):(S=t[15],C=t[16]),(0,Q.useEffect)(S,C);let w,T;t[17]!==i||t[18]!==u.caseSensitive||t[19]!==u.open||t[20]!==u.query||t[21]!==u.wholeWord||t[22]!==r?(w=()=>{if(!i||i.isDestroyed){p(eC);return}if(!u.open||r){i.commands.clearFindMatches(),p(eC);return}let e=window.setTimeout(()=>{if(i.isDestroyed)return;i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current});let e=oC(i);p(t=>sC(t,e)?t:e)},nC);return()=>window.clearTimeout(e)},T=[i,u.open,u.query,u.caseSensitive,u.wholeWord,r],t[17]=i,t[18]=u.caseSensitive,t[19]=u.open,t[20]=u.query,t[21]=u.wholeWord,t[22]=r,t[23]=w,t[24]=T):(w=t[23],T=t[24]),(0,Q.useEffect)(w,T);let E,D;t[25]!==i||t[26]!==u.open||t[27]!==r?(E=()=>{if(!i||i.isDestroyed||!u.open||r)return;let e=()=>{let e=nt(i.state),t=oC(i);p(e=>sC(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},D=[i,u.open,r],t[25]=i,t[26]=u.open,t[27]=r,t[28]=E,t[29]=D):(E=t[28],D=t[29]),(0,Q.useEffect)(E,D);let O,k;t[30]!==n||t[31]!==i||t[32]!==u.open||t[33]!==r?(O=()=>{let e=function(e){let t=aC(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(Ws(t,`find`)){t.preventDefault(),u.open?cC(i,d,p):e(!1);return}if(Ws(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=Ws(t,`find-next`),n=Ws(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&lC(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),cC(i,d,p))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},k=[n,i,u.open,r],t[30]=n,t[31]=i,t[32]=u.open,t[33]=r,t[34]=O,t[35]=k):(O=t[34],k=t[35]),(0,Q.useEffect)(O,k);let A;t[36]!==i||t[37]!==u.caseSensitive||t[38]!==u.query||t[39]!==u.wholeWord?(A=function(){return!i||i.isDestroyed?!1:(i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current}),!0)},t[36]=i,t[37]=u.caseSensitive,t[38]=u.query,t[39]=u.wholeWord,t[40]=A):A=t[40];let j=A,M;t[41]===i?M=t[42]:(M=function(){if(!i||i.isDestroyed)return;let e=nt(i.state),t=oC(i);p(e=>sC(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=M);let N=M,P;t[43]===i?P=t[44]:(P=function(){cC(i,d,p)},t[43]=i,t[44]=P);let F=P,I;t[45]!==j||t[46]!==i||t[47]!==N?(I=function(){!i||i.isDestroyed||(j(),i.commands.selectNextFindMatch()&&lC(i),N())},t[45]=j,t[46]=i,t[47]=N,t[48]=I):I=t[48];let L=I,R;t[49]!==j||t[50]!==i||t[51]!==N?(R=function(){!i||i.isDestroyed||(j(),i.commands.selectPreviousFindMatch()&&lC(i),N())},t[49]=j,t[50]=i,t[51]=N,t[52]=R):R=t[52];let z=R,B;t[53]!==j||t[54]!==i||t[55]!==u.replacement||t[56]!==N?(B=function(){!i||i.isDestroyed||(j(),i.commands.replaceCurrentFindMatch(u.replacement)&&lC(i),N())},t[53]=j,t[54]=i,t[55]=u.replacement,t[56]=N,t[57]=B):B=t[57];let V=B,H;t[58]!==j||t[59]!==i||t[60]!==u.replacement||t[61]!==N?(H=function(){!i||i.isDestroyed||(j(),i.commands.replaceAllFindMatches(u.replacement)&&lC(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let ee,te,W,ne,re;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>d(t=>({...t,query:e,activeIndex:0})),te=e=>d(t=>({...t,replacement:e})),W=e=>d(t=>({...t,replaceOpen:e})),ne=e=>d(t=>({...t,caseSensitive:e})),re=e=>d(t=>({...t,wholeWord:e})),t[63]=ee,t[64]=te,t[65]=W,t[66]=ne,t[67]=re):(ee=t[63],te=t[64],W=t[65],ne=t[66],re=t[67]);let G;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(G=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)($S,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:ee,onReplacementChange:te,onReplaceOpenChange:W,onCaseSensitiveChange:ne,onWholeWordChange:re,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=G):G=t[80],G}function dC(e){return{...e,open:!1,activeIndex:0}}function fC(e){return{...e,activeIndex:0}}var pC=300;function mC(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(mc),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(mc);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(yc(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,pC)};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 hC(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function gC(e){let t=(0,$.c)(8),{poolEntries:n}=yt(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>hC(i),t[3]=i,t[4]=a);let[o,s]=(0,Q.useState)(a),c,l;return t[5]===i?(c=t[6],l=t[7]):(c=()=>{if(!i){s(null);return}let e=i.document.getMap(`lifecycle`);s(hC(i));let t=()=>s(hC(i));return e.observe(t),()=>{e.unobserve(t)}},l=[i],t[5]=i,t[6]=c,t[7]=l),(0,Q.useEffect)(c,l),o}function _C(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Sc(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Cc,r)}var vC=`ok-doc-panel-width-v1`;function yC(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function bC(e){try{let t=(e??localStorage).getItem(vC);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?yC(n):320}catch{return 320}}function xC(e,t){try{(t??localStorage).setItem(vC,String(yC(e)))}catch{}}function SC(){try{return typeof localStorage>`u`?320:bC()}catch{return 320}}var CC=1024,wC=1280,TC={left:CC,right:wC};function EC(e,t,n){return e==null?t>=TC[n]?`above`:`below`:`embedded`}function DC(e){return e===`above`?`open`:`collapsed`}var OC=`ok-sidebar-pins-v2`;function kC(e){return e===`open`||e===`collapsed`}function AC(e){return e===`above`||e===`below`||e===`embedded`}function jC(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!AC(e)||!kC(t[e]))return!1;return!0}function MC(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return jC(n.left)&&(r.left=n.left),jC(n.right)&&(r.right=n.right),r}function NC(e){try{let t=(e??localStorage).getItem(OC);return t==null?{}:MC(t)}catch{return{}}}function PC(e,t){try{t.setItem(OC,JSON.stringify(e))}catch{}}function FC(e,t,n){return n[e]?.[t]??DC(t)}function IC(e,t,n,r){let i=r??localStorage,a=NC(i);return a[e]={...a[e],[t]:n},PC(a,i),a}function LC(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`?RC: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 RC(e){return e===`synced`?`synced`:`connected`}var zC=Qr;function BC(e,t={}){let n=J(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var VC=200,HC=`Outside any block`;function UC(e){let t=(0,$.c)(5),{editor:n}=e,r=Ie(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?WC(n,r):o.current?HC:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},VC),()=>{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 WC(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=BC(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=BC(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 GC(){let[e]=(0,Q.useState)(ei);return e}function KC({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:$r(e.display_name),color:Lr(e.id,qn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Lr(e.id,qn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function qC(e,t){return e>t}function JC(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.isChangeOrigin===!0?!0:`snapshot`in t&&`prevSnapshot`in t&&t.snapshot===null&&t.prevSnapshot===null}var YC=3,XC=6e4;function ZC(e,t){let n=0;for(let r of e)t-r<XC&&(n+=1);return n<YC}var QC=new Map;function $C(e,t){for(let n of e.changed.keys()){let e=n;for(;e!=null;){if(e===t)return!0;let n=e._item;e=n==null?null:n.parent}}return!1}function ew(e){let t=Gt.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function tw(e){let{fragment:t,docName:n,onWedged:r}=e,i=0,a=0,o=!1,s=!1,c=!1,l=null,u=new WeakSet,d=e=>{let t=Gt.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){ut.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-prosemirror-changed`}),console.warn(`[binding-staleness-guard] ySync binding on "${n}" exposes no _prosemirrorChanged — write-back gate disarmed (vendored y-tiptap contract change?)`);return}if(u.has(t))return;u.add(t);let r=t._prosemirrorChanged.bind(t);t._prosemirrorChanged=e=>{qC(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!qC(i,a)||l!==null&&ew(l.state))return;o=!0;let e=Date.now();for(let[t,n]of QC)n.every(t=>e-t>=XC)&&QC.delete(t);let t=(QC.get(n)??[]).filter(t=>e-t<XC);if(!ZC(t,e)){QC.set(n,t),ut.count(`ok/editor/binding-wedge-rate-capped`,{docName:n}),console.warn(`[binding-staleness-guard] wedge on "${n}" rate-capped (externalSeq=${i}, appliedSeq=${a}) — publication gate stays closed, no further recycle`);return}t.push(e),QC.set(n,t),console.warn(`[binding-staleness-guard] wedged binding on "${n}" — Y→PM apply missing (externalSeq=${i}, appliedSeq=${a})`);try{r({externalSeq:i,appliedSeq:a})}catch(e){o=!1,ut.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==Gt&&$C(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new jr({state:{init:()=>null,apply:e=>(JC(e.getMeta(Gt))&&(a=i,o&&ut.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!qC(i,a)||ew(t)?!0:e.getMeta(Gt)!==void 0,view:e=>{let r=t.doc;return r==null?(ut.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-ydoc`}),console.error(`[binding-staleness-guard] fragment has no Y.Doc for "${n}" — staleness guard disarmed`),{}):(s=!0,l=e,d(e.state),r.off(`beforeObserverCalls`,p),r.on(`beforeObserverCalls`,p),{destroy:()=>{s=!1,l=null,r.off(`beforeObserverCalls`,p)}})}})}function nw(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 rw=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&&Cr(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(Rr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(ri(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ln(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(dr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Vi(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ji(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Gr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Dr(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 mr){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 gi){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():nw(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Hr(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()}},iw=e=>new jr({key:typeof e.pluginKey==`string`?new Zi(e.pluginKey):e.pluginKey,view:t=>new rw({view:t,...e})});ai.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[iw({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 aw=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 Yn(e,{textSerializers:Ki(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Rr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(ri(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ln(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(dr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Vi(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ji(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Gr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Dr(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);Hr({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()}},ow=e=>new jr({key:typeof e.pluginKey==`string`?new Zi(e.pluginKey):e.pluginKey,view:t=>new aw({view:t,...e})});ai.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?[ow({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 sw(e,t){return e??new Zi(t)}var cw=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,lw=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),uw=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(`.`)),dw=new Set([`children`,`className`,`style`]),fw=new Set([`tabIndex`]),pw=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),mw={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function hw(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function gw(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function _w(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||pw.has(e)}function vw(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function yw(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:mw[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function bw(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 xw(e){return fw.has(e)}function Sw(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function Cw(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 ww(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||uw.has(e)?String(t):`${t}px`}function Tw(e,t){lw.has(t)||e.style.removeProperty(vw(t))}function Ew(e,t,n){lw.has(t)||e.style.setProperty(vw(t),ww(t,n))}function Dw(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(dw.has(r)||!_w(r)||hw(r,t[r])||hw(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=gw(r);if(a==null||a===!1){xw(r)&&Cw(e,r),e.removeAttribute(o);return}if(a===!0){xw(r)&&Sw(e,r,!0),e.setAttribute(o,``);return}if(xw(r)){Sw(e,r,a);return}e.setAttribute(o,String(a))})}function Ow(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function kw(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){Tw(e,t);return}Ew(e,t,a)}})}function Aw(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(!hw(t,n))return;let{eventName:i,options:a}=yw(t),o=t=>{n(bw(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function jw(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);cw(()=>{let i=n.current;return Ow(e,i.className,t.className),kw(e,i.style,t.style),Dw(e,i,t),r.current=Aw(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 Mw=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)(sw(e,`bubbleMenu`)).current;jw(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=x(),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=iw({...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,Kc.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)(sw(e,`floatingMenu`)).current;jw(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=x(),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=ow({...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,Kc.createPortal)(s,u.current)});var Nw=[{name:`paragraph`,label:`Text`,icon:Nl,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Tt,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Pe,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:at,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Oe,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:u,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:q,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:z,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:Gl,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function Pw(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Fw},t[0]=n,t[1]=r);let{current:i,activeStates:a}=b(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)(le,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsxs)(sa,{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=Nw.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)($o,{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)(Wo,{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)(jo,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function Fw(e){let t=Object.fromEntries(Nw.map(t=>[t.name,t.isActive(e.editor)]));return{current:Nw.find(e=>t[e.name])??Nw[0],activeStates:t}}function Iw(e){let t=Ut(e.state.selection.content(),e.state.schema);return Et().serialize(t).trim()}function Lw(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function Rw(e){let t=(0,$.c)(15),{editor:n,shortcutEnabled:r}=e,a=r===void 0?!1:r,{_:o}=i(),{openSelection:c}=bc(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=Zn(),t[0]=l):l=t[0];let u=l,d=bh(),f;t[1]!==o||t[2]!==n||t[3]!==c?(f=()=>{let e;try{e=Iw(n)}catch(e){console.error(`Edit with AI: could not read the selection`,e),X.error(o({id:`-RXIMO`}));return}c({docName:kt(n),instruction:``,selectionMarkdown:e})},t[1]=o,t[2]=n,t[3]=c,t[4]=f):f=t[4];let p=f,m,h;if(t[5]!==d||t[6]!==p||t[7]!==a?(m=()=>{if(!u||d)return;let e=e=>{a&&Ws(e,`edit-with-ai`)&&(Lw(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),p()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},h=[u,d,a,p],t[5]=d,t[6]=p,t[7]=a,t[8]=m,t[9]=h):(m=t[8],h=t[9]),(0,Q.useEffect)(m,h),!u||d)return null;let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Aa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[10]=g):g=t[10];let _,v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(ya,{className:`size-3.5`,"aria-hidden":`true`}),v=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`EVnzPs`})}),t[11]=_,t[12]=v):(_=t[11],v=t[12]);let y;return t[13]===p?y=t[14]:(y=(0,Z.jsxs)(Z.Fragment,{children:[g,(0,Z.jsxs)(sa,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:p,children:[_,v]})]}),t[13]=p,t[14]=y),y}function zw(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 Bw(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:Ve(typeof n.src==`string`?n.src:``)}function Vw(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 Hw(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:Uw},t[0]=n,t[1]=a),b(a)===null)return null;let o;t[2]===r?o=t[3]:(o=r({id:`WcWS__`}),t[2]=r,t[3]=o);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault();let t=zw(n);t&&Vw(t,Bw(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Uo,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,"aria-label":o,className:`text-accent-foreground`,onMouseDown:c,children:l})}),t[7]=o,t[8]=c,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ar,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`WcWS__`})}),t[10]=d):d=t[10];let f;return t[11]===u?f=t[12]:(f=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(pr,{children:[u,d]})}),t[11]=u,t[12]=f),f}function Uw(e){return zw(e.editor)}function Ww(e){return zw(e)!==null}function Gw(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function Kw(e){let{from:t,to:n}=e.state.selection,r=!1;return e.state.doc.nodesBetween(t,n,e=>e.type.name===`footnoteReference`?(r=!0,!1):!0),r}function qw(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function Jw(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=i(),a;t[0]===n?a=t[1]:(a={editor:n,selector:Yw},t[0]=n,t[1]=a);let o=b(a),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!Gw(n)||n.state.selection.empty||qw(n)||Kw(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=sr(Ir(n.state.doc)),a=Di(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(a,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=r({id:`sIGbBZ`}),t[5]=r,t[6]=l);let u;t[7]===c?u=t[8]:(u=e=>{e.preventDefault(),c()},t[7]=c,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(xe,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d):d=t[9];let f;t[10]!==o||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":l,onMouseDown:u,disabled:o,children:d})}),t[10]=o,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===r?p=t[15]:(p=r({id:`sIGbBZ`}),t[14]=r,t[15]=p);let m;t[16]===p?m=t[17]:(m=(0,Z.jsx)(Ar,{side:`bottom`,sideOffset:8,children:p}),t[16]=p,t[17]=m);let h;return t[18]!==f||t[19]!==m?(h=(0,Z.jsxs)(pr,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function Yw(e){let t=e.editor;return!!(!Gw(t)||t.state.selection.empty||qw(t)||Kw(t))}var Xw=[{value:`left`,label:`Align left`,icon:ve},{value:`center`,label:`Align center`,icon:he},{value:`right`,label:`Align right`,icon:j}];function Zw(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!tn.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function Qw(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:$w},t[0]=n,t[1]=r);let i=b(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=Xw.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{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(!tn.has(a)||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(mr.create(u.doc,s)),Jt(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Ar,{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 $w(e){return Zw(e.editor)}function eT(e){return Zw(e)!==null}var tT=[{name:`bold`,icon:Gc,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:vl,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:$l,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:Yl,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:Ae,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:gl,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function nT(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:rT},t[0]=n,t[1]=r);let i=b(r),a;t[2]!==i||t[3]!==n?(a=tT.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{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)(Ar,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(D,{"aria-label":Gs(e.shortcutId),children:Us(e.shortcutId)})]})]},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 rT(e){return Object.fromEntries(tT.map(t=>[t.name,t.isActive(e.editor)]))}function iT(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:f,pages:p}=si(),m;t[0]===n?m=t[1]:(m=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=m);let h=m,_;t[2]===n?_=t[3]:(_=n.getAttributes(`link`).href??``,t[2]=n,t[3]=_);let v=_,y;t[4]===n?y=t[5]:(y=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=y);let b=y,x,S;t[6]===n?(x=t[7],S=t[8]):(x=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},S=[n],t[6]=n,t[7]=x,t[8]=S),(0,Q.useEffect)(x,S);let C,T;t[9]===a?(C=t[10],T=t[11]):(C=()=>{a&&requestAnimationFrame(()=>u.current?.focus())},T=[a],t[9]=a,t[10]=C,t[11]=T),(0,Q.useEffect)(C,T);let E;t[12]!==n||t[13]!==h||t[14]!==c?(E=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():h&&n.chain().focus().unsetLink().run(),o(!1)},t[12]=n,t[13]=h,t[14]=c,t[15]=E):E=t[15];let O=E,k;t[16]===n?k=t[17]:(k=function(){n.chain().focus().unsetLink().run(),o(!1)},t[16]=n,t[17]=k);let A=k,j;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(e){l(w(e.path,null))},t[18]=j):j=t[18];let M=j,P;t[19]!==O||t[20]!==n?(P=function(e){e.key===`Enter`&&(e.preventDefault(),O()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[19]=O,t[20]=n,t[21]=P):P=t[21];let F=P;if(a){let e;t[22]===r?e=t[23]:(e=r({id:`ZsGpr_`}),t[22]=r,t[23]=e);let n;t[24]===r?n=t[25]:(n=r({id:`roAe2K`}),t[24]=r,t[25]=n);let i;t[26]!==d||t[27]!==F||t[28]!==f||t[29]!==p||t[30]!==e||t[31]!==n||t[32]!==c?(i=(0,Z.jsx)(lt,{ref:u,type:`text`,placeholder:e,value:c,pages:p,folderPaths:d,loading:f,onValueChange:l,onSuggestionSelect:M,onKeyDown:F,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[26]=d,t[27]=F,t[28]=f,t[29]=p,t[30]=e,t[31]=n,t[32]=c,t[33]=i):i=t[33];let a;t[34]===r?a=t[35]:(a=r({id:`tP5DDk`}),t[34]=r,t[35]=a);let o;t[36]===O?o=t[37]:(o=()=>{O()},t[36]=O,t[37]=o);let m;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(nl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=m):m=t[38];let _;t[39]!==a||t[40]!==o?(_=(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:m}),t[39]=a,t[40]=o,t[41]=_):_=t[41];let y;t[42]!==i||t[43]!==_?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,_]}),t[42]=i,t[43]=_,t[44]=y):y=t[44];let b;t[45]!==r||t[46]!==v||t[47]!==h||t[48]!==A?(b=h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),N(v)},children:(0,Z.jsx)(ms,{className:`size-3.5`})})}),(0,Z.jsx)(Ar,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),A()},children:(0,Z.jsx)(g,{className:`size-3.5`})})}),(0,Z.jsx)(Ar,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[45]=r,t[46]=v,t[47]=h,t[48]=A,t[49]=b):b=t[49];let x;return t[50]!==y||t[51]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[y,b]}),t[50]=y,t[51]=b,t[52]=x):x=t[52],x}let I;t[53]===r?I=t[54]:(I=r({id:`p0Iq25`}),t[53]=r,t[54]=I);let L=h?`bg-accent text-primary`:`text-accent-foreground`,R;t[55]===b?R=t[56]:(R=e=>{e.preventDefault(),l(b()),o(!0)},t[55]=b,t[56]=R);let z;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(bl,{className:`size-3.5`}),t[57]=z):z=t[57];let B;t[58]!==I||t[59]!==L||t[60]!==R?(B=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,"aria-label":I,className:L,onMouseDown:R,children:z})}),t[58]=I,t[59]=L,t[60]=R,t[61]=B):B=t[61];let V;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(s,{id:`yzF66j`}),t[62]=V):V=t[62];let H;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsxs)(Ar,{side:`bottom`,sideOffset:8,children:[V,(0,Z.jsx)(D,{children:Us(`command-palette`)})]}),t[63]=H):H=t[63];let U;return t[64]===B?U=t[65]:(U=(0,Z.jsxs)(pr,{children:[B,H]}),t[64]=B,t[65]=U),U}function aT({editor:e}){if(nt(e.state).query||e.isActive(`codeBlock`))return!1;if(eT(e)||Ww(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 oT(e){let t=(0,$.c)(23),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:dT},t[0]=n,t[1]=l);let u=b(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:uT},t[2]=n,t[3]=d);let f=b(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{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]=p):p=t[6];let m;if(t[7]!==n.view.dom||t[8]!==p){let e={getBoundingClientRect:p,contextElement:n.view.dom};m=()=>{let t=a.current;t&&(c.current?.(),c.current=lr(e,t,()=>{Hr(e,t,{placement:`top`,strategy:`fixed`,middleware:[Ln(8),Rr(),ri({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(lT)}))},t[7]=n.view.dom,t[8]=p,t[9]=m}else m=t[9];let h=m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{c.current?.(),c.current=null,s(cT)},t[10]=g):g=t[10];let _=g,v;t[11]===h?v=t[12]:(v={onShow:h,onHide:_,strategy:`fixed`},t[11]=h,t[12]=v);let y;t[13]!==n||t[14]!==f||t[15]!==u||t[16]!==i||t[17]!==o?(y=u?(0,Z.jsx)(Qw,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(Hw,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pw,{editor:n}),(0,Z.jsx)(Aa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(nT,{editor:n},o),(0,Z.jsx)(Aa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(iT,{editor:n},`${o}-link`),(0,Z.jsx)(Jw,{editor:n},`${o}-footnote`),(0,Z.jsx)(Rw,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[13]=n,t[14]=f,t[15]=u,t[16]=i,t[17]=o,t[18]=y):y=t[18];let x;return t[19]!==n||t[20]!==v||t[21]!==y?(x=(0,Z.jsx)(Mw,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:sT,shouldShow:aT,updateDelay:250,options:v,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:y}),t[19]=n,t[20]=v,t[21]=y,t[22]=x):x=t[22],x}function sT(){return document.body}function cT(e){return e+1}function lT(){}function uT(e){return Ww(e.editor)}function dT(e){return eT(e.editor)}var fT=`application/x-open-knowledge-sidebar-item+json`,pT={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function mT(e){return JSON.stringify(e)}function hT(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:Tr(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:gr(e.assetPath)}:{target:Ii(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:yr(e.docName)}}function gT(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(fT);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!_T(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!vT(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function _T(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vT(e){return typeof e==`string`&&Object.hasOwn(pT,e)}function yT(e,t){return(n,r)=>{let i=r,a=gT(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function bT(e,t){let n=hT(e);t(n.target,{tabBehavior:`append`}),cr(n.hash)}function xT(e){return[...e?[{label:`Toggle header column`,icon:el,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:ga,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:Qo,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:g,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:ml,run:e=>e.chain().focus().deleteTable().run()}]}function ST(e){return[...e?[{label:`Toggle header row`,icon:Xl,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:fe,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:S,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:g,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:ml,run:e=>e.chain().focus().deleteTable().run()}]}function CT(e){if(!e.isEditable||nt(e.state).query)return null;let{state:t,view:n}=e,r=t.selection.$from,i=-1;for(let e=r.depth;e>0;e--){let t=r.node(e).type.spec.tableRole;if(t===`cell`||t===`header_cell`){i=r.before(e);break}}if(i<0)return null;let a=n.nodeDOM(i);if(!(a instanceof HTMLTableCellElement))return null;let o=a.closest(`table`),s=a.closest(`tr`),c=a.closest(`.ProseMirror`);if(!o||!s||!c)return null;let l=Array.prototype.indexOf.call(o.rows,s),u=a.cellIndex,d=o.rows[0]?.cells[u],f=o.rows[l]?.cells[0];return!d||!f?null:{columnAnchor:d,rowAnchor:f,isFirstColumn:u===0,isFirstRow:l===0}}function wT(e){let t=(0,$.c)(22),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==i?(s=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return lr(r,e,()=>{Hr(r,e,{strategy:`absolute`,placement:t,middleware:[Ln(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(TT)})},c=[r,i],t[0]=r,t[1]=i,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l=i===`column`?al:ns,u=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`,d=i===`column`?`Column options`:`Row options`,f;t[4]===l?f=t[5]:(f=(0,Z.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[4]=l,t[5]=f);let p;t[6]!==u||t[7]!==d||t[8]!==f?(p=(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`secondary`,className:u,"aria-label":d,children:f})}),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m=i===`column`?`center`:`start`,h=i===`column`?`bottom`:`right`,g;if(t[10]!==n||t[11]!==a){let e;t[13]===n?e=t[14]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(To,{}),(0,Z.jsxs)($o,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[13]=n,t[14]=e),g=a.map(e),t[10]=n,t[11]=a,t[12]=g}else g=t[12];let _;t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Z.jsx)(Wo,{align:m,side:h,className:`w-auto min-w-44 whitespace-nowrap`,children:g}),t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==_||t[20]!==p?(v=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(jo,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function TT(){}function ET(e){let t=(0,$.c)(18),{editor:n}=e,[r,i]=(0,Q.useState)(null),a,o;if(t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=()=>i(e=>{let t=CT(n);return e&&t&&e.columnAnchor===t.columnAnchor&&e.rowAnchor===t.rowAnchor?e:t});return e(),n.on(`selectionUpdate`,e),n.on(`update`,e),()=>{n.off(`selectionUpdate`,e),n.off(`update`,e)}},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),!r)return null;let s=r.columnAnchor,c;t[3]===r.isFirstColumn?c=t[4]:(c=xT(r.isFirstColumn),t[3]=r.isFirstColumn,t[4]=c);let l;t[5]!==r.columnAnchor||t[6]!==n||t[7]!==c?(l=(0,Z.jsx)(wT,{editor:n,anchor:s,axis:`column`,items:c}),t[5]=r.columnAnchor,t[6]=n,t[7]=c,t[8]=l):l=t[8];let u=r.rowAnchor,d;t[9]===r.isFirstRow?d=t[10]:(d=ST(r.isFirstRow),t[9]=r.isFirstRow,t[10]=d);let f;t[11]!==r.rowAnchor||t[12]!==n||t[13]!==d?(f=(0,Z.jsx)(wT,{editor:n,anchor:u,axis:`row`,items:d}),t[11]=r.rowAnchor,t[12]=n,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{className:`ok-table-cell-handle-layer`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function DT(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=Gt.getState(e.state)?.binding;if(!t){ut.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){ut.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}ut.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return ai.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new jr({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var OT=new WeakMap;function kT(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=ni(e.color),n.textContent=e.name,t.append(n),t}var AT={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},jT=100,MT=100,NT=3,PT=250;function FT(){let e=new Vr({extensions:ti});return{mdManager:e,text:qe({mdManager:e}),html:l({mdManager:e}),paste:Ft({mdManager:e}),drop:St({mdManager:e})}}function IT(e,t){return t?{collaboration:ot.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[DT({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:ot.configure({document:e.document}),guard:[]}}function LT(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=IT(t,r);return[...Dt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),zC.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,ai.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[We]}}),ai.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[pt(e,{cursorBuilder:kT})]}}),ai.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[tw({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o]}function RT(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{OT.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=OT.get(e);if(OT.delete(e),r==null)return;let i=performance.now();ut(`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:yT(n.drop,e.onSidebarDrop)},extensions:vp(LT(e))}}function zT(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=RT({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:c,onWedged:a,onSidebarDrop:o}),u=l.onBeforeCreate;return{...l,onBeforeCreate:e=>{u?.(e);let{editor:t}=e,{doc:n,mapping:r}=ze(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var BT=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(AT),c=GC(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=yt(),p=n.configuration.name??``,[m]=(0,Q.useState)(FT),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new yi(zT({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;ut(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{bT(e,f)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=m,t[1]=p,t[2]=f,t[3]=r,t[4]=n,t[5]=d,t[6]=h):h=t[6];let[g]=(0,Q.useState)(h),_,v;if(t[7]!==g||t[8]!==p||t[9]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=ce(p)??crypto.randomUUID();_=Q.use,v=E({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{dt(y)},S=[y],t[12]=y,t[13]=x,t[14]=S),(0,Q.useEffect)(x,S);let C;return t[15]!==u||t[16]!==p||t[17]!==b||t[18]!==c||t[19]!==i||t[20]!==a||t[21]!==l||t[22]!==n?(C=(0,Z.jsx)(VT,{provider:n,isSourceMode:i,docName:p,activeDocName:u,identity:c,principal:l,editor:b,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[15]=u,t[16]=p,t[17]=b,t[18]=c,t[19]=i,t[20]=a,t[21]=l,t[22]=n,t[23]=C):C=t[23],C},VT=e=>{let t=(0,$.c)(93),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),p,h;t[0]===d?(p=t[1],h=t[2]):(p=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},h=[d],t[0]=d,t[1]=p,t[2]=h),(0,Q.useLayoutEffect)(p,h);let g;t[3]!==c||t[4]!==n.configuration.name?(g=()=>(vt(c,n.configuration.name??null),()=>{vt(c,null)}),t[3]=c,t[4]=n.configuration.name,t[5]=g):g=t[5];let _;t[6]!==c||t[7]!==n?(_=[c,n],t[6]=c,t[7]=n,t[8]=_):_=t[8],(0,Q.useEffect)(g,_);let v;t[9]!==c||t[10]!==n.configuration.name?(v=()=>{let e=n.configuration.name;if(e)return ye(e,c),()=>ge(e,c)},t[9]=c,t[10]=n.configuration.name,t[11]=v):v=t[11];let y;t[12]!==c||t[13]!==n?(y=[c,n],t[12]=c,t[13]=n,t[14]=y):y=t[14],(0,Q.useEffect)(v,y);let b;t[15]!==c||t[16]!==n.configuration.name?(b=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,vc(e,`wysiwyg`,xc(c))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),vc(e,`wysiwyg`,null)}},t[15]=c,t[16]=n.configuration.name,t[17]=b):b=t[17];let x;t[18]!==c||t[19]!==n?(x=[c,n],t[18]=c,t[19]=n,t[20]=x):x=t[20],(0,Q.useEffect)(b,x);let S;t[21]!==c||t[22]!==n.configuration.name?(S=()=>{},t[21]=c,t[22]=n.configuration.name,t[23]=S):S=t[23];let w;t[24]!==c||t[25]!==n?(w=[c,n],t[24]=c,t[25]=n,t[26]=w):w=t[26],(0,Q.useEffect)(S,w);let T,E;t[27]===c?(T=t[28],E=t[29]):(T=()=>{let e=HT,t=null,n=()=>{if(t||c.isDestroyed)return;let n=_e(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 _e(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},E=[c],t[27]=c,t[28]=T,t[29]=E),(0,Q.useEffect)(T,E);let D,O;t[30]!==i||t[31]!==c?(D=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!_e(c))return;e=!0;let t=m(i)?.selection??null;if(t)try{let e=c.state.doc.content.size;if(t.type===`text`){let n=Math.max(0,Math.min(t.anchor,e)),r=Math.max(0,Math.min(t.head,e));c.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));c.commands.setNodeSelection(n)}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(JSON.stringify({event:`ok-editor-selection-restore-failed`,docName:i,message:n})),ut(`ok/editor/selection-restore-failed`,{docName:i,message:n})}C(i)};if(_e(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},O=[c,i],t[30]=i,t[31]=c,t[32]=D,t[33]=O):(D=t[32],O=t[33]),(0,Q.useEffect)(D,O);let k,A;t[34]!==u||t[35]!==n.document||t[36]!==l?(k=()=>{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)},ar)};c(AT);let f=()=>{if(Ci(e),!Ai(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`?Ai(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)}},A=[n.document,u,l],t[34]=u,t[35]=n.document,t[36]=l,t[37]=k,t[38]=A):(k=t[37],A=t[38]),(0,Q.useEffect)(k,A);let j,M;t[39]!==a||t[40]!==i||t[41]!==c||t[42]!==n?(j=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<jT){e+=1,t=window.setTimeout(p,MT);return}r=null,o=null,e=0},u=function(e){let t=_e(c);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},d=function(e){let t=u(e);return t?(t.scrollIntoView({behavior:`smooth`,block:`start`}),!0):!1},f=function(e,n){let r=NT,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,PT)))};t=window.setTimeout(o,PT)};function p(){if(!r||i!==a)return;let t=r,n=o;if(!n){l();return}d(t)?(s=n,r=null,o=null,e=0,f(t,n)):l()}let m=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=Xn(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},M=[n,c,i,a],t[39]=a,t[40]=i,t[41]=c,t[42]=n,t[43]=j,t[44]=M):(j=t[43],M=t[44]),(0,Q.useEffect)(j,M);let N,P;t[45]===c?(N=t[46],P=t[47]):(N=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=_e(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(hc,e),()=>window.removeEventListener(hc,e)},P=[c],t[45]=c,t[46]=N,t[47]=P),(0,Q.useEffect)(N,P);let F;t[48]!==a||t[49]!==i||t[50]!==o||t[51]!==r||t[52]!==s||t[53]!==n.awareness?(F=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:KC({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[48]=a,t[49]=i,t[50]=o,t[51]=r,t[52]=s,t[53]=n.awareness,t[54]=F):F=t[54];let I;t[55]!==a||t[56]!==i||t[57]!==o||t[58]!==r||t[59]!==s||t[60]!==n?(I=[n,i,a,o,s,r],t[55]=a,t[56]=i,t[57]=o,t[58]=r,t[59]=s,t[60]=n,t[61]=I):I=t[61],(0,Q.useEffect)(F,I);let L,R;t[62]!==c||t[63]!==r?(L=()=>(wt(c,r),()=>{wt(c,!1)}),R=[c,r],t[62]=c,t[63]=r,t[64]=L,t[65]=R):(L=t[64],R=t[65]),(0,Q.useEffect)(L,R);let z;t[66]!==a||t[67]!==i||t[68]!==c||t[69]!==r?(z=!r&&(0,Z.jsx)(oT,{editor:c,shortcutEnabled:i===a}),t[66]=a,t[67]=i,t[68]=c,t[69]=r,t[70]=z):z=t[70];let B;t[71]!==c||t[72]!==r?(B=!r&&(0,Z.jsx)(ET,{editor:c}),t[71]=c,t[72]=r,t[73]=B):B=t[73];let V;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[74]=V):V=t[74];let H;t[75]===c?H=t[76]:(H=(0,Z.jsx)(Xt,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[75]=c,t[76]=H);let U;t[77]!==d||t[78]!==H?(U=(0,Kc.createPortal)(H,d),t[77]=d,t[78]=H,t[79]=U):U=t[79];let ee;t[80]===c?ee=t[81]:(ee=(0,Z.jsx)(UC,{editor:c}),t[80]=c,t[81]=ee);let te;t[82]===c?te=t[83]:(te=ht(c),t[82]=c,t[83]=te);let W;t[84]===te.store?W=t[85]:(W=(0,Z.jsx)(qt,{store:te.store}),t[84]=te.store,t[85]=W);let ne;return t[86]!==z||t[87]!==B||t[88]!==U||t[89]!==ee||t[90]!==W||t[91]!==l?(ne=(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:[z,B,V,U,ee,W]}),t[86]=z,t[87]=B,t[88]=U,t[89]=ee,t[90]=W,t[91]=l,t[92]=ne):ne=t[92],ne};function HT(){return A()}var UT=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function WT(e,t,n,r,i,a){if(e==r)return[];let o=eE(e,t,n,r,i,a),s=tE(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new UT(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new UT(t,t+o,i,i),new UT(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new UT(t,t,i,i+o),new UT(n,n,i+o+c,a)]}if(c==1||l==1)return[new UT(t,n,i,a)];let u=rE(e,t,n,r,i,a);if(u){let[o,s,c]=u;return WT(e,t,o,r,i,s).concat(WT(e,o+c,n,r,s+c,a))}return JT(e,t,n,r,i,a)}var GT=1e9,KT=0,qT=!1;function JT(e,t,n,r,i,a){let o=n-t,s=a-i;if(GT<1e9&&Math.min(o,s)>GT*16||KT>0&&Date.now()>KT)return Math.min(o,s)>GT*64?[new UT(t,n,i,a)]:iE(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);XT.reset(c),ZT.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:ZT,f=d?null:XT;for(let p=0;p<c;p++){if(p>GT||KT>0&&!(p&63)&&Date.now()>KT)return iE(e,t,n,r,i,a);let m=XT.advance(p,o,s,c,d,!1,l)||ZT.advance(p,o,s,c,f,!0,u);if(m)return QT(e,t,n,t+m[0],r,i,a,i+m[1])}return[new UT(t,n,i,a)]}var YT=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},XT=new YT,ZT=new YT;function QT(e,t,n,r,i,a,o,s){let c=!1;return!yE(e,r)&&++r==n&&(c=!0),!yE(i,s)&&++s==o&&(c=!0),c?[new UT(t,n,a,o)]:WT(e,t,r,i,a,s).concat(WT(e,r,n,i,s,o))}function $T(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function eE(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=$T(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!yE(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function tE(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=$T(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!yE(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function nE(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){yE(e,s)||s++;let u=s+o;if(yE(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=eE(e,u,n,r,i+f+d.length,a),c=tE(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function rE(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=rE(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:nE(e,t,n,r,i,a,Math.floor(o/4),-1)}function iE(e,t,n,r,i,a){qT=!0;let o=n-t,s=a-i,c;if(o<s){let s=nE(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=nE(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new UT(t,n,i,a)];let[l,u,d]=c;return WT(e,t,l,r,i,u).concat(WT(e,l+d,n,r,u+d,a))}function aE(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new UT(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function oE(e,t,n){for(;;){aE(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=eE(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new UT(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=tE(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new UT(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new UT(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new UT(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function sE(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=mE(t,a.fromA,l),f=pE(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new UT(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=pE(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new UT(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=mE(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new UT(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=gE(n,a.fromB,a.toB),r,o=t<0?-1:hE(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=gE(t,a.fromA,a.toA),r,o=n<0?-1:hE(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return aE(e,3),e}var cE;try{cE=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function lE(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function uE(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!lE(n):cE?!_E(n)||t==e.length-1?+!!cE.test(String.fromCharCode(n)):cE.test(e.slice(t,t+2))?2:0:0}function dE(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!lE(n):cE?!vE(n)||t==1?+!!cE.test(String.fromCharCode(n)):cE.test(e.slice(t-2,t))?2:0:0}var fE=8;function pE(e,t,n){if(t==e.length||!dE(e,t))return t;for(let r=t,i=t+n,a=0;a<fE;a++){let t=uE(e,r);if(!t||r+t>i)return r;r+=t}return t}function mE(e,t,n){if(!t||!uE(e,t))return t;for(let r=t,i=t-n,a=0;a<fE;a++){let t=dE(e,r);if(!t||r-t<i)return r;r-=t}return t}function hE(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function gE(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var _E=e=>e>=55296&&e<=56319,vE=e=>e>=56320&&e<=57343;function yE(e,t){return!t||t==e.length||!_E(e.charCodeAt(t-1))||!vE(e.charCodeAt(t))}function bE(e,t,n){let r=n?.override;return r?r(e,t):(GT=(n?.scanLimit??1e9)>>1,KT=n?.timeout?Date.now()+n.timeout:0,qT=!1,oE(e,t,WT(e,0,e.length,t,0,t.length)))}function xE(){return!qT}function SE(e,t,n){return sE(bE(e,t,n),e,t)}var CE=tc.define({combine:e=>e[0]}),wE=nc.define(),TE=tc.define(),EE=Xs.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(wE)&&(e=n.value);for(let n of t.state.facet(TE))e=n(e,t);return e}});function DE(e){let t=e.field(EE,!1);if(!t)return null;let n=e.facet(CE);return{chunks:t,side:n?n.side:null}}var OE=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return jE(SE(e.toString(),t.toString(),n),e,t,0,0,xE())}static updateA(e,t,n,r,i){return FE(PE(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return FE(PE(e,r,!1,t.length),e,t,n,i)}};function kE(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function AE(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function jE(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=kE(c.fromA+r,c.fromB+i,t,n),[d,f]=AE(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=kE(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=AE(a.toA+r,a.toB+i,t,n),s++}o.push(new OE(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var ME=1e3;function NE(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function PE(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>ME&&([l,d]=NE(e,a-ME,n,!0)),o<t.length-ME&&([u,f]=NE(e,o+ME,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function FE(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=SE(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of jE(h,n,r,d,f,xE()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var IE={scanLimit:500},LE=rc.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=qE(e))}update(e){(e.docChanged||e.viewportChanged||zE(e.startState,e.state)||BE(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=qE(e.view))}},{decorations:e=>e.deco}),RE=qs.low(sc({class:`cm-changeGutter`,markers:e=>e.plugin(LE)?.gutter||uc.empty}));function zE(e,t){return e.field(EE,!1)!=t.field(EE,!1)}function BE(e,t){return e.facet(CE)!=t.facet(CE)}var VE=$s.line({class:`cm-changedLine`}),HE=$s.mark({class:`cm-changedText`}),UE=$s.mark({tagName:`ins`,class:`cm-insertedLine`}),WE=$s.mark({tagName:`del`,class:`cm-deletedLine`}),GE=new class extends oc{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function KE(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,VE),i.add(o,s,n?WE:UE),a&&a.add(o,o,GE);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,VE),a&&a.add(u,u,GE);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,HE),s<t)c++;else break}u=t}}}function qE(e){let t=e.state.field(EE),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(CE),o=n==`a`,s=new ec,c=i?new ec:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&KE(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var JE=class extends Ks{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},YE=nc.define({map:(e,t)=>e.map(t)}),XE=Xs.define({create:()=>$s.none,update:(e,t)=>{for(let e of t.effects)if(e.is(YE))return e.value;return e.map(t.changes)},provide:e=>ac.decorations.from(e)}),ZE=.01;function QE(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function $E(e,t,n){let r=new ec,i=new ec,a=e.state.field(XE).iter(),o=t.state.field(XE).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-ZE?(l-=n,r.add(s,s,$s.widget({widget:new JE(-n),block:!0,side:-1}))):n>ZE&&(u+=n,i.add(c,c,$s.widget({widget:new JE(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<ZE?r.add(e.state.doc.length,e.state.doc.length,$s.widget({widget:new JE(-p),block:!0,side:1})):p>ZE&&i.add(t.state.doc.length,t.state.doc.length,$s.widget({widget:new JE(p),block:!0,side:1}));let m=r.finish(),h=i.finish();QE(m,e.state.field(XE))||e.dispatch({effects:YE.of(m)}),QE(h,t.state.field(XE))||t.dispatch({effects:YE.of(h)})}var eD=nc.define({map:(e,t)=>t.mapPos(e)}),tD=class extends Ks{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:eD.of(n)});let{side:r,sibling:i}=e.state.facet(CE);i&&i().dispatch({effects:eD.of(nD(n,e.state.field(EE),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function nD(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var rD=Xs.define({create(e){return $s.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(eD)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>ac.decorations.from(e)});function iD({margin:e=3,minSize:t=4}){return rD.init(n=>aD(n,e,t))}function aD(e,t,n){let r=new ec,i=e.facet(CE).side==`a`,a=e.field(EE),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,$s.replace({widget:new tD(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var oD=ac.styleModule.of(new cc({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),sD=ac.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),cD=new ic,lD=new ic,uD=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||IE;let t=[qs.low(LE),sD,oD,XE,ac.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(YE)))&&this.measure()})],n=[CE.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(RE);let r=Ys.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],ac.editorAttributes.of({class:`cm-merge-a`}),lD.of(n),t]}),i=[CE.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(RE);let a=Ys.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],ac.editorAttributes.of({class:`cm-merge-b`}),lD.of(i),t]});this.chunks=OE.build(r.doc,a.doc,this.diffConf);let o=[EE.init(()=>this.chunks),cD.of(e.collapseUnchanged?iD(e.collapseUnchanged):[])];r=r.update({effects:nc.appendConfig.of(o)}).state,a=a.update({effects:nc.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new ac({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new ac({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),Js.empty(e[0].startState.doc.length));this.chunks=t==this.a?OE.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):OE.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:wE.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:wE.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(CE),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(lD.reconfigure([CE.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?RE:[]])),a.push(lD.reconfigure([CE.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?RE:[]]))}if(r){let t=cD.reconfigure(e.collapseUnchanged?iD(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){$E(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=dD(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=dD(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function dD(e){let t=e.nextSibling;return e.remove(),t}var fD=new class extends oc{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},pD=qs.low(sc({class:`cm-changeGutter`,markers:e=>e.plugin(LE)?.gutter||uc.empty,widgetMarker:(e,t)=>t instanceof vD?fD:null}));function mD(e){let t=typeof e.original==`string`?Qs.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||IE;return[qs.low(LE),CD,sD,ac.editorAttributes.of({class:`cm-merge-b`}),TE.of((e,t)=>{let r=t.effects.find(e=>e.is(hD));return r&&(e=OE.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=OE.updateB(e,t.state.field(gD),t.newDoc,t.changes,n)),e}),CE.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?kD:void 0,side:`b`}),gD.init(()=>t),e.gutter===!1?[]:pD,e.collapseUnchanged?iD(e.collapseUnchanged):[],EE.init(e=>OE.build(t,e.doc,n))]}var hD=nc.define(),gD=Xs.define({create:()=>Qs.empty,update(e,t){for(let n of t.effects)n.is(hD)&&(e=n.value.doc);return e}}),_D=new WeakMap,vD=class extends Ks{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function yD(e,t,n){let r=_D.get(t.changes);if(r)return r;let i=$s.widget({block:!0,side:-1,widget:new vD(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(CE),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),bD(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),xD(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(gD).sliceString(t.fromA,t.endA),u=a&&e.facet(dc),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
26
+ `)?null:i}function oC(e){let t=nt(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function sC(e,t){return e.current===t.current&&e.total===t.total}function cC(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(eC)}function lC(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=_e(e);if(!t)return;let n=t.dom.querySelector(`.ok-find-match-active`);n instanceof HTMLElement&&n.scrollIntoView({block:`center`,inline:`nearest`,behavior:`auto`})})}function uC(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=rC(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useRef)(n),c=(0,Q.useRef)(0),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={open:!1,replaceOpen:!1,query:``,replacement:``,caseSensitive:!1,wholeWord:!1,activeIndex:0},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(eC),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(fC))},h=[n],t[1]=n,t[2]=m,t[3]=h),(0,Q.useEffect)(m,h);let g,_;t[4]===u.activeIndex?(g=t[5],_=t[6]):(g=()=>{c.current=u.activeIndex},_=[u.activeIndex],t[4]=u.activeIndex,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v,y;t[7]===i?(v=t[8],y=t[9]):(v=()=>{let e=o.current;e&&e!==i&&!e.isDestroyed&&e.commands.clearFindMatches(),o.current=i},y=[i],t[7]=i,t[8]=v,t[9]=y),(0,Q.useEffect)(v,y);let b,x;t[10]===u.open?(b=t[11],x=t[12]):(b=()=>{if(!u.open||!a.current)return;let e=requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()});return()=>cancelAnimationFrame(e)},x=[u.open],t[10]=u.open,t[11]=b,t[12]=x),(0,Q.useEffect)(b,x);let S,C;t[13]!==u.open||t[14]!==r?(S=()=>{!u.open||!r||d(dC)},C=[u.open,r],t[13]=u.open,t[14]=r,t[15]=S,t[16]=C):(S=t[15],C=t[16]),(0,Q.useEffect)(S,C);let w,T;t[17]!==i||t[18]!==u.caseSensitive||t[19]!==u.open||t[20]!==u.query||t[21]!==u.wholeWord||t[22]!==r?(w=()=>{if(!i||i.isDestroyed){p(eC);return}if(!u.open||r){i.commands.clearFindMatches(),p(eC);return}let e=window.setTimeout(()=>{if(i.isDestroyed)return;i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current});let e=oC(i);p(t=>sC(t,e)?t:e)},nC);return()=>window.clearTimeout(e)},T=[i,u.open,u.query,u.caseSensitive,u.wholeWord,r],t[17]=i,t[18]=u.caseSensitive,t[19]=u.open,t[20]=u.query,t[21]=u.wholeWord,t[22]=r,t[23]=w,t[24]=T):(w=t[23],T=t[24]),(0,Q.useEffect)(w,T);let E,D;t[25]!==i||t[26]!==u.open||t[27]!==r?(E=()=>{if(!i||i.isDestroyed||!u.open||r)return;let e=()=>{let e=nt(i.state),t=oC(i);p(e=>sC(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},D=[i,u.open,r],t[25]=i,t[26]=u.open,t[27]=r,t[28]=E,t[29]=D):(E=t[28],D=t[29]),(0,Q.useEffect)(E,D);let O,k;t[30]!==n||t[31]!==i||t[32]!==u.open||t[33]!==r?(O=()=>{let e=function(e){let t=aC(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(Ws(t,`find`)){t.preventDefault(),u.open?cC(i,d,p):e(!1);return}if(Ws(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=Ws(t,`find-next`),n=Ws(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&lC(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),cC(i,d,p))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},k=[n,i,u.open,r],t[30]=n,t[31]=i,t[32]=u.open,t[33]=r,t[34]=O,t[35]=k):(O=t[34],k=t[35]),(0,Q.useEffect)(O,k);let A;t[36]!==i||t[37]!==u.caseSensitive||t[38]!==u.query||t[39]!==u.wholeWord?(A=function(){return!i||i.isDestroyed?!1:(i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current}),!0)},t[36]=i,t[37]=u.caseSensitive,t[38]=u.query,t[39]=u.wholeWord,t[40]=A):A=t[40];let j=A,M;t[41]===i?M=t[42]:(M=function(){if(!i||i.isDestroyed)return;let e=nt(i.state),t=oC(i);p(e=>sC(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=M);let N=M,P;t[43]===i?P=t[44]:(P=function(){cC(i,d,p)},t[43]=i,t[44]=P);let F=P,I;t[45]!==j||t[46]!==i||t[47]!==N?(I=function(){!i||i.isDestroyed||(j(),i.commands.selectNextFindMatch()&&lC(i),N())},t[45]=j,t[46]=i,t[47]=N,t[48]=I):I=t[48];let L=I,R;t[49]!==j||t[50]!==i||t[51]!==N?(R=function(){!i||i.isDestroyed||(j(),i.commands.selectPreviousFindMatch()&&lC(i),N())},t[49]=j,t[50]=i,t[51]=N,t[52]=R):R=t[52];let z=R,B;t[53]!==j||t[54]!==i||t[55]!==u.replacement||t[56]!==N?(B=function(){!i||i.isDestroyed||(j(),i.commands.replaceCurrentFindMatch(u.replacement)&&lC(i),N())},t[53]=j,t[54]=i,t[55]=u.replacement,t[56]=N,t[57]=B):B=t[57];let V=B,H;t[58]!==j||t[59]!==i||t[60]!==u.replacement||t[61]!==N?(H=function(){!i||i.isDestroyed||(j(),i.commands.replaceAllFindMatches(u.replacement)&&lC(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let ee,te,W,ne,re;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>d(t=>({...t,query:e,activeIndex:0})),te=e=>d(t=>({...t,replacement:e})),W=e=>d(t=>({...t,replaceOpen:e})),ne=e=>d(t=>({...t,caseSensitive:e})),re=e=>d(t=>({...t,wholeWord:e})),t[63]=ee,t[64]=te,t[65]=W,t[66]=ne,t[67]=re):(ee=t[63],te=t[64],W=t[65],ne=t[66],re=t[67]);let G;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(G=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)($S,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:ee,onReplacementChange:te,onReplaceOpenChange:W,onCaseSensitiveChange:ne,onWholeWordChange:re,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=G):G=t[80],G}function dC(e){return{...e,open:!1,activeIndex:0}}function fC(e){return{...e,activeIndex:0}}var pC=300;function mC(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(mc),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(mc);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(yc(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,pC)};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 hC(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function gC(e){let t=(0,$.c)(8),{poolEntries:n}=yt(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>hC(i),t[3]=i,t[4]=a);let[o,s]=(0,Q.useState)(a),c,l;return t[5]===i?(c=t[6],l=t[7]):(c=()=>{if(!i){s(null);return}let e=i.document.getMap(`lifecycle`);s(hC(i));let t=()=>s(hC(i));return e.observe(t),()=>{e.unobserve(t)}},l=[i],t[5]=i,t[6]=c,t[7]=l),(0,Q.useEffect)(c,l),o}function _C(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Sc(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Cc,r)}var vC=`ok-doc-panel-width-v1`;function yC(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function bC(e){try{let t=(e??localStorage).getItem(vC);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?yC(n):320}catch{return 320}}function xC(e,t){try{(t??localStorage).setItem(vC,String(yC(e)))}catch{}}function SC(){try{return typeof localStorage>`u`?320:bC()}catch{return 320}}var CC=1024,wC=1280,TC={left:CC,right:wC};function EC(e,t,n){return e==null?t>=TC[n]?`above`:`below`:`embedded`}function DC(e){return e===`above`?`open`:`collapsed`}var OC=`ok-sidebar-pins-v2`;function kC(e){return e===`open`||e===`collapsed`}function AC(e){return e===`above`||e===`below`||e===`embedded`}function jC(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!AC(e)||!kC(t[e]))return!1;return!0}function MC(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return jC(n.left)&&(r.left=n.left),jC(n.right)&&(r.right=n.right),r}function NC(e){try{let t=(e??localStorage).getItem(OC);return t==null?{}:MC(t)}catch{return{}}}function PC(e,t){try{t.setItem(OC,JSON.stringify(e))}catch{}}function FC(e,t,n){return n[e]?.[t]??DC(t)}function IC(e,t,n,r){let i=r??localStorage,a=NC(i);return a[e]={...a[e],[t]:n},PC(a,i),a}function LC(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`?RC: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 RC(e){return e===`synced`?`synced`:`connected`}var zC=Qr;function BC(e,t={}){let n=J(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var VC=200,HC=`Outside any block`;function UC(e){let t=(0,$.c)(5),{editor:n}=e,r=Ie(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?WC(n,r):o.current?HC:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},VC),()=>{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 WC(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=BC(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=BC(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 GC(){let[e]=(0,Q.useState)(ei);return e}function KC({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:$r(e.display_name),color:Lr(e.id,qn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Lr(e.id,qn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function qC(e,t){return e>t}function JC(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.isChangeOrigin===!0?!0:`snapshot`in t&&`prevSnapshot`in t&&t.snapshot===null&&t.prevSnapshot===null}var YC=3,XC=6e4;function ZC(e,t){let n=0;for(let r of e)t-r<XC&&(n+=1);return n<YC}var QC=new Map;function $C(e,t){for(let n of e.changed.keys()){let e=n;for(;e!=null;){if(e===t)return!0;let n=e._item;e=n==null?null:n.parent}}return!1}function ew(e){let t=Gt.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function tw(e){let{fragment:t,docName:n,onWedged:r}=e,i=0,a=0,o=!1,s=!1,c=!1,l=null,u=new WeakSet,d=e=>{let t=Gt.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){ut.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-prosemirror-changed`}),console.warn(`[binding-staleness-guard] ySync binding on "${n}" exposes no _prosemirrorChanged — write-back gate disarmed (vendored y-tiptap contract change?)`);return}if(u.has(t))return;u.add(t);let r=t._prosemirrorChanged.bind(t);t._prosemirrorChanged=e=>{qC(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!qC(i,a)||l!==null&&ew(l.state))return;o=!0;let e=Date.now();for(let[t,n]of QC)n.every(t=>e-t>=XC)&&QC.delete(t);let t=(QC.get(n)??[]).filter(t=>e-t<XC);if(!ZC(t,e)){QC.set(n,t),ut.count(`ok/editor/binding-wedge-rate-capped`,{docName:n}),console.warn(`[binding-staleness-guard] wedge on "${n}" rate-capped (externalSeq=${i}, appliedSeq=${a}) — publication gate stays closed, no further recycle`);return}t.push(e),QC.set(n,t),console.warn(`[binding-staleness-guard] wedged binding on "${n}" — Y→PM apply missing (externalSeq=${i}, appliedSeq=${a})`);try{r({externalSeq:i,appliedSeq:a})}catch(e){o=!1,ut.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==Gt&&$C(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new jr({state:{init:()=>null,apply:e=>(JC(e.getMeta(Gt))&&(a=i,o&&ut.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!qC(i,a)||ew(t)?!0:e.getMeta(Gt)!==void 0,view:e=>{let r=t.doc;return r==null?(ut.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-ydoc`}),console.error(`[binding-staleness-guard] fragment has no Y.Doc for "${n}" — staleness guard disarmed`),{}):(s=!0,l=e,d(e.state),r.off(`beforeObserverCalls`,p),r.on(`beforeObserverCalls`,p),{destroy:()=>{s=!1,l=null,r.off(`beforeObserverCalls`,p)}})}})}function nw(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 rw=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&&Cr(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(Rr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(ri(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ln(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(dr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Vi(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ji(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Gr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Dr(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 mr){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 gi){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():nw(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Hr(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()}},iw=e=>new jr({key:typeof e.pluginKey==`string`?new Zi(e.pluginKey):e.pluginKey,view:t=>new rw({view:t,...e})});ai.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[iw({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 aw=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 Yn(e,{textSerializers:Ki(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Rr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(ri(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ln(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(dr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Vi(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ji(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Gr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Dr(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);Hr({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()}},ow=e=>new jr({key:typeof e.pluginKey==`string`?new Zi(e.pluginKey):e.pluginKey,view:t=>new aw({view:t,...e})});ai.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?[ow({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 sw(e,t){return e??new Zi(t)}var cw=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,lw=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),uw=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(`.`)),dw=new Set([`children`,`className`,`style`]),fw=new Set([`tabIndex`]),pw=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),mw={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function hw(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function gw(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function _w(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||pw.has(e)}function vw(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function yw(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:mw[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function bw(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 xw(e){return fw.has(e)}function Sw(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function Cw(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 ww(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||uw.has(e)?String(t):`${t}px`}function Tw(e,t){lw.has(t)||e.style.removeProperty(vw(t))}function Ew(e,t,n){lw.has(t)||e.style.setProperty(vw(t),ww(t,n))}function Dw(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(dw.has(r)||!_w(r)||hw(r,t[r])||hw(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=gw(r);if(a==null||a===!1){xw(r)&&Cw(e,r),e.removeAttribute(o);return}if(a===!0){xw(r)&&Sw(e,r,!0),e.setAttribute(o,``);return}if(xw(r)){Sw(e,r,a);return}e.setAttribute(o,String(a))})}function Ow(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function kw(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){Tw(e,t);return}Ew(e,t,a)}})}function Aw(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(!hw(t,n))return;let{eventName:i,options:a}=yw(t),o=t=>{n(bw(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function jw(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);cw(()=>{let i=n.current;return Ow(e,i.className,t.className),kw(e,i.style,t.style),Dw(e,i,t),r.current=Aw(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 Mw=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)(sw(e,`bubbleMenu`)).current;jw(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=x(),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=iw({...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,Kc.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)(sw(e,`floatingMenu`)).current;jw(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=x(),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=ow({...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,Kc.createPortal)(s,u.current)});var Nw=[{name:`paragraph`,label:`Text`,icon:Nl,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Tt,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Pe,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:at,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Oe,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:u,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:q,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:z,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:Gl,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function Pw(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Fw},t[0]=n,t[1]=r);let{current:i,activeStates:a}=b(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)(le,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsxs)(sa,{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=Nw.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)($o,{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)(Wo,{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)(jo,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function Fw(e){let t=Object.fromEntries(Nw.map(t=>[t.name,t.isActive(e.editor)]));return{current:Nw.find(e=>t[e.name])??Nw[0],activeStates:t}}function Iw(e){let t=Ut(e.state.selection.content(),e.state.schema);return Et().serialize(t).trim()}function Lw(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function Rw(e){let t=(0,$.c)(15),{editor:n,shortcutEnabled:r}=e,a=r===void 0?!1:r,{_:o}=i(),{openSelection:c}=bc(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=Zn(),t[0]=l):l=t[0];let u=l,d=bh(),f;t[1]!==o||t[2]!==n||t[3]!==c?(f=()=>{let e;try{e=Iw(n)}catch(e){console.error(`Edit with AI: could not read the selection`,e),X.error(o({id:`-RXIMO`}));return}c({docName:kt(n),instruction:``,selectionMarkdown:e})},t[1]=o,t[2]=n,t[3]=c,t[4]=f):f=t[4];let p=f,m,h;if(t[5]!==d||t[6]!==p||t[7]!==a?(m=()=>{if(!u||d)return;let e=e=>{a&&Ws(e,`edit-with-ai`)&&(Lw(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),p()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},h=[u,d,a,p],t[5]=d,t[6]=p,t[7]=a,t[8]=m,t[9]=h):(m=t[8],h=t[9]),(0,Q.useEffect)(m,h),!u||d)return null;let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Aa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[10]=g):g=t[10];let _,v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(ya,{className:`size-3.5`,"aria-hidden":`true`}),v=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`EVnzPs`})}),t[11]=_,t[12]=v):(_=t[11],v=t[12]);let y;return t[13]===p?y=t[14]:(y=(0,Z.jsxs)(Z.Fragment,{children:[g,(0,Z.jsxs)(sa,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:p,children:[_,v]})]}),t[13]=p,t[14]=y),y}function zw(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 Bw(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:Ve(typeof n.src==`string`?n.src:``)}function Vw(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 Hw(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:Uw},t[0]=n,t[1]=a),b(a)===null)return null;let o;t[2]===r?o=t[3]:(o=r({id:`WcWS__`}),t[2]=r,t[3]=o);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault();let t=zw(n);t&&Vw(t,Bw(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Uo,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,"aria-label":o,className:`text-accent-foreground`,onMouseDown:c,children:l})}),t[7]=o,t[8]=c,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ar,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`WcWS__`})}),t[10]=d):d=t[10];let f;return t[11]===u?f=t[12]:(f=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(pr,{children:[u,d]})}),t[11]=u,t[12]=f),f}function Uw(e){return zw(e.editor)}function Ww(e){return zw(e)!==null}function Gw(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function Kw(e){let{from:t,to:n}=e.state.selection,r=!1;return e.state.doc.nodesBetween(t,n,e=>e.type.name===`footnoteReference`?(r=!0,!1):!0),r}function qw(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function Jw(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=i(),a;t[0]===n?a=t[1]:(a={editor:n,selector:Yw},t[0]=n,t[1]=a);let o=b(a),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!Gw(n)||n.state.selection.empty||qw(n)||Kw(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=sr(Ir(n.state.doc)),a=Di(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(a,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=r({id:`sIGbBZ`}),t[5]=r,t[6]=l);let u;t[7]===c?u=t[8]:(u=e=>{e.preventDefault(),c()},t[7]=c,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(xe,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d):d=t[9];let f;t[10]!==o||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":l,onMouseDown:u,disabled:o,children:d})}),t[10]=o,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===r?p=t[15]:(p=r({id:`sIGbBZ`}),t[14]=r,t[15]=p);let m;t[16]===p?m=t[17]:(m=(0,Z.jsx)(Ar,{side:`bottom`,sideOffset:8,children:p}),t[16]=p,t[17]=m);let h;return t[18]!==f||t[19]!==m?(h=(0,Z.jsxs)(pr,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function Yw(e){let t=e.editor;return!!(!Gw(t)||t.state.selection.empty||qw(t)||Kw(t))}var Xw=[{value:`left`,label:`Align left`,icon:ve},{value:`center`,label:`Align center`,icon:he},{value:`right`,label:`Align right`,icon:j}];function Zw(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!tn.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function Qw(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:$w},t[0]=n,t[1]=r);let i=b(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=Xw.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{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(!tn.has(a)||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(mr.create(u.doc,s)),Jt(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Ar,{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 $w(e){return Zw(e.editor)}function eT(e){return Zw(e)!==null}var tT=[{name:`bold`,icon:Gc,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:vl,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:$l,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:Yl,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:Ae,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:gl,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function nT(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:rT},t[0]=n,t[1]=r);let i=b(r),a;t[2]!==i||t[3]!==n?(a=tT.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{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)(Ar,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(D,{"aria-label":Gs(e.shortcutId),children:Us(e.shortcutId)})]})]},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 rT(e){return Object.fromEntries(tT.map(t=>[t.name,t.isActive(e.editor)]))}function iT(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:f,pages:p}=si(),m;t[0]===n?m=t[1]:(m=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=m);let h=m,_;t[2]===n?_=t[3]:(_=n.getAttributes(`link`).href??``,t[2]=n,t[3]=_);let v=_,y;t[4]===n?y=t[5]:(y=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=y);let b=y,x,S;t[6]===n?(x=t[7],S=t[8]):(x=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},S=[n],t[6]=n,t[7]=x,t[8]=S),(0,Q.useEffect)(x,S);let C,T;t[9]===a?(C=t[10],T=t[11]):(C=()=>{a&&requestAnimationFrame(()=>u.current?.focus())},T=[a],t[9]=a,t[10]=C,t[11]=T),(0,Q.useEffect)(C,T);let E;t[12]!==n||t[13]!==h||t[14]!==c?(E=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():h&&n.chain().focus().unsetLink().run(),o(!1)},t[12]=n,t[13]=h,t[14]=c,t[15]=E):E=t[15];let O=E,k;t[16]===n?k=t[17]:(k=function(){n.chain().focus().unsetLink().run(),o(!1)},t[16]=n,t[17]=k);let A=k,j;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(e){l(w(e.path,null))},t[18]=j):j=t[18];let M=j,P;t[19]!==O||t[20]!==n?(P=function(e){e.key===`Enter`&&(e.preventDefault(),O()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[19]=O,t[20]=n,t[21]=P):P=t[21];let F=P;if(a){let e;t[22]===r?e=t[23]:(e=r({id:`ZsGpr_`}),t[22]=r,t[23]=e);let n;t[24]===r?n=t[25]:(n=r({id:`roAe2K`}),t[24]=r,t[25]=n);let i;t[26]!==d||t[27]!==F||t[28]!==f||t[29]!==p||t[30]!==e||t[31]!==n||t[32]!==c?(i=(0,Z.jsx)(lt,{ref:u,type:`text`,placeholder:e,value:c,pages:p,folderPaths:d,loading:f,onValueChange:l,onSuggestionSelect:M,onKeyDown:F,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[26]=d,t[27]=F,t[28]=f,t[29]=p,t[30]=e,t[31]=n,t[32]=c,t[33]=i):i=t[33];let a;t[34]===r?a=t[35]:(a=r({id:`tP5DDk`}),t[34]=r,t[35]=a);let o;t[36]===O?o=t[37]:(o=()=>{O()},t[36]=O,t[37]=o);let m;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(nl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=m):m=t[38];let _;t[39]!==a||t[40]!==o?(_=(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:m}),t[39]=a,t[40]=o,t[41]=_):_=t[41];let y;t[42]!==i||t[43]!==_?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,_]}),t[42]=i,t[43]=_,t[44]=y):y=t[44];let b;t[45]!==r||t[46]!==v||t[47]!==h||t[48]!==A?(b=h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),N(v)},children:(0,Z.jsx)(ms,{className:`size-3.5`})})}),(0,Z.jsx)(Ar,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),A()},children:(0,Z.jsx)(g,{className:`size-3.5`})})}),(0,Z.jsx)(Ar,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[45]=r,t[46]=v,t[47]=h,t[48]=A,t[49]=b):b=t[49];let x;return t[50]!==y||t[51]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[y,b]}),t[50]=y,t[51]=b,t[52]=x):x=t[52],x}let I;t[53]===r?I=t[54]:(I=r({id:`p0Iq25`}),t[53]=r,t[54]=I);let L=h?`bg-accent text-primary`:`text-accent-foreground`,R;t[55]===b?R=t[56]:(R=e=>{e.preventDefault(),l(b()),o(!0)},t[55]=b,t[56]=R);let z;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(bl,{className:`size-3.5`}),t[57]=z):z=t[57];let B;t[58]!==I||t[59]!==L||t[60]!==R?(B=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,"aria-label":I,className:L,onMouseDown:R,children:z})}),t[58]=I,t[59]=L,t[60]=R,t[61]=B):B=t[61];let V;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(s,{id:`yzF66j`}),t[62]=V):V=t[62];let H;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsxs)(Ar,{side:`bottom`,sideOffset:8,children:[V,(0,Z.jsx)(D,{children:Us(`command-palette`)})]}),t[63]=H):H=t[63];let U;return t[64]===B?U=t[65]:(U=(0,Z.jsxs)(pr,{children:[B,H]}),t[64]=B,t[65]=U),U}function aT({editor:e}){if(nt(e.state).query||e.isActive(`codeBlock`))return!1;if(eT(e)||Ww(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 oT(e){let t=(0,$.c)(23),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:dT},t[0]=n,t[1]=l);let u=b(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:uT},t[2]=n,t[3]=d);let f=b(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{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]=p):p=t[6];let m;if(t[7]!==n.view.dom||t[8]!==p){let e={getBoundingClientRect:p,contextElement:n.view.dom};m=()=>{let t=a.current;t&&(c.current?.(),c.current=lr(e,t,()=>{Hr(e,t,{placement:`top`,strategy:`fixed`,middleware:[Ln(8),Rr(),ri({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(lT)}))},t[7]=n.view.dom,t[8]=p,t[9]=m}else m=t[9];let h=m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{c.current?.(),c.current=null,s(cT)},t[10]=g):g=t[10];let _=g,v;t[11]===h?v=t[12]:(v={onShow:h,onHide:_,strategy:`fixed`},t[11]=h,t[12]=v);let y;t[13]!==n||t[14]!==f||t[15]!==u||t[16]!==i||t[17]!==o?(y=u?(0,Z.jsx)(Qw,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(Hw,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pw,{editor:n}),(0,Z.jsx)(Aa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(nT,{editor:n},o),(0,Z.jsx)(Aa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(iT,{editor:n},`${o}-link`),(0,Z.jsx)(Jw,{editor:n},`${o}-footnote`),(0,Z.jsx)(Rw,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[13]=n,t[14]=f,t[15]=u,t[16]=i,t[17]=o,t[18]=y):y=t[18];let x;return t[19]!==n||t[20]!==v||t[21]!==y?(x=(0,Z.jsx)(Mw,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:sT,shouldShow:aT,updateDelay:250,options:v,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:y}),t[19]=n,t[20]=v,t[21]=y,t[22]=x):x=t[22],x}function sT(){return document.body}function cT(e){return e+1}function lT(){}function uT(e){return Ww(e.editor)}function dT(e){return eT(e.editor)}var fT=56,pT=`0 2px 4px rgba(0, 0, 0, 0.08)`,mT=150,hT=globalThis.ScrollTimeline;function gT(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+fT);return{startOffset:o,endOffset:o+a,maxShift:a}}var _T=new WeakMap;function vT(e){let t=_T.get(e);if(t){for(let e of t.animations)e.cancel();_T.delete(e)}}function yT(e){for(let t of Array.from(e.cells))vT(t)}var bT=e=>e.cellIndex===0?`3`:`2`;function xT(e,t){return ST(e,t,e=>({transform:`translateY(${e}px)`}))}function ST(e,t,n){if(!(t>0))return[{offset:0,...n(0)},{offset:1,...n(0)}];let r=t=>Math.max(0,Math.min(t-e.startOffset,e.maxShift));return Array.from(new Set([0,e.startOffset/t,e.endOffset/t,1].map(e=>Math.max(0,Math.min(e,1))))).sort((e,t)=>e-t).map(e=>({offset:e,...n(r(e*t))}))}function CT(e,t,n,r){if(!(t>0))return[{...n,offset:0},{...n,offset:1}];let i=e.startOffset/t;if(i<=0)return[{...r,offset:0},{...r,offset:1}];if(i>=1)return[{...n,offset:0},{...n,offset:1}];let a=Math.min(i+1/t,1);return[{...n,offset:0},{...n,offset:i},{...r,offset:a},{...r,offset:1}]}function wT(e,t,n){return CT(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:pT})}function TT(e,t){return CT(e,t,{opacity:`0`},{opacity:`1`})}function ET(e,t,n,r){let i=bT(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=_T.get(e);if(o?.key===a)return;if(o)for(let e of o.animations)e.cancel();let s={timeline:t,fill:`both`,easing:`linear`},c=e.animate(xT(n,r),s),l=e.animate(wT(n,r,i),s),u=e.animate(TT(n,r),{...s,pseudoElement:`::before`});_T.set(e,{key:a,animations:[c,l,u]})}function DT(e,t){let n=bT(e),r=`in|${t}|${n}`,i=_T.get(e);if(i?.key===r)return;if(i)for(let e of i.animations)e.cancel();let a=e.animate([{transform:`translateY(${t}px)`,zIndex:n,boxShadow:pT}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});_T.set(e,{key:r,animations:[a,o]})}function OT(e,t,n,r){let i=e.getBoundingClientRect().top,a=e.scrollTop,o=e.scrollHeight-e.clientHeight,s=t.querySelectorAll(`.tableWrapper`);for(let e of s){r?.(e);let t=e.querySelector(`table`);if(!t)continue;let s=t.querySelector(`tbody`)?.rows[0];if(!s||!Array.from(s.cells).some(e=>e.tagName===`TH`))continue;let c=t.getBoundingClientRect(),l=s.getBoundingClientRect(),u=gT(a,i,c.top,c.height,l.height);if(!u){yT(s);continue}if(n){if(o<=0){yT(s);continue}for(let e of Array.from(s.cells))ET(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+fT){yT(s);continue}for(let e of Array.from(s.cells))DT(e,d)}}var kT=ai.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new jr({key:new Zi(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||OT(t,e.dom,n,u)},l=()=>{r??=requestAnimationFrame(()=>{r=null,c()})};function u(e){s.has(e)||(s.add(e),e.addEventListener(`contentvisibilityautostatechange`,l))}let d=()=>{if(n){i??l(),i!=null&&clearTimeout(i),i=setTimeout(()=>{i=null,c()},mT);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&hT)try{n=new hT({source:t,axis:`block`})}catch{n=null}t?.addEventListener(`scroll`,d,{passive:!0}),t&&typeof ResizeObserver<`u`&&(a=new ResizeObserver(l),a.observe(t),a.observe(e.dom)),c()}}),{update(e,t){t.doc.eq(e.state.doc)||c()},destroy(){o=!0,t?.removeEventListener(`scroll`,d),a?.disconnect(),r!=null&&cancelAnimationFrame(r),i!=null&&clearTimeout(i);for(let e of s)e.removeEventListener(`contentvisibilityautostatechange`,l);s.clear();for(let t of e.dom.querySelectorAll(`.tableWrapper > table > tbody > tr:first-child`))yT(t)}}}})]}}),AT=`application/x-open-knowledge-sidebar-item+json`,jT={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function MT(e){return JSON.stringify(e)}function NT(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:Tr(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:gr(e.assetPath)}:{target:Ii(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:yr(e.docName)}}function PT(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(AT);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!FT(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!IT(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function FT(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function IT(e){return typeof e==`string`&&Object.hasOwn(jT,e)}function LT(e,t){return(n,r)=>{let i=r,a=PT(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function RT(e,t){let n=NT(e);t(n.target,{tabBehavior:`append`}),cr(n.hash)}function zT(e){return[...e?[{label:`Toggle header column`,icon:el,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:ga,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:Qo,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:g,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:ml,run:e=>e.chain().focus().deleteTable().run()}]}function BT(e){return[...e?[{label:`Toggle header row`,icon:Xl,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:fe,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:S,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:g,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:ml,run:e=>e.chain().focus().deleteTable().run()}]}function VT(e){if(!e.isEditable||nt(e.state).query)return null;let{state:t,view:n}=e,r=t.selection.$from,i=-1;for(let e=r.depth;e>0;e--){let t=r.node(e).type.spec.tableRole;if(t===`cell`||t===`header_cell`){i=r.before(e);break}}if(i<0)return null;let a=n.nodeDOM(i);if(!(a instanceof HTMLTableCellElement))return null;let o=a.closest(`table`),s=a.closest(`tr`),c=a.closest(`.ProseMirror`);if(!o||!s||!c)return null;let l=Array.prototype.indexOf.call(o.rows,s),u=a.cellIndex,d=o.rows[0]?.cells[u],f=o.rows[l]?.cells[0];return!d||!f?null:{columnAnchor:d,rowAnchor:f,isFirstColumn:u===0,isFirstRow:l===0}}function HT(e){let t=(0,$.c)(22),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==i?(s=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return lr(r,e,()=>{Hr(r,e,{strategy:`absolute`,placement:t,middleware:[Ln(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(UT)})},c=[r,i],t[0]=r,t[1]=i,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l=i===`column`?al:ns,u=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`,d=i===`column`?`Column options`:`Row options`,f;t[4]===l?f=t[5]:(f=(0,Z.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[4]=l,t[5]=f);let p;t[6]!==u||t[7]!==d||t[8]!==f?(p=(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`secondary`,className:u,"aria-label":d,children:f})}),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m=i===`column`?`center`:`start`,h=i===`column`?`bottom`:`right`,g;if(t[10]!==n||t[11]!==a){let e;t[13]===n?e=t[14]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(To,{}),(0,Z.jsxs)($o,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[13]=n,t[14]=e),g=a.map(e),t[10]=n,t[11]=a,t[12]=g}else g=t[12];let _;t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Z.jsx)(Wo,{align:m,side:h,className:`w-auto min-w-44 whitespace-nowrap`,children:g}),t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==_||t[20]!==p?(v=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(jo,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function UT(){}function WT(e){let t=(0,$.c)(18),{editor:n}=e,[r,i]=(0,Q.useState)(null),a,o;if(t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=()=>i(e=>{let t=VT(n);return e&&t&&e.columnAnchor===t.columnAnchor&&e.rowAnchor===t.rowAnchor?e:t});return e(),n.on(`selectionUpdate`,e),n.on(`update`,e),()=>{n.off(`selectionUpdate`,e),n.off(`update`,e)}},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),!r)return null;let s=r.columnAnchor,c;t[3]===r.isFirstColumn?c=t[4]:(c=zT(r.isFirstColumn),t[3]=r.isFirstColumn,t[4]=c);let l;t[5]!==r.columnAnchor||t[6]!==n||t[7]!==c?(l=(0,Z.jsx)(HT,{editor:n,anchor:s,axis:`column`,items:c}),t[5]=r.columnAnchor,t[6]=n,t[7]=c,t[8]=l):l=t[8];let u=r.rowAnchor,d;t[9]===r.isFirstRow?d=t[10]:(d=BT(r.isFirstRow),t[9]=r.isFirstRow,t[10]=d);let f;t[11]!==r.rowAnchor||t[12]!==n||t[13]!==d?(f=(0,Z.jsx)(HT,{editor:n,anchor:u,axis:`row`,items:d}),t[11]=r.rowAnchor,t[12]=n,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{className:`ok-table-cell-handle-layer`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function GT(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=Gt.getState(e.state)?.binding;if(!t){ut.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){ut.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}ut.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return ai.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new jr({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var KT=new WeakMap;function qT(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=ni(e.color),n.textContent=e.name,t.append(n),t}var JT={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},YT=100,XT=100,ZT=3,QT=250;function $T(){let e=new Vr({extensions:ti});return{mdManager:e,text:qe({mdManager:e}),html:l({mdManager:e}),paste:Ft({mdManager:e}),drop:St({mdManager:e})}}function eE(e,t){return t?{collaboration:ot.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[GT({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:ot.configure({document:e.document}),guard:[]}}function tE(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=eE(t,r);return[...Dt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),zC.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,ai.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[We]}}),ai.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[pt(e,{cursorBuilder:qT})]}}),ai.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[tw({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,kT]}function nE(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{KT.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=KT.get(e);if(KT.delete(e),r==null)return;let i=performance.now();ut(`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:LT(n.drop,e.onSidebarDrop)},extensions:vp(tE(e))}}function rE(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=nE({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:c,onWedged:a,onSidebarDrop:o}),u=l.onBeforeCreate;return{...l,onBeforeCreate:e=>{u?.(e);let{editor:t}=e,{doc:n,mapping:r}=ze(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var iE=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(JT),c=GC(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=yt(),p=n.configuration.name??``,[m]=(0,Q.useState)($T),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new yi(rE({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;ut(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{RT(e,f)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=m,t[1]=p,t[2]=f,t[3]=r,t[4]=n,t[5]=d,t[6]=h):h=t[6];let[g]=(0,Q.useState)(h),_,v;if(t[7]!==g||t[8]!==p||t[9]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=ce(p)??crypto.randomUUID();_=Q.use,v=E({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{dt(y)},S=[y],t[12]=y,t[13]=x,t[14]=S),(0,Q.useEffect)(x,S);let C;return t[15]!==u||t[16]!==p||t[17]!==b||t[18]!==c||t[19]!==i||t[20]!==a||t[21]!==l||t[22]!==n?(C=(0,Z.jsx)(aE,{provider:n,isSourceMode:i,docName:p,activeDocName:u,identity:c,principal:l,editor:b,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[15]=u,t[16]=p,t[17]=b,t[18]=c,t[19]=i,t[20]=a,t[21]=l,t[22]=n,t[23]=C):C=t[23],C},aE=e=>{let t=(0,$.c)(93),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),p,h;t[0]===d?(p=t[1],h=t[2]):(p=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},h=[d],t[0]=d,t[1]=p,t[2]=h),(0,Q.useLayoutEffect)(p,h);let g;t[3]!==c||t[4]!==n.configuration.name?(g=()=>(vt(c,n.configuration.name??null),()=>{vt(c,null)}),t[3]=c,t[4]=n.configuration.name,t[5]=g):g=t[5];let _;t[6]!==c||t[7]!==n?(_=[c,n],t[6]=c,t[7]=n,t[8]=_):_=t[8],(0,Q.useEffect)(g,_);let v;t[9]!==c||t[10]!==n.configuration.name?(v=()=>{let e=n.configuration.name;if(e)return ye(e,c),()=>ge(e,c)},t[9]=c,t[10]=n.configuration.name,t[11]=v):v=t[11];let y;t[12]!==c||t[13]!==n?(y=[c,n],t[12]=c,t[13]=n,t[14]=y):y=t[14],(0,Q.useEffect)(v,y);let b;t[15]!==c||t[16]!==n.configuration.name?(b=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,vc(e,`wysiwyg`,xc(c))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),vc(e,`wysiwyg`,null)}},t[15]=c,t[16]=n.configuration.name,t[17]=b):b=t[17];let x;t[18]!==c||t[19]!==n?(x=[c,n],t[18]=c,t[19]=n,t[20]=x):x=t[20],(0,Q.useEffect)(b,x);let S;t[21]!==c||t[22]!==n.configuration.name?(S=()=>{},t[21]=c,t[22]=n.configuration.name,t[23]=S):S=t[23];let w;t[24]!==c||t[25]!==n?(w=[c,n],t[24]=c,t[25]=n,t[26]=w):w=t[26],(0,Q.useEffect)(S,w);let T,E;t[27]===c?(T=t[28],E=t[29]):(T=()=>{let e=oE,t=null,n=()=>{if(t||c.isDestroyed)return;let n=_e(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 _e(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},E=[c],t[27]=c,t[28]=T,t[29]=E),(0,Q.useEffect)(T,E);let D,O;t[30]!==i||t[31]!==c?(D=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!_e(c))return;e=!0;let t=m(i)?.selection??null;if(t)try{let e=c.state.doc.content.size;if(t.type===`text`){let n=Math.max(0,Math.min(t.anchor,e)),r=Math.max(0,Math.min(t.head,e));c.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));c.commands.setNodeSelection(n)}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(JSON.stringify({event:`ok-editor-selection-restore-failed`,docName:i,message:n})),ut(`ok/editor/selection-restore-failed`,{docName:i,message:n})}C(i)};if(_e(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},O=[c,i],t[30]=i,t[31]=c,t[32]=D,t[33]=O):(D=t[32],O=t[33]),(0,Q.useEffect)(D,O);let k,A;t[34]!==u||t[35]!==n.document||t[36]!==l?(k=()=>{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)},ar)};c(JT);let f=()=>{if(Ci(e),!Ai(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`?Ai(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)}},A=[n.document,u,l],t[34]=u,t[35]=n.document,t[36]=l,t[37]=k,t[38]=A):(k=t[37],A=t[38]),(0,Q.useEffect)(k,A);let j,M;t[39]!==a||t[40]!==i||t[41]!==c||t[42]!==n?(j=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<YT){e+=1,t=window.setTimeout(p,XT);return}r=null,o=null,e=0},u=function(e){let t=_e(c);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},d=function(e){let t=u(e);return t?(t.scrollIntoView({behavior:`smooth`,block:`start`}),!0):!1},f=function(e,n){let r=ZT,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,QT)))};t=window.setTimeout(o,QT)};function p(){if(!r||i!==a)return;let t=r,n=o;if(!n){l();return}d(t)?(s=n,r=null,o=null,e=0,f(t,n)):l()}let m=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=Xn(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},M=[n,c,i,a],t[39]=a,t[40]=i,t[41]=c,t[42]=n,t[43]=j,t[44]=M):(j=t[43],M=t[44]),(0,Q.useEffect)(j,M);let N,P;t[45]===c?(N=t[46],P=t[47]):(N=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=_e(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(hc,e),()=>window.removeEventListener(hc,e)},P=[c],t[45]=c,t[46]=N,t[47]=P),(0,Q.useEffect)(N,P);let F;t[48]!==a||t[49]!==i||t[50]!==o||t[51]!==r||t[52]!==s||t[53]!==n.awareness?(F=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:KC({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[48]=a,t[49]=i,t[50]=o,t[51]=r,t[52]=s,t[53]=n.awareness,t[54]=F):F=t[54];let I;t[55]!==a||t[56]!==i||t[57]!==o||t[58]!==r||t[59]!==s||t[60]!==n?(I=[n,i,a,o,s,r],t[55]=a,t[56]=i,t[57]=o,t[58]=r,t[59]=s,t[60]=n,t[61]=I):I=t[61],(0,Q.useEffect)(F,I);let L,R;t[62]!==c||t[63]!==r?(L=()=>(wt(c,r),()=>{wt(c,!1)}),R=[c,r],t[62]=c,t[63]=r,t[64]=L,t[65]=R):(L=t[64],R=t[65]),(0,Q.useEffect)(L,R);let z;t[66]!==a||t[67]!==i||t[68]!==c||t[69]!==r?(z=!r&&(0,Z.jsx)(oT,{editor:c,shortcutEnabled:i===a}),t[66]=a,t[67]=i,t[68]=c,t[69]=r,t[70]=z):z=t[70];let B;t[71]!==c||t[72]!==r?(B=!r&&(0,Z.jsx)(WT,{editor:c}),t[71]=c,t[72]=r,t[73]=B):B=t[73];let V;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[74]=V):V=t[74];let H;t[75]===c?H=t[76]:(H=(0,Z.jsx)(Xt,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[75]=c,t[76]=H);let U;t[77]!==d||t[78]!==H?(U=(0,Kc.createPortal)(H,d),t[77]=d,t[78]=H,t[79]=U):U=t[79];let ee;t[80]===c?ee=t[81]:(ee=(0,Z.jsx)(UC,{editor:c}),t[80]=c,t[81]=ee);let te;t[82]===c?te=t[83]:(te=ht(c),t[82]=c,t[83]=te);let W;t[84]===te.store?W=t[85]:(W=(0,Z.jsx)(qt,{store:te.store}),t[84]=te.store,t[85]=W);let ne;return t[86]!==z||t[87]!==B||t[88]!==U||t[89]!==ee||t[90]!==W||t[91]!==l?(ne=(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:[z,B,V,U,ee,W]}),t[86]=z,t[87]=B,t[88]=U,t[89]=ee,t[90]=W,t[91]=l,t[92]=ne):ne=t[92],ne};function oE(){return A()}var sE=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function cE(e,t,n,r,i,a){if(e==r)return[];let o=vE(e,t,n,r,i,a),s=yE(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new sE(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new sE(t,t+o,i,i),new sE(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new sE(t,t,i,i+o),new sE(n,n,i+o+c,a)]}if(c==1||l==1)return[new sE(t,n,i,a)];let u=xE(e,t,n,r,i,a);if(u){let[o,s,c]=u;return cE(e,t,o,r,i,s).concat(cE(e,o+c,n,r,s+c,a))}return fE(e,t,n,r,i,a)}var lE=1e9,uE=0,dE=!1;function fE(e,t,n,r,i,a){let o=n-t,s=a-i;if(lE<1e9&&Math.min(o,s)>lE*16||uE>0&&Date.now()>uE)return Math.min(o,s)>lE*64?[new sE(t,n,i,a)]:SE(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);mE.reset(c),hE.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:hE,f=d?null:mE;for(let p=0;p<c;p++){if(p>lE||uE>0&&!(p&63)&&Date.now()>uE)return SE(e,t,n,r,i,a);let m=mE.advance(p,o,s,c,d,!1,l)||hE.advance(p,o,s,c,f,!0,u);if(m)return gE(e,t,n,t+m[0],r,i,a,i+m[1])}return[new sE(t,n,i,a)]}var pE=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},mE=new pE,hE=new pE;function gE(e,t,n,r,i,a,o,s){let c=!1;return!LE(e,r)&&++r==n&&(c=!0),!LE(i,s)&&++s==o&&(c=!0),c?[new sE(t,n,a,o)]:cE(e,t,r,i,a,s).concat(cE(e,r,n,i,s,o))}function _E(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function vE(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=_E(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!LE(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function yE(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=_E(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!LE(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function bE(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){LE(e,s)||s++;let u=s+o;if(LE(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=vE(e,u,n,r,i+f+d.length,a),c=yE(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function xE(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=xE(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:bE(e,t,n,r,i,a,Math.floor(o/4),-1)}function SE(e,t,n,r,i,a){dE=!0;let o=n-t,s=a-i,c;if(o<s){let s=bE(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=bE(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new sE(t,n,i,a)];let[l,u,d]=c;return cE(e,t,l,r,i,u).concat(cE(e,l+d,n,r,u+d,a))}function CE(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new sE(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function wE(e,t,n){for(;;){CE(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=vE(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new sE(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=yE(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new sE(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new sE(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new sE(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function TE(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=ME(t,a.fromA,l),f=jE(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new sE(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=jE(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new sE(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=ME(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new sE(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=PE(n,a.fromB,a.toB),r,o=t<0?-1:NE(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=PE(t,a.fromA,a.toA),r,o=n<0?-1:NE(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return CE(e,3),e}var EE;try{EE=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function DE(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function OE(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!DE(n):EE?!FE(n)||t==e.length-1?+!!EE.test(String.fromCharCode(n)):EE.test(e.slice(t,t+2))?2:0:0}function kE(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!DE(n):EE?!IE(n)||t==1?+!!EE.test(String.fromCharCode(n)):EE.test(e.slice(t-2,t))?2:0:0}var AE=8;function jE(e,t,n){if(t==e.length||!kE(e,t))return t;for(let r=t,i=t+n,a=0;a<AE;a++){let t=OE(e,r);if(!t||r+t>i)return r;r+=t}return t}function ME(e,t,n){if(!t||!OE(e,t))return t;for(let r=t,i=t-n,a=0;a<AE;a++){let t=kE(e,r);if(!t||r-t<i)return r;r-=t}return t}function NE(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function PE(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var FE=e=>e>=55296&&e<=56319,IE=e=>e>=56320&&e<=57343;function LE(e,t){return!t||t==e.length||!FE(e.charCodeAt(t-1))||!IE(e.charCodeAt(t))}function RE(e,t,n){let r=n?.override;return r?r(e,t):(lE=(n?.scanLimit??1e9)>>1,uE=n?.timeout?Date.now()+n.timeout:0,dE=!1,wE(e,t,cE(e,0,e.length,t,0,t.length)))}function zE(){return!dE}function BE(e,t,n){return TE(RE(e,t,n),e,t)}var VE=tc.define({combine:e=>e[0]}),HE=nc.define(),UE=tc.define(),WE=Xs.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(HE)&&(e=n.value);for(let n of t.state.facet(UE))e=n(e,t);return e}});function GE(e){let t=e.field(WE,!1);if(!t)return null;let n=e.facet(VE);return{chunks:t,side:n?n.side:null}}var KE=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return YE(BE(e.toString(),t.toString(),n),e,t,0,0,zE())}static updateA(e,t,n,r,i){return $E(QE(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return $E(QE(e,r,!1,t.length),e,t,n,i)}};function qE(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function JE(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function YE(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=qE(c.fromA+r,c.fromB+i,t,n),[d,f]=JE(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=qE(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=JE(a.toA+r,a.toB+i,t,n),s++}o.push(new KE(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var XE=1e3;function ZE(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function QE(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>XE&&([l,d]=ZE(e,a-XE,n,!0)),o<t.length-XE&&([u,f]=ZE(e,o+XE,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function $E(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=BE(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of YE(h,n,r,d,f,zE()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var eD={scanLimit:500},tD=rc.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=dD(e))}update(e){(e.docChanged||e.viewportChanged||rD(e.startState,e.state)||iD(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=dD(e.view))}},{decorations:e=>e.deco}),nD=qs.low(sc({class:`cm-changeGutter`,markers:e=>e.plugin(tD)?.gutter||uc.empty}));function rD(e,t){return e.field(WE,!1)!=t.field(WE,!1)}function iD(e,t){return e.facet(VE)!=t.facet(VE)}var aD=$s.line({class:`cm-changedLine`}),oD=$s.mark({class:`cm-changedText`}),sD=$s.mark({tagName:`ins`,class:`cm-insertedLine`}),cD=$s.mark({tagName:`del`,class:`cm-deletedLine`}),lD=new class extends oc{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function uD(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,aD),i.add(o,s,n?cD:sD),a&&a.add(o,o,lD);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,aD),a&&a.add(u,u,lD);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,oD),s<t)c++;else break}u=t}}}function dD(e){let t=e.state.field(WE),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(VE),o=n==`a`,s=new ec,c=i?new ec:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&uD(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var fD=class extends Ks{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},pD=nc.define({map:(e,t)=>e.map(t)}),mD=Xs.define({create:()=>$s.none,update:(e,t)=>{for(let e of t.effects)if(e.is(pD))return e.value;return e.map(t.changes)},provide:e=>ac.decorations.from(e)}),hD=.01;function gD(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function _D(e,t,n){let r=new ec,i=new ec,a=e.state.field(mD).iter(),o=t.state.field(mD).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-hD?(l-=n,r.add(s,s,$s.widget({widget:new fD(-n),block:!0,side:-1}))):n>hD&&(u+=n,i.add(c,c,$s.widget({widget:new fD(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<hD?r.add(e.state.doc.length,e.state.doc.length,$s.widget({widget:new fD(-p),block:!0,side:1})):p>hD&&i.add(t.state.doc.length,t.state.doc.length,$s.widget({widget:new fD(p),block:!0,side:1}));let m=r.finish(),h=i.finish();gD(m,e.state.field(mD))||e.dispatch({effects:pD.of(m)}),gD(h,t.state.field(mD))||t.dispatch({effects:pD.of(h)})}var vD=nc.define({map:(e,t)=>t.mapPos(e)}),yD=class extends Ks{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:vD.of(n)});let{side:r,sibling:i}=e.state.facet(VE);i&&i().dispatch({effects:vD.of(bD(n,e.state.field(WE),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function bD(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var xD=Xs.define({create(e){return $s.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(vD)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>ac.decorations.from(e)});function SD({margin:e=3,minSize:t=4}){return xD.init(n=>CD(n,e,t))}function CD(e,t,n){let r=new ec,i=e.facet(VE).side==`a`,a=e.field(WE),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,$s.replace({widget:new yD(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var wD=ac.styleModule.of(new cc({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),TD=ac.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),ED=new ic,DD=new ic,OD=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||eD;let t=[qs.low(tD),TD,wD,mD,ac.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(pD)))&&this.measure()})],n=[VE.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(nD);let r=Ys.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],ac.editorAttributes.of({class:`cm-merge-a`}),DD.of(n),t]}),i=[VE.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(nD);let a=Ys.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],ac.editorAttributes.of({class:`cm-merge-b`}),DD.of(i),t]});this.chunks=KE.build(r.doc,a.doc,this.diffConf);let o=[WE.init(()=>this.chunks),ED.of(e.collapseUnchanged?SD(e.collapseUnchanged):[])];r=r.update({effects:nc.appendConfig.of(o)}).state,a=a.update({effects:nc.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new ac({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new ac({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),Js.empty(e[0].startState.doc.length));this.chunks=t==this.a?KE.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):KE.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:HE.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:HE.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(VE),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(DD.reconfigure([VE.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?nD:[]])),a.push(DD.reconfigure([VE.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?nD:[]]))}if(r){let t=ED.reconfigure(e.collapseUnchanged?SD(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){_D(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=kD(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=kD(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function kD(e){let t=e.nextSibling;return e.remove(),t}var AD=new class extends oc{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},jD=qs.low(sc({class:`cm-changeGutter`,markers:e=>e.plugin(tD)?.gutter||uc.empty,widgetMarker:(e,t)=>t instanceof ID?AD:null}));function MD(e){let t=typeof e.original==`string`?Qs.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||eD;return[qs.low(tD),VD,TD,ac.editorAttributes.of({class:`cm-merge-b`}),UE.of((e,t)=>{let r=t.effects.find(e=>e.is(ND));return r&&(e=KE.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=KE.updateB(e,t.state.field(PD),t.newDoc,t.changes,n)),e}),VE.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?qD:void 0,side:`b`}),PD.init(()=>t),e.gutter===!1?[]:jD,e.collapseUnchanged?SD(e.collapseUnchanged):[],WE.init(e=>KE.build(t,e.doc,n))]}var ND=nc.define(),PD=Xs.define({create:()=>Qs.empty,update(e,t){for(let n of t.effects)n.is(ND)&&(e=n.value.doc);return e}}),FD=new WeakMap,ID=class extends Ks{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function LD(e,t,n){let r=FD.get(t.changes);if(r)return r;let i=$s.widget({block:!0,side:-1,widget:new ID(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(VE),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),RD(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),zD(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(PD).sliceString(t.fromA,t.endA),u=a&&e.facet(dc),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
27
27
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
28
- `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Zs(t,{style:t=>fc(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return _D.set(t.changes,i),i}function bD(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(EE).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(gD);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Js.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:hD.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function xD(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(EE).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(gD).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function SD(e){let t=new ec;for(let n of e.field(EE)){let r=e.facet(CE).overrideChunk&&TD(e,n);t.add(n.fromB,n.fromB,yD(e,n,!!r))}return t.finish()}var CD=Xs.define({create:e=>SD(e),update(e,t){return t.state.field(EE,!1)==t.startState.field(EE,!1)?e:SD(t.state)},provide:e=>ac.decorations.from(e)}),wD=new WeakMap;function TD(e,t){let n=wD.get(t);if(n!==void 0)return n;n=null;let r=e.field(gD),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push($s.widget({widget:new ED(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(HE.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return wD.set(t,n),n}var ED=class extends Ks{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},DD=new class extends oc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},OD=$s.line({class:`cm-inlineChangedLine`});function kD(e,t,n,r){let i=TD(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,DD),n.add(o.from,o.from,OD);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var AD=h({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),jD=an({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),MD=ac.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function ND({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function PD(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Li(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?AD:jD,u=[ac.editable.of(!1),Ys.readOnly.of(!0)],d=[Tc,R(),...u,l,ac.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new ac({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=ND({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new ac({doc:p,extensions:[Tc,R(),ac.editable.of(!1),l,MD,ac.lineWrapping,mD({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),ac.updateListener.of(e=>{let t=DE(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=DE(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new uD({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new ac({doc:p,extensions:[...d,mD({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof ac)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof ac)||De(e)},t[13]=A):A=t[13];let j=A,M=b===0,N;t[14]!==f||t[15]!==b?(N=b===null?``:b===0?f({id:`lPzyrU`}):Y._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=N):N=t[16];let P=N,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=F):F=t[17];let I;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,Kc.createPortal)((0,Z.jsx)(sa,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),I=C.map(e),t[18]=f,t[19]=C,t[20]=I}else I=t[20];let L;t[23]!==M||t[24]!==o||t[25]!==P||t[26]!==d||t[27]!==u?(L=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${M?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:P}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(sa,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(sa,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(sa,{variant:`default`,size:`sm`,disabled:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,t[24]=o,t[25]=P,t[26]=d,t[27]=u,t[28]=L):L=t[28];let z;return t[29]!==L||t[30]!==I?(z=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=z):z=t[31],z}async function FD(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function ID(e,t){return FD(e,`content`,t)}async function LD(e){return FD(e,`mine`)}async function RD(e){return FD(e,`theirs`)}async function zD(e){return FD(e,`delete`)}async function BD(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function VD(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=lo(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>di(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),BD(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await ID(u,e);t.ok||X.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),X.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(PD,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(zD),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(sa,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(RD),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(sa,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(PD,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(LD),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(sa,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(zD),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(sa,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)(PD,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function HD(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Wt(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 UD=`__back-nav__`;function WD(e){return e instanceof Re||e instanceof Ct||e instanceof Me||e instanceof rt||e instanceof It||e instanceof te?e.docName:null}function GD(e){if(e instanceof Re){let t=e.docName;return{title:Y._({id:`Jejur6`}),summary:Y._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Ct){let t=e.docName;return{title:Y._({id:`V7QxyT`}),summary:Y._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Me){let t=e.docName;return{title:Y._({id:`1di5fu`}),summary:Y._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof rt){let t=e.docName;return{title:Y._({id:`wvbc1r`}),summary:Y._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof It)return{title:Y._({id:`Gfr4fu`}),summary:Y._({id:`j6LB7S`})};if(e instanceof te){let t=e.docName;return{title:Y._({id:`vv7kpg`}),summary:Y._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Y._({id:`W5A0Ly`});return{title:Y._({id:`29VNqC`}),summary:t}}function KD(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=GD(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(wx,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(sa,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(sa,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(ft(WD(n)??i),o(a),r(UD))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(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:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function qD(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)(KD,{...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]===UD){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}: ${GD(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)(re,{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}function JD(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Br(t);return{map:n,keys:Wr(t),parseError:r}}function YD(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>JD(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=Hn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=et(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=gt(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(XD,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(ZD,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function XD(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function ZD(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function QD(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Br(t);return{map:n,keys:Wr(t),parseError:r}}function $D(e){let t=(0,$.c)(127),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>QD(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Hn(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]!==r||t[9]!==a?(M=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.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=Xr(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=M):M=t[10];let N=M,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=P):P=t[11];let F=P,I;t[12]===r?I=t[13]:(I=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=I);let L=I,R;t[14]!==N||t[15]!==L?(R=function(e,t){F(e),L(N({[e]:t}),[e])},t[14]=N,t[15]=L,t[16]=R):R=t[16];let z=R,B;t[17]!==N||t[18]!==L?(B=function(e){F(e),L(N({[e]:null}),[e])},t[17]=N,t[18]=L,t[19]=B):B=t[19];let V=B,H;t[20]!==r||t[21]!==a?(H=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=Xr(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=H):H=t[22];let U=H,ee;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e,t){return`${e} ${t}`},t[23]=ee):ee=t[23];let te=ee,W;t[24]!==a||t[25]!==m?(W=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>te(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=W):W=t[26];let ne=W,re;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(re={activationConstraint:{distance:4}},t[27]=re):re=t[27];let G;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(G={coordinateGetter:fo},t[28]=G):G=t[28];let ie=ro(So(bo,re),So(Ua,G)),K;t[29]!==z||t[30]!==p?(K=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=qa(n,t);(!Object.hasOwn(p,e)||!_i(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=K):K=t[31];let q=K,ae;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=ae):ae=t[32];let oe=ae,{addPropertySignal:se,clearAddProperty:ce}=AS(),le;t[33]!==se||t[34]!==j?(le=se.get(j)??0,t[33]=se,t[34]=j,t[35]=le):le=t[35];let ue=le,de,fe;t[36]===ue?(de=t[37],fe=t[38]):(de=()=>{ue>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},fe=[ue],t[36]=ue,t[37]=de,t[38]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[39]!==ce||t[40]!==j?(pe=()=>()=>ce(j),me=[j,ce],t[39]=ce,t[40]=j,t[41]=pe,t[42]=me):(pe=t[41],me=t[42]),(0,Q.useEffect)(pe,me);let he;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Va[e];return{...t,type:e,value:n,error:null}})},t[43]=he):he=t[43];let ge=he,_e;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){S(t=>t&&{...t,value:e})},t[44]=_e):_e=t[44];let ve=_e,ye;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ye=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=ye):ye=t[45];let be=ye,xe;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(xe=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=N({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[46]=r,t[47]=x,t[48]=N,t[49]=p,t[50]=xe):xe=t[50];let Se=xe,Ce;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){S(null)},t[51]=Ce):Ce=t[51];let we=Ce,Te;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){w({key:e,draft:e,error:null})},t[52]=Te):Te=t[52];let Ee=Te,De;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=De):De=t[53];let Oe=De,ke;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ke=function(){w(null)},t[54]=ke):ke=t[54];let Ae=ke,je;t[55]!==r||t[56]!==p||t[57]!==U||t[58]!==C?(je=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=U(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),F(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=U,t[58]=C,t[59]=je):je=t[59];let Me=je,Ne;t[60]!==p||t[61]!==m?(Ne=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=Ne):Ne=t[62];let Pe=Ne,Fe;if(t[63]!==Pe){Fe=new Map;for(let e of Pe)Fe.set(e,(Fe.get(e)??0)+1);t[63]=Pe,t[64]=Fe}else Fe=t[64];if(Pe.length===0&&!x&&!h)return null;let Ie=!g,Le;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Le=e=>_(!e),t[65]=Le):Le=t[65];let Re=!g,ze;t[66]===Re?ze=t[67]:(ze=(0,Z.jsx)(Os,{"data-expanded":Re,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Re,t[67]=ze);let Be;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=Be):Be=t[68];let Ve;t[69]===ze?Ve=t[70]:(Ve=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(sa,{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:[ze,Be]})}),t[69]=ze,t[70]=Ve);let He;t[71]===h?He=t[72]:(He=h?(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)(Pi,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=He);let Ue;if(t[73]!==Pe){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>te(e,t),t[75]=e):e=t[75],Ue=Pe.map(e),t[73]=Pe,t[74]=Ue}else Ue=t[74];let We;if(t[76]!==z||t[77]!==Me||t[78]!==Fe||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==V||t[83]!==C||t[84]!==Pe||t[85]!==k||t[86]!==q){let e;t[88]!==z||t[89]!==Me||t[90]!==Fe||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==V||t[95]!==C||t[96]!==k||t[97]!==q?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??$n(n),i=C?.key===e?C:null,a=(Fe.get(e)??0)>1;return(0,Z.jsx)(to,{sortableId:te(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Ee(e),onChangeDraft:Oe,onCommit:Me,onCancel:Ae},onCommit:t=>z(e,t),onChangeType:t=>q(e,t),onRemove:()=>V(e)},`${e}-${t}`)},t[88]=z,t[89]=Me,t[90]=Fe,t[91]=E,t[92]=p,t[93]=y,t[94]=V,t[95]=C,t[96]=k,t[97]=q,t[98]=e):e=t[98],We=Pe.map(e),t[76]=z,t[77]=Me,t[78]=Fe,t[79]=E,t[80]=p,t[81]=y,t[82]=V,t[83]=C,t[84]=Pe,t[85]=k,t[86]=q,t[87]=We}else We=t[87];let Ge;t[99]!==Ue||t[100]!==We?(Ge=(0,Z.jsx)(Da,{items:Ue,strategy:La,children:We}),t[99]=Ue,t[100]=We,t[101]=Ge):Ge=t[101];let Ke;t[102]!==ne||t[103]!==ie||t[104]!==Ge?(Ke=(0,Z.jsx)(Ga,{sensors:ie,collisionDetection:vo,onDragEnd:ne,children:Ge}),t[102]=ne,t[103]=ie,t[104]=Ge,t[105]=Ke):Ke=t[105];let qe;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(qe=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(to,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:eO},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=qe):qe=t[110];let Je;t[111]!==r||t[112]!==x||t[113]!==Se?(Je=x?(0,Z.jsx)(Za,{draft:x,onChangeName:be,onChangeType:ge,onChangeValue:ve,onCommit:Se,onCancel:we}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(sa,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:oe,"aria-label":r({id:`F-NRCj`}),className:`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)(At,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=Se,t[114]=Je):Je=t[114];let Ye;t[115]!==He||t[116]!==Ke||t[117]!==qe||t[118]!==Je?(Ye=(0,Z.jsxs)(As,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[He,Ke,qe,Je]}),t[115]=He,t[116]=Ke,t[117]=qe,t[118]=Je,t[119]=Ye):Ye=t[119];let Xe;t[120]!==Ie||t[121]!==Ve||t[122]!==Ye?(Xe=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(Ms,{open:Ie,onOpenChange:Le,children:[Ve,Ye]})}),t[120]=Ie,t[121]=Ve,t[122]=Ye,t[123]=Xe):Xe=t[123];let Ze;return t[124]!==a||t[125]!==Xe?(Ze=(0,Z.jsx)(fs,{binding:a,children:Xe}),t[124]=a,t[125]=Xe,t[126]=Ze):Ze=t[126],Ze}function eO(){}var tO=p(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function nO(e){let t=e.threshold??tO;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function rO(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var iO=p(`ACTIVITY_MOUNT_LIMIT`,3);function aO(){return n(()=>import(`./SourceEditor-D1zhJS8f.js`),__vite__mapDeps([47,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,48,24,46]),import.meta.url)}var oO=(0,Q.lazy)(async()=>({default:(await aO()).SourceEditor}));function sO(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Je(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 cO(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Y._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Y._({id:`Sc1bKE`,values:{docName:e}}):Y._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Y._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Y._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Y._({id:`bmC18N`,values:{docName:e}}):Y._({id:`pAgkuZ`,values:{docName:e}})}:null}function lO(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(G,{name:`activity-pool`,children:(0,Z.jsx)(uO,{...e})}),t[0]=e,t[1]=n),n}function uO(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=yt(),{pages:u,loading:d}=si(),f=sO(c,n,iO),p=(0,Q.useRef)(``),m=f.map(dO).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)U(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;on(e,t&&t.length>0?t:crypto.randomUUID())}ut(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,ct(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)(_O,{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 dO(e){return e.docName}function fO(e){let t=(0,$.c)(8),{isActive:n,initialScrollTop:r,children:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(r??0),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=a.current;if(!e)return;let t=()=>{e.scrollTop>0&&(o.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>{if(!n)return;let e=a.current;if(!e)return;let t=o.current;if(t===0)return;let r=performance.now(),i=!1;e.scrollTop=t,e.scrollTop===t&&e.scrollHeight>t&&ut(`ok/scroll-restore/phase1-success`,{target:t,elapsedMs:performance.now()-r});let s=!1,c=0,l=()=>{s||(s=!0,cancelAnimationFrame(c),clearTimeout(f),e.removeEventListener(`wheel`,u),e.removeEventListener(`touchstart`,u))},u=()=>l();e.addEventListener(`wheel`,u,{passive:!0}),e.addEventListener(`touchstart`,u,{passive:!0});let d=()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&!i&&(ut(`ok/scroll-restore/phase2-success`,{target:t,elapsedMs:performance.now()-r}),i=!0)),c=requestAnimationFrame(d))};c=requestAnimationFrame(d);let f=setTimeout(()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&ut(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function pO(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)(Vb,{}),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)(oO,{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 mO(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)(io,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Ce,{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)(sa,{type:`button`,onClick:hO,children:[(0,Z.jsx)(io,{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 hO(){return window.location.reload()}function gO(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function _O(e){let t=(0,$.c)(53),{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=cO(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=gC(n.docName)===`conflict`,h;t[3]===n.docName?h=t[4]:(h=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=h);let[g]=(0,Q.useState)(h),_=n.provider.document.getText(`source`).length,[v,y]=(0,Q.useState)(i),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==v||t[7]!==b?(S=()=>{i&&!v?y(!0):!i&&!b&&x(!0)},C=[i,v,b],t[5]=i,t[6]=v,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=nO({ytextLength:_,isSourceMode:i,visitedSource:v,visitedVisual:b}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==_?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&ut(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:_,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,_,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=_,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let k;t[19]===n.docName?k=t[20]:(k=()=>m(n.docName),t[19]=n.docName,t[20]=k);let[A]=(0,Q.useState)(k),j=A?.html??null,[M,N]=(0,Q.useState)(!1),P,F;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==M||t[26]!==i||t[27]!==_?(P=()=>{rO({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(ut(`ok/cold/first-toggle`,{docName:n.docName,mountId:ce(n.docName),ytextLength:_,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,_,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=M,t[26]=i,t[27]=_,t[28]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=A?.scrollTop,z;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==g||t[41]!==s||t[42]!==f||t[43]!==j?(z=f?(0,Z.jsx)(mO,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(qD,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(gO,{html:j}):(0,Z.jsx)(Vb,{}),children:(0,Z.jsx)(HD,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(VD,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(YD,{provider:n.provider}),!i&&(0,Z.jsx)($D,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(pO,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(BT,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:g},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=g,t[41]=s,t[42]=f,t[43]=j,t[44]=z):z=t[44];let B;t[45]!==r||t[46]!==R||t[47]!==z?(B=(0,Z.jsx)(fO,{isActive:r,initialScrollTop:R,children:z}),t[45]=r,t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;return t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:B}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52],V}function vO(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function yO(e){let{value:t,unit:n}=vO(e);return n===`rem`?t*16:t}function bO(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var xO=3600*24*7;function SO(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?CO:m,O=g===void 0?xO: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,ee;t[0]===r?(U=t[1],ee=t[2]):(U=()=>{V.current=r},ee=[r],t[0]=r,t[1]=U,t[2]=ee),(0,Q.useEffect)(U,ee);let te,W;t[3]===y?(te=t[4],W=t[5]):(te=()=>{H.current=y},W=[y],t[3]=y,t[4]=te,t[5]=W),(0,Q.useEffect)(te,W);let ne=yO(b),re;t[6]===x?re=t[7]:(re=yO(x),t[6]=x,t[7]=re);let G=re,ie;t[8]!==E||t[9]!==k?(ie=function(e){E&&(P.current=!0,j.current=H.current?0:yO(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]=ie):ie=t[10];let K=ie,q,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==G||t[18]!==ne||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(q=()=>{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}=vO(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<=ne*w;else if(e<=ne){let n=ne*(w-1);t=ne-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>ne*T){a();let t=n(r,M.current,j.current,s),c=Math.max(ne,Math.min(G,t)),u=bO(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(ne,Math.min(G,u)),f=bO(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,ne,G,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]=G,t[18]=ne,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=q,t[25]=ae):(q=t[24],ae=t[25]),(0,Q.useEffect)(q,ae);let oe;return t[26]===K?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:K},t[26]=K,t[27]=oe),oe}function CO(){}var wO=3600*24*7,TO=`18rem`,EO=`3rem`,DO=`app-file-sidebar`,OO=`14.625rem`,kO=`32rem`,AO=`sidebar_width`,jO=/^\d+(?:\.\d+)?(?:rem|px)$/,MO=Q.createContext(null);function NO(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${AO}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return jO.test(n)?n:e}function PO(){let e=Q.use(MO);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function FO(e){let t=(0,$.c)(58),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]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...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);let l=c===void 0?TO:c,[u]=Q.useState(LO),d;t[8]===u?d=t[9]:(d=()=>EC(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>NO(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=NC();return FC(`left`,EC(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),IC(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(IO)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${CC}px)`),t=()=>{let e=EC(u,window.innerWidth,`left`);p(e),C(FC(`left`,e,NC())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(DO)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)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"]`)||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{Ws(e,`toggle-files-sidebar`)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":EO,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let ee=U,te;t[48]===r?te=t[49]:(te=ea(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=te);let W;t[50]!==n||t[51]!==a||t[52]!==ee||t[53]!==te?(W=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:ee,className:te,...a,children:n}),t[50]=n,t[51]=a,t[52]=ee,t[53]=te,t[54]=W):W=t[54];let ne;return t[55]!==H||t[56]!==W?(ne=(0,Z.jsx)(MO.Provider,{value:H,children:W}),t[55]=H,t[56]=W,t[57]=ne):ne=t[57],ne}function IO(e){return!e}function LO(){return Bi()}function RO(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=PO();if(d===`none`){let e;t[7]===r?e=t[8]:(e=ea(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=ea(`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[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`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`,x;t[20]!==r||t[21]!==b?(x=ea(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 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)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(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[23]=n,t[24]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:DO,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function zO(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=PO(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=Gs(`toggle-files-sidebar`);l=sa,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=DO,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=ea(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(Te,{}):(0,Z.jsx)(kl,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function BO(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=PO(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:OO,maxResizeWidth:kO,setIsDraggingRail:h,widthCookieName:AO,widthCookieMaxAge:wO},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=SO(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=ea(`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[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function VO(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=PO(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=ea(`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`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function HO(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=ea(`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 UO(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=ea(`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 WO(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=ea(`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 GO(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=ea(`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 KO(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=ea(`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 qO=la(`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 JO(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?na:`button`,{state:m}=PO(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=ea(qO({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(Gn,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ar,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(pr,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function YO(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function XO(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=bi.safeParse(t);return n.success?n.data.currentBranch??null:null}var ZO=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:YO({fetchBranch:XO,subscribeToEvent:ii}),QO=ZO.subscribe,$O=ZO.getSnapshot;function ek(){return(0,Q.useSyncExternalStore)(QO,$O,$O)}function tk(){let e=(0,$.c)(6),t=ek(),n=No(),{state:r}=PO(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&os(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function nk(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=tk();if(!o&&l===null)return null;let u=r??n,d=r!=null,{words:f,chars:p,tokens:m}=u,h;t[0]!==c||t[1]!==d||t[2]!==o?(h=c(o?d?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=c,t[1]=d,t[2]=o,t[3]=h):h=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(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[4]=g):g=t[4];let _;t[5]===l?_=t[6]:(_=l===null?null:(0,Z.jsx)(rk,{identity:l}),t[5]=l,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[7]=_,t[8]=v);let y;t[9]!==c||t[10]!==u.chars||t[11]!==u.tokens||t[12]!==u.words||t[13]!==p||t[14]!==d||t[15]!==o||t[16]!==m||t[17]!==f?(y=o?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[d?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:c({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:f}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:p}})]}),(0,Z.jsxs)(`span`,{children:[u.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:m}})]})]}):null,t[9]=c,t[10]=u.chars,t[11]=u.tokens,t[12]=u.words,t[13]=p,t[14]=d,t[15]=o,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==h||t[20]!==v||t[21]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":h,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[g,v,y]}),t[19]=h,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function rk(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ar,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(Be,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function ik(e){let t=(0,$.c)(11),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{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=ea(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function ak(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=ea(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ok(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=ea(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function sk(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=ea(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function ck(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=ea(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Os,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var lk=1,uk=2,dk=4;function fk(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=Qt(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>dk?[...u.slice(0,lk).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(lk,-uk)},...u.slice(-uk).map((e,t)=>d(e,u.length-uk+t))]:u.map((e,t)=>d(e,t));a=ik,t[8]===r?c=t[9]:(c=ea(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=ak,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(pk)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function pk(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(ck,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(ok,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(al,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(ok,{className:`min-w-0`,children:(0,Z.jsx)(sk,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var mk={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`},hk=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`,...mk,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},gk=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)(hk,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},_k=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)(hk,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function vk(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Us(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=Gs(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(fk,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(Gn,{children:(0,Z.jsx)(_k,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(hs,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(pr,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(gk,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(hs,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(Ar,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(pr,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(_s,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(sa,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Gn,{children:(0,Z.jsx)(Sl,{})})}),(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=pr,h=sa,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,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]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],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];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)(Gn,{children:u?(0,Z.jsx)(jl,{}):(0,Z.jsx)(Al,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(Ar,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function yk(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var bk=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BWmb9zCZ.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function xk(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(Ck,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Sk,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(G,{name:`editor-area`,children:(0,Z.jsxs)(OS,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Sk(){let e=(0,$.c)(5),t=Nh(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(zS,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function Ck(e){let t=(0,$.c)(144),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,onSaveVersion:c,saving:l}=e,{_:u}=i(),{activeDocName:d,activeProvider:f,activeTarget:p,recycleDocument:m,docPanelMode:h,docPanelAgentId:g,docPanelExpandSignal:_}=yt(),{openDocumentTransition:v}=Mt(),{requestAddProperty:y}=AS(),b=mC(f,d),x=_C(d,n===`source`?`source`:`wysiwyg`),S=LC(f),C=S===`connected`||S===`synced`,w=gC(d)===`conflict`,T=(0,Q.useDeferredValue)(d),E=p?.kind===`missing`,D=!!d&&p?.kind!==`folder`,O;t[0]!==u||t[1]!==E?(O=E?u({id:`K-a33w`}):void 0,t[0]=u,t[1]=E,t[2]=O):O=t[2];let k=O,[A]=(0,Q.useState)(Tk),j=A!==null,M;t[3]===A?M=t[4]:(M=()=>EC(A,window.innerWidth,`right`),t[3]=A,t[4]=M);let[N,P]=(0,Q.useState)(M),F=(0,Q.useRef)(N),I,L;t[5]===N?(I=t[6],L=t[7]):(I=()=>{F.current=N},L=[N],t[5]=N,t[6]=I,t[7]=L),(0,Q.useEffect)(I,L);let R=kb(),z;t[8]===N?z=t[9]:(z=()=>FC(`right`,N,NC())===`collapsed`,t[8]=N,t[9]=z);let[B]=(0,Q.useState)(z),[V,H]=(0,Q.useState)(B),U=(0,Q.useRef)(V),ee,te;t[10]===V?(ee=t[11],te=t[12]):(ee=()=>{U.current=V},te=[V],t[10]=V,t[11]=ee,t[12]=te),(0,Q.useEffect)(ee,te);let[W,ne]=(0,Q.useState)(!1),re=(0,Q.useRef)(!1),[G]=(0,Q.useState)(wk),ie=(0,Q.useRef)(G),q=(0,Q.useRef)(null),ae;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e){q.current!=null&&clearTimeout(q.current),q.current=setTimeout(()=>{xC(e),q.current=null},100)},t[13]=ae):ae=t[13];let oe=ae,se,ce;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>()=>{q.current!=null&&clearTimeout(q.current)},se=[],t[14]=se,t[15]=ce):(se=t[14],ce=t[15]),(0,Q.useEffect)(ce,se);let[le,ue]=(0,Q.useState)(null),de;t[16]!==V||t[17]!==R?(de=function(){if(R.current==null)return;let e=F.current;V?(IC(`right`,e,`open`),R.current?.expand()):(IC(`right`,e,`collapsed`),R.current?.collapse())},t[16]=V,t[17]=R,t[18]=de):de=t[18];let fe=de,pe,me;t[19]!==A||t[20]!==R?(pe=()=>{let e=window.matchMedia(`(min-width: ${wC}px)`),t=()=>{let e=EC(A,window.innerWidth,`right`);P(e);let t=FC(`right`,e,NC())===`collapsed`;H(t),t?R.current?.collapse():R.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},me=[A,R],t[19]=A,t[20]=R,t[21]=pe,t[22]=me):(pe=t[21],me=t[22]),(0,Q.useEffect)(pe,me);let he,ge;t[23]!==le||t[24]!==j||t[25]!==R?(he=()=>{if(le==null||j)return;let e=new ResizeObserver(()=>{U.current||re.current||R.current?.resize(`${ie.current}px`)});return e.observe(le),()=>e.disconnect()},ge=[le,j,R],t[23]=le,t[24]=j,t[25]=R,t[26]=he,t[27]=ge):(he=t[26],ge=t[27]),(0,Q.useEffect)(he,ge);let _e,ve;t[28]!==o||t[29]!==R?(_e=()=>{let e=e=>{o(e),R.current?.expand()},t=Mm();return t&&e(t),Pm(t=>{Mm(),e(t)})},ve=[o,R],t[28]=o,t[29]=R,t[30]=_e,t[31]=ve):(_e=t[30],ve=t[31]),(0,Q.useEffect)(_e,ve);let ye,be;t[32]!==_||t[33]!==R?(ye=()=>{_!==0&&R.current?.expand()},be=[_,R],t[32]=_,t[33]=R,t[34]=ye,t[35]=be):(ye=t[34],be=t[35]),(0,Q.useEffect)(ye,be);let xe,Se;t[36]===V?(xe=t[37],Se=t[38]):(xe=()=>{if(!V||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},Se=[V],t[36]=V,t[37]=xe,t[38]=Se),(0,Q.useLayoutEffect)(xe,Se);let Ce,we;t[39]===V?(Ce=t[40],we=t[41]):(Ce=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!V})},we=[V],t[39]=V,t[40]=Ce,t[41]=we),(0,Q.useEffect)(Ce,we);let Te,Ee;t[42]===fe?(Te=t[43],Ee=t[44]):(Te=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&fe()})},Ee=[fe],t[42]=fe,t[43]=Te,t[44]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[45]===fe?(De=t[46],Oe=t[47]):(De=()=>{if(window.okDesktop!=null)return;let e=e=>{Ws(e,`toggle-document-panel`)&&(e.preventDefault(),fe())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Oe=[fe],t[45]=fe,t[46]=De,t[47]=Oe),(0,Q.useEffect)(De,Oe);let ke=(0,Q.useRef)(null),[Ae,je]=(0,Q.useState)(null),Me=p?.kind===`large-file`?p.docName:d,Ne,Pe;t[48]===Me?(Ne=t[49],Pe=t[50]):(Ne=()=>{if(Me&&Me!==ke.current){let e=ke.current;ke.current=Me,je(e)}},Pe=[Me],t[48]=Me,t[49]=Ne,t[50]=Pe),(0,Q.useEffect)(Ne,Pe);let Fe;t[51]===v?Fe=t[52]:(Fe=function(e){let t=yr(e);window.location.hash===t?v(e):window.location.hash=t},t[51]=v,t[52]=Fe);let Ie=Fe;if(p?.kind===`large-file`){let e;t[53]!==Ie||t[54]!==Ae?(e=Ae?{previousDocName:Ae,onNavigateBack:Ie}:void 0,t[53]=Ie,t[54]=Ae,t[55]=e):e=t[55];let n;return t[56]!==p.docName||t[57]!==p.limit||t[58]!==p.size||t[59]!==e?(n=(0,Z.jsx)(wS,{docName:p.docName,size:p.size,limit:p.limit,backNav:e}),t[56]=p.docName,t[57]=p.limit,t[58]=p.size,t[59]=e,t[60]=n):n=t[60],n}if(p?.kind===`folder`){if(!(h===`agent`&&g!==null)){let e;return t[61]===p.folderPath?e=t[62]:(e=(0,Z.jsx)(bS,{folderPath:p.folderPath}),t[61]=p.folderPath,t[62]=e),e}let e;t[63]===p.folderPath?e=t[64]:(e=(0,Z.jsx)(GS,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(bS,{folderPath:p.folderPath})}),t[63]=p.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(KS,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(GS,{defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(bk,{showBackButton:!1})})}),t[66]=r):r=t[66];let i;return t[67]===e?i=t[68]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(WS,{orientation:`horizontal`,children:[e,n,r]})}),t[67]=e,t[68]=i),i}if(p?.kind===`asset`){let e;return t[69]!==p.assetPath||t[70]!==p.mediaKind?(e=(0,Z.jsx)(Bb,{assetPath:p.assetPath,mediaKind:p.mediaKind},p.assetPath),t[69]=p.assetPath,t[70]=p.mediaKind,t[71]=e):e=t[71],e}if(!f||!d){if((typeof window<`u`?pi(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Vb,{}),t[72]=e):e=t[72],e}let e;return t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Vx,{}),t[73]=e):e=t[73],e}let Le=n===`source`,Re=!C,ze=V,Be;t[74]!==d||t[75]!==y?(Be=function(){d&&y(d)},t[74]=d,t[75]=y,t[76]=Be):Be=t[76];let Ve=Be,Ue=T??d,We=Ae??void 0,Ge;t[77]!==k||t[78]!==Le||t[79]!==Ie||t[80]!==m||t[81]!==Ue||t[82]!==We?(Ge=(0,Z.jsx)(lO,{activeDocName:Ue,isSourceMode:Le,editorPlaceholder:k,previousDocName:We,onNavigateBack:Ie,onRecycle:m}),t[77]=k,t[78]=Le,t[79]=Ie,t[80]=m,t[81]=Ue,t[82]=We,t[83]=Ge):Ge=t[83];let Ke;t[84]!==d||t[85]!==Le?(Ke=(0,Z.jsx)(uC,{activeDocName:d,isSourceMode:Le}),t[84]=d,t[85]=Le,t[86]=Ke):Ke=t[86];let qe;t[87]!==d||t[88]!==T?(qe=yk({activeDocName:d,deferredActiveDocName:T,mountResolved:d!==null&&K(d),syncResolved:d!==null&&He(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Vb,{}),d===null?null:(0,Z.jsx)(TS,{docName:d})]}):null,t[87]=d,t[88]=T,t[89]=qe):qe=t[89];let Je;t[90]!==Ge||t[91]!==Ke||t[92]!==qe?(Je=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[Ge,Ke,qe]}),t[90]=Ge,t[91]=Ke,t[92]=qe,t[93]=Je):Je=t[93];let Ye;t[94]!==d||t[95]!==w||t[96]!==ze||t[97]!==Le||t[98]!==r||t[99]!==Ve||t[100]!==Re||t[101]!==fe?(Ye=!w&&(0,Z.jsx)(vk,{activeDocName:d,isSourceMode:Le,sourceDisabled:Re,onModeChange:r,showAddPropertyButton:!Le,onAddProperty:Ve,isPanelCollapsed:ze,onTogglePanel:fe}),t[94]=d,t[95]=w,t[96]=ze,t[97]=Le,t[98]=r,t[99]=Ve,t[100]=Re,t[101]=fe,t[102]=Ye):Ye=t[102];let Xe;t[103]!==Je||t[104]!==Ye?(Xe=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[Je,Ye]}),t[103]=Je,t[104]=Ye,t[105]=Xe):Xe=t[105];let Ze;t[106]!==x||t[107]!==D||t[108]!==b?(Ze=(0,Z.jsx)(nk,{stats:b,selectionStats:x,showStats:D}),t[106]=x,t[107]=D,t[108]=b,t[109]=Ze):Ze=t[109];let Qe;t[110]!==Xe||t[111]!==Ze?(Qe=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[Xe,Ze]}),t[110]=Xe,t[111]=Ze,t[112]=Qe):Qe=t[112];let $e=Qe,et=W||void 0,tt;t[113]===B?tt=t[114]:(tt=B?{defaultSize:`100%`}:{},t[113]=B,t[114]=tt);let nt=W?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,rt;t[115]!==$e||t[116]!==tt||t[117]!==nt?(rt=(0,Z.jsx)(GS,{minSize:`30%`,...tt,className:nt,children:$e}),t[115]=$e,t[116]=tt,t[117]=nt,t[118]=rt):rt=t[118];let it=j&&V,at;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(at=()=>{ne(!0),re.current=!0;let e=()=>{ne(!1),re.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[119]=at):at=t[119];let J;t[120]===it?J=t[121]:(J=(0,Z.jsx)(KS,{withHandle:!0,disabled:it,onPointerDown:at}),t[120]=it,t[121]=J);let ot=B?0:`${G}px`,st;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(st=e=>{H(e.asPercentage===0),e.inPixels>0&&re.current&&(ie.current=e.inPixels,oe(e.inPixels))},t[122]=st):st=t[122];let ct=!W&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,lt;t[123]===ct?lt=t[124]:(lt=ea(`flex flex-col bg-muted/20`,ct),t[123]=ct,t[124]=lt);let ut;t[125]!==d||t[126]!==a||t[127]!==h||t[128]!==Le||t[129]!==o||t[130]!==c||t[131]!==l?(ut=(0,Z.jsx)(Fv,{docName:d,isSourceMode:Le,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l}),t[125]=d,t[126]=a,t[127]=h,t[128]=Le,t[129]=o,t[130]=c,t[131]=l,t[132]=ut):ut=t[132];let dt;t[133]!==V||t[134]!==R||t[135]!==ot||t[136]!==lt||t[137]!==ut?(dt=(0,Z.jsx)(GS,{id:`doc-panel`,panelRef:R,defaultSize:ot,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:st,inert:V,className:lt,children:ut}),t[133]=V,t[134]=R,t[135]=ot,t[136]=lt,t[137]=ut,t[138]=dt):dt=t[138];let ft;return t[139]!==et||t[140]!==rt||t[141]!==J||t[142]!==dt?(ft=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:ue,children:(0,Z.jsxs)(WS,{orientation:`horizontal`,"data-dragging":et,children:[rt,J,dt]})}),t[139]=et,t[140]=rt,t[141]=J,t[142]=dt,t[143]=ft):ft=t[143],ft}function wk(){return SC()}function Tk(){return Bi()}function Ek(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 Dk(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 Ok=1e3,kk=!1;function Ak(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function jk(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:Sa(i)?a=i:(a=void 0,kk||(kk=!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`&&(Ak({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=Dk(i),{current:c,crossDoc:l}=a?_a(a,n,Date.now()):{current:[],crossDoc:[]},u=Mk,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Ek(e.current,p)&&Ek(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,Ok);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 Mk(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Nk=`sync-status`;function Pk(e,t){let n=(0,$.c)(5),{_:r}=i(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==e?(c=()=>{s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t&&(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current?(o.current=!0,X.warning(r({id:`HGNCsl`}),{id:Nk,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,X.success(r({id:`GhjUB_`}),{id:Nk,duration:3e3})))},l=[e,t,r],n[0]=r,n[1]=t,n[2]=e,n[3]=c,n[4]=l):(c=n[3],l=n[4]),(0,Q.useEffect)(c,l)}var Fk=4,Ik=3,Lk={Bird:Wc,Cat:Xc,Dog:il,Fish:ll,Mouse:Il,Rabbit:Fl,Shrimp:Ul,Snail:Wl,Squirrel:ql,Turtle:Ql};Object.freeze(Object.keys(Lk));function Rk(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Lk,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var zk={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function Bk(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=Rk(n),c=s.kind===`animal`?Lk[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=Ur(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=ni(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(Ar,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(pr,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function Vk(e){let t=zk[e.icon];return e.displayName||t||Y._({id:`iEQQyu`})}function Hk(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 Uk(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=yt(),{presence:u,agentId:d}=n,f=Vk(u),p=Hk(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(ba,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(ba,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)(Gn,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(Ar,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(pr,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function Wk(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?Y._({id:`9euN0m`,values:{count:n}}):Y._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(T,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,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[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(Bk,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(Uk,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(ie,{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:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(ee,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function Gk(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(Bk,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(Uk,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function Kk(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=yt(),{current:s,crossDoc:c}=jk(t,r,n);if(Pk(LC(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,Fk),n;e[6]===s?n=e[7]:(n=s.slice(Fk),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Ik),d;e[8]===c?d=e[9]:(d=c.slice(Ik),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=>Gk(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)(Wk,{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)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>Gk(e,p,!0,m)),f.length>0?(0,Z.jsx)(Wk,{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}var qk=`.md`,Jk=/\.(md|mdx)$/i;function Yk(e,t=qk){return`${e}${t}`}function Xk(e){return _A(e).replace(Jk,``)}function Zk(e){return Pr(e)?eA(e.path):Jn(e)?e.path:Yk(e.docName,e.docExt)}function Qk(e){let t=_A(e).match(Jk);return t?`.${t[1].toLowerCase()}`:void 0}function $k(e){return _A(e)}function eA(e){let t=_A(e.trim());return t?`${t}/`:``}function tA(e){return e.endsWith(`/`)?$k(e):Xk(e)}function nA(e){return e.map(Zk)}function rA(e){return[...e].sort().join(`\0`)}function iA(e){return rA(nA(e))}function aA(e){let t=new Set;for(let n of e){if(Pr(n)){let e=eA(n.path);e&&t.add(e)}let e=(Pr(n)||Jn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Pr(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function oA(e){if(!e)return[];let t=_A(e.replace(Jk,``)).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 sA(e,t,n){let r=Qk(e);if(r)return r;let i=n.find(e=>Gi(e)&&e.docName===t);return i?i.docExt??qk:gA(e).includes(`.`)?void 0:qk}function cA(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!Jn(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function lA(e,t,n){if(Qk(e))return null;let r=n.find(e=>Jn(e)&&e.path===t);return r?r.path:gA(e).includes(`.`)?t:cA(t,n)}function uA(e,t){let n=e.kind===`directory`,r=n?$k(e.path):Xk(e.path);if(n)return{kind:`folder`,name:_A(gA(e.path)).replace(Jk,``),path:r,treePath:fA(e.path,!0)};let i=lA(e.path,r,t);if(i)return{kind:`asset`,name:_A(gA(i)),path:i,treePath:i};let a=sA(e.path,r,t);return{kind:`file`,name:_A(gA(e.path)).replace(Jk,``),path:r,treePath:fA(e.path,!1),docExt:a}}function dA(e){return e.kind===`directory`?$k(e.path):e.path}function fA(e,t){return t?eA(e):Jk.test(e)?e:`${e}${qk}`}function pA(e,t,n){let r=eA(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}${qk}`;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 mA(e,t){return e===`file`?fA(t,!1):`${$k(t)}/index${qk}`}function hA(e,t){return t.kind===`root`||t.directoryPath==null?gA(e):`${t.directoryPath}${gA(e)}`}function gA(e){let t=_A(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function _A(e){return e.endsWith(`/`)?e.slice(0,-1):e}function vA(e,t){return t.trim()}function yA(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function bA(e,t){let n=vA(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function xA(e,t,n=[],r=[]){if(t.length===0&&n.length===0&&r.length===0)return e;let i=new Map(t.map(e=>[e.fromDocName,e.toDocName])),a=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>Gi(e)?{...e,docName:i.get(e.docName)??e.docName}:Pr(e)?{...e,path:OA(e.path,n)}:Jn(e)?{...e,path:a.get(e.path)??OA(e.path,n)}:e)}function SA(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>Gi(e)?!i.has(e.docName)&&!MA(e.docName,n):Pr(e)?!MA(e.path,n):Jn(e)?!a.has(e.path)&&!MA(e.path,n):!0)}function CA(e,t){if(e.kind!==`asset`||t.some(t=>Jn(t)&&t.path===e.path))return e;let n=cA(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function wA(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>kA(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Gi(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>Pr(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(Gi(i)){let e=jA(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Pr(i)){let e=AA(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function TA(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function EA(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function DA(e,t){let n=e.kind===`file`?Yk(e.path,e.docExt):e.path;return ig(t.contentDir,n,t.pathSeparator)}function OA(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 kA(e,t){return Gi(e)&&Gi(t)?e.docName===t.docName:Pr(e)&&Pr(t)||Jn(e)&&Jn(t)?e.path===t.path:!1}function AA(e,t,n){return e===t?n:jA(e,t,n)}function jA(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function MA(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function NA(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)(Qu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function PA(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=ea(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)($u,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function FA(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)(od,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function IA(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=ea(`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 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ed,{children:(0,Z.jsx)(td,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function LA(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=ea(`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)(nd,{"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 RA(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=ea(`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-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Os,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(sd,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function zA(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=ea(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden 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 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(cd,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function BA(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=ea(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(id,{children:(0,Z.jsx)(Ds,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(rd,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function VA(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=ea(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ad,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var HA=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,UA=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,WA={start:[Yo.Space],cancel:[Yo.Esc],end:[Yo.Space,Yo.Enter]};function GA(e){return ea(HA,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function KA(e){return e?void 0:-1}function qA({className:e,isDragging:t}){return ea(e,t&&UA)}function JA(e){return e.code===Yo.Enter&&e.target===e.currentTarget}function YA({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&JA(e)?`activate-tab`:`delegate-sortable`}function XA({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:wa.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function ZA(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function QA(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var $A=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return vo(e)},ej=[`.md`,`.mdx`],tj=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,nj=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,rj=ea(nj,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),ij=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function aj(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function oj(e){let t=yr(e);window.location.hash!==t&&(window.location.hash=t)}function sj(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function cj(e,t){let n=[t,...ej].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 lj(e){let t=(0,$.c)(37),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]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=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;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=go(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=XA({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=YA({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=qA({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function uj(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=rn(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=rn(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(PA,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(LA,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(LA,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(LA,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(VA,{}),(0,Z.jsx)(LA,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(IA,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(NA,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function dj(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:a,isPinned:o,tabId:s,unpinTab:c}=e,{_:l}=i();if(o){let e;t[0]!==l||t[1]!==n?(e=l({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=l,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s||t[4]!==c?(r=e=>{e.stopPropagation(),c(s)},t[3]=s,t[4]=c,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Pl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let u;t[10]!==l||t[11]!==n?(u=l({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=l,t[11]=n,t[12]=u):u=t[12];let d;t[13]===a?d=t[14]:(d=GA(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=KA(a),t[15]=a,t[16]=f);let p;t[17]!==r||t[18]!==s?(p=e=>{e.stopPropagation(),r(s)},t[17]=r,t[18]=s,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(ys,{"aria-hidden":`true`}),t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p?(h=(0,Z.jsx)(sa,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u,"data-testid":`editor-tab-close-button`,className:d,tabIndex:f,onClick:p,children:m}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=h):h=t[25],h}function fj(e){let t=(0,$.c)(1),{docName:n}=e;if(gC(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Pi,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function pj(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:b,pinnedTabIds:x,remapTabsForRename:S,reorderTabs:C,unpinTab:w,visibleTabIds:T}=yt(),{_:E}=i(),{pageMeta:D}=si(),O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),ee=(0,Q.useRef)(t),te;e[0]!==n||e[1]!==t||e[2]!==a?(te=n??(a?y(a):t?Yt(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=te):te=e[3];let W=te,ne;e[4]!==r||e[5]!==W||e[6]!==h||e[7]!==g||e[8]!==v?(ne=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:W?`${W}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=W,e[6]=h,e[7]=g,e[8]=v,e[9]=ne):ne=e[9];let re=ne,G,ie;e[10]===t?(G=e[11],ie=e[12]):(G=()=>{ee.current=t},ie=[t],e[10]=t,e[11]=G,e[12]=ie),(0,Q.useEffect)(G,ie);let K,q;e[13]===re?(K=e[14],q=e[15]):(K=()=>{re&&(O.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[re],e[13]=re,e[14]=K,e[15]=q),(0,Q.useEffect)(K,q);let ae,oe;e[16]===j?(ae=e[17],oe=e[18]):(ae=()=>{j&&(B.current?.focus(),B.current?.select())},oe=[j],e[16]=j,e[17]=ae,e[18]=oe),(0,Q.useEffect)(ae,oe);let se,ce;e[19]!==v||e[20]!==j?(se=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),z(!1))},ce=[v,j],e[19]=v,e[20]=j,e[21]=se,e[22]=ce):(se=e[21],ce=e[22]),(0,Q.useEffect)(se,ce);let le=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},ue=function(){H.current=!0,U.current=null,M(null),P(``),I(null),z(!1)},de=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=j?.docName;if(!e){ue();return}let t=vA(`file`,cj(N,D.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ue();return}if(t===U.current){B.current?.focus();return}if(!yA(t)){I(E({id:`P8yDjG`})),B.current?.focus();return}let i=bA({kind:`file`,path:e,name:r},t);V.current=!0,z(!0),I(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){z(!1),V.current=!1;return}let r=await L(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),z(!1),V.current=!1,U.current=t,B.current?.focus();return}let a=Ee(Hi,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=ee.current,s=TA(o,a);pe(a);let c=!0;try{let e=EA(a,p(),m);await Promise.all(e.map(e=>l(e))),S(a),vi([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),X.error(E({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),z(!1),V.current=!1,U.current=null,c&&s&&s!==o&&oj(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(E({id:`HIb0vl`})),z(!1),V.current=!1,U.current=t,B.current?.focus()}},fe=typeof window<`u`&&window.okDesktop!=null,me;e[23]===g?me=e[24]:(me=new Set(g),e[23]=g,e[24]=me);let he=me,ge;e[25]===k?ge=e[26]:(ge=QA(k),e[25]=k,e[26]=ge);let _e;e[27]===ge?_e=e[28]:(_e=[ge],e[27]=ge,e[28]=_e);let ve=_e,ye;e[29]!==u||e[30]!==f||e[31]!==he?(ye=function(e){let t=[],n=[];for(let r of e)he.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=he,e[32]=ye):ye=e[32];let be=ye,xe;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(xe={activationConstraint:{distance:8}},e[33]=xe):xe=e[33];let Se;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(Se={coordinateGetter:fo,keyboardCodes:WA},e[34]=Se):Se=e[34];let Ce=ro(So(bo,xe),So(Ua,Se)),we;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(){A(ZA(O.current))},e[35]=we):we=e[35];let Te=we,De;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(){A(null)},e[36]=De):De=e[36];let Oe=De,ke;e[37]!==Oe||e[38]!==C||e[39]!==T?(ke=function(e){Oe();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=T.indexOf(t),i=T.indexOf(n);r<0||i<0||r===i||C(mo([...T],r,i),t)},e[37]=Oe,e[38]=C,e[39]=T,e[40]=ke):ke=e[40];let Ae=ke,je=fe?``:void 0,Me;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Me=ea(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,fe&&`[-webkit-app-region:drag]`),e[41]=Me):Me=e[41];let Ne=sj,Pe;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=ea(`flex items-end gap-1`,fe&&`[-webkit-app-region:no-drag]`),e[42]=Pe):Pe=e[42];let Fe=Ga,Ie=$A,Le;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Le={container:typeof document<`u`?document.body:void 0},e[43]=Le):Le=e[43];let Re=Da,ze;e[44]===T?ze=e[45]:(ze=[...T],e[44]=T,e[45]=ze);let Be=za,Ve=T.map(e=>{if(he.has(e)){let t=e===r;return(0,Z.jsx)(uj,{tabId:e,canPin:!1,openTabs:T,closeTab:u,closeTabs:be,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(lj,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:ea(tj,t?nj:rj),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:ij,onClick:()=>c(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:GA(t),tabIndex:KA(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(ys,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=en(e),n=e===W,i=x.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Qt(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(uj,{tabId:e,openTabs:T,closeTab:d,closeTabs:be,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(lj,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ea(tj,n?nj:rj),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:ij,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:ea(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:ea(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(dj,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:w})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Qt(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(uj,{tabId:e,openTabs:T,closeTab:d,closeTabs:be,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(lj,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ea(tj,n?nj:rj),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:ij,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:ea(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:ea(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(dj,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:w})]})},e)}let a=t.docName,l=D.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=Qt(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,y=`editor-tab-rename-error-${aj(a)}`;return(0,Z.jsx)(uj,{disabled:v,tabId:e,openTabs:T,closeTab:d,closeTabs:be,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsx)(lj,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ea(tj,n?nj:rj,v&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(qS,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(QS,{ref:B,value:N,disabled:R,"aria-label":E({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?y:void 0,"aria-busy":R||void 0,title:F??a,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=>{P(cj(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),de()):e.key===`Escape`&&(e.preventDefault(),ue())},onBlur:de}),(0,Z.jsx)(YS,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(ZS,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:y,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:ij,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),le(e,a)},tabIndex:-1,children:[(0,Z.jsx)(fj,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(dj,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:w})]})})},e)}),He;e[46]!==Re||e[47]!==ze||e[48]!==Be||e[49]!==Ve?(He=(0,Z.jsx)(Re,{items:ze,strategy:Be,children:Ve}),e[46]=Re,e[47]=ze,e[48]=Be,e[49]=Ve,e[50]=He):He=e[50];let Ue;e[51]!==Fe||e[52]!==Oe||e[53]!==Ae||e[54]!==Te||e[55]!==Ce||e[56]!==!1||e[57]!==Ie||e[58]!==Le||e[59]!==He||e[60]!==ve?(Ue=(0,Z.jsx)(Fe,{sensors:Ce,autoScroll:!1,collisionDetection:Ie,modifiers:ve,onDragStart:Te,onDragEnd:Ae,onDragCancel:Oe,accessibility:Le,children:He}),e[51]=Fe,e[52]=Oe,e[53]=Ae,e[54]=Te,e[55]=Ce,e[56]=!1,e[57]=Ie,e[58]=Le,e[59]=He,e[60]=ve,e[61]=Ue):Ue=e[61];let We;e[62]===E?We=e[63]:(We=E({id:`3YvS-c`}),e[62]=E,e[63]=We);let Ge;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsx)(At,{"aria-hidden":`true`}),e[64]=Ge):Ge=e[64];let Ke;e[65]!==_||e[66]!==We?(Ke=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":We,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ge})}),e[65]=_,e[66]=We,e[67]=Ke):Ke=e[67];let qe;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsx)(Ar,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=qe):qe=e[68];let Je;e[69]===Ke?Je=e[70]:(Je=(0,Z.jsxs)(pr,{children:[Ke,qe]}),e[69]=Ke,e[70]=Je);let Ye;e[71]!==Pe||e[72]!==Ue||e[73]!==Je?(Ye=(0,Z.jsxs)(`div`,{className:Pe,children:[Ue,Je]}),e[71]=Pe,e[72]=Ue,e[73]=Je,e[74]=Ye):Ye=e[74];let Xe;return e[75]!==je||e[76]!==Me||e[77]!==Ne||e[78]!==Ye?(Xe=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":je,className:Me,onWheel:Ne,children:Ye}),e[75]=je,e[76]=Me,e[77]=Ne,e[78]=Ye,e[79]=Xe):Xe=e[79],Xe}function mj(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 hj(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:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Zt},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:Hd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:ci},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:mj},{label:`Twitter`,href:`https://x.com/inkeep`,icon:hj}],_j=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(nn,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(T,{asChild:!0,children:(0,Z.jsxs)(sa,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(pr,{children:[o,(0,Z.jsx)(Ar,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=gj.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Xo(e,r),onAuxClick:e=>Xo(e,r),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)(i,{"aria-hidden":`true`,className:`size-4 shrink-0`}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(ie,{align:`end`,className:`w-64 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(ee,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function vj(e){let t=(0,$.c)(75),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=jg(),{dispatch:u}=bg(),{merged:d}=be(),f=d?.appearance?.preview?.autoOpen??!0,[p,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(!1);if(bh())return null;let g=typeof window<`u`&&window.okDesktop!=null,_=r??p,v;t[0]!==a||t[1]!==r||t[2]!==l?(v=e=>{r===void 0&&m(e),a?.(e),e&&l()},t[0]=a,t[1]=r,t[2]=l,t[3]=v):v=t[3];let y=v,b=n===null,x=!!n?.selection,S;t[4]!==f||t[5]!==n?(S=n!==null&&n.docContext!==null?fr(n.docContext.relativePath,f):``,t[4]=f,t[5]=n,t[6]=S):S=t[6];let C=S,w;t[7]!==u||t[8]!==n?(w=e=>{n!==null&&u(e.id,n)},t[7]=u,t[8]=n,t[9]=w):w=t[9];let T=w,E,D,O,k,A,j,M,N,P,F,I,L,R,z;if(t[10]!==y||t[11]!==T||t[12]!==n||t[13]!==_||t[14]!==C||t[15]!==c||t[16]!==b){let e;t[31]===c?e=t[32]:(e=e=>c[e.id]?.installed===!0,t[31]=c,t[32]=e),A=Ch.filter(e);let r;t[33]===c?r=t[34]:(r=Ch.some(e=>c[e.id]?.installed==null),t[33]=c,t[34]=r),j=r,O=c[`claude-code`]?.installed===!0;let i;t[35]!==n||t[36]!==C?(i=()=>{n!==null&&Yb(C)},t[35]=n,t[36]=C,t[37]=i):i=t[37],k=i,D=jo,R=_,z=y,M=!1;let a;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(a=g?()=>{h.current=!0}:void 0,t[38]=a):a=t[38];let o;t[39]===y?o=t[40]:(o=g?()=>{if(h.current){h.current=!1;return}y(!0)}:void 0,t[39]=y,t[40]=o);let l,u;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(ya,{className:`size-3.5`,"aria-hidden":`true`}),u=(0,Z.jsx)(s,{id:`O7_W_a`}),t[41]=l,t[42]=u):(l=t[41],u=t[42]),t[43]!==o||t[44]!==b?(N=(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsxs)(sa,{variant:`ghost`,size:`sm`,disabled:b,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:a,onClick:o,children:[l,u]})}),t[43]=o,t[44]=b,t[45]=N):N=t[45],E=Wo,P=`end`,F=`min-w-[220px]`,I=`open-in-agent-menu`;let d;t[46]!==T||t[47]!==C||t[48]!==c?(d=e=>{let t=c[e.id];return(0,Z.jsx)(Xb,{target:e,installState:t,isElectronHost:g,prompt:C,onSelect:()=>T(e)},e.id)},t[46]=T,t[47]=C,t[48]=c,t[49]=d):d=t[49],L=A.map(d),t[10]=y,t[11]=T,t[12]=n,t[13]=_,t[14]=C,t[15]=c,t[16]=b,t[17]=E,t[18]=D,t[19]=O,t[20]=k,t[21]=A,t[22]=j,t[23]=M,t[24]=N,t[25]=P,t[26]=F,t[27]=I,t[28]=L,t[29]=R,t[30]=z}else E=t[17],D=t[18],O=t[19],k=t[20],A=t[21],j=t[22],M=t[23],N=t[24],P=t[25],F=t[26],I=t[27],L=t[28],R=t[29],z=t[30];let B;t[50]!==A||t[51]!==x||t[52]!==j?(B=x&&A.length===0?(0,Z.jsx)($o,{disabled:!0,"data-testid":`open-in-agent-selection-empty`,children:j?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}):null,t[50]=A,t[51]=x,t[52]=j,t[53]=B):B=t[53];let V;t[54]!==o||t[55]!==O||t[56]!==k||t[57]!==n||t[58]!==x?(V=!O&&!x?(0,Z.jsxs)($o,{onSelect:k,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":o({id:`aA51jP`}),children:[(0,Z.jsx)(_t,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[54]=o,t[55]=O,t[56]=k,t[57]=n,t[58]=x,t[59]=V):V=t[59];let H;t[60]!==E||t[61]!==B||t[62]!==V||t[63]!==P||t[64]!==F||t[65]!==I||t[66]!==L?(H=(0,Z.jsxs)(E,{align:P,className:F,"data-testid":I,children:[L,B,V]}),t[60]=E,t[61]=B,t[62]=V,t[63]=P,t[64]=F,t[65]=I,t[66]=L,t[67]=H):H=t[67];let U;return t[68]!==D||t[69]!==M||t[70]!==N||t[71]!==H||t[72]!==R||t[73]!==z?(U=(0,Z.jsxs)(D,{open:R,onOpenChange:z,modal:M,children:[N,H]}),t[68]=D,t[69]=M,t[70]=N,t[71]=H,t[72]=R,t[73]=z,t[74]=U):U=t[74],U}var yj=50,bj=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,MS.preload()},yj))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=kh)},u=(0,Z.jsx)(Vl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsxs)(sa,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(pr,{children:[d,(0,Z.jsx)(Ar,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function xj(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=Po(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),p,m;t[0]===u?(p=t[1],m=t[2]):(p=()=>{!u||!f.current||(f.current.focus(),f.current.select())},m=[u],t[0]=u,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=o?.hasRemote===!0,g=n===null,_;t[3]!==a||t[4]!==c||t[5]!==h||t[6]!==n||t[7]!==r?(_=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await ka({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:Eo,toastSuccess:Ej,toastError:Tj,logEvent:wj});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{X.error(a({id:`u3YnKw`}))}l(!1)}},t[3]=a,t[4]=c,t[5]=h,t[6]=n,t[7]=r,t[8]=_):_=t[8];let v=_,y=u!==null,b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||d(null)},t[9]=b):b=t[9];let x;t[10]!==a||t[11]!==n?.kind?(x=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=x):x=t[12];let S=c||g,C,w;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Hl,{className:`size-3.5`,"aria-hidden":!0}),w=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=C,t[14]=w):(C=t[13],w=t[14]);let T;t[15]!==v||t[16]!==x||t[17]!==S?(T=(0,Z.jsx)(W,{asChild:!0,children:(0,Z.jsxs)(sa,{variant:`ghost`,size:`sm`,"aria-label":x,onClick:v,disabled:S,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[C,w]})}),t[15]=v,t[16]=x,t[17]=S,t[18]=T):T=t[18];let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[20]=D):D=t[20];let O=u??``,k;t[21]===a?k=t[22]:(k=a({id:`5-FeN2`}),t[21]=a,t[22]=k);let A;t[23]!==O||t[24]!==k?(A=(0,Z.jsxs)(ie,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[E,D,(0,Z.jsx)(ks,{ref:f,readOnly:!0,value:O,onFocus:Cj,onClick:Sj,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":k})]}),t[23]=O,t[24]=k,t[25]=A):A=t[25];let j;return t[26]!==T||t[27]!==A||t[28]!==y?(j=(0,Z.jsxs)(ee,{open:y,onOpenChange:b,children:[T,A]}),t[26]=T,t[27]=A,t[28]=y,t[29]=j):j=t[29],j}function Sj(e){return e.currentTarget.select()}function Cj(e){return e.currentTarget.select()}function wj(e){return console.log(e)}function Tj(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function Ej(e){return X.success(e)}function Dj(e){let t=(0,$.c)(44),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=yt(),{state:p}=PO(),m=Oh(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=Us(`toggle-files-sidebar`),t[0]=h):h=t[0];let g=h,_=Us(`command-palette`),v=No(),[y,b]=(0,Q.useState)(!1),x;bb0:{if(f===null){let e;t[1]===v?e=t[2]:(e=sg({workspace:v}),t[1]=v,t[2]=e),x=e;break bb0}if(f.kind===`folder`){if(!v){x=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==v?(e=cg({folderRelativePath:f.folderPath,workspace:v}),t[3]=f.folderPath,t[4]=v,t[5]=e):e=t[5],x=e;break bb0}let e;t[6]!==d||t[7]!==v?(e=og({docName:d,workspace:v}),t[6]=d,t[7]=v,t[8]=e):e=t[8],x=e}let S=c??x,C;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=so(f.folderPath),t[9]=f.folderPath,t[10]=e),C=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=cs(d),t[11]=d,t[12]=e),C=e;break bb1}C=null}let w=C,T=typeof window<`u`&&window.okDesktop!=null,E=p===`collapsed`,D=T?``:void 0,k=T&&E&&`pl-[78px]`,A;t[13]===k?A=t[14]:(A=ea(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,T&&`[-webkit-app-region:drag]`,k,T&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[13]=k,t[14]=A);let j=!m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(zO,{className:ea(`-ml-1 shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ar,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:g}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:g}})})]}),E&&a&&(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:_}}),"data-telemetry-event":`ok.editor_header.search.click`,className:ea(`shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(O,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ar,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:_}})})]}),(0,Z.jsx)(Aa,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(pj,{})]}),M;t[15]===j?M=t[16]:(M=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:j}),t[15]=j,t[16]=M);let N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=ea(`flex shrink-0 items-center justify-end gap-2 px-3`,T&&`[&>*]:[-webkit-app-region:no-drag]`),t[17]=N):N=t[17];let P;t[18]!==S||t[19]!==l||t[20]!==o||t[21]!==y||t[22]!==b||t[23]!==w||t[24]!==m?(P=!m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vj,{input:S,open:o,onOpenChange:l}),(0,Z.jsx)(xj,{input:w,onClickWhenNoRemote:()=>b(!0)}),(0,Z.jsx)(us,{open:y,onOpenChange:b})]}),t[18]=S,t[19]=l,t[20]=o,t[21]=y,t[22]=b,t[23]=w,t[24]=m,t[25]=P):P=t[25];let F;t[26]!==r||t[27]!==n?(F=(0,Z.jsx)(Vo,{onSignIn:n,onSetIdentity:r}),t[26]=r,t[27]=n,t[28]=F):F=t[28];let I,L,R;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Kk,{}),L=(0,Z.jsx)(Aa,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),R=(0,Z.jsx)(dd,{}),t[29]=I,t[30]=L,t[31]=R):(I=t[29],L=t[30],R=t[31]);let z;t[32]===m?z=t[33]:(z=!m&&(0,Z.jsx)(bj,{}),t[32]=m,t[33]=z);let B;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(_j,{}),t[34]=B):B=t[34];let V;t[35]!==P||t[36]!==F||t[37]!==z?(V=(0,Z.jsxs)(`div`,{className:N,children:[P,F,I,L,R,z,B]}),t[35]=P,t[36]=F,t[37]=z,t[38]=V):V=t[38];let H;return t[39]!==V||t[40]!==D||t[41]!==A||t[42]!==M?(H=(0,Z.jsxs)(`header`,{"data-electron-drag":D,className:A,children:[M,V]}),t[39]=V,t[40]=D,t[41]=A,t[42]=M,t[43]=H):H=t[43],H}function Oj(e){let t=(0,$.c)(48),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,{_:a}=i(),[o,s]=l_(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Av[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),w=Ho(),{projectLocalConfig:T,projectLocalSynced:E}=be(),D=No(),{activeDocName:O}=yt(),k=w?.hasRemote,A=w?.pushPermission?.checkStatus,j;t[2]!==v||t[3]!==T||t[4]!==E||t[5]!==k||t[6]!==A?(j=p_({autoSyncOnboardingDismissed:v,hasRemote:k,projectLocalSynced:E,projectLocalConfig:T,pushPermissionCheckStatus:A}),t[2]=v,t[3]=T,t[4]=E,t[5]=k,t[6]=A,t[7]=j):j=t[7];let M=j,N,P;t[8]===O?(N=t[9],P=t[10]):(N=()=>{let e=function(e){let t=e.detail;t&&O&&_c(O,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(t_,e),()=>window.removeEventListener(t_,e)},P=[O],t[8]=O,t[9]=N,t[10]=P),(0,Q.useEffect)(N,P),u_(w?.pausedReason);let F;t[11]===s?F=t[12]:(F=function(e){l(e),s(e)},t[11]=s,t[12]=F);let I=F,L;t[13]===a?L=t[14]:(L=async function(){_(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?X.success(a({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),X.error(a({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),X.error(a({id:`q7zsRM`}))}_(!1)},t[13]=a,t[14]=L);let R=L,z;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){x(e),e||C(null)},t[15]=z):z=t[15];let B=z,V;t[16]!==a||t[17]!==O||t[18]!==D?(V={openSelection(e){let t=lg({docName:e.docName,workspace:D,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown})??og({docName:O,workspace:D});return t===null?(X.error(a({id:`_VRtd7`})),!1):(C(t),x(!0),!0)}},t[16]=a,t[17]=O,t[18]=D,t[19]=V):V=t[19];let H,U;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{p(`auth`),d(!0)},U=()=>{p(`identity`),d(!0)},t[20]=H,t[21]=U):(H=t[20],U=t[21]);let ee;t[22]!==r||t[23]!==S||t[24]!==b?(ee=(0,Z.jsx)(Dj,{onSignIn:H,onSetIdentity:U,onOpenSearch:r,openInAgentMenuOpen:b,openInAgentMenuInput:S,onOpenInAgentMenuOpenChange:B}),t[22]=r,t[23]=S,t[24]=b,t[25]=ee):ee=t[25];let te;t[26]!==m||t[27]!==c||t[28]!==I||t[29]!==R||t[30]!==g?(te=(0,Z.jsx)(xk,{editorMode:c,onModeChange:I,activeTab:m,onActiveTabChange:h,onSaveVersion:R,saving:g}),t[26]=m,t[27]=c,t[28]=I,t[29]=R,t[30]=g,t[31]=te):te=t[31];let W;t[32]!==V||t[33]!==ee||t[34]!==te?(W=(0,Z.jsxs)(wc,{value:V,children:[ee,te]}),t[32]=V,t[33]=ee,t[34]=te,t[35]=W):W=t[35];let ne=f===`identity`,re;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>{d(!1)},t[36]=re):re=t[36];let G;t[37]!==u||t[38]!==ne?(G=(0,Z.jsx)(zo,{open:u,onOpenChange:d,identityPrompt:ne,onSuccess:re}),t[37]=u,t[38]=ne,t[39]=G):G=t[39];let ie;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>y(!0),t[40]=ie):ie=t[40];let K;t[41]===M?K=t[42]:(K=(0,Z.jsx)(d_,{open:M,onResolved:ie}),t[41]=M,t[42]=K);let q;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Qg,{}),t[43]=q):q=t[43];let ae;return t[44]!==W||t[45]!==G||t[46]!==K?(ae=(0,Z.jsxs)(Z.Fragment,{children:[W,G,K,q]}),t[44]=W,t[45]=G,t[46]=K,t[47]=ae):ae=t[47],ae}function kj(e){let t=yr(di(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function Aj(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=lo();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Pi,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Pi,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(jj),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function jj(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(sa,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>kj(e.file),children:[(0,Z.jsx)(Pi,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var Mj=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
28
+ `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Zs(t,{style:t=>fc(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return FD.set(t.changes,i),i}function RD(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(WE).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(PD);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Js.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:ND.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function zD(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(WE).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(PD).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function BD(e){let t=new ec;for(let n of e.field(WE)){let r=e.facet(VE).overrideChunk&&UD(e,n);t.add(n.fromB,n.fromB,LD(e,n,!!r))}return t.finish()}var VD=Xs.define({create:e=>BD(e),update(e,t){return t.state.field(WE,!1)==t.startState.field(WE,!1)?e:BD(t.state)},provide:e=>ac.decorations.from(e)}),HD=new WeakMap;function UD(e,t){let n=HD.get(t);if(n!==void 0)return n;n=null;let r=e.field(PD),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push($s.widget({widget:new WD(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(oD.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return HD.set(t,n),n}var WD=class extends Ks{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},GD=new class extends oc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},KD=$s.line({class:`cm-inlineChangedLine`});function qD(e,t,n,r){let i=UD(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,GD),n.add(o.from,o.from,KD);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var JD=h({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),YD=an({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),XD=ac.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function ZD({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function QD(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Li(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?JD:YD,u=[ac.editable.of(!1),Ys.readOnly.of(!0)],d=[Tc,R(),...u,l,ac.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new ac({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=ZD({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new ac({doc:p,extensions:[Tc,R(),ac.editable.of(!1),l,XD,ac.lineWrapping,MD({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),ac.updateListener.of(e=>{let t=GE(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=GE(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new OD({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new ac({doc:p,extensions:[...d,MD({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof ac)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof ac)||De(e)},t[13]=A):A=t[13];let j=A,M=b===0,N;t[14]!==f||t[15]!==b?(N=b===null?``:b===0?f({id:`lPzyrU`}):Y._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=N):N=t[16];let P=N,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=F):F=t[17];let I;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,Kc.createPortal)((0,Z.jsx)(sa,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),I=C.map(e),t[18]=f,t[19]=C,t[20]=I}else I=t[20];let L;t[23]!==M||t[24]!==o||t[25]!==P||t[26]!==d||t[27]!==u?(L=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${M?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:P}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(sa,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(sa,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(sa,{variant:`default`,size:`sm`,disabled:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,t[24]=o,t[25]=P,t[26]=d,t[27]=u,t[28]=L):L=t[28];let z;return t[29]!==L||t[30]!==I?(z=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=z):z=t[31],z}async function $D(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function eO(e,t){return $D(e,`content`,t)}async function tO(e){return $D(e,`mine`)}async function nO(e){return $D(e,`theirs`)}async function rO(e){return $D(e,`delete`)}async function iO(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function aO(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=lo(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>di(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),iO(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await eO(u,e);t.ok||X.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),X.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(QD,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(rO),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(sa,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(nO),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(sa,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(QD,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(tO),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(sa,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(rO),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(sa,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)(QD,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function oO(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Wt(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 sO=`__back-nav__`;function cO(e){return e instanceof Re||e instanceof Ct||e instanceof Me||e instanceof rt||e instanceof It||e instanceof te?e.docName:null}function lO(e){if(e instanceof Re){let t=e.docName;return{title:Y._({id:`Jejur6`}),summary:Y._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Ct){let t=e.docName;return{title:Y._({id:`V7QxyT`}),summary:Y._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Me){let t=e.docName;return{title:Y._({id:`1di5fu`}),summary:Y._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof rt){let t=e.docName;return{title:Y._({id:`wvbc1r`}),summary:Y._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof It)return{title:Y._({id:`Gfr4fu`}),summary:Y._({id:`j6LB7S`})};if(e instanceof te){let t=e.docName;return{title:Y._({id:`vv7kpg`}),summary:Y._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Y._({id:`W5A0Ly`});return{title:Y._({id:`29VNqC`}),summary:t}}function uO(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=lO(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(wx,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(sa,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(sa,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(ft(cO(n)??i),o(a),r(sO))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(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:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function dO(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)(uO,{...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]===sO){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}: ${lO(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)(re,{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}function fO(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Br(t);return{map:n,keys:Wr(t),parseError:r}}function pO(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>fO(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=Hn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=et(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=gt(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(mO,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(hO,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function mO(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function hO(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function gO(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Br(t);return{map:n,keys:Wr(t),parseError:r}}function _O(e){let t=(0,$.c)(127),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>gO(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Hn(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]!==r||t[9]!==a?(M=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.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=Xr(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=M):M=t[10];let N=M,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=P):P=t[11];let F=P,I;t[12]===r?I=t[13]:(I=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=I);let L=I,R;t[14]!==N||t[15]!==L?(R=function(e,t){F(e),L(N({[e]:t}),[e])},t[14]=N,t[15]=L,t[16]=R):R=t[16];let z=R,B;t[17]!==N||t[18]!==L?(B=function(e){F(e),L(N({[e]:null}),[e])},t[17]=N,t[18]=L,t[19]=B):B=t[19];let V=B,H;t[20]!==r||t[21]!==a?(H=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=Xr(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=H):H=t[22];let U=H,ee;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e,t){return`${e} ${t}`},t[23]=ee):ee=t[23];let te=ee,W;t[24]!==a||t[25]!==m?(W=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>te(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=W):W=t[26];let ne=W,re;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(re={activationConstraint:{distance:4}},t[27]=re):re=t[27];let G;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(G={coordinateGetter:fo},t[28]=G):G=t[28];let ie=ro(So(bo,re),So(Ua,G)),K;t[29]!==z||t[30]!==p?(K=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=qa(n,t);(!Object.hasOwn(p,e)||!_i(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=K):K=t[31];let q=K,ae;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=ae):ae=t[32];let oe=ae,{addPropertySignal:se,clearAddProperty:ce}=AS(),le;t[33]!==se||t[34]!==j?(le=se.get(j)??0,t[33]=se,t[34]=j,t[35]=le):le=t[35];let ue=le,de,fe;t[36]===ue?(de=t[37],fe=t[38]):(de=()=>{ue>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},fe=[ue],t[36]=ue,t[37]=de,t[38]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[39]!==ce||t[40]!==j?(pe=()=>()=>ce(j),me=[j,ce],t[39]=ce,t[40]=j,t[41]=pe,t[42]=me):(pe=t[41],me=t[42]),(0,Q.useEffect)(pe,me);let he;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Va[e];return{...t,type:e,value:n,error:null}})},t[43]=he):he=t[43];let ge=he,_e;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){S(t=>t&&{...t,value:e})},t[44]=_e):_e=t[44];let ve=_e,ye;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ye=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=ye):ye=t[45];let be=ye,xe;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(xe=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=N({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[46]=r,t[47]=x,t[48]=N,t[49]=p,t[50]=xe):xe=t[50];let Se=xe,Ce;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){S(null)},t[51]=Ce):Ce=t[51];let we=Ce,Te;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){w({key:e,draft:e,error:null})},t[52]=Te):Te=t[52];let Ee=Te,De;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=De):De=t[53];let Oe=De,ke;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ke=function(){w(null)},t[54]=ke):ke=t[54];let Ae=ke,je;t[55]!==r||t[56]!==p||t[57]!==U||t[58]!==C?(je=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=U(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),F(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=U,t[58]=C,t[59]=je):je=t[59];let Me=je,Ne;t[60]!==p||t[61]!==m?(Ne=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=Ne):Ne=t[62];let Pe=Ne,Fe;if(t[63]!==Pe){Fe=new Map;for(let e of Pe)Fe.set(e,(Fe.get(e)??0)+1);t[63]=Pe,t[64]=Fe}else Fe=t[64];if(Pe.length===0&&!x&&!h)return null;let Ie=!g,Le;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Le=e=>_(!e),t[65]=Le):Le=t[65];let Re=!g,ze;t[66]===Re?ze=t[67]:(ze=(0,Z.jsx)(Os,{"data-expanded":Re,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Re,t[67]=ze);let Be;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=Be):Be=t[68];let Ve;t[69]===ze?Ve=t[70]:(Ve=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(sa,{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:[ze,Be]})}),t[69]=ze,t[70]=Ve);let He;t[71]===h?He=t[72]:(He=h?(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)(Pi,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=He);let Ue;if(t[73]!==Pe){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>te(e,t),t[75]=e):e=t[75],Ue=Pe.map(e),t[73]=Pe,t[74]=Ue}else Ue=t[74];let We;if(t[76]!==z||t[77]!==Me||t[78]!==Fe||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==V||t[83]!==C||t[84]!==Pe||t[85]!==k||t[86]!==q){let e;t[88]!==z||t[89]!==Me||t[90]!==Fe||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==V||t[95]!==C||t[96]!==k||t[97]!==q?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??$n(n),i=C?.key===e?C:null,a=(Fe.get(e)??0)>1;return(0,Z.jsx)(to,{sortableId:te(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Ee(e),onChangeDraft:Oe,onCommit:Me,onCancel:Ae},onCommit:t=>z(e,t),onChangeType:t=>q(e,t),onRemove:()=>V(e)},`${e}-${t}`)},t[88]=z,t[89]=Me,t[90]=Fe,t[91]=E,t[92]=p,t[93]=y,t[94]=V,t[95]=C,t[96]=k,t[97]=q,t[98]=e):e=t[98],We=Pe.map(e),t[76]=z,t[77]=Me,t[78]=Fe,t[79]=E,t[80]=p,t[81]=y,t[82]=V,t[83]=C,t[84]=Pe,t[85]=k,t[86]=q,t[87]=We}else We=t[87];let Ge;t[99]!==Ue||t[100]!==We?(Ge=(0,Z.jsx)(Da,{items:Ue,strategy:La,children:We}),t[99]=Ue,t[100]=We,t[101]=Ge):Ge=t[101];let Ke;t[102]!==ne||t[103]!==ie||t[104]!==Ge?(Ke=(0,Z.jsx)(Ga,{sensors:ie,collisionDetection:vo,onDragEnd:ne,children:Ge}),t[102]=ne,t[103]=ie,t[104]=Ge,t[105]=Ke):Ke=t[105];let qe;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(qe=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(to,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:vO},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=qe):qe=t[110];let Je;t[111]!==r||t[112]!==x||t[113]!==Se?(Je=x?(0,Z.jsx)(Za,{draft:x,onChangeName:be,onChangeType:ge,onChangeValue:ve,onCommit:Se,onCancel:we}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(sa,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:oe,"aria-label":r({id:`F-NRCj`}),className:`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)(At,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=Se,t[114]=Je):Je=t[114];let Ye;t[115]!==He||t[116]!==Ke||t[117]!==qe||t[118]!==Je?(Ye=(0,Z.jsxs)(As,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[He,Ke,qe,Je]}),t[115]=He,t[116]=Ke,t[117]=qe,t[118]=Je,t[119]=Ye):Ye=t[119];let Xe;t[120]!==Ie||t[121]!==Ve||t[122]!==Ye?(Xe=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(Ms,{open:Ie,onOpenChange:Le,children:[Ve,Ye]})}),t[120]=Ie,t[121]=Ve,t[122]=Ye,t[123]=Xe):Xe=t[123];let Ze;return t[124]!==a||t[125]!==Xe?(Ze=(0,Z.jsx)(fs,{binding:a,children:Xe}),t[124]=a,t[125]=Xe,t[126]=Ze):Ze=t[126],Ze}function vO(){}var yO=p(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function bO(e){let t=e.threshold??yO;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function xO(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var SO=p(`ACTIVITY_MOUNT_LIMIT`,3);function CO(){return n(()=>import(`./SourceEditor-D1zhJS8f.js`),__vite__mapDeps([47,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,48,24,46]),import.meta.url)}var wO=(0,Q.lazy)(async()=>({default:(await CO()).SourceEditor}));function TO(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Je(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 EO(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Y._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Y._({id:`Sc1bKE`,values:{docName:e}}):Y._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Y._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Y._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Y._({id:`bmC18N`,values:{docName:e}}):Y._({id:`pAgkuZ`,values:{docName:e}})}:null}function DO(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(G,{name:`activity-pool`,children:(0,Z.jsx)(OO,{...e})}),t[0]=e,t[1]=n),n}function OO(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=yt(),{pages:u,loading:d}=si(),f=TO(c,n,SO),p=(0,Q.useRef)(``),m=f.map(kO).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)U(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;on(e,t&&t.length>0?t:crypto.randomUUID())}ut(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,ct(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)(FO,{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 kO(e){return e.docName}function AO(e){let t=(0,$.c)(8),{isActive:n,initialScrollTop:r,children:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(r??0),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=a.current;if(!e)return;let t=()=>{e.scrollTop>0&&(o.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>{if(!n)return;let e=a.current;if(!e)return;let t=o.current;if(t===0)return;let r=performance.now(),i=!1;e.scrollTop=t,e.scrollTop===t&&e.scrollHeight>t&&ut(`ok/scroll-restore/phase1-success`,{target:t,elapsedMs:performance.now()-r});let s=!1,c=0,l=()=>{s||(s=!0,cancelAnimationFrame(c),clearTimeout(f),e.removeEventListener(`wheel`,u),e.removeEventListener(`touchstart`,u))},u=()=>l();e.addEventListener(`wheel`,u,{passive:!0}),e.addEventListener(`touchstart`,u,{passive:!0});let d=()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&!i&&(ut(`ok/scroll-restore/phase2-success`,{target:t,elapsedMs:performance.now()-r}),i=!0)),c=requestAnimationFrame(d))};c=requestAnimationFrame(d);let f=setTimeout(()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&ut(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function jO(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)(Vb,{}),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)(wO,{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 MO(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)(io,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Ce,{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)(sa,{type:`button`,onClick:NO,children:[(0,Z.jsx)(io,{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 NO(){return window.location.reload()}function PO(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function FO(e){let t=(0,$.c)(53),{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=EO(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=gC(n.docName)===`conflict`,h;t[3]===n.docName?h=t[4]:(h=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=h);let[g]=(0,Q.useState)(h),_=n.provider.document.getText(`source`).length,[v,y]=(0,Q.useState)(i),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==v||t[7]!==b?(S=()=>{i&&!v?y(!0):!i&&!b&&x(!0)},C=[i,v,b],t[5]=i,t[6]=v,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=bO({ytextLength:_,isSourceMode:i,visitedSource:v,visitedVisual:b}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==_?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&ut(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:_,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,_,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=_,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let k;t[19]===n.docName?k=t[20]:(k=()=>m(n.docName),t[19]=n.docName,t[20]=k);let[A]=(0,Q.useState)(k),j=A?.html??null,[M,N]=(0,Q.useState)(!1),P,F;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==M||t[26]!==i||t[27]!==_?(P=()=>{xO({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(ut(`ok/cold/first-toggle`,{docName:n.docName,mountId:ce(n.docName),ytextLength:_,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,_,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=M,t[26]=i,t[27]=_,t[28]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=A?.scrollTop,z;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==g||t[41]!==s||t[42]!==f||t[43]!==j?(z=f?(0,Z.jsx)(MO,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(dO,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(PO,{html:j}):(0,Z.jsx)(Vb,{}),children:(0,Z.jsx)(oO,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(aO,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(pO,{provider:n.provider}),!i&&(0,Z.jsx)(_O,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(jO,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(iE,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:g},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=g,t[41]=s,t[42]=f,t[43]=j,t[44]=z):z=t[44];let B;t[45]!==r||t[46]!==R||t[47]!==z?(B=(0,Z.jsx)(AO,{isActive:r,initialScrollTop:R,children:z}),t[45]=r,t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;return t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:B}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52],V}function IO(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function LO(e){let{value:t,unit:n}=IO(e);return n===`rem`?t*16:t}function RO(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var zO=3600*24*7;function BO(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?VO:m,O=g===void 0?zO: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,ee;t[0]===r?(U=t[1],ee=t[2]):(U=()=>{V.current=r},ee=[r],t[0]=r,t[1]=U,t[2]=ee),(0,Q.useEffect)(U,ee);let te,W;t[3]===y?(te=t[4],W=t[5]):(te=()=>{H.current=y},W=[y],t[3]=y,t[4]=te,t[5]=W),(0,Q.useEffect)(te,W);let ne=LO(b),re;t[6]===x?re=t[7]:(re=LO(x),t[6]=x,t[7]=re);let G=re,ie;t[8]!==E||t[9]!==k?(ie=function(e){E&&(P.current=!0,j.current=H.current?0:LO(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]=ie):ie=t[10];let K=ie,q,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==G||t[18]!==ne||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(q=()=>{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}=IO(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<=ne*w;else if(e<=ne){let n=ne*(w-1);t=ne-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>ne*T){a();let t=n(r,M.current,j.current,s),c=Math.max(ne,Math.min(G,t)),u=RO(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(ne,Math.min(G,u)),f=RO(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,ne,G,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]=G,t[18]=ne,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=q,t[25]=ae):(q=t[24],ae=t[25]),(0,Q.useEffect)(q,ae);let oe;return t[26]===K?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:K},t[26]=K,t[27]=oe),oe}function VO(){}var HO=3600*24*7,UO=`18rem`,WO=`3rem`,GO=`app-file-sidebar`,KO=`14.625rem`,qO=`32rem`,JO=`sidebar_width`,YO=/^\d+(?:\.\d+)?(?:rem|px)$/,XO=Q.createContext(null);function ZO(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${JO}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return YO.test(n)?n:e}function QO(){let e=Q.use(XO);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function $O(e){let t=(0,$.c)(58),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]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...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);let l=c===void 0?UO:c,[u]=Q.useState(tk),d;t[8]===u?d=t[9]:(d=()=>EC(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>ZO(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=NC();return FC(`left`,EC(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),IC(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(ek)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${CC}px)`),t=()=>{let e=EC(u,window.innerWidth,`left`);p(e),C(FC(`left`,e,NC())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(GO)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)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"]`)||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{Ws(e,`toggle-files-sidebar`)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":WO,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let ee=U,te;t[48]===r?te=t[49]:(te=ea(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=te);let W;t[50]!==n||t[51]!==a||t[52]!==ee||t[53]!==te?(W=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:ee,className:te,...a,children:n}),t[50]=n,t[51]=a,t[52]=ee,t[53]=te,t[54]=W):W=t[54];let ne;return t[55]!==H||t[56]!==W?(ne=(0,Z.jsx)(XO.Provider,{value:H,children:W}),t[55]=H,t[56]=W,t[57]=ne):ne=t[57],ne}function ek(e){return!e}function tk(){return Bi()}function nk(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=QO();if(d===`none`){let e;t[7]===r?e=t[8]:(e=ea(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=ea(`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[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`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`,x;t[20]!==r||t[21]!==b?(x=ea(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 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)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(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[23]=n,t[24]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:GO,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function rk(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=QO(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=Gs(`toggle-files-sidebar`);l=sa,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=GO,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=ea(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(Te,{}):(0,Z.jsx)(kl,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function ik(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=QO(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:KO,maxResizeWidth:qO,setIsDraggingRail:h,widthCookieName:JO,widthCookieMaxAge:HO},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=BO(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=ea(`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[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function ak(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=QO(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=ea(`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`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function ok(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=ea(`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 sk(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=ea(`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 ck(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=ea(`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 lk(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=ea(`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 uk(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=ea(`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 dk=la(`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 fk(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?na:`button`,{state:m}=QO(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=ea(dk({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(Gn,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ar,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(pr,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function pk(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function mk(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=bi.safeParse(t);return n.success?n.data.currentBranch??null:null}var hk=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:pk({fetchBranch:mk,subscribeToEvent:ii}),gk=hk.subscribe,_k=hk.getSnapshot;function vk(){return(0,Q.useSyncExternalStore)(gk,_k,_k)}function yk(){let e=(0,$.c)(6),t=vk(),n=No(),{state:r}=QO(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&os(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function bk(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=yk();if(!o&&l===null)return null;let u=r??n,d=r!=null,{words:f,chars:p,tokens:m}=u,h;t[0]!==c||t[1]!==d||t[2]!==o?(h=c(o?d?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=c,t[1]=d,t[2]=o,t[3]=h):h=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(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[4]=g):g=t[4];let _;t[5]===l?_=t[6]:(_=l===null?null:(0,Z.jsx)(xk,{identity:l}),t[5]=l,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[7]=_,t[8]=v);let y;t[9]!==c||t[10]!==u.chars||t[11]!==u.tokens||t[12]!==u.words||t[13]!==p||t[14]!==d||t[15]!==o||t[16]!==m||t[17]!==f?(y=o?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[d?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:c({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:f}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:p}})]}),(0,Z.jsxs)(`span`,{children:[u.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:m}})]})]}):null,t[9]=c,t[10]=u.chars,t[11]=u.tokens,t[12]=u.words,t[13]=p,t[14]=d,t[15]=o,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==h||t[20]!==v||t[21]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":h,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[g,v,y]}),t[19]=h,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function xk(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ar,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(Be,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Sk(e){let t=(0,$.c)(11),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{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=ea(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function Ck(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=ea(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wk(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=ea(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tk(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=ea(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Ek(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=ea(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Os,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var Dk=1,Ok=2,kk=4;function Ak(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=Qt(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>kk?[...u.slice(0,Dk).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(Dk,-Ok)},...u.slice(-Ok).map((e,t)=>d(e,u.length-Ok+t))]:u.map((e,t)=>d(e,t));a=Sk,t[8]===r?c=t[9]:(c=ea(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=Ck,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(jk)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function jk(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(Ek,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(wk,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(al,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(wk,{className:`min-w-0`,children:(0,Z.jsx)(Tk,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var Mk={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`},Nk=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`,...Mk,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},Pk=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)(Nk,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},Fk=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)(Nk,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function Ik(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Us(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=Gs(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(Ak,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(Gn,{children:(0,Z.jsx)(Fk,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(hs,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(pr,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Pk,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(hs,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(Ar,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(pr,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(_s,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(sa,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Gn,{children:(0,Z.jsx)(Sl,{})})}),(0,Z.jsx)(Ar,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=pr,h=sa,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,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]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],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];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)(Gn,{children:u?(0,Z.jsx)(jl,{}):(0,Z.jsx)(Al,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(Ar,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function Lk(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var Rk=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BWmb9zCZ.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function zk(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(Vk,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Bk,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(G,{name:`editor-area`,children:(0,Z.jsxs)(OS,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Bk(){let e=(0,$.c)(5),t=Nh(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(zS,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function Vk(e){let t=(0,$.c)(144),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,onSaveVersion:c,saving:l}=e,{_:u}=i(),{activeDocName:d,activeProvider:f,activeTarget:p,recycleDocument:m,docPanelMode:h,docPanelAgentId:g,docPanelExpandSignal:_}=yt(),{openDocumentTransition:v}=Mt(),{requestAddProperty:y}=AS(),b=mC(f,d),x=_C(d,n===`source`?`source`:`wysiwyg`),S=LC(f),C=S===`connected`||S===`synced`,w=gC(d)===`conflict`,T=(0,Q.useDeferredValue)(d),E=p?.kind===`missing`,D=!!d&&p?.kind!==`folder`,O;t[0]!==u||t[1]!==E?(O=E?u({id:`K-a33w`}):void 0,t[0]=u,t[1]=E,t[2]=O):O=t[2];let k=O,[A]=(0,Q.useState)(Uk),j=A!==null,M;t[3]===A?M=t[4]:(M=()=>EC(A,window.innerWidth,`right`),t[3]=A,t[4]=M);let[N,P]=(0,Q.useState)(M),F=(0,Q.useRef)(N),I,L;t[5]===N?(I=t[6],L=t[7]):(I=()=>{F.current=N},L=[N],t[5]=N,t[6]=I,t[7]=L),(0,Q.useEffect)(I,L);let R=kb(),z;t[8]===N?z=t[9]:(z=()=>FC(`right`,N,NC())===`collapsed`,t[8]=N,t[9]=z);let[B]=(0,Q.useState)(z),[V,H]=(0,Q.useState)(B),U=(0,Q.useRef)(V),ee,te;t[10]===V?(ee=t[11],te=t[12]):(ee=()=>{U.current=V},te=[V],t[10]=V,t[11]=ee,t[12]=te),(0,Q.useEffect)(ee,te);let[W,ne]=(0,Q.useState)(!1),re=(0,Q.useRef)(!1),[G]=(0,Q.useState)(Hk),ie=(0,Q.useRef)(G),q=(0,Q.useRef)(null),ae;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e){q.current!=null&&clearTimeout(q.current),q.current=setTimeout(()=>{xC(e),q.current=null},100)},t[13]=ae):ae=t[13];let oe=ae,se,ce;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>()=>{q.current!=null&&clearTimeout(q.current)},se=[],t[14]=se,t[15]=ce):(se=t[14],ce=t[15]),(0,Q.useEffect)(ce,se);let[le,ue]=(0,Q.useState)(null),de;t[16]!==V||t[17]!==R?(de=function(){if(R.current==null)return;let e=F.current;V?(IC(`right`,e,`open`),R.current?.expand()):(IC(`right`,e,`collapsed`),R.current?.collapse())},t[16]=V,t[17]=R,t[18]=de):de=t[18];let fe=de,pe,me;t[19]!==A||t[20]!==R?(pe=()=>{let e=window.matchMedia(`(min-width: ${wC}px)`),t=()=>{let e=EC(A,window.innerWidth,`right`);P(e);let t=FC(`right`,e,NC())===`collapsed`;H(t),t?R.current?.collapse():R.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},me=[A,R],t[19]=A,t[20]=R,t[21]=pe,t[22]=me):(pe=t[21],me=t[22]),(0,Q.useEffect)(pe,me);let he,ge;t[23]!==le||t[24]!==j||t[25]!==R?(he=()=>{if(le==null||j)return;let e=new ResizeObserver(()=>{U.current||re.current||R.current?.resize(`${ie.current}px`)});return e.observe(le),()=>e.disconnect()},ge=[le,j,R],t[23]=le,t[24]=j,t[25]=R,t[26]=he,t[27]=ge):(he=t[26],ge=t[27]),(0,Q.useEffect)(he,ge);let _e,ve;t[28]!==o||t[29]!==R?(_e=()=>{let e=e=>{o(e),R.current?.expand()},t=Mm();return t&&e(t),Pm(t=>{Mm(),e(t)})},ve=[o,R],t[28]=o,t[29]=R,t[30]=_e,t[31]=ve):(_e=t[30],ve=t[31]),(0,Q.useEffect)(_e,ve);let ye,be;t[32]!==_||t[33]!==R?(ye=()=>{_!==0&&R.current?.expand()},be=[_,R],t[32]=_,t[33]=R,t[34]=ye,t[35]=be):(ye=t[34],be=t[35]),(0,Q.useEffect)(ye,be);let xe,Se;t[36]===V?(xe=t[37],Se=t[38]):(xe=()=>{if(!V||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},Se=[V],t[36]=V,t[37]=xe,t[38]=Se),(0,Q.useLayoutEffect)(xe,Se);let Ce,we;t[39]===V?(Ce=t[40],we=t[41]):(Ce=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!V})},we=[V],t[39]=V,t[40]=Ce,t[41]=we),(0,Q.useEffect)(Ce,we);let Te,Ee;t[42]===fe?(Te=t[43],Ee=t[44]):(Te=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&fe()})},Ee=[fe],t[42]=fe,t[43]=Te,t[44]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[45]===fe?(De=t[46],Oe=t[47]):(De=()=>{if(window.okDesktop!=null)return;let e=e=>{Ws(e,`toggle-document-panel`)&&(e.preventDefault(),fe())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Oe=[fe],t[45]=fe,t[46]=De,t[47]=Oe),(0,Q.useEffect)(De,Oe);let ke=(0,Q.useRef)(null),[Ae,je]=(0,Q.useState)(null),Me=p?.kind===`large-file`?p.docName:d,Ne,Pe;t[48]===Me?(Ne=t[49],Pe=t[50]):(Ne=()=>{if(Me&&Me!==ke.current){let e=ke.current;ke.current=Me,je(e)}},Pe=[Me],t[48]=Me,t[49]=Ne,t[50]=Pe),(0,Q.useEffect)(Ne,Pe);let Fe;t[51]===v?Fe=t[52]:(Fe=function(e){let t=yr(e);window.location.hash===t?v(e):window.location.hash=t},t[51]=v,t[52]=Fe);let Ie=Fe;if(p?.kind===`large-file`){let e;t[53]!==Ie||t[54]!==Ae?(e=Ae?{previousDocName:Ae,onNavigateBack:Ie}:void 0,t[53]=Ie,t[54]=Ae,t[55]=e):e=t[55];let n;return t[56]!==p.docName||t[57]!==p.limit||t[58]!==p.size||t[59]!==e?(n=(0,Z.jsx)(wS,{docName:p.docName,size:p.size,limit:p.limit,backNav:e}),t[56]=p.docName,t[57]=p.limit,t[58]=p.size,t[59]=e,t[60]=n):n=t[60],n}if(p?.kind===`folder`){if(!(h===`agent`&&g!==null)){let e;return t[61]===p.folderPath?e=t[62]:(e=(0,Z.jsx)(bS,{folderPath:p.folderPath}),t[61]=p.folderPath,t[62]=e),e}let e;t[63]===p.folderPath?e=t[64]:(e=(0,Z.jsx)(GS,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(bS,{folderPath:p.folderPath})}),t[63]=p.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(KS,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(GS,{defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(Rk,{showBackButton:!1})})}),t[66]=r):r=t[66];let i;return t[67]===e?i=t[68]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(WS,{orientation:`horizontal`,children:[e,n,r]})}),t[67]=e,t[68]=i),i}if(p?.kind===`asset`){let e;return t[69]!==p.assetPath||t[70]!==p.mediaKind?(e=(0,Z.jsx)(Bb,{assetPath:p.assetPath,mediaKind:p.mediaKind},p.assetPath),t[69]=p.assetPath,t[70]=p.mediaKind,t[71]=e):e=t[71],e}if(!f||!d){if((typeof window<`u`?pi(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Vb,{}),t[72]=e):e=t[72],e}let e;return t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Vx,{}),t[73]=e):e=t[73],e}let Le=n===`source`,Re=!C,ze=V,Be;t[74]!==d||t[75]!==y?(Be=function(){d&&y(d)},t[74]=d,t[75]=y,t[76]=Be):Be=t[76];let Ve=Be,Ue=T??d,We=Ae??void 0,Ge;t[77]!==k||t[78]!==Le||t[79]!==Ie||t[80]!==m||t[81]!==Ue||t[82]!==We?(Ge=(0,Z.jsx)(DO,{activeDocName:Ue,isSourceMode:Le,editorPlaceholder:k,previousDocName:We,onNavigateBack:Ie,onRecycle:m}),t[77]=k,t[78]=Le,t[79]=Ie,t[80]=m,t[81]=Ue,t[82]=We,t[83]=Ge):Ge=t[83];let Ke;t[84]!==d||t[85]!==Le?(Ke=(0,Z.jsx)(uC,{activeDocName:d,isSourceMode:Le}),t[84]=d,t[85]=Le,t[86]=Ke):Ke=t[86];let qe;t[87]!==d||t[88]!==T?(qe=Lk({activeDocName:d,deferredActiveDocName:T,mountResolved:d!==null&&K(d),syncResolved:d!==null&&He(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Vb,{}),d===null?null:(0,Z.jsx)(TS,{docName:d})]}):null,t[87]=d,t[88]=T,t[89]=qe):qe=t[89];let Je;t[90]!==Ge||t[91]!==Ke||t[92]!==qe?(Je=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[Ge,Ke,qe]}),t[90]=Ge,t[91]=Ke,t[92]=qe,t[93]=Je):Je=t[93];let Ye;t[94]!==d||t[95]!==w||t[96]!==ze||t[97]!==Le||t[98]!==r||t[99]!==Ve||t[100]!==Re||t[101]!==fe?(Ye=!w&&(0,Z.jsx)(Ik,{activeDocName:d,isSourceMode:Le,sourceDisabled:Re,onModeChange:r,showAddPropertyButton:!Le,onAddProperty:Ve,isPanelCollapsed:ze,onTogglePanel:fe}),t[94]=d,t[95]=w,t[96]=ze,t[97]=Le,t[98]=r,t[99]=Ve,t[100]=Re,t[101]=fe,t[102]=Ye):Ye=t[102];let Xe;t[103]!==Je||t[104]!==Ye?(Xe=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[Je,Ye]}),t[103]=Je,t[104]=Ye,t[105]=Xe):Xe=t[105];let Ze;t[106]!==x||t[107]!==D||t[108]!==b?(Ze=(0,Z.jsx)(bk,{stats:b,selectionStats:x,showStats:D}),t[106]=x,t[107]=D,t[108]=b,t[109]=Ze):Ze=t[109];let Qe;t[110]!==Xe||t[111]!==Ze?(Qe=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[Xe,Ze]}),t[110]=Xe,t[111]=Ze,t[112]=Qe):Qe=t[112];let $e=Qe,et=W||void 0,tt;t[113]===B?tt=t[114]:(tt=B?{defaultSize:`100%`}:{},t[113]=B,t[114]=tt);let nt=W?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,rt;t[115]!==$e||t[116]!==tt||t[117]!==nt?(rt=(0,Z.jsx)(GS,{minSize:`30%`,...tt,className:nt,children:$e}),t[115]=$e,t[116]=tt,t[117]=nt,t[118]=rt):rt=t[118];let it=j&&V,at;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(at=()=>{ne(!0),re.current=!0;let e=()=>{ne(!1),re.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[119]=at):at=t[119];let J;t[120]===it?J=t[121]:(J=(0,Z.jsx)(KS,{withHandle:!0,disabled:it,onPointerDown:at}),t[120]=it,t[121]=J);let ot=B?0:`${G}px`,st;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(st=e=>{H(e.asPercentage===0),e.inPixels>0&&re.current&&(ie.current=e.inPixels,oe(e.inPixels))},t[122]=st):st=t[122];let ct=!W&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,lt;t[123]===ct?lt=t[124]:(lt=ea(`flex flex-col bg-muted/20`,ct),t[123]=ct,t[124]=lt);let ut;t[125]!==d||t[126]!==a||t[127]!==h||t[128]!==Le||t[129]!==o||t[130]!==c||t[131]!==l?(ut=(0,Z.jsx)(Fv,{docName:d,isSourceMode:Le,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l}),t[125]=d,t[126]=a,t[127]=h,t[128]=Le,t[129]=o,t[130]=c,t[131]=l,t[132]=ut):ut=t[132];let dt;t[133]!==V||t[134]!==R||t[135]!==ot||t[136]!==lt||t[137]!==ut?(dt=(0,Z.jsx)(GS,{id:`doc-panel`,panelRef:R,defaultSize:ot,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:st,inert:V,className:lt,children:ut}),t[133]=V,t[134]=R,t[135]=ot,t[136]=lt,t[137]=ut,t[138]=dt):dt=t[138];let ft;return t[139]!==et||t[140]!==rt||t[141]!==J||t[142]!==dt?(ft=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:ue,children:(0,Z.jsxs)(WS,{orientation:`horizontal`,"data-dragging":et,children:[rt,J,dt]})}),t[139]=et,t[140]=rt,t[141]=J,t[142]=dt,t[143]=ft):ft=t[143],ft}function Hk(){return SC()}function Uk(){return Bi()}function Wk(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 Gk(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 Kk=1e3,qk=!1;function Jk(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Yk(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:Sa(i)?a=i:(a=void 0,qk||(qk=!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`&&(Jk({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=Gk(i),{current:c,crossDoc:l}=a?_a(a,n,Date.now()):{current:[],crossDoc:[]},u=Xk,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Wk(e.current,p)&&Wk(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,Kk);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 Xk(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Zk=`sync-status`;function Qk(e,t){let n=(0,$.c)(5),{_:r}=i(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==e?(c=()=>{s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t&&(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current?(o.current=!0,X.warning(r({id:`HGNCsl`}),{id:Zk,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,X.success(r({id:`GhjUB_`}),{id:Zk,duration:3e3})))},l=[e,t,r],n[0]=r,n[1]=t,n[2]=e,n[3]=c,n[4]=l):(c=n[3],l=n[4]),(0,Q.useEffect)(c,l)}var $k=4,eA=3,tA={Bird:Wc,Cat:Xc,Dog:il,Fish:ll,Mouse:Il,Rabbit:Fl,Shrimp:Ul,Snail:Wl,Squirrel:ql,Turtle:Ql};Object.freeze(Object.keys(tA));function nA(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(tA,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var rA={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function iA(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=nA(n),c=s.kind===`animal`?tA[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=Ur(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=ni(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(Ar,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(pr,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function aA(e){let t=rA[e.icon];return e.displayName||t||Y._({id:`iEQQyu`})}function oA(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 sA(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=yt(),{presence:u,agentId:d}=n,f=aA(u),p=oA(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(ba,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(ba,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)(Gn,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(Ar,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(pr,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function cA(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?Y._({id:`9euN0m`,values:{count:n}}):Y._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(T,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,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[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(iA,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(sA,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(ie,{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:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(ee,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function lA(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(iA,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(sA,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function uA(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=yt(),{current:s,crossDoc:c}=Yk(t,r,n);if(Qk(LC(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,$k),n;e[6]===s?n=e[7]:(n=s.slice($k),e[6]=s,e[7]=n);let r=n,u=c.slice(0,eA),d;e[8]===c?d=e[9]:(d=c.slice(eA),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=>lA(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)(cA,{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)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>lA(e,p,!0,m)),f.length>0?(0,Z.jsx)(cA,{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}var dA=`.md`,fA=/\.(md|mdx)$/i;function pA(e,t=dA){return`${e}${t}`}function mA(e){return FA(e).replace(fA,``)}function hA(e){return Pr(e)?vA(e.path):Jn(e)?e.path:pA(e.docName,e.docExt)}function gA(e){let t=FA(e).match(fA);return t?`.${t[1].toLowerCase()}`:void 0}function _A(e){return FA(e)}function vA(e){let t=FA(e.trim());return t?`${t}/`:``}function yA(e){return e.endsWith(`/`)?_A(e):mA(e)}function bA(e){return e.map(hA)}function xA(e){return[...e].sort().join(`\0`)}function SA(e){return xA(bA(e))}function CA(e){let t=new Set;for(let n of e){if(Pr(n)){let e=vA(n.path);e&&t.add(e)}let e=(Pr(n)||Jn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Pr(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function wA(e){if(!e)return[];let t=FA(e.replace(fA,``)).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 TA(e,t,n){let r=gA(e);if(r)return r;let i=n.find(e=>Gi(e)&&e.docName===t);return i?i.docExt??dA:PA(e).includes(`.`)?void 0:dA}function EA(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!Jn(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function DA(e,t,n){if(gA(e))return null;let r=n.find(e=>Jn(e)&&e.path===t);return r?r.path:PA(e).includes(`.`)?t:EA(t,n)}function OA(e,t){let n=e.kind===`directory`,r=n?_A(e.path):mA(e.path);if(n)return{kind:`folder`,name:FA(PA(e.path)).replace(fA,``),path:r,treePath:AA(e.path,!0)};let i=DA(e.path,r,t);if(i)return{kind:`asset`,name:FA(PA(i)),path:i,treePath:i};let a=TA(e.path,r,t);return{kind:`file`,name:FA(PA(e.path)).replace(fA,``),path:r,treePath:AA(e.path,!1),docExt:a}}function kA(e){return e.kind===`directory`?_A(e.path):e.path}function AA(e,t){return t?vA(e):fA.test(e)?e:`${e}${dA}`}function jA(e,t,n){let r=vA(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}${dA}`;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 MA(e,t){return e===`file`?AA(t,!1):`${_A(t)}/index${dA}`}function NA(e,t){return t.kind===`root`||t.directoryPath==null?PA(e):`${t.directoryPath}${PA(e)}`}function PA(e){let t=FA(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function FA(e){return e.endsWith(`/`)?e.slice(0,-1):e}function IA(e,t){return t.trim()}function LA(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function RA(e,t){let n=IA(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function zA(e,t,n=[],r=[]){if(t.length===0&&n.length===0&&r.length===0)return e;let i=new Map(t.map(e=>[e.fromDocName,e.toDocName])),a=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>Gi(e)?{...e,docName:i.get(e.docName)??e.docName}:Pr(e)?{...e,path:KA(e.path,n)}:Jn(e)?{...e,path:a.get(e.path)??KA(e.path,n)}:e)}function BA(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>Gi(e)?!i.has(e.docName)&&!XA(e.docName,n):Pr(e)?!XA(e.path,n):Jn(e)?!a.has(e.path)&&!XA(e.path,n):!0)}function VA(e,t){if(e.kind!==`asset`||t.some(t=>Jn(t)&&t.path===e.path))return e;let n=EA(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function HA(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>qA(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Gi(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>Pr(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(Gi(i)){let e=YA(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Pr(i)){let e=JA(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function UA(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function WA(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function GA(e,t){let n=e.kind===`file`?pA(e.path,e.docExt):e.path;return ig(t.contentDir,n,t.pathSeparator)}function KA(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 qA(e,t){return Gi(e)&&Gi(t)?e.docName===t.docName:Pr(e)&&Pr(t)||Jn(e)&&Jn(t)?e.path===t.path:!1}function JA(e,t,n){return e===t?n:YA(e,t,n)}function YA(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function XA(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function ZA(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)(Qu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}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=ea(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)($u,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $A(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)(od,{"data-slot":`context-menu-sub`,...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=ea(`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 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ed,{children:(0,Z.jsx)(td,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tj(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=ea(`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)(nd,{"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 nj(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=ea(`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-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Os,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(sd,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function rj(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=ea(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden 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 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(cd,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ij(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=ea(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(id,{children:(0,Z.jsx)(Ds,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(rd,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function aj(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=ea(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ad,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var oj=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,sj=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,cj={start:[Yo.Space],cancel:[Yo.Esc],end:[Yo.Space,Yo.Enter]};function lj(e){return ea(oj,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function uj(e){return e?void 0:-1}function dj({className:e,isDragging:t}){return ea(e,t&&sj)}function fj(e){return e.code===Yo.Enter&&e.target===e.currentTarget}function pj({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&fj(e)?`activate-tab`:`delegate-sortable`}function mj({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:wa.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function hj(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function gj(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var _j=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return vo(e)},vj=[`.md`,`.mdx`],yj=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,bj=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,xj=ea(bj,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),Sj=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function Cj(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function wj(e){let t=yr(e);window.location.hash!==t&&(window.location.hash=t)}function Tj(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function Ej(e,t){let n=[t,...vj].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 Dj(e){let t=(0,$.c)(37),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]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=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;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=go(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=mj({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=pj({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=dj({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function Oj(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=rn(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=rn(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(QA,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(tj,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(tj,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(tj,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(aj,{}),(0,Z.jsx)(tj,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(ej,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(ZA,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function kj(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:a,isPinned:o,tabId:s,unpinTab:c}=e,{_:l}=i();if(o){let e;t[0]!==l||t[1]!==n?(e=l({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=l,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s||t[4]!==c?(r=e=>{e.stopPropagation(),c(s)},t[3]=s,t[4]=c,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Pl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let u;t[10]!==l||t[11]!==n?(u=l({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=l,t[11]=n,t[12]=u):u=t[12];let d;t[13]===a?d=t[14]:(d=lj(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=uj(a),t[15]=a,t[16]=f);let p;t[17]!==r||t[18]!==s?(p=e=>{e.stopPropagation(),r(s)},t[17]=r,t[18]=s,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(ys,{"aria-hidden":`true`}),t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p?(h=(0,Z.jsx)(sa,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u,"data-testid":`editor-tab-close-button`,className:d,tabIndex:f,onClick:p,children:m}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=h):h=t[25],h}function Aj(e){let t=(0,$.c)(1),{docName:n}=e;if(gC(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Pi,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function jj(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:b,pinnedTabIds:x,remapTabsForRename:S,reorderTabs:C,unpinTab:w,visibleTabIds:T}=yt(),{_:E}=i(),{pageMeta:D}=si(),O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),ee=(0,Q.useRef)(t),te;e[0]!==n||e[1]!==t||e[2]!==a?(te=n??(a?y(a):t?Yt(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=te):te=e[3];let W=te,ne;e[4]!==r||e[5]!==W||e[6]!==h||e[7]!==g||e[8]!==v?(ne=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:W?`${W}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=W,e[6]=h,e[7]=g,e[8]=v,e[9]=ne):ne=e[9];let re=ne,G,ie;e[10]===t?(G=e[11],ie=e[12]):(G=()=>{ee.current=t},ie=[t],e[10]=t,e[11]=G,e[12]=ie),(0,Q.useEffect)(G,ie);let K,q;e[13]===re?(K=e[14],q=e[15]):(K=()=>{re&&(O.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[re],e[13]=re,e[14]=K,e[15]=q),(0,Q.useEffect)(K,q);let ae,oe;e[16]===j?(ae=e[17],oe=e[18]):(ae=()=>{j&&(B.current?.focus(),B.current?.select())},oe=[j],e[16]=j,e[17]=ae,e[18]=oe),(0,Q.useEffect)(ae,oe);let se,ce;e[19]!==v||e[20]!==j?(se=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),z(!1))},ce=[v,j],e[19]=v,e[20]=j,e[21]=se,e[22]=ce):(se=e[21],ce=e[22]),(0,Q.useEffect)(se,ce);let le=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},ue=function(){H.current=!0,U.current=null,M(null),P(``),I(null),z(!1)},de=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=j?.docName;if(!e){ue();return}let t=IA(`file`,Ej(N,D.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ue();return}if(t===U.current){B.current?.focus();return}if(!LA(t)){I(E({id:`P8yDjG`})),B.current?.focus();return}let i=RA({kind:`file`,path:e,name:r},t);V.current=!0,z(!0),I(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){z(!1),V.current=!1;return}let r=await L(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),z(!1),V.current=!1,U.current=t,B.current?.focus();return}let a=Ee(Hi,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=ee.current,s=UA(o,a);pe(a);let c=!0;try{let e=WA(a,p(),m);await Promise.all(e.map(e=>l(e))),S(a),vi([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),X.error(E({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),z(!1),V.current=!1,U.current=null,c&&s&&s!==o&&wj(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(E({id:`HIb0vl`})),z(!1),V.current=!1,U.current=t,B.current?.focus()}},fe=typeof window<`u`&&window.okDesktop!=null,me;e[23]===g?me=e[24]:(me=new Set(g),e[23]=g,e[24]=me);let he=me,ge;e[25]===k?ge=e[26]:(ge=gj(k),e[25]=k,e[26]=ge);let _e;e[27]===ge?_e=e[28]:(_e=[ge],e[27]=ge,e[28]=_e);let ve=_e,ye;e[29]!==u||e[30]!==f||e[31]!==he?(ye=function(e){let t=[],n=[];for(let r of e)he.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=he,e[32]=ye):ye=e[32];let be=ye,xe;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(xe={activationConstraint:{distance:8}},e[33]=xe):xe=e[33];let Se;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(Se={coordinateGetter:fo,keyboardCodes:cj},e[34]=Se):Se=e[34];let Ce=ro(So(bo,xe),So(Ua,Se)),we;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(){A(hj(O.current))},e[35]=we):we=e[35];let Te=we,De;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(){A(null)},e[36]=De):De=e[36];let Oe=De,ke;e[37]!==Oe||e[38]!==C||e[39]!==T?(ke=function(e){Oe();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=T.indexOf(t),i=T.indexOf(n);r<0||i<0||r===i||C(mo([...T],r,i),t)},e[37]=Oe,e[38]=C,e[39]=T,e[40]=ke):ke=e[40];let Ae=ke,je=fe?``:void 0,Me;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Me=ea(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,fe&&`[-webkit-app-region:drag]`),e[41]=Me):Me=e[41];let Ne=Tj,Pe;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=ea(`flex items-end gap-1`,fe&&`[-webkit-app-region:no-drag]`),e[42]=Pe):Pe=e[42];let Fe=Ga,Ie=_j,Le;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Le={container:typeof document<`u`?document.body:void 0},e[43]=Le):Le=e[43];let Re=Da,ze;e[44]===T?ze=e[45]:(ze=[...T],e[44]=T,e[45]=ze);let Be=za,Ve=T.map(e=>{if(he.has(e)){let t=e===r;return(0,Z.jsx)(Oj,{tabId:e,canPin:!1,openTabs:T,closeTab:u,closeTabs:be,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(Dj,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:ea(yj,t?bj:xj),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:Sj,onClick:()=>c(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:lj(t),tabIndex:uj(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(ys,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=en(e),n=e===W,i=x.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Qt(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(Oj,{tabId:e,openTabs:T,closeTab:d,closeTabs:be,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(Dj,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ea(yj,n?bj:xj),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:Sj,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:ea(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:ea(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(kj,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:w})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Qt(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(Oj,{tabId:e,openTabs:T,closeTab:d,closeTabs:be,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(Dj,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ea(yj,n?bj:xj),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:Sj,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:ea(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:ea(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(kj,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:w})]})},e)}let a=t.docName,l=D.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=Qt(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,y=`editor-tab-rename-error-${Cj(a)}`;return(0,Z.jsx)(Oj,{disabled:v,tabId:e,openTabs:T,closeTab:d,closeTabs:be,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsx)(Dj,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:ea(yj,n?bj:xj,v&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(qS,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(QS,{ref:B,value:N,disabled:R,"aria-label":E({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?y:void 0,"aria-busy":R||void 0,title:F??a,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=>{P(Ej(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),de()):e.key===`Escape`&&(e.preventDefault(),ue())},onBlur:de}),(0,Z.jsx)(YS,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(ZS,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:y,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:Sj,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),le(e,a)},tabIndex:-1,children:[(0,Z.jsx)(Aj,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(kj,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:w})]})})},e)}),He;e[46]!==Re||e[47]!==ze||e[48]!==Be||e[49]!==Ve?(He=(0,Z.jsx)(Re,{items:ze,strategy:Be,children:Ve}),e[46]=Re,e[47]=ze,e[48]=Be,e[49]=Ve,e[50]=He):He=e[50];let Ue;e[51]!==Fe||e[52]!==Oe||e[53]!==Ae||e[54]!==Te||e[55]!==Ce||e[56]!==!1||e[57]!==Ie||e[58]!==Le||e[59]!==He||e[60]!==ve?(Ue=(0,Z.jsx)(Fe,{sensors:Ce,autoScroll:!1,collisionDetection:Ie,modifiers:ve,onDragStart:Te,onDragEnd:Ae,onDragCancel:Oe,accessibility:Le,children:He}),e[51]=Fe,e[52]=Oe,e[53]=Ae,e[54]=Te,e[55]=Ce,e[56]=!1,e[57]=Ie,e[58]=Le,e[59]=He,e[60]=ve,e[61]=Ue):Ue=e[61];let We;e[62]===E?We=e[63]:(We=E({id:`3YvS-c`}),e[62]=E,e[63]=We);let Ge;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsx)(At,{"aria-hidden":`true`}),e[64]=Ge):Ge=e[64];let Ke;e[65]!==_||e[66]!==We?(Ke=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":We,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ge})}),e[65]=_,e[66]=We,e[67]=Ke):Ke=e[67];let qe;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsx)(Ar,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=qe):qe=e[68];let Je;e[69]===Ke?Je=e[70]:(Je=(0,Z.jsxs)(pr,{children:[Ke,qe]}),e[69]=Ke,e[70]=Je);let Ye;e[71]!==Pe||e[72]!==Ue||e[73]!==Je?(Ye=(0,Z.jsxs)(`div`,{className:Pe,children:[Ue,Je]}),e[71]=Pe,e[72]=Ue,e[73]=Je,e[74]=Ye):Ye=e[74];let Xe;return e[75]!==je||e[76]!==Me||e[77]!==Ne||e[78]!==Ye?(Xe=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":je,className:Me,onWheel:Ne,children:Ye}),e[75]=je,e[76]=Me,e[77]=Ne,e[78]=Ye,e[79]=Xe):Xe=e[79],Xe}function Mj(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 Nj(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 Pj=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Zt},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:Hd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:ci},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:Mj},{label:`Twitter`,href:`https://x.com/inkeep`,icon:Nj}],Fj=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(nn,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(T,{asChild:!0,children:(0,Z.jsxs)(sa,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(pr,{children:[o,(0,Z.jsx)(Ar,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=Pj.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Xo(e,r),onAuxClick:e=>Xo(e,r),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)(i,{"aria-hidden":`true`,className:`size-4 shrink-0`}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(ie,{align:`end`,className:`w-64 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(ee,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function Ij(e){let t=(0,$.c)(75),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=jg(),{dispatch:u}=bg(),{merged:d}=be(),f=d?.appearance?.preview?.autoOpen??!0,[p,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(!1);if(bh())return null;let g=typeof window<`u`&&window.okDesktop!=null,_=r??p,v;t[0]!==a||t[1]!==r||t[2]!==l?(v=e=>{r===void 0&&m(e),a?.(e),e&&l()},t[0]=a,t[1]=r,t[2]=l,t[3]=v):v=t[3];let y=v,b=n===null,x=!!n?.selection,S;t[4]!==f||t[5]!==n?(S=n!==null&&n.docContext!==null?fr(n.docContext.relativePath,f):``,t[4]=f,t[5]=n,t[6]=S):S=t[6];let C=S,w;t[7]!==u||t[8]!==n?(w=e=>{n!==null&&u(e.id,n)},t[7]=u,t[8]=n,t[9]=w):w=t[9];let T=w,E,D,O,k,A,j,M,N,P,F,I,L,R,z;if(t[10]!==y||t[11]!==T||t[12]!==n||t[13]!==_||t[14]!==C||t[15]!==c||t[16]!==b){let e;t[31]===c?e=t[32]:(e=e=>c[e.id]?.installed===!0,t[31]=c,t[32]=e),A=Ch.filter(e);let r;t[33]===c?r=t[34]:(r=Ch.some(e=>c[e.id]?.installed==null),t[33]=c,t[34]=r),j=r,O=c[`claude-code`]?.installed===!0;let i;t[35]!==n||t[36]!==C?(i=()=>{n!==null&&Yb(C)},t[35]=n,t[36]=C,t[37]=i):i=t[37],k=i,D=jo,R=_,z=y,M=!1;let a;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(a=g?()=>{h.current=!0}:void 0,t[38]=a):a=t[38];let o;t[39]===y?o=t[40]:(o=g?()=>{if(h.current){h.current=!1;return}y(!0)}:void 0,t[39]=y,t[40]=o);let l,u;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(ya,{className:`size-3.5`,"aria-hidden":`true`}),u=(0,Z.jsx)(s,{id:`O7_W_a`}),t[41]=l,t[42]=u):(l=t[41],u=t[42]),t[43]!==o||t[44]!==b?(N=(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsxs)(sa,{variant:`ghost`,size:`sm`,disabled:b,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:a,onClick:o,children:[l,u]})}),t[43]=o,t[44]=b,t[45]=N):N=t[45],E=Wo,P=`end`,F=`min-w-[220px]`,I=`open-in-agent-menu`;let d;t[46]!==T||t[47]!==C||t[48]!==c?(d=e=>{let t=c[e.id];return(0,Z.jsx)(Xb,{target:e,installState:t,isElectronHost:g,prompt:C,onSelect:()=>T(e)},e.id)},t[46]=T,t[47]=C,t[48]=c,t[49]=d):d=t[49],L=A.map(d),t[10]=y,t[11]=T,t[12]=n,t[13]=_,t[14]=C,t[15]=c,t[16]=b,t[17]=E,t[18]=D,t[19]=O,t[20]=k,t[21]=A,t[22]=j,t[23]=M,t[24]=N,t[25]=P,t[26]=F,t[27]=I,t[28]=L,t[29]=R,t[30]=z}else E=t[17],D=t[18],O=t[19],k=t[20],A=t[21],j=t[22],M=t[23],N=t[24],P=t[25],F=t[26],I=t[27],L=t[28],R=t[29],z=t[30];let B;t[50]!==A||t[51]!==x||t[52]!==j?(B=x&&A.length===0?(0,Z.jsx)($o,{disabled:!0,"data-testid":`open-in-agent-selection-empty`,children:j?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}):null,t[50]=A,t[51]=x,t[52]=j,t[53]=B):B=t[53];let V;t[54]!==o||t[55]!==O||t[56]!==k||t[57]!==n||t[58]!==x?(V=!O&&!x?(0,Z.jsxs)($o,{onSelect:k,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":o({id:`aA51jP`}),children:[(0,Z.jsx)(_t,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[54]=o,t[55]=O,t[56]=k,t[57]=n,t[58]=x,t[59]=V):V=t[59];let H;t[60]!==E||t[61]!==B||t[62]!==V||t[63]!==P||t[64]!==F||t[65]!==I||t[66]!==L?(H=(0,Z.jsxs)(E,{align:P,className:F,"data-testid":I,children:[L,B,V]}),t[60]=E,t[61]=B,t[62]=V,t[63]=P,t[64]=F,t[65]=I,t[66]=L,t[67]=H):H=t[67];let U;return t[68]!==D||t[69]!==M||t[70]!==N||t[71]!==H||t[72]!==R||t[73]!==z?(U=(0,Z.jsxs)(D,{open:R,onOpenChange:z,modal:M,children:[N,H]}),t[68]=D,t[69]=M,t[70]=N,t[71]=H,t[72]=R,t[73]=z,t[74]=U):U=t[74],U}var Lj=50,Rj=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,MS.preload()},Lj))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=kh)},u=(0,Z.jsx)(Vl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsxs)(sa,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(pr,{children:[d,(0,Z.jsx)(Ar,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function zj(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=Po(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),p,m;t[0]===u?(p=t[1],m=t[2]):(p=()=>{!u||!f.current||(f.current.focus(),f.current.select())},m=[u],t[0]=u,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=o?.hasRemote===!0,g=n===null,_;t[3]!==a||t[4]!==c||t[5]!==h||t[6]!==n||t[7]!==r?(_=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await ka({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:Eo,toastSuccess:Wj,toastError:Uj,logEvent:Hj});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{X.error(a({id:`u3YnKw`}))}l(!1)}},t[3]=a,t[4]=c,t[5]=h,t[6]=n,t[7]=r,t[8]=_):_=t[8];let v=_,y=u!==null,b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||d(null)},t[9]=b):b=t[9];let x;t[10]!==a||t[11]!==n?.kind?(x=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=x):x=t[12];let S=c||g,C,w;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Hl,{className:`size-3.5`,"aria-hidden":!0}),w=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=C,t[14]=w):(C=t[13],w=t[14]);let T;t[15]!==v||t[16]!==x||t[17]!==S?(T=(0,Z.jsx)(W,{asChild:!0,children:(0,Z.jsxs)(sa,{variant:`ghost`,size:`sm`,"aria-label":x,onClick:v,disabled:S,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[C,w]})}),t[15]=v,t[16]=x,t[17]=S,t[18]=T):T=t[18];let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[20]=D):D=t[20];let O=u??``,k;t[21]===a?k=t[22]:(k=a({id:`5-FeN2`}),t[21]=a,t[22]=k);let A;t[23]!==O||t[24]!==k?(A=(0,Z.jsxs)(ie,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[E,D,(0,Z.jsx)(ks,{ref:f,readOnly:!0,value:O,onFocus:Vj,onClick:Bj,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":k})]}),t[23]=O,t[24]=k,t[25]=A):A=t[25];let j;return t[26]!==T||t[27]!==A||t[28]!==y?(j=(0,Z.jsxs)(ee,{open:y,onOpenChange:b,children:[T,A]}),t[26]=T,t[27]=A,t[28]=y,t[29]=j):j=t[29],j}function Bj(e){return e.currentTarget.select()}function Vj(e){return e.currentTarget.select()}function Hj(e){return console.log(e)}function Uj(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function Wj(e){return X.success(e)}function Gj(e){let t=(0,$.c)(44),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=yt(),{state:p}=QO(),m=Oh(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=Us(`toggle-files-sidebar`),t[0]=h):h=t[0];let g=h,_=Us(`command-palette`),v=No(),[y,b]=(0,Q.useState)(!1),x;bb0:{if(f===null){let e;t[1]===v?e=t[2]:(e=sg({workspace:v}),t[1]=v,t[2]=e),x=e;break bb0}if(f.kind===`folder`){if(!v){x=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==v?(e=cg({folderRelativePath:f.folderPath,workspace:v}),t[3]=f.folderPath,t[4]=v,t[5]=e):e=t[5],x=e;break bb0}let e;t[6]!==d||t[7]!==v?(e=og({docName:d,workspace:v}),t[6]=d,t[7]=v,t[8]=e):e=t[8],x=e}let S=c??x,C;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=so(f.folderPath),t[9]=f.folderPath,t[10]=e),C=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=cs(d),t[11]=d,t[12]=e),C=e;break bb1}C=null}let w=C,T=typeof window<`u`&&window.okDesktop!=null,E=p===`collapsed`,D=T?``:void 0,k=T&&E&&`pl-[78px]`,A;t[13]===k?A=t[14]:(A=ea(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,T&&`[-webkit-app-region:drag]`,k,T&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[13]=k,t[14]=A);let j=!m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(rk,{className:ea(`-ml-1 shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ar,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:g}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:g}})})]}),E&&a&&(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:_}}),"data-telemetry-event":`ok.editor_header.search.click`,className:ea(`shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(O,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ar,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:_}})})]}),(0,Z.jsx)(Aa,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(jj,{})]}),M;t[15]===j?M=t[16]:(M=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:j}),t[15]=j,t[16]=M);let N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=ea(`flex shrink-0 items-center justify-end gap-2 px-3`,T&&`[&>*]:[-webkit-app-region:no-drag]`),t[17]=N):N=t[17];let P;t[18]!==S||t[19]!==l||t[20]!==o||t[21]!==y||t[22]!==b||t[23]!==w||t[24]!==m?(P=!m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ij,{input:S,open:o,onOpenChange:l}),(0,Z.jsx)(zj,{input:w,onClickWhenNoRemote:()=>b(!0)}),(0,Z.jsx)(us,{open:y,onOpenChange:b})]}),t[18]=S,t[19]=l,t[20]=o,t[21]=y,t[22]=b,t[23]=w,t[24]=m,t[25]=P):P=t[25];let F;t[26]!==r||t[27]!==n?(F=(0,Z.jsx)(Vo,{onSignIn:n,onSetIdentity:r}),t[26]=r,t[27]=n,t[28]=F):F=t[28];let I,L,R;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(uA,{}),L=(0,Z.jsx)(Aa,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),R=(0,Z.jsx)(dd,{}),t[29]=I,t[30]=L,t[31]=R):(I=t[29],L=t[30],R=t[31]);let z;t[32]===m?z=t[33]:(z=!m&&(0,Z.jsx)(Rj,{}),t[32]=m,t[33]=z);let B;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Fj,{}),t[34]=B):B=t[34];let V;t[35]!==P||t[36]!==F||t[37]!==z?(V=(0,Z.jsxs)(`div`,{className:N,children:[P,F,I,L,R,z,B]}),t[35]=P,t[36]=F,t[37]=z,t[38]=V):V=t[38];let H;return t[39]!==V||t[40]!==D||t[41]!==A||t[42]!==M?(H=(0,Z.jsxs)(`header`,{"data-electron-drag":D,className:A,children:[M,V]}),t[39]=V,t[40]=D,t[41]=A,t[42]=M,t[43]=H):H=t[43],H}function Kj(e){let t=(0,$.c)(48),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,{_:a}=i(),[o,s]=l_(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Av[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),w=Ho(),{projectLocalConfig:T,projectLocalSynced:E}=be(),D=No(),{activeDocName:O}=yt(),k=w?.hasRemote,A=w?.pushPermission?.checkStatus,j;t[2]!==v||t[3]!==T||t[4]!==E||t[5]!==k||t[6]!==A?(j=p_({autoSyncOnboardingDismissed:v,hasRemote:k,projectLocalSynced:E,projectLocalConfig:T,pushPermissionCheckStatus:A}),t[2]=v,t[3]=T,t[4]=E,t[5]=k,t[6]=A,t[7]=j):j=t[7];let M=j,N,P;t[8]===O?(N=t[9],P=t[10]):(N=()=>{let e=function(e){let t=e.detail;t&&O&&_c(O,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(t_,e),()=>window.removeEventListener(t_,e)},P=[O],t[8]=O,t[9]=N,t[10]=P),(0,Q.useEffect)(N,P),u_(w?.pausedReason);let F;t[11]===s?F=t[12]:(F=function(e){l(e),s(e)},t[11]=s,t[12]=F);let I=F,L;t[13]===a?L=t[14]:(L=async function(){_(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?X.success(a({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),X.error(a({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),X.error(a({id:`q7zsRM`}))}_(!1)},t[13]=a,t[14]=L);let R=L,z;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){x(e),e||C(null)},t[15]=z):z=t[15];let B=z,V;t[16]!==a||t[17]!==O||t[18]!==D?(V={openSelection(e){let t=lg({docName:e.docName,workspace:D,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown})??og({docName:O,workspace:D});return t===null?(X.error(a({id:`_VRtd7`})),!1):(C(t),x(!0),!0)}},t[16]=a,t[17]=O,t[18]=D,t[19]=V):V=t[19];let H,U;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{p(`auth`),d(!0)},U=()=>{p(`identity`),d(!0)},t[20]=H,t[21]=U):(H=t[20],U=t[21]);let ee;t[22]!==r||t[23]!==S||t[24]!==b?(ee=(0,Z.jsx)(Gj,{onSignIn:H,onSetIdentity:U,onOpenSearch:r,openInAgentMenuOpen:b,openInAgentMenuInput:S,onOpenInAgentMenuOpenChange:B}),t[22]=r,t[23]=S,t[24]=b,t[25]=ee):ee=t[25];let te;t[26]!==m||t[27]!==c||t[28]!==I||t[29]!==R||t[30]!==g?(te=(0,Z.jsx)(zk,{editorMode:c,onModeChange:I,activeTab:m,onActiveTabChange:h,onSaveVersion:R,saving:g}),t[26]=m,t[27]=c,t[28]=I,t[29]=R,t[30]=g,t[31]=te):te=t[31];let W;t[32]!==V||t[33]!==ee||t[34]!==te?(W=(0,Z.jsxs)(wc,{value:V,children:[ee,te]}),t[32]=V,t[33]=ee,t[34]=te,t[35]=W):W=t[35];let ne=f===`identity`,re;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>{d(!1)},t[36]=re):re=t[36];let G;t[37]!==u||t[38]!==ne?(G=(0,Z.jsx)(zo,{open:u,onOpenChange:d,identityPrompt:ne,onSuccess:re}),t[37]=u,t[38]=ne,t[39]=G):G=t[39];let ie;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>y(!0),t[40]=ie):ie=t[40];let K;t[41]===M?K=t[42]:(K=(0,Z.jsx)(d_,{open:M,onResolved:ie}),t[41]=M,t[42]=K);let q;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Qg,{}),t[43]=q):q=t[43];let ae;return t[44]!==W||t[45]!==G||t[46]!==K?(ae=(0,Z.jsxs)(Z.Fragment,{children:[W,G,K,q]}),t[44]=W,t[45]=G,t[46]=K,t[47]=ae):ae=t[47],ae}function qj(e){let t=yr(di(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function Jj(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=lo();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Pi,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Pi,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(Yj),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function Yj(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(sa,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>qj(e.file),children:[(0,Z.jsx)(Pi,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var Xj=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
29
29
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
30
30
  <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"/>
31
31
  </symbol>
@@ -42,68 +42,68 @@ Error generating stack: `+e.message+`
42
42
  <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
43
43
  <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" />
44
44
  </symbol>
45
- </svg>`,Nj=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
45
+ </svg>`,Zj=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
46
46
  <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"/>
47
47
  <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"/>
48
- </symbol>`,Pj=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
48
+ </symbol>`,Qj=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
49
49
  <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"/>
50
- </symbol>`,Fj=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
50
+ </symbol>`,$j=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
51
51
  <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"/>
52
52
  <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"/>
53
- </symbol>`,Ij=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
53
+ </symbol>`,eM=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
54
54
  <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"/>
55
- </symbol>`,Lj=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
55
+ </symbol>`,tM=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
56
56
  <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"/>
57
57
  <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"/>
58
- </symbol>`,Rj=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
58
+ </symbol>`,nM=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
59
59
  <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"/>
60
60
  <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"/>
61
61
  <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"/>
62
- </symbol>`,zj=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
62
+ </symbol>`,rM=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
63
63
  <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"/>
64
- </symbol>`,Bj=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
64
+ </symbol>`,iM=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
65
65
  <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"/>
66
- </symbol>`,Vj=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
66
+ </symbol>`,aM=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
67
67
  <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"/>
68
68
  <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"/>
69
- </symbol>`,Hj=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
69
+ </symbol>`,oM=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
70
70
  <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"/>
71
71
  <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"/>
72
72
  <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"/>
73
- </symbol>`,Uj=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
73
+ </symbol>`,sM=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
74
74
  <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"/>
75
75
  <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"/>
76
- </symbol>`,Wj=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
76
+ </symbol>`,cM=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
77
77
  <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"/>
78
78
  <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"/>
79
- </symbol>`,Gj=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
79
+ </symbol>`,lM=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
80
80
  <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"/>
81
81
  <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"/>
82
- </symbol>`,Kj=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
82
+ </symbol>`,uM=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
83
83
  <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"/>
84
- </symbol>`,qj=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
84
+ </symbol>`,dM=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
85
85
  <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"/>
86
- </symbol>`,Jj=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
86
+ </symbol>`,fM=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
87
87
  <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"/>
88
- </symbol>`,Yj=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
88
+ </symbol>`,pM=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
89
89
  <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"/>
90
- </symbol>`,Xj=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
90
+ </symbol>`,mM=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
91
91
  <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"/>
92
92
  <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"/>
93
- </symbol>`,Zj=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
93
+ </symbol>`,hM=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
94
94
  <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"/>
95
95
  <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"/>
96
- </symbol>`,Qj=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
96
+ </symbol>`,gM=`<symbol id="file-tree-builtin-javascript" 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="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"/>
99
- </symbol>`,$j=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
99
+ </symbol>`,_M=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
100
100
  <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"/>
101
- </symbol>`,eM=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
101
+ </symbol>`,vM=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
102
102
  <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
103
- </symbol>`,tM=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
103
+ </symbol>`,yM=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
104
104
  <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"/>
105
105
  <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"/>
106
- </symbol>`,nM=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
106
+ </symbol>`,bM=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
107
107
  <defs>
108
108
  <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
109
109
  <stop stop-color="currentColor"/>
@@ -113,82 +113,82 @@ Error generating stack: `+e.message+`
113
113
  <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
114
114
  <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
115
115
  <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
116
- </symbol>`,rM=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
116
+ </symbol>`,xM=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
117
117
  <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"/>
118
118
  <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
119
- </symbol>`,iM=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
119
+ </symbol>`,SM=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
120
120
  <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"/>
121
- </symbol>`,aM=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
121
+ </symbol>`,CM=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
122
122
  <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"/>
123
- </symbol>`,oM=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
123
+ </symbol>`,wM=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
124
124
  <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
125
125
  <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
126
126
  <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
127
127
  <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
128
- </symbol>`,sM=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
128
+ </symbol>`,TM=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
129
129
  <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"/>
130
130
  <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"/>
131
- </symbol>`,cM=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
131
+ </symbol>`,EM=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
132
132
  <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"/>
133
133
  <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"/>
134
- </symbol>`,lM=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
134
+ </symbol>`,DM=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
135
135
  <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"/>
136
- </symbol>`,uM=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
136
+ </symbol>`,OM=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
137
137
  <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"/>
138
- </symbol>`,dM=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
138
+ </symbol>`,kM=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
139
139
  <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"/>
140
- </symbol>`,fM=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
140
+ </symbol>`,AM=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
141
141
  <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"/>
142
142
  <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
143
- </symbol>`,pM=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
143
+ </symbol>`,jM=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
144
144
  <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"/>
145
- </symbol>`,mM=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
145
+ </symbol>`,MM=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
146
146
  <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"/>
147
147
  <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"/>
148
- </symbol>`,hM=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
148
+ </symbol>`,NM=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
149
149
  <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"/>
150
150
  <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"/>
151
- </symbol>`,gM=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
151
+ </symbol>`,PM=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
152
152
  <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"/>
153
- </symbol>`,_M=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
153
+ </symbol>`,FM=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
154
154
  <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"/>
155
155
  <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"/>
156
- </symbol>`,vM=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
156
+ </symbol>`,IM=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
157
157
  <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"/>
158
- </symbol>`,yM=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
158
+ </symbol>`,LM=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
159
159
  <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"/>
160
- </symbol>`,bM=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
160
+ </symbol>`,RM=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
161
161
  <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"/>
162
162
  <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"/>
163
- </symbol>`,xM=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
163
+ </symbol>`,zM=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
164
164
  <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"/>
165
165
  <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"/>
166
- </symbol>`,SM=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
166
+ </symbol>`,BM=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
167
167
  <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"/>
168
- </symbol>`,CM=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
168
+ </symbol>`,VM=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
169
169
  <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"/>
170
170
  <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"/>
171
171
  <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"/>
172
- </symbol>`,wM=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
172
+ </symbol>`,HM=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
173
173
  <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
174
174
  <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
175
- </symbol>`,TM=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
175
+ </symbol>`,UM=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
176
176
  <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"/>
177
177
  <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"/>
178
178
  <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"/>
179
- </symbol>`,EM=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
179
+ </symbol>`,WM=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
180
180
  <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"/>
181
181
  <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"/>
182
- </symbol>`,DM=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
182
+ </symbol>`,GM=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
183
183
  <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"/>
184
- </symbol>`,OM=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
184
+ </symbol>`,KM=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
185
185
  <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"/>
186
186
  <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"/>
187
- </symbol>`,kM=[Fj,Vj,Hj,Uj,Kj,qj,Jj,Xj,Zj,Qj,$j,eM,tM,sM,lM,uM,gM,_M,bM,xM,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
187
+ </symbol>`,qM=[$j,aM,oM,sM,uM,dM,fM,mM,hM,gM,_M,vM,yM,TM,DM,OM,PM,FM,RM,zM,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
188
188
  <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"/>
189
189
  <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"/>
190
- </symbol>`],AM=[Nj,Pj,Ij,Lj,Rj,zj,Bj,Wj,Gj,Yj,nM,rM,iM,aM,oM,cM,dM,fM,pM,mM,hM,vM,yM,SM,CM,wM,TM,EM,DM,OM];function jM(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
191
- `)}\n</svg>`)}var MM=jM(Mj,kM),NM={minimal:Mj,standard:MM,complete:jM(MM,AM)},PM={".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`},FM={"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`},IM={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},LM=new Set([`bash`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),RM=new Set([`complete`]);function zM(e){return NM[e===`none`?`minimal`:e]}function BM(e){return`file-tree-builtin-${e}`}function VM(e){return e!==`none`&&RM.has(e)}function HM(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=PM[t.toLowerCase()];if(i!=null&&(r||LM.has(i)))return i;for(let e of n){if(r){let t=IM[e];if(t!=null)return t}let t=FM[e];if(t!=null&&(r||LM.has(t)))return t}return`default`}var UM=`file-tree-container`,WM=`data-file-tree-style`,GM=`data-file-tree-unsafe-css`,KM=`data-file-tree-scrollbar-measure`,qM=`data-file-tree-scrollbar-gutter-measured`,JM=`--trees-scrollbar-gutter-measured`,YM=`header`,XM=`context-menu`,ZM=`context-menu-trigger`;function QM(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function $M(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(QM(e)?`none`:`complete`),colored:e.colored??!0}}var eN=e=>e.trim().toLowerCase(),tN=e=>e.split(`/`).at(-1)??e,nN=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 rN(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function iN(e){let t=$M(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(eN(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=tN(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return rN(c,e);for(let[t,n]of a)if(s.includes(t))return rN(n,e);let l=nN(n);for(let t of l){let n=i.get(t);if(n!=null)return rN(n,e)}let u=HM(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:BM(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:rN(s,e)}}}var aN=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,oN=/^0(?:\.0+)?%?$/;function sN(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 cN(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||aN.test(t))return!0;let n=sN(t);return n!=null&&oN.test(n)}function lN(e){return cN(e)?void 0:e}function uN(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=lN(t[`list.focusOutline`])??lN(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 dN=5,fN=1<<dN,pN=fN*4;function mN(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function hN(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function gN(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 _N(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 vN(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function yN(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 bN(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,wN(e,t)}function xN(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=_N(e).get(t);if(i===void 0)return;let a=i>>dN;e.childVisibleChunkSums[a]+=r}function SN(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=TN(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=fN}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 CN(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>dN;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<dN}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 wN(e,t){if(t.childIds.length<pN){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/fN),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>>dN]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function TN(e,t,n,r){let i=Math.min(t.childIds.length,n+fN),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 EN=7,DN=3,ON=1<<DN,kN=4;function AN(e,t,n=0){return e<<kN|n<<DN|t}function jN(e){return e.depthAndFlags>>>kN}function MN(e){return(e.depthAndFlags&ON)>>DN}function NN(e){return(e.depthAndFlags&ON)!==0}function PN(e){return e.depthAndFlags&EN}function FN(e,t){return(PN(e)&t)!==0}function IN(e,t){e.depthAndFlags|=t}function LN(e,t){e.depthAndFlags=AN(t,PN(e),MN(e))}var RN=Symbol(`benchmarkInstrumentation`);function zN(e,t){return t==null||Object.defineProperty(e,RN,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function BN(e){return e==null?null:e[RN]??null}function VN(e,t,n){return e==null?n():e.measurePhase(t,n)}function HN(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function UN(e){return e>=48&&e<=57}function WN(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!UN(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&&UN(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 GN(e){let t=e.toLowerCase();return{lowerValue:t,tokens:WN(t)}}function KN(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 qN(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=KN(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function JN(e,t,n){let r=qN(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function YN(e,t){return JN(e,t,GN)}function XN(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function ZN(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=XN(e,r);return a===XN(t,r)?YN(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 QN(e,t){return ZN(e,t)}function $N(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=GN(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=XN(e,n);return o===XN(t,n)?JN(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 eP(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=GN(r);return e.sortKeyById[t]=i,i}function tP(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function nP(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 rP(e){let{hasTrailingSlash:t,segments:n}=nP(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function iP(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=nP(e);return{requiresDirectory:t,segments:n}}var aP=``;function oP(){let e=new Map;return e.set(aP,0),{idByValue:e,valueById:[aP],sortKeyById:[GN(aP)]}}function sP(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 cP(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var lP=Symbol(`pathStorePreparedInputKind`);function uP(e,t){return e[lP]=t,e}function dP(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function fP(e,t,n){return n===`default`?QN(e,t):n(dP(e),dP(t))}function pP(){return{depthAndFlags:AN(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function mP(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 hP(e){return e.isDirectory?e.segments.length:e.segments.length-1}function gP(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 _P(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function vP(e,t={}){return wP(e,t).map(e=>e.path)}function yP(e,t={}){let n=wP(e,t);return uP({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function bP(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 uP({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function xP(e){let t=e,n=t.preparedPaths;if(t[lP]===`prepared`&&n!=null)return n;if(!gP(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function SP(e){let t=e;return t[lP]===`presorted`&&t.presortedPaths!=null||_P(t.presortedPaths)?t.presortedPaths:null}function CP(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function wP(e,t={}){let n=tP(t),r=BN(t);HN(r,`workload.inputFiles`,e.length);let i=VN(r,`store.preparePathEntries.parse`,()=>e.map(e=>rP(e)));return VN(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>fP(e,t,n.sort))),i}var TP=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[pP()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=oP();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=BN(e),this.options=tP(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,mN())}appendPaths(e){return VN(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>rP(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,VN(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return VN(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:AN(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:AN(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:AN(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=rP(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:AN(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:AN(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=rP(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(VN(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||VN(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`?$N(this.lastPreparedPath,e,this.segmentSortKeyCache):fP(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=hP(e),i=n==null?0:hP(n),a=n==null?0:mP(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=sP(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:AN(jN(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),vN(i,s),s}createFileChildUnchecked(e,t){let n=sP(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:AN(jN(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),vN(r,a),a}getOrCreateDirectoryChild(e,t){let n=sP(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&&!NN(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:AN(jN(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),vN(r,a),this.directories.set(a,mN()),a}createDirectoryChild(e,t){let n=sP(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:AN(jN(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),vN(r,a),this.directories.set(a,mN()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!NN(n))throw Error(`Path is not a directory: "${t}"`);if(FN(n,1))throw Error(`Duplicate path: "${t}"`);IN(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,hN());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(NN(a)){let t=hN();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;NN(n)&&this.directories.set(t,mN());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),vN(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!NN(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 bN(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function EP(e,t=`closed`,n=null){let r=OP(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 DP(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function OP(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 kP(e,t){return FN(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:jN(t)<=e.defaultExpansion}function AP(e,t,n=e.snapshot.nodes[t]){return n==null||!NN(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:kP(e,n)}function jP(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!NN(r))return;let i=kP(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 MP(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 NP(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function PP(e,t){let n=MP(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 FP(e,t){let n=MP(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function IP(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 LP(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function RP(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 zP(e,t){e.directoryLoadInfoById.delete(t)}function BP(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 VP(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function HP(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function UP(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function WP(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function GP(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function KP(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function qP(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 JP(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 YP(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 XP(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 ZP(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 QP(e,t,n){return{...n,visibleCountDelta:lF(e)-t}}function $P(e,t){let n=lF(e),r=DP();e.transactionStack.push(r);try{t()}catch(t){throw nF(e,r,!1),t}nF(e,r,!0,lF(e)-n)}function eF(e,t){let n=e.instrumentation;if(n==null){tF(e,t);return}VN(n,`store.events.record`,()=>tF(e,t))}function tF(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){sF(e,t);return}n.events.push(t),oF(n,t)}function nF(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?aF(i,t):VN(n,`store.events.batch.merge`,()=>aF(i,t));return}let a=rF(t,r),o=e.instrumentation;if(o==null){sF(e,a);return}VN(o,`store.events.batch.commit`,()=>sF(e,a))}function rF(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 iF(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function aF(e,t){for(let n of t.events)e.events.push(n);iF(e,t)}function oF(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function sF(e,t){let n=e.instrumentation;if(n==null){cF(e,t);return}VN(n,`store.events.emit`,()=>cF(e,t))}function cF(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function lF(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function uF(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!NN(n)||FN(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||!NN(a)?null:i}function dF(e,t){let n=t;for(;;){let t=uF(e,n);if(t==null)return n;n=t}}function fF(e,t){let n=[t],r=t;for(;;){let t=uF(e,r);if(t==null)return n;n.push(t),r=t}}function pF(e,t){let n=t==null?e.snapshot.rootId:CF(e,t);return n==null?[]:DF(e,n)}function mF(e,t){let n=rP(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=HF(e,VF(e,r)),{createdNodeIds:a,directoryId:o}=OF(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=EF(e,o);if(FN(n,1))throw Error(`Path already exists: "${t}"`);IN(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=AF(e,o,n.basename),s.add(c);bF(e,o);let l=HF(e,o);return VP({affectedAncestorIds:SF(e,c),affectedNodeIds:[...s],path:t,projectionChanged:UF(i,l)})}function hF(e,t,n){let r=CF(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=EF(e,r);if(FN(i,2))throw Error(`The root node cannot be removed`);if(NN(i)&&TF(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=HF(e,a),s=zF(e,r);NF(e,a,r,i.nameId),BF(e,a),bF(e,a);let c=HF(e,a);return HP({affectedAncestorIds:SF(e,a),affectedNodeIds:s,path:t,projectionChanged:UF(o,c),recursive:n.recursive===!0})}function gF(e,t,n,r){let i=CF(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=EF(e,i);if(FN(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=LF(e,i,n),c=HF(e,a.parentId),l=HF(e,s.parentId),u=cP(e.snapshot.segmentTable,a.nameId),d=sP(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(NN(a)&&qF(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=gN(e.snapshot.nodes,TF(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&RF(e,p,o,MN(a))===`skip`)return null;let m=a.parentId;NF(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),KF(e,i),MF(e,s.parentId,i),BF(e,m),e.pathCacheVersion++,bF(e,m),s.parentId!==m&&bF(e,s.parentId);let h=HF(e,m),g=HF(e,s.parentId);return UP({affectedAncestorIds:[...new Set([...SF(e,m),...SF(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:WF([c,l],[h,g]),to:yF(e,i)})}function _F(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function vF(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function yF(e,t){let n=EF(e,t),r=_F(e,t);if(r!=null)return r;if(FN(n,2))return vF(e,t,``);let i=yF(e,n.parentId),a=cP(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return vF(e,t,NN(n)?`${o}/`:o)}function bF(e,t){let n=e.instrumentation;if(n==null){YF(e,t);return}VN(n,`store.recomputeCountsUpwardFrom`,()=>YF(e,t))}function xF(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||!NN(o)){JF(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){JF(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function SF(e,t){let n=[],r=t;for(;r!=null;){let t=EF(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function CF(e,t){if(t.length===0)return e.snapshot.rootId;let n=iP(t);return wF(e,n.segments,n.requiresDirectory)}function wF(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=TF(e,r),a=gN(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=EF(e,r);return n&&!NN(i)?null:r}function TF(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 EF(e,t){let n=e.snapshot.nodes[t];if(n===void 0||FN(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function DF(e,t){let n=e.snapshot.nodes[t];if(n===void 0||FN(n,4))return[];if(!NN(n))return[yF(e,t)];if(TF(e,t).childIds.length===0)return FN(n,1)&&!FN(n,2)?[yF(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||FN(n,4)){i.pop();continue}if(!NN(n)){r.push(yF(e,t.nodeId)),i.pop();continue}let a=TF(e,t.nodeId);if(a.childIds.length===0){FN(n,1)&&!FN(n,2)&&r.push(yF(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 OF(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=sP(e.snapshot.segmentTable,i),a=TF(e,r),o=gN(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!NN(EF(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=kF(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function kF(e,t,n){let r=EF(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:AN(jN(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,mN()),MF(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function AF(e,t,n){let r=sP(e.snapshot.segmentTable,n),i=TF(e,t);if(gN(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${ZF(e,t,n)}"`);let a=EF(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:AN(jN(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),MF(e,t,o),e.activeNodeCount++,o}function jF(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}PF(e,n,o)<0?i=a:r=a+1}return r}function MF(e,t,n){let r=TF(e,t),i=EF(e,n);gN(e.snapshot.nodes,r).set(i.nameId,n),xN(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=jF(e,r,n);r.childIds.splice(a,0,n),yN(r,a),wN(e.snapshot.nodes,r)}function NF(e,t,n,r){let i=TF(e,t),a=_N(i),o=a.get(n)??-1;gN(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&xN(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),yN(i,o),wN(e.snapshot.nodes,i))}function PF(e,t,n){let r=e.snapshot.options.sort;return r===`default`?FF(e,t,n):r(IF(e,t),IF(e,n))}function FF(e,t,n){let r=EF(e,t),i=EF(e,n),a=NN(r);if(a!==NN(i))return a?-1:1;let o=qN(eP(e.snapshot.segmentTable,r.nameId),eP(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=cP(e.snapshot.segmentTable,r.nameId),c=cP(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function IF(e,t){let n=EF(e,t),r=yF(e,t),i=NN(n),a=i?r.slice(0,-1):r;return{basename:cP(e.snapshot.segmentTable,n.nameId),depth:jN(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function LF(e,t,n){let r=EF(e,t),i=CF(e,n);if(i!=null){let t=EF(e,i);if(NN(t))return{basename:cP(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=iP(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=iP(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:wF(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function RF(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${yF(e,t)}"`);let i=EF(e,t);if(MN(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(NN(i)&&TF(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return zF(e,t),NF(e,a,t,o),BF(e,a),bF(e,a),`handled`}function zF(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=EF(e,t.nodeId);if(t.visitedChildren||!NN(i)){NN(i)&&e.snapshot.directories.delete(t.nodeId),IN(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),zP(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=TF(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 BF(e,t){let n=t;for(;n!=null;){let t=EF(e,n);if(!NN(t)||FN(t,2)||TF(e,n).childIds.length>0)return;IN(t,1),n=t.parentId===n?null:t.parentId}}function VF(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=gN(e.snapshot.nodes,TF(e,n)).get(t);if(i==null||!NN(EF(e,i)))break;n=i}return n}function HF(e,t){let n=GF(e,t);if(n==null)return null;let r=dF(e,n),i=EF(e,r),a=n===r?null:fF(e,n).map(t=>yF(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:TF(e,r).childIds.length>0,path:yF(e,r),terminalKind:MN(i)})}function UF(e,t){return WF([e],[t])}function WF(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 GF(e,t){let n=t;for(;n!=null;){let t=EF(e,n);if(!NN(t)||FN(t,2))return null;if(!AP(e,n,t))return n;n=t.parentId}return null}function KF(e,t){let n=EF(e,t);if(LN(n,(t===e.snapshot.rootId?-1:jN(EF(e,n.parentId)))+1),!NN(n))return;let r=TF(e,t);for(let t of r.childIds)KF(e,t)}function qF(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=EF(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function JF(e,t,n=EF(e,t),r=!1){let i=e.instrumentation;if(i==null){XF(e,t,n,r);return}VN(i,`store.recomputeNodeCounts`,()=>XF(e,t,n,r))}function YF(e,t){let n=t;for(;n!=null;){let t=EF(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(JF(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&xN(TF(e,s),n,a,o),n=s}}function XF(e,t,n,r){if(!NN(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=TF(e,t);if(r){let t=e.instrumentation;t==null?bN(e.snapshot.nodes,i):VN(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>bN(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,FN(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=uF(e,t)==null?AP(e,t,n)?1+o:1:o}function ZF(e,t,n){let r=yF(e,t);return r.length===0?n:`${r}${n}`}function QF(e){return e!=null&&!FN(e,4)}function $F(e,t){let n=e.snapshot.nodes[t];return!QF(n)||!NN(n)||FN(n,2)?null:n}function eI(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&QF(e.snapshot.nodes[n])&&(t+=1);return t}function tI(e){return Math.max(0,e.valueById.length-1)}function nI(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:eI(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:tI(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function rI(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 iI(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)$F(e,n)!=null&&t.push(yF(e,n));for(let t of e.expandedDirectoryIds)$F(e,t)!=null&&n.push(yF(e,t));return{collapsedPaths:t,expandedPaths:n}}function aI(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)$F(e,n)==null||NP(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:yF(e,n)});return t}function oI(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=CF(e,n);t!=null&&jP(e,t,!0,EF(e,t))}for(let n of t.collapsedPaths){let t=CF(e,n);t!=null&&jP(e,t,!1,EF(e,t))}}function sI(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=CF(e,n.path);t!=null&&$F(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function cI(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function lI(e){let t=e.snapshot.segmentTable,n=oP();for(let r of e.snapshot.nodes)if(QF(r)){if(FN(r,2)){r.nameId=0;continue}r.nameId=sP(n,cP(t,r.nameId))}e.snapshot.segmentTable=n}function uI(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!QF(r)||!NN(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return QF(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[EF(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),bN(e.snapshot.nodes,n)}}function dI(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(QF(n))break;--t}e.snapshot.nodes.length=t+1}function fI(e){let t=iI(e),n=aI(e);VN(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>cI(e)),VN(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>lI(e)),VN(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>uI(e)),VN(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>dI(e)),VN(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>oI(e,t)),VN(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>sI(e,n)),VN(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>xF(e,e.snapshot.rootId))}function pI(e){let t=iI(e),n=aI(e),r=VN(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>pF(e)),i=zN({...e.snapshot.options},e.instrumentation),a=VN(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new TP(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,VN(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>oI(e,t)),VN(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>sI(e,n)),VN(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>xF(e,e.snapshot.rootId))}function mI(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function hI(e,t){let n=nI(e);t===`stable`?VN(e.instrumentation,`store.cleanup.stable`,()=>fI(e)):VN(e.instrumentation,`store.cleanup.aggressive`,()=>pI(e));let r=nI(e);return rI(t,t===`stable`,n,r)}var gI=64;function _I(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 vI(e){return EF(e,e.snapshot.rootId).visibleSubtreeCount}function yI(e,t,n,r){let i=EF(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function bI(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:zI(e,t.cursor),setSize:t.setSize,subtreeEndIndex:yI(e,t.cursor,t.index,n)}}function xI(e,t,n,r,i,a){let o=TF(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=SN(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return SI(e,u,l,r+c,i+1,s,o.childIds.length,a)}function SI(e,t,n,r,i,a,o,s){if(!NN(EF(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=NI(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=EF(e,c.terminalNodeId);if(!NN(l)||!AP(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return xI(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function CI(e,t){let n=vI(e);if(t<0||t>=n)return null;let r=xI(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>yF(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=bI(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:zI(e,r.cursor),setSize:r.setSize,subtreeEndIndex:yI(e,r.cursor,r.index,n)}}function wI(e,t,n){let r=e.instrumentation,i=vI(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 RI(e,o+1);let t=[],n=AI(e,a);for(let r=a;r<=o&&n!=null;r++){let r=zI(e,n);t.push(r),n=FI(e,n)}return t}let s=[],c=0,l=0,u=VN(r,`store.getVisibleSlice.selectFirstRow`,()=>AI(e,a));for(let t=a;t<=o&&u!=null;t++){let t=VN(r,`store.getVisibleSlice.materializeRow`,()=>zI(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=VN(r,`store.getVisibleSlice.advanceCursor`,()=>FI(e,u))}return HN(r,`workload.visibleRowsRead`,s.length),HN(r,`workload.flattenedRowsRead`,c),HN(r,`workload.flattenedSegmentsRead`,l),s}function TI(e,t=vI(e)){let n=e.instrumentation;return n==null?LI(e,t):VN(n,`store.getVisibleTreeProjection`,()=>LI(e,t))}function EI(e){return II(TI(e))}function DI(e,t){let n=CF(e,t);if(n==null||n===e.snapshot.rootId||NN(EF(e,n))&&dF(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=EF(e,i).parentId,n=TF(e,t),s=_N(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=CN(a,n,s),t!==o){let n=EF(e,t),a=uF(e,t);if(!AP(e,t,n)&&a!==i)return null;dF(e,t)===t&&(r+=1)}i=t}return r}function OI(e,t){let n=CF(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=EF(e,n);if(!NN(r))throw Error(`Path is not a directory: "${t}"`);return AP(e,n,r)?null:(jP(e,n,!0,r),bF(e,n),WP({affectedAncestorIds:SF(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function kI(e,t){let n=CF(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=EF(e,n);if(!NN(r))throw Error(`Path is not a directory: "${t}"`);return AP(e,n,r)?(jP(e,n,!1,r),bF(e,n),GP({affectedAncestorIds:SF(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function AI(e,t){return t<0||t>=vI(e)?null:jI(e,e.snapshot.rootId,t,-1)}function jI(e,t,n,r){let i=TF(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?SN(e.snapshot.nodes,i,n):VN(a,`store.getVisibleSlice.selectChildIndex`,()=>SN(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return MI(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function MI(e,t,n,r){if(!NN(EF(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=NI(e,t,r);if(n===0)return i;let a=EF(e,i.terminalNodeId);if(!NN(a)||!AP(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return jI(e,i.terminalNodeId,n-1,i.visibleDepth)}function NI(e,t,n){return NN(EF(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:dF(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:VN(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>dF(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function PI(e,t){let n=EF(e,t);if(!NN(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:uF(e,r)!==t}function FI(e,t){let n=EF(e,t.terminalNodeId);if(NN(n)){let r=TF(e,t.terminalNodeId);if(AP(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:MI(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=EF(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=TF(e,n),o=_N(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 MI(e,s,0,i);PI(e,r)&&i--,r=n}}function II(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 LI(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(gI);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=_I(o,y);let x,S=_;if(NN(v))S=f?dF(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:yF(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&&NN(C)&&AP(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 RI(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(!NN(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:yF(e,f)};continue}let h=l?dF(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=zI(e,g);let _=i[h];_!=null&&NN(_)&&AP(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function zI(e,t){let n=EF(e,t.terminalNodeId),r=NN(n)?BI(e,t):null,i=yF(e,t.terminalNodeId),a=cP(e.snapshot.segmentTable,n.nameId),o=NN(n)&&TF(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?fF(e,t.headNodeId).map(n=>{let r=EF(e,n);return{isTerminal:n===t.terminalNodeId,name:cP(e.snapshot.segmentTable,r.nameId),nodeId:n,path:yF(e,n)}}):VN(c,`store.getVisibleSlice.flatten.collectSegments`,()=>fF(e,t.headNodeId).map(n=>{let r=EF(e,n);return{isTerminal:n===t.terminalNodeId,name:cP(e.snapshot.segmentTable,r.nameId),nodeId:n,path:yF(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:NN(n)&&AP(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:NN(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function BI(e,t){if(t.headNodeId===t.terminalNodeId)return NP(e,t.terminalNodeId);let n=fF(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=NP(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function VI(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||!NN(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&&wN(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&NN(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,wN(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function HI(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var UI=class e{#e;constructor(e={}){let t=BN(e),n=VN(t,`store.builder.create`,()=>new TP(e));if(e.preparedInput!=null){let t=SP(e.preparedInput);t==null?n.appendPreparedPaths(xP(e.preparedInput),!1):n.appendPresortedPaths(t,CP(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(VN(t,`store.preparePathEntries`,()=>wP(r,e)))}let r=VN(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=VN(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=VN(t,`store.state.create`,()=>EP(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:VN(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||HI(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&VN(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?VN(t,`store.state.initializeOpenVisibleCounts`,()=>VI(this.#e)):VN(t,`store.state.recomputeCounts`,()=>xF(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return vP(e,t)}static prepareInput(e,t={}){return yP(e,t)}static preparePresortedInput(e){return bP(e)}list(e){return VN(this.#e.instrumentation,`store.list`,()=>pF(this.#e,e))}add(e){VN(this.#e.instrumentation,`store.add`,()=>{let t=vI(this.#e);eF(this.#e,QP(this.#e,t,mF(this.#e,e)))})}remove(e,t={}){VN(this.#e.instrumentation,`store.remove`,()=>{let n=vI(this.#e);eF(this.#e,QP(this.#e,n,hF(this.#e,e,t)))})}move(e,t,n={}){VN(this.#e.instrumentation,`store.move`,()=>{let r=vI(this.#e),i=gF(this.#e,e,t,n);i!=null&&eF(this.#e,QP(this.#e,r,i))})}batch(e){$P(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 VN(this.#e.instrumentation,`store.getVisibleCount`,()=>vI(this.#e))}getVisibleSlice(e,t){return VN(this.#e.instrumentation,`store.getVisibleSlice`,()=>wI(this.#e,e,t))}getVisibleRowContext(e){return VN(this.#e.instrumentation,`store.getVisibleRowContext`,()=>CI(this.#e,e))}getVisibleTreeProjection(){return EI(this.#e)}getVisibleTreeProjectionData(e){return TI(this.#e,e)}getVisibleIndex(e){return VN(this.#e.instrumentation,`store.getVisibleIndex`,()=>DI(this.#e,e))}getPathInfo(e){return VN(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=CF(this.#e,e);if(t==null)return null;let n=EF(this.#e,t);return{depth:jN(n),kind:NN(n)?`directory`:`file`,path:yF(this.#e,t)}})}isExpanded(e){return VN(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=EF(this.#e,t);return AP(this.#e,t,n)})}expand(e){VN(this.#e.instrumentation,`store.expand`,()=>{let t=vI(this.#e),n=OI(this.#e,e);n!=null&&eF(this.#e,QP(this.#e,t,n))})}collapse(e){VN(this.#e.instrumentation,`store.collapse`,()=>{let t=vI(this.#e),n=kI(this.#e,e);n!=null&&eF(this.#e,QP(this.#e,t,n))})}on(e,t){return BP(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return NP(this.#e,t)}markDirectoryUnloaded(e){VN(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(TF(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=vI(this.#e);FP(this.#e,t),eF(this.#e,QP(this.#e,n,KP({affectedAncestorIds:SF(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return VN(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=vI(this.#e),r=PP(this.#e,t);return eF(this.#e,QP(this.#e,n,qP({affectedAncestorIds:SF(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return VN(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||NP(this.#e,n)!==`loading`||!LP(this.#e,n,e.attemptId))return!1;let r=yF(this.#e,n);this.validateChildPatch(r,t);let i=vI(this.#e),a=[];for(let e of t.operations){WI(r,e);let t=vI(this.#e);switch(e.type){case`add`:a.push(QP(this.#e,t,mF(this.#e,e.path)));break;case`remove`:a.push(QP(this.#e,t,hF(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=gF(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(QP(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return eF(this.#e,QP(this.#e,i,JP({affectedAncestorIds:SF(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:yF(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return VN(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=vI(this.#e),r=IP(this.#e,t,e.attemptId);return eF(this.#e,QP(this.#e,n,YP({affectedAncestorIds:SF(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:yF(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return VN(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=vI(this.#e),i=RP(this.#e,n,e.attemptId,t);return eF(this.#e,QP(this.#e,r,XP({affectedAncestorIds:SF(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:yF(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return VN(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(mI(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=vI(this.#e),n=hI(this.#e,e.mode??`stable`);return eF(this.#e,QP(this.#e,t,ZP({...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=TF(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??GN(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=qN(eP(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(!NN(EF(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=EF(this.#e,n);AP(this.#e,n,i)||(jP(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=EF(this.#e,e);if(!AP(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=CF(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!NN(EF(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!NN(EF(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=EF(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=EF(this.#e,e),r=uF(this.#e,e);if(!AP(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 WI(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 GI={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function KI(e,t){if(typeof e==`number`)return{itemHeight:t??GI.default.itemHeight,factor:e};let n=GI[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var qI=GI.default.itemHeight,JI=`@layer base, theme, unsafe;
190
+ </symbol>`],JM=[Zj,Qj,eM,tM,nM,rM,iM,cM,lM,pM,bM,xM,SM,CM,wM,EM,kM,AM,jM,MM,NM,IM,LM,BM,VM,HM,UM,WM,GM,KM];function YM(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
191
+ `)}\n</svg>`)}var XM=YM(Xj,qM),ZM={minimal:Xj,standard:XM,complete:YM(XM,JM)},QM={".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`},$M={"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`},eN={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},tN=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 rN(e){return ZM[e===`none`?`minimal`:e]}function iN(e){return`file-tree-builtin-${e}`}function aN(e){return e!==`none`&&nN.has(e)}function oN(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=QM[t.toLowerCase()];if(i!=null&&(r||tN.has(i)))return i;for(let e of n){if(r){let t=eN[e];if(t!=null)return t}let t=$M[e];if(t!=null&&(r||tN.has(t)))return t}return`default`}var sN=`file-tree-container`,cN=`data-file-tree-style`,lN=`data-file-tree-unsafe-css`,uN=`data-file-tree-scrollbar-measure`,dN=`data-file-tree-scrollbar-gutter-measured`,fN=`--trees-scrollbar-gutter-measured`,pN=`header`,mN=`context-menu`,hN=`context-menu-trigger`;function gN(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function _N(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(gN(e)?`none`:`complete`),colored:e.colored??!0}}var vN=e=>e.trim().toLowerCase(),yN=e=>e.split(`/`).at(-1)??e,bN=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 xN(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function SN(e){let t=_N(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(vN(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=yN(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return xN(c,e);for(let[t,n]of a)if(s.includes(t))return xN(n,e);let l=bN(n);for(let t of l){let n=i.get(t);if(n!=null)return xN(n,e)}let u=oN(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:iN(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:xN(s,e)}}}var CN=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,wN=/^0(?:\.0+)?%?$/;function TN(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 EN(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||CN.test(t))return!0;let n=TN(t);return n!=null&&wN.test(n)}function DN(e){return EN(e)?void 0:e}function ON(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=DN(t[`list.focusOutline`])??DN(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 kN=5,AN=1<<kN,jN=AN*4;function MN(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function NN(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function PN(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 FN(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 IN(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function LN(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 RN(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,HN(e,t)}function zN(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=FN(e).get(t);if(i===void 0)return;let a=i>>kN;e.childVisibleChunkSums[a]+=r}function BN(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=UN(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=AN}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 VN(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>kN;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<kN}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 HN(e,t){if(t.childIds.length<jN){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/AN),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>>kN]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function UN(e,t,n,r){let i=Math.min(t.childIds.length,n+AN),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 WN=7,GN=3,KN=1<<GN,qN=4;function JN(e,t,n=0){return e<<qN|n<<GN|t}function YN(e){return e.depthAndFlags>>>qN}function XN(e){return(e.depthAndFlags&KN)>>GN}function ZN(e){return(e.depthAndFlags&KN)!==0}function QN(e){return e.depthAndFlags&WN}function $N(e,t){return(QN(e)&t)!==0}function eP(e,t){e.depthAndFlags|=t}function tP(e,t){e.depthAndFlags=JN(t,QN(e),XN(e))}var nP=Symbol(`benchmarkInstrumentation`);function rP(e,t){return t==null||Object.defineProperty(e,nP,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function iP(e){return e==null?null:e[nP]??null}function aP(e,t,n){return e==null?n():e.measurePhase(t,n)}function oP(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function sP(e){return e>=48&&e<=57}function cP(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!sP(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&&sP(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 lP(e){let t=e.toLowerCase();return{lowerValue:t,tokens:cP(t)}}function uP(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 dP(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=uP(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function fP(e,t,n){let r=dP(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function pP(e,t){return fP(e,t,lP)}function mP(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function hP(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=mP(e,r);return a===mP(t,r)?pP(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 gP(e,t){return hP(e,t)}function _P(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=lP(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=mP(e,n);return o===mP(t,n)?fP(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 vP(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=lP(r);return e.sortKeyById[t]=i,i}function yP(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function bP(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 xP(e){let{hasTrailingSlash:t,segments:n}=bP(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function SP(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=bP(e);return{requiresDirectory:t,segments:n}}var CP=``;function wP(){let e=new Map;return e.set(CP,0),{idByValue:e,valueById:[CP],sortKeyById:[lP(CP)]}}function TP(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 EP(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var DP=Symbol(`pathStorePreparedInputKind`);function OP(e,t){return e[DP]=t,e}function kP(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function AP(e,t,n){return n===`default`?gP(e,t):n(kP(e),kP(t))}function jP(){return{depthAndFlags:JN(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function MP(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 NP(e){return e.isDirectory?e.segments.length:e.segments.length-1}function PP(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 FP(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function IP(e,t={}){return HP(e,t).map(e=>e.path)}function LP(e,t={}){let n=HP(e,t);return OP({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function RP(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 OP({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function zP(e){let t=e,n=t.preparedPaths;if(t[DP]===`prepared`&&n!=null)return n;if(!PP(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function BP(e){let t=e;return t[DP]===`presorted`&&t.presortedPaths!=null||FP(t.presortedPaths)?t.presortedPaths:null}function VP(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function HP(e,t={}){let n=yP(t),r=iP(t);oP(r,`workload.inputFiles`,e.length);let i=aP(r,`store.preparePathEntries.parse`,()=>e.map(e=>xP(e)));return aP(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>AP(e,t,n.sort))),i}var UP=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[jP()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=wP();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=iP(e),this.options=yP(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,MN())}appendPaths(e){return aP(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>xP(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,aP(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return aP(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:JN(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:JN(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:JN(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=xP(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:JN(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:JN(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=xP(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(aP(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||aP(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`?_P(this.lastPreparedPath,e,this.segmentSortKeyCache):AP(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=NP(e),i=n==null?0:NP(n),a=n==null?0:MP(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=TP(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:JN(YN(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),IN(i,s),s}createFileChildUnchecked(e,t){let n=TP(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:JN(YN(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),IN(r,a),a}getOrCreateDirectoryChild(e,t){let n=TP(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&&!ZN(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:JN(YN(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),IN(r,a),this.directories.set(a,MN()),a}createDirectoryChild(e,t){let n=TP(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:JN(YN(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),IN(r,a),this.directories.set(a,MN()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!ZN(n))throw Error(`Path is not a directory: "${t}"`);if($N(n,1))throw Error(`Duplicate path: "${t}"`);eP(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,NN());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(ZN(a)){let t=NN();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;ZN(n)&&this.directories.set(t,MN());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),IN(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!ZN(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 RN(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function WP(e,t=`closed`,n=null){let r=KP(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 GP(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function KP(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 qP(e,t){return $N(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:YN(t)<=e.defaultExpansion}function JP(e,t,n=e.snapshot.nodes[t]){return n==null||!ZN(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:qP(e,n)}function YP(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!ZN(r))return;let i=qP(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 XP(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 ZP(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function QP(e,t){let n=XP(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 $P(e,t){let n=XP(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function eF(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 tF(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 rF(e,t){e.directoryLoadInfoById.delete(t)}function iF(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 aF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function oF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function sF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function cF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function lF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function uF(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function dF(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 fF(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 pF(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 mF(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 hF(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 gF(e,t,n){return{...n,visibleCountDelta:DF(e)-t}}function _F(e,t){let n=DF(e),r=GP();e.transactionStack.push(r);try{t()}catch(t){throw bF(e,r,!1),t}bF(e,r,!0,DF(e)-n)}function vF(e,t){let n=e.instrumentation;if(n==null){yF(e,t);return}aP(n,`store.events.record`,()=>yF(e,t))}function yF(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){TF(e,t);return}n.events.push(t),wF(n,t)}function bF(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?CF(i,t):aP(n,`store.events.batch.merge`,()=>CF(i,t));return}let a=xF(t,r),o=e.instrumentation;if(o==null){TF(e,a);return}aP(o,`store.events.batch.commit`,()=>TF(e,a))}function xF(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 SF(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function CF(e,t){for(let n of t.events)e.events.push(n);SF(e,t)}function wF(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function TF(e,t){let n=e.instrumentation;if(n==null){EF(e,t);return}aP(n,`store.events.emit`,()=>EF(e,t))}function EF(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function DF(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function OF(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!ZN(n)||$N(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||!ZN(a)?null:i}function kF(e,t){let n=t;for(;;){let t=OF(e,n);if(t==null)return n;n=t}}function AF(e,t){let n=[t],r=t;for(;;){let t=OF(e,r);if(t==null)return n;n.push(t),r=t}}function jF(e,t){let n=t==null?e.snapshot.rootId:VF(e,t);return n==null?[]:GF(e,n)}function MF(e,t){let n=xP(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=oI(e,aI(e,r)),{createdNodeIds:a,directoryId:o}=KF(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=WF(e,o);if($N(n,1))throw Error(`Path already exists: "${t}"`);eP(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=JF(e,o,n.basename),s.add(c);RF(e,o);let l=oI(e,o);return aF({affectedAncestorIds:BF(e,c),affectedNodeIds:[...s],path:t,projectionChanged:sI(i,l)})}function NF(e,t,n){let r=VF(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=WF(e,r);if($N(i,2))throw Error(`The root node cannot be removed`);if(ZN(i)&&UF(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=oI(e,a),s=rI(e,r);ZF(e,a,r,i.nameId),iI(e,a),RF(e,a);let c=oI(e,a);return oF({affectedAncestorIds:BF(e,a),affectedNodeIds:s,path:t,projectionChanged:sI(o,c),recursive:n.recursive===!0})}function PF(e,t,n,r){let i=VF(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=WF(e,i);if($N(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=tI(e,i,n),c=oI(e,a.parentId),l=oI(e,s.parentId),u=EP(e.snapshot.segmentTable,a.nameId),d=TP(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(ZN(a)&&dI(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=PN(e.snapshot.nodes,UF(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&nI(e,p,o,XN(a))===`skip`)return null;let m=a.parentId;ZF(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),uI(e,i),XF(e,s.parentId,i),iI(e,m),e.pathCacheVersion++,RF(e,m),s.parentId!==m&&RF(e,s.parentId);let h=oI(e,m),g=oI(e,s.parentId);return sF({affectedAncestorIds:[...new Set([...BF(e,m),...BF(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:cI([c,l],[h,g]),to:LF(e,i)})}function FF(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function IF(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function LF(e,t){let n=WF(e,t),r=FF(e,t);if(r!=null)return r;if($N(n,2))return IF(e,t,``);let i=LF(e,n.parentId),a=EP(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return IF(e,t,ZN(n)?`${o}/`:o)}function RF(e,t){let n=e.instrumentation;if(n==null){pI(e,t);return}aP(n,`store.recomputeCountsUpwardFrom`,()=>pI(e,t))}function zF(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||!ZN(o)){fI(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){fI(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function BF(e,t){let n=[],r=t;for(;r!=null;){let t=WF(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function VF(e,t){if(t.length===0)return e.snapshot.rootId;let n=SP(t);return HF(e,n.segments,n.requiresDirectory)}function HF(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=UF(e,r),a=PN(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=WF(e,r);return n&&!ZN(i)?null:r}function UF(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 WF(e,t){let n=e.snapshot.nodes[t];if(n===void 0||$N(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function GF(e,t){let n=e.snapshot.nodes[t];if(n===void 0||$N(n,4))return[];if(!ZN(n))return[LF(e,t)];if(UF(e,t).childIds.length===0)return $N(n,1)&&!$N(n,2)?[LF(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||$N(n,4)){i.pop();continue}if(!ZN(n)){r.push(LF(e,t.nodeId)),i.pop();continue}let a=UF(e,t.nodeId);if(a.childIds.length===0){$N(n,1)&&!$N(n,2)&&r.push(LF(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 KF(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=TP(e.snapshot.segmentTable,i),a=UF(e,r),o=PN(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!ZN(WF(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=qF(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function qF(e,t,n){let r=WF(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:JN(YN(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,MN()),XF(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function JF(e,t,n){let r=TP(e.snapshot.segmentTable,n),i=UF(e,t);if(PN(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${hI(e,t,n)}"`);let a=WF(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:JN(YN(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),XF(e,t,o),e.activeNodeCount++,o}function YF(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}QF(e,n,o)<0?i=a:r=a+1}return r}function XF(e,t,n){let r=UF(e,t),i=WF(e,n);PN(e.snapshot.nodes,r).set(i.nameId,n),zN(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=YF(e,r,n);r.childIds.splice(a,0,n),LN(r,a),HN(e.snapshot.nodes,r)}function ZF(e,t,n,r){let i=UF(e,t),a=FN(i),o=a.get(n)??-1;PN(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&zN(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),LN(i,o),HN(e.snapshot.nodes,i))}function QF(e,t,n){let r=e.snapshot.options.sort;return r===`default`?$F(e,t,n):r(eI(e,t),eI(e,n))}function $F(e,t,n){let r=WF(e,t),i=WF(e,n),a=ZN(r);if(a!==ZN(i))return a?-1:1;let o=dP(vP(e.snapshot.segmentTable,r.nameId),vP(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=EP(e.snapshot.segmentTable,r.nameId),c=EP(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function eI(e,t){let n=WF(e,t),r=LF(e,t),i=ZN(n),a=i?r.slice(0,-1):r;return{basename:EP(e.snapshot.segmentTable,n.nameId),depth:YN(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function tI(e,t,n){let r=WF(e,t),i=VF(e,n);if(i!=null){let t=WF(e,i);if(ZN(t))return{basename:EP(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=SP(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=SP(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:HF(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: "${LF(e,t)}"`);let i=WF(e,t);if(XN(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(ZN(i)&&UF(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return rI(e,t),ZF(e,a,t,o),iI(e,a),RF(e,a),`handled`}function rI(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=WF(e,t.nodeId);if(t.visitedChildren||!ZN(i)){ZN(i)&&e.snapshot.directories.delete(t.nodeId),eP(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),rF(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=UF(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 iI(e,t){let n=t;for(;n!=null;){let t=WF(e,n);if(!ZN(t)||$N(t,2)||UF(e,n).childIds.length>0)return;eP(t,1),n=t.parentId===n?null:t.parentId}}function aI(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=PN(e.snapshot.nodes,UF(e,n)).get(t);if(i==null||!ZN(WF(e,i)))break;n=i}return n}function oI(e,t){let n=lI(e,t);if(n==null)return null;let r=kF(e,n),i=WF(e,r),a=n===r?null:AF(e,n).map(t=>LF(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:UF(e,r).childIds.length>0,path:LF(e,r),terminalKind:XN(i)})}function sI(e,t){return cI([e],[t])}function cI(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 lI(e,t){let n=t;for(;n!=null;){let t=WF(e,n);if(!ZN(t)||$N(t,2))return null;if(!JP(e,n,t))return n;n=t.parentId}return null}function uI(e,t){let n=WF(e,t);if(tP(n,(t===e.snapshot.rootId?-1:YN(WF(e,n.parentId)))+1),!ZN(n))return;let r=UF(e,t);for(let t of r.childIds)uI(e,t)}function dI(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=WF(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function fI(e,t,n=WF(e,t),r=!1){let i=e.instrumentation;if(i==null){mI(e,t,n,r);return}aP(i,`store.recomputeNodeCounts`,()=>mI(e,t,n,r))}function pI(e,t){let n=t;for(;n!=null;){let t=WF(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(fI(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&zN(UF(e,s),n,a,o),n=s}}function mI(e,t,n,r){if(!ZN(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=UF(e,t);if(r){let t=e.instrumentation;t==null?RN(e.snapshot.nodes,i):aP(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>RN(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,$N(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=OF(e,t)==null?JP(e,t,n)?1+o:1:o}function hI(e,t,n){let r=LF(e,t);return r.length===0?n:`${r}${n}`}function gI(e){return e!=null&&!$N(e,4)}function _I(e,t){let n=e.snapshot.nodes[t];return!gI(n)||!ZN(n)||$N(n,2)?null:n}function vI(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&gI(e.snapshot.nodes[n])&&(t+=1);return t}function yI(e){return Math.max(0,e.valueById.length-1)}function bI(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:vI(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:yI(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function xI(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 SI(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)_I(e,n)!=null&&t.push(LF(e,n));for(let t of e.expandedDirectoryIds)_I(e,t)!=null&&n.push(LF(e,t));return{collapsedPaths:t,expandedPaths:n}}function CI(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)_I(e,n)==null||ZP(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:LF(e,n)});return t}function wI(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=VF(e,n);t!=null&&YP(e,t,!0,WF(e,t))}for(let n of t.collapsedPaths){let t=VF(e,n);t!=null&&YP(e,t,!1,WF(e,t))}}function TI(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=VF(e,n.path);t!=null&&_I(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function EI(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function DI(e){let t=e.snapshot.segmentTable,n=wP();for(let r of e.snapshot.nodes)if(gI(r)){if($N(r,2)){r.nameId=0;continue}r.nameId=TP(n,EP(t,r.nameId))}e.snapshot.segmentTable=n}function OI(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!gI(r)||!ZN(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return gI(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[WF(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),RN(e.snapshot.nodes,n)}}function kI(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(gI(n))break;--t}e.snapshot.nodes.length=t+1}function AI(e){let t=SI(e),n=CI(e);aP(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>EI(e)),aP(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>DI(e)),aP(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>OI(e)),aP(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>kI(e)),aP(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>wI(e,t)),aP(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>TI(e,n)),aP(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>zF(e,e.snapshot.rootId))}function jI(e){let t=SI(e),n=CI(e),r=aP(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>jF(e)),i=rP({...e.snapshot.options},e.instrumentation),a=aP(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new UP(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,aP(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>wI(e,t)),aP(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>TI(e,n)),aP(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>zF(e,e.snapshot.rootId))}function MI(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function NI(e,t){let n=bI(e);t===`stable`?aP(e.instrumentation,`store.cleanup.stable`,()=>AI(e)):aP(e.instrumentation,`store.cleanup.aggressive`,()=>jI(e));let r=bI(e);return xI(t,t===`stable`,n,r)}var PI=64;function FI(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 II(e){return WF(e,e.snapshot.rootId).visibleSubtreeCount}function LI(e,t,n,r){let i=WF(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function RI(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:rL(e,t.cursor),setSize:t.setSize,subtreeEndIndex:LI(e,t.cursor,t.index,n)}}function zI(e,t,n,r,i,a){let o=UF(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=BN(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return BI(e,u,l,r+c,i+1,s,o.childIds.length,a)}function BI(e,t,n,r,i,a,o,s){if(!ZN(WF(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=ZI(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=WF(e,c.terminalNodeId);if(!ZN(l)||!JP(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return zI(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function VI(e,t){let n=II(e);if(t<0||t>=n)return null;let r=zI(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>LF(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=RI(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:rL(e,r.cursor),setSize:r.setSize,subtreeEndIndex:LI(e,r.cursor,r.index,n)}}function HI(e,t,n){let r=e.instrumentation,i=II(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=JI(e,a);for(let r=a;r<=o&&n!=null;r++){let r=rL(e,n);t.push(r),n=$I(e,n)}return t}let s=[],c=0,l=0,u=aP(r,`store.getVisibleSlice.selectFirstRow`,()=>JI(e,a));for(let t=a;t<=o&&u!=null;t++){let t=aP(r,`store.getVisibleSlice.materializeRow`,()=>rL(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=aP(r,`store.getVisibleSlice.advanceCursor`,()=>$I(e,u))}return oP(r,`workload.visibleRowsRead`,s.length),oP(r,`workload.flattenedRowsRead`,c),oP(r,`workload.flattenedSegmentsRead`,l),s}function UI(e,t=II(e)){let n=e.instrumentation;return n==null?tL(e,t):aP(n,`store.getVisibleTreeProjection`,()=>tL(e,t))}function WI(e){return eL(UI(e))}function GI(e,t){let n=VF(e,t);if(n==null||n===e.snapshot.rootId||ZN(WF(e,n))&&kF(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=WF(e,i).parentId,n=UF(e,t),s=FN(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=VN(a,n,s),t!==o){let n=WF(e,t),a=OF(e,t);if(!JP(e,t,n)&&a!==i)return null;kF(e,t)===t&&(r+=1)}i=t}return r}function KI(e,t){let n=VF(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=WF(e,n);if(!ZN(r))throw Error(`Path is not a directory: "${t}"`);return JP(e,n,r)?null:(YP(e,n,!0,r),RF(e,n),cF({affectedAncestorIds:BF(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function qI(e,t){let n=VF(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=WF(e,n);if(!ZN(r))throw Error(`Path is not a directory: "${t}"`);return JP(e,n,r)?(YP(e,n,!1,r),RF(e,n),lF({affectedAncestorIds:BF(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function JI(e,t){return t<0||t>=II(e)?null:YI(e,e.snapshot.rootId,t,-1)}function YI(e,t,n,r){let i=UF(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?BN(e.snapshot.nodes,i,n):aP(a,`store.getVisibleSlice.selectChildIndex`,()=>BN(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return XI(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function XI(e,t,n,r){if(!ZN(WF(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=ZI(e,t,r);if(n===0)return i;let a=WF(e,i.terminalNodeId);if(!ZN(a)||!JP(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return YI(e,i.terminalNodeId,n-1,i.visibleDepth)}function ZI(e,t,n){return ZN(WF(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:kF(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:aP(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>kF(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function QI(e,t){let n=WF(e,t);if(!ZN(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:OF(e,r)!==t}function $I(e,t){let n=WF(e,t.terminalNodeId);if(ZN(n)){let r=UF(e,t.terminalNodeId);if(JP(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:XI(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=WF(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=UF(e,n),o=FN(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 XI(e,s,0,i);QI(e,r)&&i--,r=n}}function eL(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 tL(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(PI);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=FI(o,y);let x,S=_;if(ZN(v))S=f?kF(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:LF(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&&ZN(C)&&JP(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(!ZN(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:LF(e,f)};continue}let h=l?kF(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=rL(e,g);let _=i[h];_!=null&&ZN(_)&&JP(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function rL(e,t){let n=WF(e,t.terminalNodeId),r=ZN(n)?iL(e,t):null,i=LF(e,t.terminalNodeId),a=EP(e.snapshot.segmentTable,n.nameId),o=ZN(n)&&UF(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?AF(e,t.headNodeId).map(n=>{let r=WF(e,n);return{isTerminal:n===t.terminalNodeId,name:EP(e.snapshot.segmentTable,r.nameId),nodeId:n,path:LF(e,n)}}):aP(c,`store.getVisibleSlice.flatten.collectSegments`,()=>AF(e,t.headNodeId).map(n=>{let r=WF(e,n);return{isTerminal:n===t.terminalNodeId,name:EP(e.snapshot.segmentTable,r.nameId),nodeId:n,path:LF(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:ZN(n)&&JP(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:ZN(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function iL(e,t){if(t.headNodeId===t.terminalNodeId)return ZP(e,t.terminalNodeId);let n=AF(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=ZP(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function aL(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||!ZN(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&&HN(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&ZN(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,HN(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function oL(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var sL=class e{#e;constructor(e={}){let t=iP(e),n=aP(t,`store.builder.create`,()=>new UP(e));if(e.preparedInput!=null){let t=BP(e.preparedInput);t==null?n.appendPreparedPaths(zP(e.preparedInput),!1):n.appendPresortedPaths(t,VP(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(aP(t,`store.preparePathEntries`,()=>HP(r,e)))}let r=aP(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=aP(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=aP(t,`store.state.create`,()=>WP(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:aP(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||oL(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&aP(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?aP(t,`store.state.initializeOpenVisibleCounts`,()=>aL(this.#e)):aP(t,`store.state.recomputeCounts`,()=>zF(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return IP(e,t)}static prepareInput(e,t={}){return LP(e,t)}static preparePresortedInput(e){return RP(e)}list(e){return aP(this.#e.instrumentation,`store.list`,()=>jF(this.#e,e))}add(e){aP(this.#e.instrumentation,`store.add`,()=>{let t=II(this.#e);vF(this.#e,gF(this.#e,t,MF(this.#e,e)))})}remove(e,t={}){aP(this.#e.instrumentation,`store.remove`,()=>{let n=II(this.#e);vF(this.#e,gF(this.#e,n,NF(this.#e,e,t)))})}move(e,t,n={}){aP(this.#e.instrumentation,`store.move`,()=>{let r=II(this.#e),i=PF(this.#e,e,t,n);i!=null&&vF(this.#e,gF(this.#e,r,i))})}batch(e){_F(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 aP(this.#e.instrumentation,`store.getVisibleCount`,()=>II(this.#e))}getVisibleSlice(e,t){return aP(this.#e.instrumentation,`store.getVisibleSlice`,()=>HI(this.#e,e,t))}getVisibleRowContext(e){return aP(this.#e.instrumentation,`store.getVisibleRowContext`,()=>VI(this.#e,e))}getVisibleTreeProjection(){return WI(this.#e)}getVisibleTreeProjectionData(e){return UI(this.#e,e)}getVisibleIndex(e){return aP(this.#e.instrumentation,`store.getVisibleIndex`,()=>GI(this.#e,e))}getPathInfo(e){return aP(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=VF(this.#e,e);if(t==null)return null;let n=WF(this.#e,t);return{depth:YN(n),kind:ZN(n)?`directory`:`file`,path:LF(this.#e,t)}})}isExpanded(e){return aP(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=WF(this.#e,t);return JP(this.#e,t,n)})}expand(e){aP(this.#e.instrumentation,`store.expand`,()=>{let t=II(this.#e),n=KI(this.#e,e);n!=null&&vF(this.#e,gF(this.#e,t,n))})}collapse(e){aP(this.#e.instrumentation,`store.collapse`,()=>{let t=II(this.#e),n=qI(this.#e,e);n!=null&&vF(this.#e,gF(this.#e,t,n))})}on(e,t){return iF(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return ZP(this.#e,t)}markDirectoryUnloaded(e){aP(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(UF(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=II(this.#e);$P(this.#e,t),vF(this.#e,gF(this.#e,n,uF({affectedAncestorIds:BF(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return aP(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=II(this.#e),r=QP(this.#e,t);return vF(this.#e,gF(this.#e,n,dF({affectedAncestorIds:BF(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return aP(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||ZP(this.#e,n)!==`loading`||!tF(this.#e,n,e.attemptId))return!1;let r=LF(this.#e,n);this.validateChildPatch(r,t);let i=II(this.#e),a=[];for(let e of t.operations){cL(r,e);let t=II(this.#e);switch(e.type){case`add`:a.push(gF(this.#e,t,MF(this.#e,e.path)));break;case`remove`:a.push(gF(this.#e,t,NF(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=PF(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(gF(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return vF(this.#e,gF(this.#e,i,fF({affectedAncestorIds:BF(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:LF(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return aP(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=II(this.#e),r=eF(this.#e,t,e.attemptId);return vF(this.#e,gF(this.#e,n,pF({affectedAncestorIds:BF(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:LF(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return aP(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=II(this.#e),i=nF(this.#e,n,e.attemptId,t);return vF(this.#e,gF(this.#e,r,mF({affectedAncestorIds:BF(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:LF(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return aP(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(MI(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=II(this.#e),n=NI(this.#e,e.mode??`stable`);return vF(this.#e,gF(this.#e,t,hF({...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=UF(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??lP(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=dP(vP(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(!ZN(WF(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=WF(this.#e,n);JP(this.#e,n,i)||(YP(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=WF(this.#e,e);if(!JP(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=VF(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!ZN(WF(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!ZN(WF(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=WF(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=WF(this.#e,e),r=OF(this.#e,e);if(!JP(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 cL(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 lL={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function uL(e,t){if(typeof e==`number`)return{itemHeight:t??lL.default.itemHeight,factor:e};let n=lL[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var dL=lL.default.itemHeight,fL=`@layer base, theme, unsafe;
192
192
 
193
193
  @layer base {
194
194
  :host {
@@ -1831,20 +1831,20 @@ Error generating stack: `+e.message+`
1831
1831
  }
1832
1832
  }
1833
1833
  }
1834
- `,YI=`@layer base, unsafe;`;function XI(e){return`${YI}
1834
+ `,pL=`@layer base, unsafe;`;function mL(e){return`${pL}
1835
1835
  @layer base {
1836
1836
  ${e}
1837
- }`}function ZI(e){return`${YI}
1837
+ }`}function hL(e){return`${pL}
1838
1838
  @layer unsafe {
1839
1839
  ${e}
1840
- }`}var QI=new WeakMap;function $I(e){let t=QI.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(KM,`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(),QI.set(e,i),i}function eL(e,t){if(!e.isConnected)return;let n=$I(t);if(n==null)return;let r=t.querySelector(`style[${qM}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(qM,``),t.appendChild(i)),i.textContent=`:host { ${JM}: ${n}px; }`}var tL;function nL(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){tL??(tL=new CSSStyleSheet,tL.replaceSync(XI(JI)));let t=!1;try{e.adoptedStyleSheets=[tL],t=!0}catch{}if(t){e.querySelector(`style[${WM}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(WM,``),t.textContent=XI(JI),e.prepend(t)}}function rL(e,t){iL(e,t),nL(t),eL(e,t)}function iL(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`});rL(this,e)}}if(customElements.define(UM,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(UM)))e instanceof HTMLElement&&rL(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var aL=e=>e.startsWith(`f::`)?e.slice(3):e;function oL(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function sL(e,t){return e===``?t:`${e}/${t}`}function cL({files:e,path:t,isFolder:n,nextBasename:r}){let i=aL(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}=oL(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=sL(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 lL(e){return e.endsWith(`/`)}function uL(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 dL(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 fL(e,t){return t.includes(e)?dL(t):[e]}function pL(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 mL(e,t){return{draggedPaths:e,target:t}}function hL(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(lL(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function gL(e,t){return t.kind===`root`||t.directoryPath==null?uL(e):t.directoryPath}function _L(e,t){let n=e.map(e=>{let n=gL(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 vL=Symbol(`FILE_TREE_RENAME_VIEW`);function yL(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var bL=512,xL=512;function SL(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function CL(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 wL(e){return CL(e).at(-1)??null}function TL(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var EL=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},DL=e=>e.toLowerCase();function OL(e){return e.endsWith(`/`)}function kL(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function AL(e){return e.endsWith(`/`)?e.slice(0,-1):e}function jL(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function ML(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 NL(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function PL(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 NL(e,t.path)?n?e:null:e;case`move`:return ML(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=PL(r,e,n),r==null)return null;return r}}}function FL(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function IL(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 LL(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(!IL(UI.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 RL(e){switch(e.operation){case`add`:return{...FL(e),operation:`add`,path:e.path};case`remove`:return{...FL(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...FL(e),from:e.from,operation:`move`,to:e.to}}}function zL(e){return{...FL(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>RL(e)),operation:`batch`}}function BL(e){switch(e.operation){case`add`:case`remove`:case`move`:return RL(e);case`batch`:return zL(e);default:return null}}function VL(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=CL(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 HL(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:VL(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var UL=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=LL({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=wL(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<=xL){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=fL(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=mL(t.draggedPaths,n);(hL(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}pL(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=mL(e.draggedPaths,t);if(hL(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=_L(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=OL(r),a=AL(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of CL(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=kL(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[vL](){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,OL(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,OL(e)?{recursive:!0}:void 0);return}let t=OL(e),n=cL({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:AL(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(jL(n.sourcePath,t),jL(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=LL({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=!SL(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=wL(e),n=TL(e,t),r=null,i=null;for(let e of this.#ve()){if(wL(e)!==t)continue;let a=TL(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=CL(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=!SL(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 UI({...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 CL(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(DL),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(DL),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 CL(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:EL(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 CL(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 CL(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=HL(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,bL)),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=PL(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=PL(this.#c,e,!0),r=[...this.#R].map(t=>PL(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=PL(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return SL(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&&yL(e)&&(this.#i=null);let t=yL(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=BL(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},WL=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 GL(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 KL(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 qL(e,t){return t?`${e}/`:e}function JL(e,t=null){let n=WL(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=GL(t.path);if(e==null)continue;let n=qL(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 KL(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var YL,XL,ZL,QL,$L,eR,tR,nR,rR,iR,aR={},oR=[],sR=Array.isArray,cR=oR.slice,lR=Object.assign;function uR(e){e&&e.parentNode&&e.remove()}function dR(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?cR.call(arguments,2):n),fR(e,o,r,i,null)}function fR(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??++XL,__i:-1,__u:0};return i==null&&YL.vnode!=null&&YL.vnode(a),a}function pR(e){return e.children}function mR(e,t){this.props=e,this.context=t,this.__g=0}function hR(e,t){if(t==null)return e.__?hR(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`?hR(e):null}function gR(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 gR(e)}}function _R(e){(8&e.__g||!(e.__g|=8)||!ZL.push(e)||$L++)&&QL==YL.debounceRendering||((QL=YL.debounceRendering)||queueMicrotask)(vR)}function vR(){for(var e,t,n,r,i,a,o,s,c=1;ZL.length;)ZL.length>c&&ZL.sort(eR),e=ZL.shift(),c=ZL.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=lR({},r)).__v=r.__v+1,YL.vnode&&YL.vnode(n),ER(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??hR(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,OR(a,n,o),n.__e!=i&&gR(n)));$L=0}function yR(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||oR,b=t.length;for(c=bR(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?aR:y[m.__i]||aR,m.__i=f,_=ER(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&jR(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=xR(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function bR(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?fR(null,o,null,null,null):sR(o)?fR(pR,{children:o},null,null,null):o.constructor==null&&o.__b>0?fR(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=SR(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=hR(s)),MR(s,s));return r}function xR(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=xR(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=hR(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function SR(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 CR(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function wR(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||CR(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||CR(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(tR,`$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=nR,e.addEventListener(t,a?iR:rR,a)):e.removeEventListener(t,a?iR:rR,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 TR(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=nR++;else if(t.u<n.l)return;return n(YL.event?YL.event(t):t)}}}function ER(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=YL.__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 mR(v,x),f.constructor=M,f.render=NR),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=lR({},f.__s)),lR(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=YL.__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=lR({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===pR&&d.key==null&&(E=kR(d.props.children)),s=yR(e,sR(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--;)uR(a[j]);DR(t)}else t.__e=n.__e,t.__k=n.__k,e.then||DR(t);YL.__e(e,t,n)}else s=t.__e=AR(n.__e,t,n,r,i,a,o,c,l,u);return(d=YL.diffed)&&d(t),128&t.__u?void 0:s}function DR(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(DR)}function OR(e,t,n){for(var r=0;r<n.length;r++)jR(n[r],n[++r],n[++r]);YL.__c&&YL.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){YL.__e(e,t.__v)}})}function kR(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:sR(e)?e.map(kR):lR({},e)}function AR(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&&=(YL.__m&&YL.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=cR.call(e.childNodes),v=n.props||aR,!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;wR(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&&!_||wR(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=``),yR(b==`template`?e.content:e,sR(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&hR(n,0),s,c,l),a!=null)for(u=a.length;u--;)uR(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||wR(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&wR(e,u,g,v[u],i))}return e}function jR(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){YL.__e(e,n)}}function MR(e,t,n){var r,i;if(YL.unmount&&YL.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||jR(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){YL.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&MR(r[i],t,n||typeof e.type!=`function`);n||uR(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function NR(e,t,n){return this.constructor(e,n)}function PR(e,t){var n,r,i,a;t==document&&(t=document.documentElement),YL.__&&YL.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=dR(pR,null,[e]),i=[],a=[],ER(t,e,r||aR,aR,t.namespaceURI,r?null:t.firstChild?cR.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),OR(i,e,a)}function FR(e,t){e.__u|=32,PR(e,t)}YL={__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 $L=0,e}},XL=0,mR.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=lR({},this.state);typeof e==`function`&&(e=e(lR({},n),this.props)),e&&lR(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),_R(this))},mR.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),_R(this))},mR.prototype.render=pR,ZL=[],$L=0,eR=function(e,t){return e.__v.__b-t.__v.__b},tR=/(PointerCapture)$|Capture$/i,nR=0,rR=TR(!1),iR=TR(!0);var IR=0;Array.isArray;function LR(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:--IR,__i:-1,__u:0,__source:i,__self:a};return YL.vnode&&YL.vnode(l),l}var RR=16,zR=16,BR={};function VR({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}=BR[e]??{width:RR,height:zR},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return LR(`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:LR(`use`,{href:c})})}var HR=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},UR=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)]},WR=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)]},GR=(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)]},KR=(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)]},qR=(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 JR({children:e,marker:t,variant:n=`default`}){"use no memo";return LR(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:LR(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?LR(`span`,{"data-truncate-fade":!0}):t})})}function YR(e){"use no memo";let{mode:t,children:n}=e;return LR(`div`,{children:[LR(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?LR(`span`,{children:n}):n}),LR(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?LR(`span`,{children:n}):n})]})}function XR({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=LR(YR,{mode:t,children:e},`content`),o=LR(JR,{marker:n,mode:t,variant:r},`marker`),s=LR(`div`,{"data-truncate-fill":!0},`fill`);return LR(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:LR(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function ZR({children:e,...t}){"use no memo";return LR(XR,{mode:`truncate`,...t,children:e})}function QR({children:e,...t}){"use no memo";return LR(XR,{mode:`fruncate`,...t,children:e})}function $R({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=LR(ZR,{...s,children:t[0]}),l=LR(QR,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return LR(`div`,{className:a,style:o});if(e.length<i)return LR(n===`end`?QR:ZR,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=HR:r===`extension`?t=UR:r===`leaf-path`&&(t=WR);else if(typeof r==`number`)t=GR,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=KR:e===`first`&&(t=qR)}else typeof r==`function`&&(t=r);t??=HR;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=LR(ZR,{...s,..._,children:f}),l=LR(QR,{...s,...v,children:p})}return LR(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[LR(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),LR(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var ez={endIndex:-1,startIndex:-1};function tz(e,t,n){return Math.min(Math.max(e,t),n)}function nz(e,t){return e<0||t<e?ez:{endIndex:t,startIndex:e}}function rz(e){return e.startIndex<0||e.endIndex<e.startIndex}function iz(e,t){return rz(e)?0:(e.endIndex-e.startIndex+1)*t}function az(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function oz(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function sz(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 cz(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 lz(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 uz(e,t,n){if(e.length===0||t<=0)return[];let r=lz(e),i=sz(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=cz(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 dz(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=tz(t.scrollTop,0,o),c=t.stickyRows??uz(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=az(s,n,t.itemHeight),m=az(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?ez:nz(m,oz(u+d,n,t.itemHeight)),y=g+1,b=rz(v)?ez:nz(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=iz(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:rz(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var fz={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},pz={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},mz=`Contains git status items`;function hz(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function gz(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 _z(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 vz(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 yz(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 bz,xz,Sz,Cz,wz=Object.is,Tz=0,Ez=[],Dz=YL,Oz=Dz.__b,kz=Dz.__r,Az=Dz.diffed,jz=Dz.__c,Mz=Dz.unmount,Nz=Dz.__;function Pz(e,t){Dz.__h&&Dz.__h(xz,e,Tz||t),Tz=0;var n=xz.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Fz(e){return Tz=1,Iz(Jz,e)}function Iz(e,t,n){var r=Pz(bz++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Jz(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);wz(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=xz,!xz.__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,wz(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};xz.__f=!0;var a=xz.shouldComponentUpdate,o=xz.componentWillUpdate;xz.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)},xz.shouldComponentUpdate=i}return r.__N||r.__}function Lz(e,t){var n=Pz(bz++,3);!Dz.__s&&qz(n.__H,t)&&(n.__=e,n.u=t,xz.__H.__h.push(n))}function Rz(e,t){var n=Pz(bz++,4);!Dz.__s&&qz(n.__H,t)&&(n.__=e,n.u=t,xz.__h.push(n))}function zz(e){return Tz=5,Bz(function(){return{current:e}},[])}function Bz(e,t){var n=Pz(bz++,7);return qz(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Vz(e,t){return Tz=8,Bz(function(){return e},t)}function Hz(){for(var e;e=Ez.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Gz),e.__H.__h.forEach(Kz),e.__H.__h=[]}catch(t){e.__H.__h=[],Dz.__e(t,e.__v)}}Dz.__b=function(e){xz=null,Oz&&Oz(e)},Dz.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Nz&&Nz(e,t)},Dz.__r=function(e){kz&&kz(e),bz=0;var t=(xz=e.__c).__H;t&&(Sz===xz?(t.__h=[],xz.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Gz),t.__h.forEach(Kz),t.__h=[],bz=0)),Sz=xz},Dz.diffed=function(e){Az&&Az(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ez.push(t)!==1&&Cz===Dz.requestAnimationFrame||((Cz=Dz.requestAnimationFrame)||Wz)(Hz)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Sz=xz=null},Dz.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Gz),e.__h=e.__h.filter(function(e){return!e.__||Kz(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Dz.__e(n,e.__v)}}),jz&&jz(e,t)},Dz.unmount=function(e){Mz&&Mz(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Gz(e)}catch(e){t=e}}),n.__H=void 0,t&&Dz.__e(t,n.__v))};var Uz=typeof requestAnimationFrame==`function`;function Wz(e){var t,n=function(){clearTimeout(r),Uz&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Uz&&(t=requestAnimationFrame(n))}function Gz(e){var t=xz,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),xz=t}function Kz(e){var t=xz;e.__c=e.__(),xz=t}function qz(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!wz(t,e[n])})}function Jz(e,t){return typeof t==`function`?t(e):t}function Yz(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 Xz(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 Zz({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return LR(`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 Qz(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:LR(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return LR(pR,{children:[LR(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:LR(ZR,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function $z(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function eB(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function tB(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 nB({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=dz(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:tB(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?tB(u,1,t,o):i&&r<=0&&c.length>0?uz(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 rB=400,iB=10,aB=40,oB=18;function sB(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))?cB(e,t,n):a instanceof HTMLElement?a:null}function cB(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 lB(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 uB(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 dB(){return navigator.vendor!==`Apple Computer, Inc.`}function fB(e,t){let n=e-t.top;if(n<aB)return-Math.ceil((aB-Math.max(0,n))/aB*oB);let r=t.bottom-e;return r<aB?Math.ceil((aB-Math.max(0,r))/aB*oB):0}function pB(e,t){if(e!=null){let t=fz[e];return t==null?null:{text:t,title:pz[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:mz}:null}function mB(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 hB(e){return e!=null&&`toggle`in e}function gB(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function _B(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function vB(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function yB(e,t){return e!=null&&e>0?e:t}function bB(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 xB(e,t,n,r,i=0){let a=vz({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function SB(e,t,n,r,i,a){let o=yz({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function CB(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function wB(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function TB(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function EB(e,t){return t&&TB(e)||(e.ctrlKey||e.metaKey)&&gB(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var DB=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function OB(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 kB(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 AB(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function jB(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function MB(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function NB(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 PB(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 FB(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 IB(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=FB(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 LB(e,t){return{kind:e.kind,name:eB(e),path:t}}function RB(e){return e==null?void 0:`${e}__tree`}function zB(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function BB(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function VB(e,t){if(e==null)return null;if(`text`in e)return LR(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?BB(e.icon)?t(e.icon):{name:e.icon}:BB(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return LR(`span`,{title:e.title,children:LR(VR,{...n})})}function HB(e){e!=null&&Yz(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function UB(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=$z(e);return LR(pR,{children:[e.depth>0?LR(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>LR(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,LR(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?LR(VR,{...t(`file-tree-icon-chevron`)}):LR(VR,{...t(`file-tree-icon-file`,u)})}),LR(`div`,{"data-item-section":`content`,children:e.isFlattened?Qz(e,c,a):c??LR($R,{minimumLength:5,split:`extension`,children:e.name})}),i?LR(`div`,{"data-item-section":`decoration`,children:r==null?null:VB(r,t)}):null,s?LR(`div`,{"data-item-section":`git`,children:VB(o,t)}):null,n?LR(`div`,{"data-item-section":`action`,children:l?LR(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:LR(VR,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function WB(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=$z(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??mB(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=pB(z,B),U=S&&w,ee=V!=null||x||U,te=U&&T===`always`,W=a.getPath()===P,ne=W?a.getValue():``,re=R||!W?null:LR(Zz,{ref:D,ariaLabel:`Rename ${eB(t)}`,isFlattened:t.isFlattened,value:ne,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),G=UB(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:ee,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:re,showDecorativeActionAffordance:te}),ie={...gz({ariaLabel:eB(t),domId:t.isFocused?zB(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:AB(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&&W?LR(`div`,{...ie,children:G}):LR(`button`,{...ie,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:G})}function GB(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has($z(e))).map((n,r)=>WB(e,n,t.start+r))}function KB({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=qI,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 _=zz(null),v=zz(null),y=zz(!1),b=zz(null),x=zz(null),S=zz(null),C=zz(null),w=zz(null),T=zz(new Map),E=zz(new Map),D=zz(()=>{}),O=zz(null),k=zz(!1),A=zz(null),j=zz(null),M=zz(!1),N=zz(null),P=zz(null),F=zz(null),I=zz(null),L=zz(null),R=zz(null),z=zz(null),B=zz(null),V=zz(!1),H=zz(null),U=zz(null),ee=zz(null),te=zz(null),W=Bz(()=>new Map,[]),[,ne]=Fz(0),[re,G]=Fz(null),[ie,K]=Fz(null),[q,ae]=Fz(null),[oe,se]=Fz(null),[ce,le]=Fz(0),[ue,de]=Fz(null),fe=zz(ue);fe.current=ue;let pe=zz(null),me=zz(null),he=zz(null),ge=zz(null),_e=zz(null),ve=zz(!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=zz(d===`retain`&&t.isSearchOpen()),[Ce,we]=Fz(p);Lz(()=>{p||we(!1)},[p]);let Te=zz(!1),Ee=Vz(()=>{Te.current=!0,we(e=>e&&!1)},[]),[De,Oe]=Fz(()=>nB({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[ke,Ae]=Fz(!1);Lz(()=>{Ae(!0)},[]);let je=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Me=e?.contextMenu?.triggerMode??(je?`right-click`:`both`),Ne=Me===`both`||Me===`button`,Pe=e?.contextMenu?.buttonVisibility??`when-needed`,Fe=Me===`both`||Me===`right-click`;Rz(()=>{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,K(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 Ie=Vz((e,t)=>{MB(T.current,e,t)},[]),Le=Vz((e,t)=>{MB(E.current,e,t)},[]),Re=Vz(e=>{x.current=e},[]),ze=Vz(e=>NB(e,E.current,T.current),[]),Be=n!=null||r!=null||i!=null,{resolveIcon:Ve}=Bz(()=>iN(a),[a]),He=t[vL](),Ue=He.getPath(),We=Ue!=null,Ge=t.isSearchOpen(),Ke=t.getSearchValue(),qe=t.getFocusedPath(),Je=t.getFocusedIndex(),Ye=t.isDragAndDropEnabled(),Xe=t.getDragSession(),Ze=Bz(()=>Xe==null?null:new Set(Xe.draggedPaths),[Xe]),Qe=Xe?.target??null,$e=Xe?.primaryPath??null,et=RB(o),{overlayHeight:tt,overlayRows:nt,snapshot:rt,visibleRows:it}=De,at=rt.physical.viewportHeight,J=Bz(()=>({end:rt.window.endIndex,start:rt.window.startIndex}),[rt.window.endIndex,rt.window.startIndex]),ot=nt,st=rt.sticky.rows,ct=rt.physical.totalHeight,lt=rt.sticky.height,ut=Bz(()=>new Set(st.map(e=>$z(e.row))),[st]),dt=Je>=0&&Je>=J.start&&Je<=J.end,ft=Vz((e,t)=>u?.({item:LB(e,t),row:e})??null,[u]),pt=Vz(e=>Yz(e==null?null:T.current.get(e)??null)?!0:Yz(S.current),[]),mt=Vz(e=>{pt(t.focusNearestPath(e))},[t,pt]),ht=zz(mt);ht.current=mt;let gt=zz(!0),_t=zz(()=>{}),vt=Vz((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=Vz(e=>{let t=e==null?null:jB(S.current,e);ae(e=>e===t?e:t)},[]),bt=Vz((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=ze(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;be(n,e?.scrollTop??null),k.current=!0,G(e=>e===n?e:n)}i.focus(),yt(a),gt.current=!0,de({anchorRect:r?.anchorRect??null,item:LB(e,n),path:n,source:r?.source??`keyboard`})},[t,ze,yt]),xt=Vz(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=vB(e,at);N.current=Je<0||e==null?null:Math.max(0,Math.min(Je*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),ne(e=>e+1))}},[t,Je,s,l,at]),St=Vz((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=vB(i,at),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:nB({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,SB(i,a,s,l,u,d),D.current(),pe.current=n?e:null,!0},[t,s,c,at,h]),Ct=()=>y.current===!0||te.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,te.current!=null&&(clearTimeout(te.current),te.current=null),V.current=!1,H.current=null,ee.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=lB(sB(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=hB(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=fB(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),dB())){let t=uB(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(te.current!=null||V.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ee.current={clientX:i.clientX,clientY:i.clientY},U.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!V.current;te.current!=null&&(clearTimeout(te.current),te.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),ee.current=null)},s=e=>{let t=e.touches[0],n=ee.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=iB*iB||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),B.current=o,te.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),U.current===a&&(U.current=null),ee.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=uB(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)},rB)},Rt=e=>{if(ue!=null){if(e.key===`Escape`){vt(),e.preventDefault(),e.stopPropagation();return}DB.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(He.isActive()){if(e.key===`Escape`)He.cancel();else if(e.key===`Enter`)He.commit();else return;se(`focus`),ne(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){xt(qe??void 0),e.preventDefault(),e.stopPropagation();return}if(Ge){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=vB(n,at);N.current=Je<0||n==null?null:Math.max(0,Math.min(Je*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`),ne(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&_B(e)){t.openSearch(e.key),ne(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=je&&TB(e),r=EB(e,je),i=r&&S.current!=null?Xz(S.current):null,a=r?new Set(PB(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==qe&&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=hB(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=NB(u,E.current,T.current);e==null||n==null?y=!1:bt(e,u)}else if((e.ctrlKey||e.metaKey)&&gB(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,G(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(xe(b,IB(S.current,v,i,u,s,lt,at)),k.current=!0,G(e=>e===b?e:b)):ye()}ne(e=>e+1),e.preventDefault(),e.stopPropagation()};Rz(()=>{if(!(!f||!Ge)){if(Se.current){Se.current=!1;return}Yz(w.current)}},[Ge,f]),Rz(()=>{let e=x.current;switch(hz({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:Ue})){case`reset`:j.current=null;return;case`reveal-canonical`:Ue!=null&&St(Ue,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(pe.current=null,j.current=Ue,Yz(e),e.select());return}},[J.end,J.start,Ue,St,ut]),Rz(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=Xz(e)?.dataset.itemPath??null;G(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,Xz(e)!=null){r();return}k.current=!1,G(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,G(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;G(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Rz(()=>{let e=S.current;e!=null&&(rt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[rt.physical.scrollTop]),Rz(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=vB(n,g);let a=()=>{let e=t.getVisibleCount(),r=yB(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Oe(nB({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?ne(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}K(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:bB(e[0]))??vB(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]),Rz(()=>{je||ue==null||vt(!1)},[vt,je,ue]);let zt=Bz(()=>ue==null?null:`${ue.path}::${ue.source}`,[ue]);Rz(()=>{if(zt==null){m?.clearSlotContent(XM);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??kB(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(XM,i),e?.contextMenu?.onOpen?.(t.item,r),HB(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&HB(i)}),()=>{m?.clearSlotContent(XM)}},[zt,e?.contextMenu,m]),Rz(()=>{ue!=null&&t.getItem(ue.path)==null&&vt()},[vt,ue,t]),Rz(()=>{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&&(OB(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]),Rz(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=qe;return}let n=qe==null?null:T.current.get(qe)??null,r=Xz(t),i=r?.dataset.itemPath??null,a=We&&x.current===r,o=f&&w.current===r,c=M.current&&!Ge,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!==qe,v=d!=null&&d===qe&&qe!=null,y=c&&SB(e,Je,s,at,ct,l),b=u!=null&&u===qe&&SB(e,Je,s,at,ct,lt),E=p!=null&&p.path===qe&&SB(e,Je,s,at,ct,p.viewportOffset),O=m!=null&&m.path===qe&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==qe&&!v&&xB(e,Je,s,at,lt))&&D.current(),!g){A.current=qe;return}if(a){A.current=qe;return}if(o&&!c){A.current=qe;return}if(n==null){c&&Je>=0&&(SB(e,Je,s,at,ct,l),D.current()),A.current=qe;return}(_||c||u===qe||d===qe||p?.path===qe||m?.path===qe||i==null||i!==qe)&&(Yz(n),u===qe&&(pe.current=null),d===qe&&(me.current=null),p?.path===qe&&(he.current=null),m?.path===qe&&(ge.current=null),M.current=!1,N.current=null),A.current=qe},[t,Je,qe,dt,s,We,Ge,J,at,f,lt,ct,it]);let Bt=Je>=0&&Je>=rt.visible.startIndex&&Je<=rt.visible.endIndex,Vt=qe!=null&&ot.some(e=>$z(e.row)===qe),Ht=Bt||Vt,Ut=Ne&&k.current===!0&&Ht?qe:null,Wt=oe===`pointer`?ie:null,Gt=ue?.path??_e.current??Wt??Ut??ie,Kt=ue?.source===`right-click`;Rz(()=>{y.current&&ue==null||yt(ze(Gt))},[ue,ze,J,at,ce,ot,Gt,yt,it]);let qt=Vz(e=>{if(y.current||OB(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`),K(e=>e===i?e:i)},[]),Jt=Vz(()=>{K(null)},[]);Rz(()=>{if(!Ye)return;let e=()=>{At(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),At(),t.cancelDrag()}},[t,Ye]);let Yt=e=>{if(!Ye||t.getDragSession()==null||V.current)return;let n=lB(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(!Ye||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=>{!Ye||t.getDragSession()==null||V.current||(e.preventDefault(),jt(e.clientX,e.clientY),t.completeDrag(),Dt(),Et(),Ot(),z.current=null)},Qt=rt.window.height,$t=rt.window.offsetTop,en=Math.min(0,at-Qt-lt),tn=re===qe||M.current,nn=qe!=null&&tn&&!dt&&Je>=0?it[Je]??t.getVisibleRows(Je,Je)[0]??null:null,rn=nn==null?null:CB(Je,s,J,Qt),an=z.current,on=$e!=null&&an!=null&&an.path===$e&&an.index>=J.start&&an.index<=J.end,sn=$e!=null&&an!=null&&an.path===$e&&!on&&an.path!==nn?.path?an:null,cn=sn==null?null:CB(sn.index,s,J,Qt),ln=wB((Je>=0?it[Je]??t.getVisibleRows(Je,Je)[0]??null:null)?.ancestorPaths.at(-1)??null),un=Ge&&qe!=null?zB(o,qe,!dt):void 0,dn=ue?.path??(Ge?qe:re),fn=ue?.path??ie,pn=ze(Gt),mn=je&&Ne&&!Kt&&!We&&pn!=null&&q!=null&&Gt!=null,hn=je&&(mn||ue!=null),gn=ue?.anchorRect,_n=gn==null&&pn!=null&&q!=null&&(ue!=null||mn)?q: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=Vz((e,n,r,i)=>{let a=t.getItem(r),o=_z({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>=rt.visible.startIndex&&n.index<=rt.visible.endIndex,l=i===`flow`&&c&&s!=null&&s.dataset.itemParked!==`true`;a?.focus(),l&&(k.current=!0,G(e=>e===r?e:r),se(`focus`)),o.toggleDirectory&&hB(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&St(r,{targetOffset:`sticky-parents`})},[t,rt.visible.endIndex,rt.visible.startIndex,St]),xn=()=>{if(y.current||!Ne||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:Ne,contextMenuButtonVisibility:Pe,contextMenuEnabled:je,contextMenuRightClickEnabled:Fe,contextMenuTriggerMode:Me,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Ye,draggedPathSet:Ze,dragTarget:Qe,gitLaneActive:Be,gitStatusByPath:n,handleRowDragEnd:It,handleRowDragStart:Ft,handleRowTouchStart:Lt,ignoredGitDirectories:r,ignoredInheritanceCache:W,instanceId:o,itemHeight:s,onKeyDown:Rt,onRowClick:bn,openContextMenuForRow:bt,registerButton:Ie,registerRenameInput:Re,renameView:He,renderDecorationForRow:ft,resolveIcon:Ve,shouldSuppressContextMenu:Ct,visualFocusPath:dn},Cn={...Sn,registerButton:Le};return LR(`div`,{ref:S,id:et,"data-file-tree-context-menu-button-visibility":je&&Ne?Pe:void 0,"data-file-tree-context-menu-trigger-mode":je?Me:void 0,"data-file-tree-has-context-menu-action-lane":je&&Ne?`true`:void 0,"data-file-tree-has-git-lane":Be?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Ye?Xt:void 0,onDragOver:Ye?Yt:void 0,onDrop:Ye?Zt:void 0,onKeyDown:Rt,onPointerLeave:je?Jt:void 0,onPointerOver:je?qt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[LR(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:ln}}),LR(`slot`,{name:YM,"data-type":`header-slot`}),f?LR(`div`,{"data-file-tree-search-container":!0,"data-open":Ge?`true`:`false`,children:LR(`input`,{ref:w,"aria-activedescendant":un,"aria-controls":et,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ce?`true`:void 0,value:Ke,onBlur:()=>{d===`retain`&&!Te.current||t.closeSearch()},onFocus:Ee,onPointerDown:Ee,onInput:e=>{Ee();let n=e.currentTarget;t.setSearch(n.value)}})}):null,LR(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&ke&&ot.length>0?LR(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:LR(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${tt}px`},children:ot.map((e,t)=>WB(Cn,e.row,`sticky:${$z(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ot.length-t}`}}))})}):null,LR(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ct}px`},children:[LR(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${$t}px`}}),LR(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${Qt}px`,top:`${en}px`,bottom:`${en}px`},children:[GB(Sn,J,ut),nn!=null&&rn!=null?WB(Sn,nn,`parked:${nn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:$e===nn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${rn}px`}}):null,sn!=null&&cn!=null?WB(Sn,sn,`parked-drag:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${cn}px`}}):null]})]})]}),je?LR(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":hn?`true`:`false`,style:vn,children:[LR(`button`,{ref:v,type:`button`,"data-type":ZM,"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:LR(VR,{...Ve(`file-tree-icon-ellipsis`)})}),ue==null?null:LR(`slot`,{name:XM})]}):null,ue==null?null:LR(`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 qB={hydrateRoot:(e,t)=>{FR(dR(KB,t),e)},renderRoot:(e,t)=>{PR(dR(KB,t),e)},unmountRoot:e=>{PR(null,e)}};function JB(e,t){qB.renderRoot(e,t)}function YB(e,t){qB.hydrateRoot(e,t)}function XB(e){qB.unmountRoot(e)}var ZB=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)}}},QB=`__c`,$B=`__k`,eV=`__d`,tV=`__s`,nV=/[\s\n\\/='"\0<>]/,rV=/^(xlink|xmlns|xml)([A-Z])/,iV=/^(?: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])/,aV=/^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/,oV=new Set([`draggable`,`spellcheck`]);function sV(e){e.__g===void 0?e[eV]=!0:e.__g|=8}function cV(e){e.__g===void 0?e[eV]=!1:e.__g&=-9}function lV(e){return e.__g===void 0?!0===e[eV]:!!(8&e.__g)}var uV=/["&<]/;function dV(e){if(e.length===0||!1===uV.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;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 fV={},pV=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(`.`)),mV=/[A-Z]/g;function hV(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:fV[n]||(fV[n]=n.replace(mV,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||pV.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function gV(){this.__d=!0}function _V(e,t){return{__v:e,context:t,props:e.props,setState:gV,forceUpdate:gV,__d:!0,__h:[]}}function vV(e,t,n){if(!e.s){if(n instanceof yV){if(!n.s)return void(n.o=vV.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(vV.bind(null,e,t),vV.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var yV=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{vV(r,1,a(this.v))}catch(e){vV(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?vV(r,1,t?t(i):i):n?vV(r,1,n(i)):vV(r,2,i)}catch(e){vV(r,2,e)}},r},e}(),bV,xV,SV,CV,wV={},TV=Array.isArray,EV=Object.assign,DV=``,OV=`<!--$s-->`,kV=`<!--/$s-->`;function AV(e,t){var n,r=e.type,i=!0;return e[QB]?(i=!1,(n=e[QB]).state=n[tV]):n=new r(e.props,t),e[QB]=n,n.__v=e,n.props=e.props,n.context=t,sV(n),n.state??=wV,n[tV]??(n[tV]=n.state),r.getDerivedStateFromProps?n.state=EV({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[tV]===n.state?n.state:n[tV]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),SV&&SV(e),n.render(n.props,n.state,t)}function jV(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===DV)return DV;var s=typeof e;if(s!=`object`)return s==`function`?DV:s==`string`?dV(e):e+DV;if(TV(e)){var c,l=DV;i[$B]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=jV(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=DV,TV(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return DV;e.__=i,bV&&bV(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===pR){if(`tpl`in g){for(var x=DV,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&&!TV(C)?x+=C:x+=jV(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+dV(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=AV(e,b),y=e[QB];else{e[QB]=y=_V(e,b);for(var E=0;lV(y)&&E++<25;){cV(y),SV&&SV(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}sV(y)}if(y.getChildContext!=null&&(t=EV({},t,y.getChildContext())),T&&YL.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===pR&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return jV(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[tV]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,wV),lV(y)?(v=AV(e,t),(y=e[QB]).getChildContext!=null&&(t=EV({},t,y.getChildContext())),jV(v=v!=null&&v.type===pR&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):DV}finally{xV&&xV(e),CV&&CV(e)}}}v=v!=null&&v.type===pR&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=jV(v,t,n,r,e,a,o);return xV&&xV(e),YL.unmount&&YL.unmount(e),e._suspended?typeof D==`string`?OV+D+kV:TV(D)?(D.unshift(OV),D.push(kV),D):D.then(function(e){return OV+e+kV}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return jV(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=YL.__e;return k&&k(i,e),DV}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=jV(v,t,n,r,e,a,o);return e._suspended?OV+s+kV:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=DV;for(var N in g){var P=g[N];if(typeof(P=NV(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=hV(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(rV.test(N))N=N.replace(rV,`$1:$2`).toLowerCase();else{if(nV.test(N))continue;N[4]!==`-`&&!oV.has(N)||P==null?n?aV.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):iV.test(N)&&(N=N.toLowerCase()):P+=DV}}P!=null&&!1!==P&&(j=!0===P||P===DV?j+` `+N:j+` `+N+`="`+(typeof P==`string`?dV(P):P+DV)+`"`)}}if(nV.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=dV(A):A!=null&&!1!==A&&!0!==A&&(M=jV(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),xV&&xV(e),CV&&CV(e),!M&&MV.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return TV(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var MV=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function NV(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var PV=0;function FV(e){return e!=null&&e.length>0?e:(PV+=1,`pst_ft_${PV}`)}function IV({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??qI)}function LV(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 RV(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 zV(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var BV=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new ZB;#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=FV(a),this.#p=JL(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=KI(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new UL({...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&&(XB(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()}getFocusedIndex(){return this.#t.getFocusedIndex()}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(),JB(t.wrapper,this.#w()))}setGitStatus(e){this.#p=JL(e,this.#p);let t=this.#T();t!=null&&JB(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),JB(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),YB(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),JB(r,this.#w())}#C(){return{initialViewportHeight:IV({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(YM,e());return}this.#l.setSlotHtml(YM,this.#e?.header?.html??null)}#k(e){let t=zV(e).find(e=>RV(e)),n=LV(zM($M(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=zV(e),n=t.find(e=>RV(e)),r=t.filter(e=>e!==n),i=$M(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=LV(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=$M(this.#m);t.colored&&VM(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${GM}]`);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(GM,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=ZI(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 rL(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)}},VV=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function HV(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:YM,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:XM,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function UV(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 WV(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 GV(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 KV({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)(()=>GV(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),VV(()=>{n.setComposition(g)},[g,n]),VV(()=>{if(c!=null)return r!=null&&WV(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=UV(HV(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)(UM,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function qV(e){let t=(0,Q.useRef)(null);return t.current??=new BV(e),(0,Q.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}function JV(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function YV(e,t){let n=e.lastIndexOf(`/`),r=n<0?``:e.slice(0,n+1),i=n<0?e:e.slice(n+1),a=i.lastIndexOf(`.`);return`${r}${a<=0?i:i.slice(0,a)}${t}`}function XV(e,t,n,r=!1){if(n)return{kind:`allow`,destinationPath:t};let i=JV(e);if(i===``)return{kind:`allow`,destinationPath:t};let a=JV(t);return r?{kind:`allow`,destinationPath:a?t:YV(t,i)}:a&&a.toLowerCase()!==i.toLowerCase()?{kind:`block`}:{kind:`allow`,destinationPath:YV(t,i)}}var ZV=`data-ok-ext-badge`,QV=`data-ok-ext-row`,$V=`
1840
+ }`}var gL=new WeakMap;function _L(e){let t=gL.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(uN,`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(),gL.set(e,i),i}function vL(e,t){if(!e.isConnected)return;let n=_L(t);if(n==null)return;let r=t.querySelector(`style[${dN}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(dN,``),t.appendChild(i)),i.textContent=`:host { ${fN}: ${n}px; }`}var yL;function bL(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){yL??(yL=new CSSStyleSheet,yL.replaceSync(mL(fL)));let t=!1;try{e.adoptedStyleSheets=[yL],t=!0}catch{}if(t){e.querySelector(`style[${cN}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(cN,``),t.textContent=mL(fL),e.prepend(t)}}function xL(e,t){SL(e,t),bL(t),vL(e,t)}function SL(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`});xL(this,e)}}if(customElements.define(sN,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(sN)))e instanceof HTMLElement&&xL(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var CL=e=>e.startsWith(`f::`)?e.slice(3):e;function wL(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function TL(e,t){return e===``?t:`${e}/${t}`}function EL({files:e,path:t,isFolder:n,nextBasename:r}){let i=CL(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}=wL(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=TL(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 DL(e){return e.endsWith(`/`)}function OL(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 kL(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 AL(e,t){return t.includes(e)?kL(t):[e]}function jL(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 ML(e,t){return{draggedPaths:e,target:t}}function NL(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(DL(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function PL(e,t){return t.kind===`root`||t.directoryPath==null?OL(e):t.directoryPath}function FL(e,t){let n=e.map(e=>{let n=PL(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 IL=Symbol(`FILE_TREE_RENAME_VIEW`);function LL(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var RL=512,zL=512;function BL(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function VL(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 HL(e){return VL(e).at(-1)??null}function UL(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var WL=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},GL=e=>e.toLowerCase();function KL(e){return e.endsWith(`/`)}function qL(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function JL(e){return e.endsWith(`/`)?e.slice(0,-1):e}function YL(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function XL(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 ZL(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function QL(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 ZL(e,t.path)?n?e:null:e;case`move`:return XL(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=QL(r,e,n),r==null)return null;return r}}}function $L(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function eR(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 tR(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(!eR(sL.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{...$L(e),operation:`add`,path:e.path};case`remove`:return{...$L(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...$L(e),from:e.from,operation:`move`,to:e.to}}}function rR(e){return{...$L(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>nR(e)),operation:`batch`}}function iR(e){switch(e.operation){case`add`:case`remove`:case`move`:return nR(e);case`batch`:return rR(e);default:return null}}function aR(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=VL(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 oR(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:aR(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var sR=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=tR({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=HL(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<=zL){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=AL(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=ML(t.draggedPaths,n);(NL(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}jL(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=ML(e.draggedPaths,t);if(NL(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=FL(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=KL(r),a=JL(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of VL(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=qL(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[IL](){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,KL(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,KL(e)?{recursive:!0}:void 0);return}let t=KL(e),n=EL({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:JL(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(YL(n.sourcePath,t),YL(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=tR({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=!BL(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=HL(e),n=UL(e,t),r=null,i=null;for(let e of this.#ve()){if(HL(e)!==t)continue;let a=UL(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=VL(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=!BL(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 sL({...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 VL(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(GL),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(GL),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 VL(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:WL(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 VL(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 VL(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=oR(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,RL)),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=QL(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=QL(this.#c,e,!0),r=[...this.#R].map(t=>QL(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=QL(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return BL(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&&LL(e)&&(this.#i=null);let t=LL(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=iR(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},cR=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 lR(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 uR(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 dR(e,t){return t?`${e}/`:e}function fR(e,t=null){let n=cR(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=lR(t.path);if(e==null)continue;let n=dR(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 uR(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var pR,mR,hR,gR,_R,vR,yR,bR,xR,SR,CR={},wR=[],TR=Array.isArray,ER=wR.slice,DR=Object.assign;function OR(e){e&&e.parentNode&&e.remove()}function kR(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?ER.call(arguments,2):n),AR(e,o,r,i,null)}function AR(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??++mR,__i:-1,__u:0};return i==null&&pR.vnode!=null&&pR.vnode(a),a}function jR(e){return e.children}function MR(e,t){this.props=e,this.context=t,this.__g=0}function NR(e,t){if(t==null)return e.__?NR(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`?NR(e):null}function PR(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 PR(e)}}function FR(e){(8&e.__g||!(e.__g|=8)||!hR.push(e)||_R++)&&gR==pR.debounceRendering||((gR=pR.debounceRendering)||queueMicrotask)(IR)}function IR(){for(var e,t,n,r,i,a,o,s,c=1;hR.length;)hR.length>c&&hR.sort(vR),e=hR.shift(),c=hR.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=DR({},r)).__v=r.__v+1,pR.vnode&&pR.vnode(n),WR(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??NR(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,KR(a,n,o),n.__e!=i&&PR(n)));_R=0}function LR(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||wR,b=t.length;for(c=RR(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?CR:y[m.__i]||CR,m.__i=f,_=WR(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&YR(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=zR(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function RR(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?AR(null,o,null,null,null):TR(o)?AR(jR,{children:o},null,null,null):o.constructor==null&&o.__b>0?AR(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=BR(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=NR(s)),XR(s,s));return r}function zR(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=zR(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=NR(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function BR(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 VR(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function HR(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||VR(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||VR(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(yR,`$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=bR,e.addEventListener(t,a?SR:xR,a)):e.removeEventListener(t,a?SR:xR,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 UR(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=bR++;else if(t.u<n.l)return;return n(pR.event?pR.event(t):t)}}}function WR(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=pR.__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 MR(v,x),f.constructor=M,f.render=ZR),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=DR({},f.__s)),DR(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=pR.__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=DR({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===jR&&d.key==null&&(E=qR(d.props.children)),s=LR(e,TR(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--;)OR(a[j]);GR(t)}else t.__e=n.__e,t.__k=n.__k,e.then||GR(t);pR.__e(e,t,n)}else s=t.__e=JR(n.__e,t,n,r,i,a,o,c,l,u);return(d=pR.diffed)&&d(t),128&t.__u?void 0:s}function GR(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(GR)}function KR(e,t,n){for(var r=0;r<n.length;r++)YR(n[r],n[++r],n[++r]);pR.__c&&pR.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){pR.__e(e,t.__v)}})}function qR(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:TR(e)?e.map(qR):DR({},e)}function JR(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&&=(pR.__m&&pR.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=ER.call(e.childNodes),v=n.props||CR,!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;HR(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&&!_||HR(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=``),LR(b==`template`?e.content:e,TR(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&NR(n,0),s,c,l),a!=null)for(u=a.length;u--;)OR(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||HR(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&HR(e,u,g,v[u],i))}return e}function YR(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){pR.__e(e,n)}}function XR(e,t,n){var r,i;if(pR.unmount&&pR.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||YR(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){pR.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&XR(r[i],t,n||typeof e.type!=`function`);n||OR(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function ZR(e,t,n){return this.constructor(e,n)}function QR(e,t){var n,r,i,a;t==document&&(t=document.documentElement),pR.__&&pR.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=kR(jR,null,[e]),i=[],a=[],WR(t,e,r||CR,CR,t.namespaceURI,r?null:t.firstChild?ER.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),KR(i,e,a)}function $R(e,t){e.__u|=32,QR(e,t)}pR={__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 _R=0,e}},mR=0,MR.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=DR({},this.state);typeof e==`function`&&(e=e(DR({},n),this.props)),e&&DR(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),FR(this))},MR.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),FR(this))},MR.prototype.render=jR,hR=[],_R=0,vR=function(e,t){return e.__v.__b-t.__v.__b},yR=/(PointerCapture)$|Capture$/i,bR=0,xR=UR(!1),SR=UR(!0);var ez=0;Array.isArray;function tz(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:--ez,__i:-1,__u:0,__source:i,__self:a};return pR.vnode&&pR.vnode(l),l}var nz=16,rz=16,iz={};function az({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}=iz[e]??{width:nz,height:rz},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return tz(`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:tz(`use`,{href:c})})}var oz=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},sz=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)]},cz=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)]},lz=(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)]},uz=(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)]},dz=(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 fz({children:e,marker:t,variant:n=`default`}){"use no memo";return tz(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:tz(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?tz(`span`,{"data-truncate-fade":!0}):t})})}function pz(e){"use no memo";let{mode:t,children:n}=e;return tz(`div`,{children:[tz(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?tz(`span`,{children:n}):n}),tz(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?tz(`span`,{children:n}):n})]})}function mz({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=tz(pz,{mode:t,children:e},`content`),o=tz(fz,{marker:n,mode:t,variant:r},`marker`),s=tz(`div`,{"data-truncate-fill":!0},`fill`);return tz(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:tz(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function hz({children:e,...t}){"use no memo";return tz(mz,{mode:`truncate`,...t,children:e})}function gz({children:e,...t}){"use no memo";return tz(mz,{mode:`fruncate`,...t,children:e})}function _z({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=tz(hz,{...s,children:t[0]}),l=tz(gz,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return tz(`div`,{className:a,style:o});if(e.length<i)return tz(n===`end`?gz:hz,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=oz:r===`extension`?t=sz:r===`leaf-path`&&(t=cz);else if(typeof r==`number`)t=lz,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=uz:e===`first`&&(t=dz)}else typeof r==`function`&&(t=r);t??=oz;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=tz(hz,{...s,..._,children:f}),l=tz(gz,{...s,...v,children:p})}return tz(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[tz(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),tz(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var vz={endIndex:-1,startIndex:-1};function yz(e,t,n){return Math.min(Math.max(e,t),n)}function bz(e,t){return e<0||t<e?vz:{endIndex:t,startIndex:e}}function xz(e){return e.startIndex<0||e.endIndex<e.startIndex}function Sz(e,t){return xz(e)?0:(e.endIndex-e.startIndex+1)*t}function Cz(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function wz(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function Tz(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 Ez(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 Dz(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 Oz(e,t,n){if(e.length===0||t<=0)return[];let r=Dz(e),i=Tz(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=Ez(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 kz(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=yz(t.scrollTop,0,o),c=t.stickyRows??Oz(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=Cz(s,n,t.itemHeight),m=Cz(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?vz:bz(m,wz(u+d,n,t.itemHeight)),y=g+1,b=xz(v)?vz:bz(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=Sz(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:xz(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var Az={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},jz={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},Mz=`Contains git status items`;function Nz(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function Pz(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 Fz(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 Iz(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 Lz(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 Rz,zz,Bz,Vz,Hz=Object.is,Uz=0,Wz=[],Gz=pR,Kz=Gz.__b,qz=Gz.__r,Jz=Gz.diffed,Yz=Gz.__c,Xz=Gz.unmount,Zz=Gz.__;function Qz(e,t){Gz.__h&&Gz.__h(zz,e,Uz||t),Uz=0;var n=zz.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function $z(e){return Uz=1,eB(fB,e)}function eB(e,t,n){var r=Qz(Rz++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):fB(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Hz(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=zz,!zz.__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,Hz(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};zz.__f=!0;var a=zz.shouldComponentUpdate,o=zz.componentWillUpdate;zz.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)},zz.shouldComponentUpdate=i}return r.__N||r.__}function tB(e,t){var n=Qz(Rz++,3);!Gz.__s&&dB(n.__H,t)&&(n.__=e,n.u=t,zz.__H.__h.push(n))}function nB(e,t){var n=Qz(Rz++,4);!Gz.__s&&dB(n.__H,t)&&(n.__=e,n.u=t,zz.__h.push(n))}function rB(e){return Uz=5,iB(function(){return{current:e}},[])}function iB(e,t){var n=Qz(Rz++,7);return dB(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function aB(e,t){return Uz=8,iB(function(){return e},t)}function oB(){for(var e;e=Wz.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(lB),e.__H.__h.forEach(uB),e.__H.__h=[]}catch(t){e.__H.__h=[],Gz.__e(t,e.__v)}}Gz.__b=function(e){zz=null,Kz&&Kz(e)},Gz.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Zz&&Zz(e,t)},Gz.__r=function(e){qz&&qz(e),Rz=0;var t=(zz=e.__c).__H;t&&(Bz===zz?(t.__h=[],zz.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(lB),t.__h.forEach(uB),t.__h=[],Rz=0)),Bz=zz},Gz.diffed=function(e){Jz&&Jz(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Wz.push(t)!==1&&Vz===Gz.requestAnimationFrame||((Vz=Gz.requestAnimationFrame)||cB)(oB)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Bz=zz=null},Gz.__c=function(e,t){t.some(function(e){try{e.__h.forEach(lB),e.__h=e.__h.filter(function(e){return!e.__||uB(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Gz.__e(n,e.__v)}}),Yz&&Yz(e,t)},Gz.unmount=function(e){Xz&&Xz(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{lB(e)}catch(e){t=e}}),n.__H=void 0,t&&Gz.__e(t,n.__v))};var sB=typeof requestAnimationFrame==`function`;function cB(e){var t,n=function(){clearTimeout(r),sB&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);sB&&(t=requestAnimationFrame(n))}function lB(e){var t=zz,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),zz=t}function uB(e){var t=zz;e.__c=e.__(),zz=t}function dB(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Hz(t,e[n])})}function fB(e,t){return typeof t==`function`?t(e):t}function pB(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 mB(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 hB({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return tz(`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 gB(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:tz(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return tz(jR,{children:[tz(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:tz(hz,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function _B(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function vB(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function yB(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 bB({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=kz(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:yB(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?yB(u,1,t,o):i&&r<=0&&c.length>0?Oz(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 xB=400,SB=10,CB=40,wB=18;function TB(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))?EB(e,t,n):a instanceof HTMLElement?a:null}function EB(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 DB(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 OB(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 kB(){return navigator.vendor!==`Apple Computer, Inc.`}function AB(e,t){let n=e-t.top;if(n<CB)return-Math.ceil((CB-Math.max(0,n))/CB*wB);let r=t.bottom-e;return r<CB?Math.ceil((CB-Math.max(0,r))/CB*wB):0}function jB(e,t){if(e!=null){let t=Az[e];return t==null?null:{text:t,title:jz[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:Mz}:null}function MB(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 NB(e){return e!=null&&`toggle`in e}function PB(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function FB(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function IB(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function LB(e,t){return e!=null&&e>0?e:t}function RB(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 zB(e,t,n,r,i=0){let a=Iz({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function BB(e,t,n,r,i,a){let o=Lz({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function VB(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function HB(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function UB(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function WB(e,t){return t&&UB(e)||(e.ctrlKey||e.metaKey)&&PB(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var GB=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function KB(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 qB(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 JB(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function YB(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function XB(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function ZB(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 QB(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 $B(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 eV(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=$B(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 tV(e,t){return{kind:e.kind,name:vB(e),path:t}}function nV(e){return e==null?void 0:`${e}__tree`}function rV(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function iV(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function aV(e,t){if(e==null)return null;if(`text`in e)return tz(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?iV(e.icon)?t(e.icon):{name:e.icon}:iV(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return tz(`span`,{title:e.title,children:tz(az,{...n})})}function oV(e){e!=null&&pB(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function sV(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=_B(e);return tz(jR,{children:[e.depth>0?tz(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>tz(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,tz(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?tz(az,{...t(`file-tree-icon-chevron`)}):tz(az,{...t(`file-tree-icon-file`,u)})}),tz(`div`,{"data-item-section":`content`,children:e.isFlattened?gB(e,c,a):c??tz(_z,{minimumLength:5,split:`extension`,children:e.name})}),i?tz(`div`,{"data-item-section":`decoration`,children:r==null?null:aV(r,t)}):null,s?tz(`div`,{"data-item-section":`git`,children:aV(o,t)}):null,n?tz(`div`,{"data-item-section":`action`,children:l?tz(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:tz(az,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function cV(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=_B(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??MB(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=jB(z,B),U=S&&w,ee=V!=null||x||U,te=U&&T===`always`,W=a.getPath()===P,ne=W?a.getValue():``,re=R||!W?null:tz(hB,{ref:D,ariaLabel:`Rename ${vB(t)}`,isFlattened:t.isFlattened,value:ne,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),G=sV(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:ee,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:re,showDecorativeActionAffordance:te}),ie={...Pz({ariaLabel:vB(t),domId:t.isFocused?rV(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:JB(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&&W?tz(`div`,{...ie,children:G}):tz(`button`,{...ie,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:G})}function lV(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(_B(e))).map((n,r)=>cV(e,n,t.start+r))}function uV({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=dL,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 _=rB(null),v=rB(null),y=rB(!1),b=rB(null),x=rB(null),S=rB(null),C=rB(null),w=rB(null),T=rB(new Map),E=rB(new Map),D=rB(()=>{}),O=rB(null),k=rB(!1),A=rB(null),j=rB(null),M=rB(!1),N=rB(null),P=rB(null),F=rB(null),I=rB(null),L=rB(null),R=rB(null),z=rB(null),B=rB(null),V=rB(!1),H=rB(null),U=rB(null),ee=rB(null),te=rB(null),W=iB(()=>new Map,[]),[,ne]=$z(0),[re,G]=$z(null),[ie,K]=$z(null),[q,ae]=$z(null),[oe,se]=$z(null),[ce,le]=$z(0),[ue,de]=$z(null),fe=rB(ue);fe.current=ue;let pe=rB(null),me=rB(null),he=rB(null),ge=rB(null),_e=rB(null),ve=rB(!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=rB(d===`retain`&&t.isSearchOpen()),[Ce,we]=$z(p);tB(()=>{p||we(!1)},[p]);let Te=rB(!1),Ee=aB(()=>{Te.current=!0,we(e=>e&&!1)},[]),[De,Oe]=$z(()=>bB({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[ke,Ae]=$z(!1);tB(()=>{Ae(!0)},[]);let je=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Me=e?.contextMenu?.triggerMode??(je?`right-click`:`both`),Ne=Me===`both`||Me===`button`,Pe=e?.contextMenu?.buttonVisibility??`when-needed`,Fe=Me===`both`||Me===`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,K(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 Ie=aB((e,t)=>{XB(T.current,e,t)},[]),Le=aB((e,t)=>{XB(E.current,e,t)},[]),Re=aB(e=>{x.current=e},[]),ze=aB(e=>ZB(e,E.current,T.current),[]),Be=n!=null||r!=null||i!=null,{resolveIcon:Ve}=iB(()=>SN(a),[a]),He=t[IL](),Ue=He.getPath(),We=Ue!=null,Ge=t.isSearchOpen(),Ke=t.getSearchValue(),qe=t.getFocusedPath(),Je=t.getFocusedIndex(),Ye=t.isDragAndDropEnabled(),Xe=t.getDragSession(),Ze=iB(()=>Xe==null?null:new Set(Xe.draggedPaths),[Xe]),Qe=Xe?.target??null,$e=Xe?.primaryPath??null,et=nV(o),{overlayHeight:tt,overlayRows:nt,snapshot:rt,visibleRows:it}=De,at=rt.physical.viewportHeight,J=iB(()=>({end:rt.window.endIndex,start:rt.window.startIndex}),[rt.window.endIndex,rt.window.startIndex]),ot=nt,st=rt.sticky.rows,ct=rt.physical.totalHeight,lt=rt.sticky.height,ut=iB(()=>new Set(st.map(e=>_B(e.row))),[st]),dt=Je>=0&&Je>=J.start&&Je<=J.end,ft=aB((e,t)=>u?.({item:tV(e,t),row:e})??null,[u]),pt=aB(e=>pB(e==null?null:T.current.get(e)??null)?!0:pB(S.current),[]),mt=aB(e=>{pt(t.focusNearestPath(e))},[t,pt]),ht=rB(mt);ht.current=mt;let gt=rB(!0),_t=rB(()=>{}),vt=aB((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=aB(e=>{let t=e==null?null:YB(S.current,e);ae(e=>e===t?e:t)},[]),bt=aB((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=ze(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;be(n,e?.scrollTop??null),k.current=!0,G(e=>e===n?e:n)}i.focus(),yt(a),gt.current=!0,de({anchorRect:r?.anchorRect??null,item:tV(e,n),path:n,source:r?.source??`keyboard`})},[t,ze,yt]),xt=aB(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=IB(e,at);N.current=Je<0||e==null?null:Math.max(0,Math.min(Je*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),ne(e=>e+1))}},[t,Je,s,l,at]),St=aB((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=IB(i,at),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:bB({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,BB(i,a,s,l,u,d),D.current(),pe.current=n?e:null,!0},[t,s,c,at,h]),Ct=()=>y.current===!0||te.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,te.current!=null&&(clearTimeout(te.current),te.current=null),V.current=!1,H.current=null,ee.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=DB(TB(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=NB(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=AB(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),kB())){let t=OB(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(te.current!=null||V.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ee.current={clientX:i.clientX,clientY:i.clientY},U.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!V.current;te.current!=null&&(clearTimeout(te.current),te.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),ee.current=null)},s=e=>{let t=e.touches[0],n=ee.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=SB*SB||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),B.current=o,te.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),U.current===a&&(U.current=null),ee.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=OB(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)},xB)},Rt=e=>{if(ue!=null){if(e.key===`Escape`){vt(),e.preventDefault(),e.stopPropagation();return}GB.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(He.isActive()){if(e.key===`Escape`)He.cancel();else if(e.key===`Enter`)He.commit();else return;se(`focus`),ne(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){xt(qe??void 0),e.preventDefault(),e.stopPropagation();return}if(Ge){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=IB(n,at);N.current=Je<0||n==null?null:Math.max(0,Math.min(Je*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`),ne(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&FB(e)){t.openSearch(e.key),ne(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=je&&UB(e),r=WB(e,je),i=r&&S.current!=null?mB(S.current):null,a=r?new Set(QB(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==qe&&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=NB(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=ZB(u,E.current,T.current);e==null||n==null?y=!1:bt(e,u)}else if((e.ctrlKey||e.metaKey)&&PB(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,G(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(xe(b,eV(S.current,v,i,u,s,lt,at)),k.current=!0,G(e=>e===b?e:b)):ye()}ne(e=>e+1),e.preventDefault(),e.stopPropagation()};nB(()=>{if(!(!f||!Ge)){if(Se.current){Se.current=!1;return}pB(w.current)}},[Ge,f]),nB(()=>{let e=x.current;switch(Nz({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:Ue})){case`reset`:j.current=null;return;case`reveal-canonical`:Ue!=null&&St(Ue,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(pe.current=null,j.current=Ue,pB(e),e.select());return}},[J.end,J.start,Ue,St,ut]),nB(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=mB(e)?.dataset.itemPath??null;G(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,mB(e)!=null){r();return}k.current=!1,G(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,G(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;G(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&&(rt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[rt.physical.scrollTop]),nB(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=IB(n,g);let a=()=>{let e=t.getVisibleCount(),r=LB(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Oe(bB({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?ne(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}K(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:RB(e[0]))??IB(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(()=>{je||ue==null||vt(!1)},[vt,je,ue]);let zt=iB(()=>ue==null?null:`${ue.path}::${ue.source}`,[ue]);nB(()=>{if(zt==null){m?.clearSlotContent(mN);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??qB(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(mN,i),e?.contextMenu?.onOpen?.(t.item,r),oV(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&oV(i)}),()=>{m?.clearSlotContent(mN)}},[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&&(KB(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=qe;return}let n=qe==null?null:T.current.get(qe)??null,r=mB(t),i=r?.dataset.itemPath??null,a=We&&x.current===r,o=f&&w.current===r,c=M.current&&!Ge,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!==qe,v=d!=null&&d===qe&&qe!=null,y=c&&BB(e,Je,s,at,ct,l),b=u!=null&&u===qe&&BB(e,Je,s,at,ct,lt),E=p!=null&&p.path===qe&&BB(e,Je,s,at,ct,p.viewportOffset),O=m!=null&&m.path===qe&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==qe&&!v&&zB(e,Je,s,at,lt))&&D.current(),!g){A.current=qe;return}if(a){A.current=qe;return}if(o&&!c){A.current=qe;return}if(n==null){c&&Je>=0&&(BB(e,Je,s,at,ct,l),D.current()),A.current=qe;return}(_||c||u===qe||d===qe||p?.path===qe||m?.path===qe||i==null||i!==qe)&&(pB(n),u===qe&&(pe.current=null),d===qe&&(me.current=null),p?.path===qe&&(he.current=null),m?.path===qe&&(ge.current=null),M.current=!1,N.current=null),A.current=qe},[t,Je,qe,dt,s,We,Ge,J,at,f,lt,ct,it]);let Bt=Je>=0&&Je>=rt.visible.startIndex&&Je<=rt.visible.endIndex,Vt=qe!=null&&ot.some(e=>_B(e.row)===qe),Ht=Bt||Vt,Ut=Ne&&k.current===!0&&Ht?qe:null,Wt=oe===`pointer`?ie:null,Gt=ue?.path??_e.current??Wt??Ut??ie,Kt=ue?.source===`right-click`;nB(()=>{y.current&&ue==null||yt(ze(Gt))},[ue,ze,J,at,ce,ot,Gt,yt,it]);let qt=aB(e=>{if(y.current||KB(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`),K(e=>e===i?e:i)},[]),Jt=aB(()=>{K(null)},[]);nB(()=>{if(!Ye)return;let e=()=>{At(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),At(),t.cancelDrag()}},[t,Ye]);let Yt=e=>{if(!Ye||t.getDragSession()==null||V.current)return;let n=DB(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(!Ye||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=>{!Ye||t.getDragSession()==null||V.current||(e.preventDefault(),jt(e.clientX,e.clientY),t.completeDrag(),Dt(),Et(),Ot(),z.current=null)},Qt=rt.window.height,$t=rt.window.offsetTop,en=Math.min(0,at-Qt-lt),tn=re===qe||M.current,nn=qe!=null&&tn&&!dt&&Je>=0?it[Je]??t.getVisibleRows(Je,Je)[0]??null:null,rn=nn==null?null:VB(Je,s,J,Qt),an=z.current,on=$e!=null&&an!=null&&an.path===$e&&an.index>=J.start&&an.index<=J.end,sn=$e!=null&&an!=null&&an.path===$e&&!on&&an.path!==nn?.path?an:null,cn=sn==null?null:VB(sn.index,s,J,Qt),ln=HB((Je>=0?it[Je]??t.getVisibleRows(Je,Je)[0]??null:null)?.ancestorPaths.at(-1)??null),un=Ge&&qe!=null?rV(o,qe,!dt):void 0,dn=ue?.path??(Ge?qe:re),fn=ue?.path??ie,pn=ze(Gt),mn=je&&Ne&&!Kt&&!We&&pn!=null&&q!=null&&Gt!=null,hn=je&&(mn||ue!=null),gn=ue?.anchorRect,_n=gn==null&&pn!=null&&q!=null&&(ue!=null||mn)?q: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=aB((e,n,r,i)=>{let a=t.getItem(r),o=Fz({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>=rt.visible.startIndex&&n.index<=rt.visible.endIndex,l=i===`flow`&&c&&s!=null&&s.dataset.itemParked!==`true`;a?.focus(),l&&(k.current=!0,G(e=>e===r?e:r),se(`focus`)),o.toggleDirectory&&NB(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&St(r,{targetOffset:`sticky-parents`})},[t,rt.visible.endIndex,rt.visible.startIndex,St]),xn=()=>{if(y.current||!Ne||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:Ne,contextMenuButtonVisibility:Pe,contextMenuEnabled:je,contextMenuRightClickEnabled:Fe,contextMenuTriggerMode:Me,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Ye,draggedPathSet:Ze,dragTarget:Qe,gitLaneActive:Be,gitStatusByPath:n,handleRowDragEnd:It,handleRowDragStart:Ft,handleRowTouchStart:Lt,ignoredGitDirectories:r,ignoredInheritanceCache:W,instanceId:o,itemHeight:s,onKeyDown:Rt,onRowClick:bn,openContextMenuForRow:bt,registerButton:Ie,registerRenameInput:Re,renameView:He,renderDecorationForRow:ft,resolveIcon:Ve,shouldSuppressContextMenu:Ct,visualFocusPath:dn},Cn={...Sn,registerButton:Le};return tz(`div`,{ref:S,id:et,"data-file-tree-context-menu-button-visibility":je&&Ne?Pe:void 0,"data-file-tree-context-menu-trigger-mode":je?Me:void 0,"data-file-tree-has-context-menu-action-lane":je&&Ne?`true`:void 0,"data-file-tree-has-git-lane":Be?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Ye?Xt:void 0,onDragOver:Ye?Yt:void 0,onDrop:Ye?Zt:void 0,onKeyDown:Rt,onPointerLeave:je?Jt:void 0,onPointerOver:je?qt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[tz(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:ln}}),tz(`slot`,{name:pN,"data-type":`header-slot`}),f?tz(`div`,{"data-file-tree-search-container":!0,"data-open":Ge?`true`:`false`,children:tz(`input`,{ref:w,"aria-activedescendant":un,"aria-controls":et,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ce?`true`:void 0,value:Ke,onBlur:()=>{d===`retain`&&!Te.current||t.closeSearch()},onFocus:Ee,onPointerDown:Ee,onInput:e=>{Ee();let n=e.currentTarget;t.setSearch(n.value)}})}):null,tz(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&ke&&ot.length>0?tz(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:tz(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${tt}px`},children:ot.map((e,t)=>cV(Cn,e.row,`sticky:${_B(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ot.length-t}`}}))})}):null,tz(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ct}px`},children:[tz(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${$t}px`}}),tz(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${Qt}px`,top:`${en}px`,bottom:`${en}px`},children:[lV(Sn,J,ut),nn!=null&&rn!=null?cV(Sn,nn,`parked:${nn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:$e===nn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${rn}px`}}):null,sn!=null&&cn!=null?cV(Sn,sn,`parked-drag:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${cn}px`}}):null]})]})]}),je?tz(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":hn?`true`:`false`,style:vn,children:[tz(`button`,{ref:v,type:`button`,"data-type":hN,"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:tz(az,{...Ve(`file-tree-icon-ellipsis`)})}),ue==null?null:tz(`slot`,{name:mN})]}):null,ue==null?null:tz(`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 dV={hydrateRoot:(e,t)=>{$R(kR(uV,t),e)},renderRoot:(e,t)=>{QR(kR(uV,t),e)},unmountRoot:e=>{QR(null,e)}};function fV(e,t){dV.renderRoot(e,t)}function pV(e,t){dV.hydrateRoot(e,t)}function mV(e){dV.unmountRoot(e)}var hV=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)}}},gV=`__c`,_V=`__k`,vV=`__d`,yV=`__s`,bV=/[\s\n\\/='"\0<>]/,xV=/^(xlink|xmlns|xml)([A-Z])/,SV=/^(?: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])/,CV=/^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/,wV=new Set([`draggable`,`spellcheck`]);function TV(e){e.__g===void 0?e[vV]=!0:e.__g|=8}function EV(e){e.__g===void 0?e[vV]=!1:e.__g&=-9}function DV(e){return e.__g===void 0?!0===e[vV]:!!(8&e.__g)}var OV=/["&<]/;function kV(e){if(e.length===0||!1===OV.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;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 AV={},jV=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(`.`)),MV=/[A-Z]/g;function NV(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:AV[n]||(AV[n]=n.replace(MV,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||jV.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function PV(){this.__d=!0}function FV(e,t){return{__v:e,context:t,props:e.props,setState:PV,forceUpdate:PV,__d:!0,__h:[]}}function IV(e,t,n){if(!e.s){if(n instanceof LV){if(!n.s)return void(n.o=IV.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(IV.bind(null,e,t),IV.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var LV=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{IV(r,1,a(this.v))}catch(e){IV(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?IV(r,1,t?t(i):i):n?IV(r,1,n(i)):IV(r,2,i)}catch(e){IV(r,2,e)}},r},e}(),RV,zV,BV,VV,HV={},UV=Array.isArray,WV=Object.assign,GV=``,KV=`<!--$s-->`,qV=`<!--/$s-->`;function JV(e,t){var n,r=e.type,i=!0;return e[gV]?(i=!1,(n=e[gV]).state=n[yV]):n=new r(e.props,t),e[gV]=n,n.__v=e,n.props=e.props,n.context=t,TV(n),n.state??=HV,n[yV]??(n[yV]=n.state),r.getDerivedStateFromProps?n.state=WV({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[yV]===n.state?n.state:n[yV]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),BV&&BV(e),n.render(n.props,n.state,t)}function YV(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===GV)return GV;var s=typeof e;if(s!=`object`)return s==`function`?GV:s==`string`?kV(e):e+GV;if(UV(e)){var c,l=GV;i[_V]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=YV(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=GV,UV(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return GV;e.__=i,RV&&RV(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===jR){if(`tpl`in g){for(var x=GV,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&&!UV(C)?x+=C:x+=YV(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+kV(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=JV(e,b),y=e[gV];else{e[gV]=y=FV(e,b);for(var E=0;DV(y)&&E++<25;){EV(y),BV&&BV(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}TV(y)}if(y.getChildContext!=null&&(t=WV({},t,y.getChildContext())),T&&pR.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===jR&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return YV(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[yV]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,HV),DV(y)?(v=JV(e,t),(y=e[gV]).getChildContext!=null&&(t=WV({},t,y.getChildContext())),YV(v=v!=null&&v.type===jR&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):GV}finally{zV&&zV(e),VV&&VV(e)}}}v=v!=null&&v.type===jR&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=YV(v,t,n,r,e,a,o);return zV&&zV(e),pR.unmount&&pR.unmount(e),e._suspended?typeof D==`string`?KV+D+qV:UV(D)?(D.unshift(KV),D.push(qV),D):D.then(function(e){return KV+e+qV}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return YV(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=pR.__e;return k&&k(i,e),GV}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=YV(v,t,n,r,e,a,o);return e._suspended?KV+s+qV:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=GV;for(var N in g){var P=g[N];if(typeof(P=ZV(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=NV(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(xV.test(N))N=N.replace(xV,`$1:$2`).toLowerCase();else{if(bV.test(N))continue;N[4]!==`-`&&!wV.has(N)||P==null?n?CV.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):SV.test(N)&&(N=N.toLowerCase()):P+=GV}}P!=null&&!1!==P&&(j=!0===P||P===GV?j+` `+N:j+` `+N+`="`+(typeof P==`string`?kV(P):P+GV)+`"`)}}if(bV.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=kV(A):A!=null&&!1!==A&&!0!==A&&(M=YV(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),zV&&zV(e),VV&&VV(e),!M&&XV.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return UV(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var XV=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function ZV(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var QV=0;function $V(e){return e!=null&&e.length>0?e:(QV+=1,`pst_ft_${QV}`)}function eH({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??dL)}function tH(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 rH(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var iH=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new hV;#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=$V(a),this.#p=fR(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=uL(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new sR({...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&&(mV(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()}getFocusedIndex(){return this.#t.getFocusedIndex()}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(),fV(t.wrapper,this.#w()))}setGitStatus(e){this.#p=fR(e,this.#p);let t=this.#T();t!=null&&fV(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),fV(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),pV(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),fV(r,this.#w())}#C(){return{initialViewportHeight:eH({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(pN,e());return}this.#l.setSlotHtml(pN,this.#e?.header?.html??null)}#k(e){let t=rH(e).find(e=>nH(e)),n=tH(rN(_N(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=rH(e),n=t.find(e=>nH(e)),r=t.filter(e=>e!==n),i=_N(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=tH(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=_N(this.#m);t.colored&&aN(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${lN}]`);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(lN,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=hL(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 xL(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)}},aH=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function oH(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:pN,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:mN,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function sH(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 cH(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 lH(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 uH({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)(()=>lH(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),aH(()=>{n.setComposition(g)},[g,n]),aH(()=>{if(c!=null)return r!=null&&cH(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=sH(oH(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)(sN,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function dH(e){let t=(0,Q.useRef)(null);return t.current??=new iH(e),(0,Q.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}function fH(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function pH(e,t){let n=e.lastIndexOf(`/`),r=n<0?``:e.slice(0,n+1),i=n<0?e:e.slice(n+1),a=i.lastIndexOf(`.`);return`${r}${a<=0?i:i.slice(0,a)}${t}`}function mH(e,t,n,r=!1){if(n)return{kind:`allow`,destinationPath:t};let i=fH(e);if(i===``)return{kind:`allow`,destinationPath:t};let a=fH(t);return r?{kind:`allow`,destinationPath:a?t:pH(t,i)}:a&&a.toLowerCase()!==i.toLowerCase()?{kind:`block`}:{kind:`allow`,destinationPath:pH(t,i)}}var hH=`data-ok-ext-badge`,gH=`data-ok-ext-row`,_H=`
1841
1841
  [data-item-selected='true'] [data-icon-token='markdown'] {
1842
1842
  color: var(--trees-selected-fg);
1843
1843
  }
1844
- [data-type='item'][${QV}] [data-truncate-segment-priority]:last-child {
1844
+ [data-type='item'][${gH}] [data-truncate-segment-priority]:last-child {
1845
1845
  display: none;
1846
1846
  }
1847
- [${ZV}] {
1847
+ [${hH}] {
1848
1848
  display: inline-block;
1849
1849
  margin-left: 0.375rem;
1850
1850
  margin-right: 0.25rem;
@@ -1856,14 +1856,14 @@ Error generating stack: `+e.message+`
1856
1856
  pointer-events: none;
1857
1857
  user-select: none;
1858
1858
  }
1859
- `;function eH(e){let t=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of t){let t=e.dataset.itemPath;if(!t||t.endsWith(`/`)){nH(e);continue}let n=JV(t);if(!n){nH(e);continue}let r=e.querySelector(`[data-truncate-group-container="middle"]`);if(!r)continue;let i=r.querySelectorAll(`[data-truncate-segment-priority]`);if(i.length<2)continue;let a=i[0];if(a){if(e.setAttribute(QV,``),rH(a),n.toLowerCase()===`.md`){tH(e);continue}iH(e,n.slice(1).toUpperCase())}}}function tH(e){let t=e.querySelector(`[${ZV}]`);t&&t.remove()}function nH(e){e.removeAttribute(QV),tH(e)}function rH(e){let t=e.querySelectorAll(`[data-truncate-content]`);for(let e of t){let t=e.firstChild;if(!t||t.nodeType!==Node.TEXT_NODE)continue;let n=t.textContent??``;n.endsWith(`.`)&&(t.textContent=n.replace(/\.+$/,``))}}function iH(e,t){let n=e.querySelector(`[${ZV}]`);if(!n){n=e.ownerDocument.createElement(`span`),n.setAttribute(ZV,``),n.setAttribute(`aria-hidden`,`true`);let t=e.querySelector(`[data-item-section="action"]`);t?t.before(n):e.appendChild(n)}n.textContent!==t&&(n.textContent=t)}function aH(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function oH(e){let t=aH(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}var sH=`data-ok-rename-extension-chip`,cH=`data-ok-renaming`,lH=`data-ok-rename-stripped`,uH=null,dH=null,fH=5e3,pH=`
1859
+ `;function vH(e){let t=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of t){let t=e.dataset.itemPath;if(!t||t.endsWith(`/`)){bH(e);continue}let n=fH(t);if(!n){bH(e);continue}let r=e.querySelector(`[data-truncate-group-container="middle"]`);if(!r)continue;let i=r.querySelectorAll(`[data-truncate-segment-priority]`);if(i.length<2)continue;let a=i[0];if(a){if(e.setAttribute(gH,``),xH(a),n.toLowerCase()===`.md`){yH(e);continue}SH(e,n.slice(1).toUpperCase())}}}function yH(e){let t=e.querySelector(`[${hH}]`);t&&t.remove()}function bH(e){e.removeAttribute(gH),yH(e)}function xH(e){let t=e.querySelectorAll(`[data-truncate-content]`);for(let e of t){let t=e.firstChild;if(!t||t.nodeType!==Node.TEXT_NODE)continue;let n=t.textContent??``;n.endsWith(`.`)&&(t.textContent=n.replace(/\.+$/,``))}}function SH(e,t){let n=e.querySelector(`[${hH}]`);if(!n){n=e.ownerDocument.createElement(`span`),n.setAttribute(hH,``),n.setAttribute(`aria-hidden`,`true`);let t=e.querySelector(`[data-item-section="action"]`);t?t.before(n):e.appendChild(n)}n.textContent!==t&&(n.textContent=t)}function CH(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function wH(e){let t=CH(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}var TH=`data-ok-rename-extension-chip`,EH=`data-ok-renaming`,DH=`data-ok-rename-stripped`,OH=null,kH=null,AH=5e3,jH=`
1860
1860
  [data-item-section="content"]:has([data-item-rename-input]) {
1861
1861
  position: relative;
1862
1862
  }
1863
- [data-item-section="content"]:has([${sH}]) [data-item-rename-input] {
1863
+ [data-item-section="content"]:has([${TH}]) [data-item-rename-input] {
1864
1864
  padding-inline-end: 36px;
1865
1865
  }
1866
- [${sH}] {
1866
+ [${TH}] {
1867
1867
  position: absolute;
1868
1868
  top: 50%;
1869
1869
  right: 6px;
@@ -1886,14 +1886,14 @@ Error generating stack: `+e.message+`
1886
1886
  applyRenameChip sets the marker on the row when the rename input mounts;
1887
1887
  the sweep in applyRenameChip clears it when the path next includes the
1888
1888
  saved extension (settle / cancel / row recycle to a settled file). */
1889
- [${cH}] [data-item-section="icon"] {
1889
+ [${EH}] [data-item-section="icon"] {
1890
1890
  position: relative;
1891
1891
  }
1892
- [${cH}] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']) {
1892
+ [${EH}] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']) {
1893
1893
  visibility: hidden;
1894
1894
  }
1895
- [${cH}='.md'] [data-item-section="icon"]::before,
1896
- [${cH}='.mdx'] [data-item-section="icon"]::before {
1895
+ [${EH}='.md'] [data-item-section="icon"]::before,
1896
+ [${EH}='.mdx'] [data-item-section="icon"]::before {
1897
1897
  content: '';
1898
1898
  display: block;
1899
1899
  position: absolute;
@@ -1905,11 +1905,11 @@ Error generating stack: `+e.message+`
1905
1905
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z'/></svg>") center / contain no-repeat;
1906
1906
  pointer-events: none;
1907
1907
  }
1908
- `;function mH(e){_H(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-item-section="content"]`),r=t.closest(`[data-type="item"]`);if(!n||!r)return;let i=r.dataset.itemPath??``;if(i.endsWith(`/`))return;let a=JV(i);a&&(vH(n,a),r.getAttribute(`data-ok-renaming`)!==a&&r.setAttribute(cH,a),hH(a),!t.hasAttribute(lH)&&(yH(t,a),t.setAttribute(lH,``)))}function hH(e){uH=e,dH!==null&&clearTimeout(dH),dH=setTimeout(gH,fH)}function gH(){uH=null,dH!==null&&(clearTimeout(dH),dH=null)}function _H(e){let t=e.querySelectorAll(`[${cH}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(cH);if(!t){e.removeAttribute(cH);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(cH);continue}let r=JV(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(cH)}if(uH===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||JV(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==uH&&e.setAttribute(cH,uH))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&gH()}function vH(e,t){let n=e.querySelector(`[${sH}]`);n||(n=e.ownerDocument.createElement(`span`),n.setAttribute(sH,``),n.setAttribute(`aria-hidden`,`true`),e.appendChild(n)),n.textContent!==t&&(n.textContent=t)}function yH(e,t){let n=e.value;if(!n.toLowerCase().endsWith(t.toLowerCase()))return;let r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;if(!r)return;let i=n.slice(0,-t.length);r.call(e,i),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.setSelectionRange(0,i.length)}function bH(e){let{focusedIndex:t,itemHeight:n,viewportHeight:r,currentScrollTop:i}=e;if(t<0)return null;let a=Math.max(0,e.topInset??0),o=t*n,s=o+n;if(o<i+a){let e=Math.max(0,o-a);return e===i?null:e}if(s>i+r){let e=s-r;return e===i?null:e}return null}function xH(e,t){let n=t.getFocusedIndex();if(n<0)return;let r=e?.querySelector(UM)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-scroll]`);if(!r)return;let i=t.getItemHeight(),a=bH({focusedIndex:n,itemHeight:i,viewportHeight:r.clientHeight,currentScrollTop:r.scrollTop,topInset:i});a!==null&&(r.scrollTop=a)}function SH(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function CH(e,t,n={}){if(!e)return SH(t);let r=qr(e);if(t&&r!==t)return SH(t);switch(e.kind){case`doc`:return SH(t??e.docName);case`large-file`:return SH(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?SH(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function wH(e,t){if(!e)return{kind:`none`};let n=t.find(t=>Zk(t)===e);if(n&&Jn(n))return{kind:`asset`,path:n.path,hash:gr(n.path),mediaKind:n.mediaKind};let r=tA(e);return e.endsWith(`/`)?t.some(e=>Pr(e)?e.path===r||e.path.startsWith(`${r}/`):(Jn(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Gi(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var TH=`You can restore this file from the Trash.`;function EH(e){let t=TH,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function DH(e,t){return e===`web`?null:EH(t)}function OH(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function kH(e,t,n){let r=wH(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>Gi(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var AH=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function jH(e){return typeof e==`string`&&AH.includes(e)?e:`system-error`}function MH(e){switch(e){case`not-found`:return Y._({id:`v41fCm`});case`permission-denied`:return Y._({id:`sJK6pq`});case`system-error`:return Y._({id:`Jqqevv`});case`path-escape`:return Y._({id:`WL6puM`})}}function NH(e){let t=MH(e.reason),n=e.detail;return n?Y._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Y._({id:`dTaauv`,values:{reason:t}})}function PH(e){return e.kind===`folder`?`${e.name}/`:e.name}function FH(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?PH(l):``;d=c?Y._({id:`5qNxOe`,values:{count:u}}):l?`${Y._({id:`E_BHoD`,values:{targetName:e}})}\n${NH(l)}`:Y._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(bs,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(ws,{children:[p,(0,Z.jsx)(vs,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let h;t[7]!==n||t[8]!==c?(h=c?(0,Z.jsx)(Ss,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(IH)})}):null,t[7]=n,t[8]=c,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=g):g=t[10];let _;t[11]!==r||t[12]!==o?(_=(0,Z.jsx)(sa,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:g}),t[11]=r,t[12]=o,t[13]=_):_=t[13];let v;t[14]===r?v=t[15]:(v=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ce,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=v);let y;t[16]!==r||t[17]!==a||t[18]!==v?(y=(0,Z.jsx)(sa,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:v}),t[16]=r,t[17]=a,t[18]=v,t[19]=y):y=t[19];let b;t[20]===r?b=t[21]:(b=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ce,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=b);let x;t[22]!==r||t[23]!==i||t[24]!==b?(x=(0,Z.jsx)(sa,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:b}),t[22]=r,t[23]=i,t[24]=b,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==_||t[28]!==y?(S=(0,Z.jsxs)(Cs,{children:[_,y,x]}),t[26]=x,t[27]=_,t[28]=y,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h?(C=(0,Z.jsxs)(xs,{className:`sm:max-w-md`,children:[m,h,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=C):C=t[33],C}function IH(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:PH(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:NH(e)})]},e.path)}function LH(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=uo(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,c;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=Rm(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),c=n;break bb0}let l;t[16]!==i||t[17]!==r?(l=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=l):l=t[18],o=n.map(l)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=c}else o=t[9],c=t[10];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[19]===o?l=t[20]:(l=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=l),l}function RH(e){return e?.isDirectory()?e:null}function zH(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function BH(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{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=RH(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}zH(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}async function VH(e,t){let n={"not-found":Y._({id:`vY54W_`}),"spawn-error":Y._({id:`ktATCe`}),timeout:Y._({id:`wrzAcD`}),"path-escape":Y._({id:`kDuh1E`}),"ipc-error":Y._({id:`jjmuxV`})},r;try{r=await e.shell.openInTerminal(t)}catch(e){console.warn(`[shell] openInTerminal IPC threw`,{dirAbsPath:t,err:e}),X.error(Y._({id:`DYwdxG`}),{description:n[`ipc-error`]});return}r.ok||(console.warn(`[shell] openInTerminal failed`,{reason:r.reason,dirAbsPath:t}),X.error(Y._({id:`DYwdxG`}),{description:n[r.reason]}))}var HH=`open-knowledge:file-tree-menu-action-delete`,UH=`open-knowledge:file-tree-menu-action-rename`,WH=`open-knowledge:file-tree-menu-action-duplicate`;function GH(e){window.dispatchEvent(new CustomEvent(HH,{detail:{target:e}}))}function KH(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(HH,t),()=>window.removeEventListener(HH,t)}function qH(e){window.dispatchEvent(new CustomEvent(UH,{detail:{target:e}}))}function JH(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(UH,t),()=>window.removeEventListener(UH,t)}function YH(e){window.dispatchEvent(new CustomEvent(WH,{detail:{target:e}}))}function XH(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(WH,t),()=>window.removeEventListener(WH,t)}function ZH(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var QH={Accept:`application/x-ndjson, application/json`};function $H(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var eU=class extends Error{};function tU(e){return typeof e==`object`&&!!e&&`type`in e}async function nU(e){let t=e.body;if(!t)throw new eU(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line`),!1}if(tU(n)){if(n.type===`error`)throw new eU(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return a=n.truncated===!0,!0}let r=Wn.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1};try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
1908
+ `;function MH(e){FH(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-item-section="content"]`),r=t.closest(`[data-type="item"]`);if(!n||!r)return;let i=r.dataset.itemPath??``;if(i.endsWith(`/`))return;let a=fH(i);a&&(IH(n,a),r.getAttribute(`data-ok-renaming`)!==a&&r.setAttribute(EH,a),NH(a),!t.hasAttribute(DH)&&(LH(t,a),t.setAttribute(DH,``)))}function NH(e){OH=e,kH!==null&&clearTimeout(kH),kH=setTimeout(PH,AH)}function PH(){OH=null,kH!==null&&(clearTimeout(kH),kH=null)}function FH(e){let t=e.querySelectorAll(`[${EH}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(EH);if(!t){e.removeAttribute(EH);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(EH);continue}let r=fH(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(EH)}if(OH===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||fH(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==OH&&e.setAttribute(EH,OH))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&PH()}function IH(e,t){let n=e.querySelector(`[${TH}]`);n||(n=e.ownerDocument.createElement(`span`),n.setAttribute(TH,``),n.setAttribute(`aria-hidden`,`true`),e.appendChild(n)),n.textContent!==t&&(n.textContent=t)}function LH(e,t){let n=e.value;if(!n.toLowerCase().endsWith(t.toLowerCase()))return;let r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;if(!r)return;let i=n.slice(0,-t.length);r.call(e,i),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.setSelectionRange(0,i.length)}function RH(e){let{focusedIndex:t,itemHeight:n,viewportHeight:r,currentScrollTop:i}=e;if(t<0)return null;let a=Math.max(0,e.topInset??0),o=t*n,s=o+n;if(o<i+a){let e=Math.max(0,o-a);return e===i?null:e}if(s>i+r){let e=s-r;return e===i?null:e}return null}function zH(e,t){let n=t.getFocusedIndex();if(n<0)return;let r=e?.querySelector(sN)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-scroll]`);if(!r)return;let i=t.getItemHeight(),a=RH({focusedIndex:n,itemHeight:i,viewportHeight:r.clientHeight,currentScrollTop:r.scrollTop,topInset:i});a!==null&&(r.scrollTop=a)}function BH(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function VH(e,t,n={}){if(!e)return BH(t);let r=qr(e);if(t&&r!==t)return BH(t);switch(e.kind){case`doc`:return BH(t??e.docName);case`large-file`:return BH(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?BH(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function HH(e,t){if(!e)return{kind:`none`};let n=t.find(t=>hA(t)===e);if(n&&Jn(n))return{kind:`asset`,path:n.path,hash:gr(n.path),mediaKind:n.mediaKind};let r=yA(e);return e.endsWith(`/`)?t.some(e=>Pr(e)?e.path===r||e.path.startsWith(`${r}/`):(Jn(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Gi(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var UH=`You can restore this file from the Trash.`;function WH(e){let t=UH,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function GH(e,t){return e===`web`?null:WH(t)}function KH(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function qH(e,t,n){let r=HH(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>Gi(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var JH=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function YH(e){return typeof e==`string`&&JH.includes(e)?e:`system-error`}function XH(e){switch(e){case`not-found`:return Y._({id:`v41fCm`});case`permission-denied`:return Y._({id:`sJK6pq`});case`system-error`:return Y._({id:`Jqqevv`});case`path-escape`:return Y._({id:`WL6puM`})}}function ZH(e){let t=XH(e.reason),n=e.detail;return n?Y._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Y._({id:`dTaauv`,values:{reason:t}})}function QH(e){return e.kind===`folder`?`${e.name}/`:e.name}function $H(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?QH(l):``;d=c?Y._({id:`5qNxOe`,values:{count:u}}):l?`${Y._({id:`E_BHoD`,values:{targetName:e}})}\n${ZH(l)}`:Y._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(bs,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(ws,{children:[p,(0,Z.jsx)(vs,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let h;t[7]!==n||t[8]!==c?(h=c?(0,Z.jsx)(Ss,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(eU)})}):null,t[7]=n,t[8]=c,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=g):g=t[10];let _;t[11]!==r||t[12]!==o?(_=(0,Z.jsx)(sa,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:g}),t[11]=r,t[12]=o,t[13]=_):_=t[13];let v;t[14]===r?v=t[15]:(v=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ce,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=v);let y;t[16]!==r||t[17]!==a||t[18]!==v?(y=(0,Z.jsx)(sa,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:v}),t[16]=r,t[17]=a,t[18]=v,t[19]=y):y=t[19];let b;t[20]===r?b=t[21]:(b=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ce,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=b);let x;t[22]!==r||t[23]!==i||t[24]!==b?(x=(0,Z.jsx)(sa,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:b}),t[22]=r,t[23]=i,t[24]=b,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==_||t[28]!==y?(S=(0,Z.jsxs)(Cs,{children:[_,y,x]}),t[26]=x,t[27]=_,t[28]=y,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h?(C=(0,Z.jsxs)(xs,{className:`sm:max-w-md`,children:[m,h,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=C):C=t[33],C}function eU(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:QH(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:ZH(e)})]},e.path)}function tU(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=uo(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,c;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=Rm(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),c=n;break bb0}let l;t[16]!==i||t[17]!==r?(l=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=l):l=t[18],o=n.map(l)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=c}else o=t[9],c=t[10];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[19]===o?l=t[20]:(l=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=l),l}function nU(e){return e?.isDirectory()?e:null}function rU(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function iU(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{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=nU(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}rU(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}async function aU(e,t){let n={"not-found":Y._({id:`vY54W_`}),"spawn-error":Y._({id:`ktATCe`}),timeout:Y._({id:`wrzAcD`}),"path-escape":Y._({id:`kDuh1E`}),"ipc-error":Y._({id:`jjmuxV`})},r;try{r=await e.shell.openInTerminal(t)}catch(e){console.warn(`[shell] openInTerminal IPC threw`,{dirAbsPath:t,err:e}),X.error(Y._({id:`DYwdxG`}),{description:n[`ipc-error`]});return}r.ok||(console.warn(`[shell] openInTerminal failed`,{reason:r.reason,dirAbsPath:t}),X.error(Y._({id:`DYwdxG`}),{description:n[r.reason]}))}var oU=`open-knowledge:file-tree-menu-action-delete`,sU=`open-knowledge:file-tree-menu-action-rename`,cU=`open-knowledge:file-tree-menu-action-duplicate`;function lU(e){window.dispatchEvent(new CustomEvent(oU,{detail:{target:e}}))}function uU(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(oU,t),()=>window.removeEventListener(oU,t)}function dU(e){window.dispatchEvent(new CustomEvent(sU,{detail:{target:e}}))}function fU(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(sU,t),()=>window.removeEventListener(sU,t)}function pU(e){window.dispatchEvent(new CustomEvent(cU,{detail:{target:e}}))}function mU(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(cU,t),()=>window.removeEventListener(cU,t)}function hU(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var gU={Accept:`application/x-ndjson, application/json`};function _U(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var vU=class extends Error{};function yU(e){return typeof e==`object`&&!!e&&`type`in e}async function bU(e){let t=e.body;if(!t)throw new vU(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line`),!1}if(yU(n)){if(n.type===`error`)throw new vU(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return a=n.truncated===!0,!0}let r=Wn.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1};try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
1909
1909
  `);for(;i!==-1;){let t=s(o.slice(0,i));if(o=o.slice(i+1),t){e=!0;break}i=o.indexOf(`
1910
1910
  `)}}o+=r.decode(),o.includes(`
1911
- `)||s(o)}finally{n.releaseLock()}return{entries:i,truncated:a}}function rU(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>Zk(e))),a=[];for(let e of t){let t=Zk(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function iU(e){return e?Y._({id:`wTcjov`}):null}function aU(e){let t=(0,$.c)(35),{_:n}=i(),r=bh(),{merged:a}=be(),o=a?.appearance?.preview?.autoOpen??!0;if(r)return null;let{input:c,installStates:l,dispatch:u,webFallbackVisible:d}=e,f=d===void 0?!0:d,p=c===null,m,h,g,_,v,y;if(t[0]!==n||t[1]!==o||t[2]!==u||t[3]!==c||t[4]!==p||t[5]!==l){let e=iU(p),r;t[12]===l?r=t[13]:(r=e=>l[e.id]?.installed===!0,t[12]=l,t[13]=r);let i=Ch.filter(r);g=l[`claude-code`]?.installed===!0;let a;t[14]!==o||t[15]!==c?(a=c!==null&&c.docContext!==null?fr(c.docContext.relativePath,o):``,t[14]=o,t[15]=c,t[16]=a):a=t[16];let d=a,f;t[17]!==c||t[18]!==d?(f=()=>{c!==null&&Yb(d)},t[17]=c,t[18]=d,t[19]=f):f=t[19],_=f,h=Ko,t[20]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(Oo,{children:[(0,Z.jsx)(ya,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[20]=y):y=t[20],m=es,v=i.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)($o,{disabled:!r,onSelect:()=>{c&&u(t.id,c)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Ub,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)}),t[0]=n,t[1]=o,t[2]=u,t[3]=c,t[4]=p,t[5]=l,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y}else m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11];let b;t[21]!==n||t[22]!==g||t[23]!==_||t[24]!==p||t[25]!==f?(b=f&&!g?(0,Z.jsxs)($o,{onSelect:_,disabled:p,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(_t,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[21]=n,t[22]=g,t[23]=_,t[24]=p,t[25]=f,t[26]=b):b=t[26];let x;t[27]!==m||t[28]!==v||t[29]!==b?(x=(0,Z.jsxs)(m,{children:[v,b]}),t[27]=m,t[28]=v,t[29]=b,t[30]=x):x=t[30];let S;return t[31]!==h||t[32]!==y||t[33]!==x?(S=(0,Z.jsxs)(h,{children:[y,x]}),t[31]=h,t[32]=y,t[33]=x,t[34]=S):S=t[34],S}var oU=p(`HOVER_INTENT_MS`,80),sU=3,cU=20,lU=new Map,uU=new Set,dU=[],fU=new Map;function pU(e){for(fU.delete(e),fU.set(e,!0);fU.size>cU;){let e=fU.keys().next().value;if(e===void 0)break;fU.delete(e)}}function mU(e){uU.delete(e),gU()}function hU(e,t){let n=Date.now();ut(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),jt(e,t,n)}function gU(){for(;uU.size<sU&&dU.length>0;){let e=dU.shift();if(!e)break;if(!fU.has(e.docName)){uU.add(e.docName),pU(e.docName);try{let t=e.prewarm(e.docName);t&&hU(e.docName,t)}catch(t){ut(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{mU(e.docName)}}}}function _U(e,t){if(Je(e)||fU.has(e))return;let n=lU.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(lU.delete(e),uU.size>=sU){dU.push({docName:e,prewarm:t});return}pU(e),uU.add(e);try{let n=t(e);n&&hU(e,n)}catch(t){ut(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{mU(e)}},oU);lU.set(e,{timer:r,prewarm:t})}function vU(e){let t=lU.get(e);t&&(clearTimeout(t.timer),lU.delete(e))}var yU=/\.(md|mdx)$/i;function bU(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function xU(e){let t=e.match(yU);return t?t[0]:null}async function SU(e,t){try{await navigator.clipboard.writeText(e),X.success(t===`full`?Y._({id:`6_ZOw4`}):Y._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),X.error(t===`full`?Y._({id:`vfRlCI`}):Y._({id:`5QGTaA`}))}}var CU=new Set([`agents`,`agent`,`claude`,`skill`]),wU=`ok-file-tree-link-decoration`,TU=`ok-file-tree-agent-decoration`,EU=`ok-file-tree-markdown`,DU=`0 0 48 48`,OU=`<symbol id="${EU}" viewBox="${DU}" fill="none" stroke="currentColor" stroke-width="4.62651" stroke-linecap="round" stroke-linejoin="round"><path d="M3.18066 33.4398V13.5603L12.4337 22.8133L21.6867 13.5603V33.4398"/><path d="M38 13.5L38 33"/><path d="M44.8195 26.5L37.8797 33.4398L30.9399 26.5"/></symbol>`;function kU(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function AU(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${kU(t)}</symbol>`}var jU=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1912
- ${AU(wU,Ht)}
1913
- ${AU(TU,Jc)}
1914
- ${OU}
1915
- </svg>`,MU=`${$V}\n${pH}`;function NU(e){return{...uN({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-file-icon-color-image":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`}}function PU(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&CU.has(t)}function FU(e){return e===`darwin`?Y._({id:`LtSYdi`}):e===`win32`?Y._({id:`qi1F96`}):Y._({id:`hz7n6T`})}function IU(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:a}=e,{_:o}=i(),s=typeof window<`u`?window.okDesktop:void 0;if(!s)return null;let c=s.platform,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=FU(c),t[0]=l):l=t[0];let u=l,d,f;t[1]!==o||t[2]!==r?(d=r?null:o({id:`wTcjov`}),f=o(c===`darwin`?d?{id:`FvpFSZ`,values:{hint:d}}:{id:`LtSYdi`}:c===`win32`?d?{id:`o4dcAf`,values:{hint:d}}:{id:`qi1F96`}:d?{id:`ScUTHW`,values:{hint:d}}:{id:`hz7n6T`}),t[1]=o,t[2]=r,t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=f,m=!r,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=()=>{if(!r)return;a();let e=ig(r.contentDir,dA(n),r.pathSeparator);s.shell.showItemInFolder(e)},t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(mt,{"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{className:`flex-1`,children:u}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===d?v=t[12]:(v=d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null,t[11]=d,t[12]=v);let y;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)($o,{disabled:m,onSelect:h,"aria-label":p,children:[g,_,v]}),t[13]=p,t[14]=m,t[15]=h,t[16]=v,t[17]=y):y=t[17],y}function LU(e){let t=(0,$.c)(21),{dirAbsPath:n,onClose:r}=e,{_:a}=i(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let c,l,u,d,f;t[0]!==a||t[1]!==n||t[2]!==r?(l=n===null?a({id:`wTcjov`}):null,c=$o,u=n===null,t[8]!==n||t[9]!==r?(d=()=>{n!==null&&(r(),VH(o,n))},t[8]=n,t[9]=r,t[10]=d):d=t[10],f=a(l?{id:`ehLu5O`,values:{hint:l}}:{id:`BJpGCq`}),t[0]=a,t[1]=n,t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d,t[7]=f):(c=t[3],l=t[4],u=t[5],d=t[6],f=t[7]);let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Zl,{"aria-hidden":`true`}),t[11]=p):p=t[11];let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`BJpGCq`})}),t[12]=m):m=t[12];let h;t[13]===l?h=t[14]:(h=l?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null,t[13]=l,t[14]=h);let g;return t[15]!==c||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==h?(g=(0,Z.jsxs)(c,{disabled:u,onSelect:d,"aria-label":f,children:[p,m,h]}),t[15]=c,t[16]=u,t[17]=d,t[18]=f,t[19]=h,t[20]=g):g=t[20],g}function RU(e,t){return uA({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function zU(e,t){return e!==t&&e.startsWith(t)}function BU(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>zU(e,t))).map(e=>RU(e,t))}function VU(e,t){return e===t||e.startsWith(`${t}/`)}function HU(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 UU(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)Gi(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):Jn(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=$k(e);VU(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function WU(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:VU(t.createdPath,e.path)}function GU(e){let t=(0,$.c)(70),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:u,projectLocalBinding:d,mergedConfig:f,onStartCreating:p,onCreateFromTemplate:m,onDuplicate:h,onDelete:_,onExpandSubtree:v,onCollapseSubtree:y,folderTreePaths:b,isAsset:x,documents:S}=e,{_:C}=i(),w=uA(n,S),T=n.kind===`directory`,E=w.kind===`asset`?null:w,D=E!==null&&u!==null,O;t[0]!==C||t[1]!==T?(O=C(T?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=C,t[1]=T,t[2]=O):O=t[2];let k=O,A=f?.appearance?.sidebar?.showHiddenFiles??!1,j=f?.appearance?.sidebar?.showAllFiles??!1,M=d!==null,N;t[3]!==T||t[4]!==n.path?(N=T?$k(n.path):null,t[3]=T,t[4]=n.path,t[5]=N):N=t[5];let P=uo(N),F=P.state.status===`ready`?(P.state.data.folder.templates_available?.length??0)>0:!0,L=l.getSelectedPaths(),R=L.includes(w.treePath)?BU(L,S):[],z=R.length>1?R:[w],B=z.length,V=Y._({id:`44_vJP`,values:{deleteCount:B}}),H;t[6]!==T||t[7]!==n||t[8]!==o?(H=T&&o?ig(o.contentDir,dA(n),o.pathSeparator):null,t[6]=T,t[7]=n,t[8]=o,t[9]=H):H=t[9];let U=H,ee;if(t[10]!==T||t[11]!==n||t[12]!==o){bb0:{if(!o||T){ee=null;break bb0}let e=dA(n),t=e.lastIndexOf(`/`);if(t===-1){ee=o.contentDir;break bb0}ee=ig(o.contentDir,e.slice(0,t),o.pathSeparator)}t[10]=T,t[11]=n,t[12]=o,t[13]=ee}else ee=t[13];let te=ee,W;t[14]!==x||t[15]!==T||t[16]!==n||t[17]!==o?(W=x?null:T?cg({folderRelativePath:dA(n),workspace:o}):og({docName:Xk(n.path),workspace:o}),t[14]=x,t[15]=T,t[16]=n,t[17]=o,t[18]=W):W=t[18];let ne=W,re;t[19]===r?re=t[20]:(re=()=>r.close({restoreFocus:!1}),t[19]=r,t[20]=re);let G=re,ie;t[21]===r?ie=t[22]:(ie=()=>r.close(),t[21]=r,t[22]=ie);let K=ie,q;t[23]!==C||t[24]!==d?(q=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,zr(t.error)),X.error(C({id:`P47EWZ`}),{description:zr(t.error)}))},t[23]=C,t[24]=d,t[25]=q):q=t[25];let ae=q,oe;t[26]!==C||t[27]!==d?(oe=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,zr(t.error)),X.error(C({id:`P47EWZ`}),{description:zr(t.error)}))},t[26]=C,t[27]=d,t[28]=oe):oe=t[28];let se=oe,ce=0,le=0;if(T){let e=eA(n.path);for(let t of b)(t===e||t.startsWith(e))&&(ce++,RH(l.getItem(t))?.isExpanded()&&le++)}let ue=T&&le<ce,de=T&&le>0,fe;t[29]===K?fe=t[30]:(fe=e=>{e||K()},t[29]=K,t[30]=fe);let pe;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[31]=pe):pe=t[31];let me;t[32]!==C||t[33]!==a||t[34]!==D||t[35]!==M||t[36]!==K||t[37]!==G||t[38]!==V||t[39]!==z||t[40]!==U||t[41]!==F||t[42]!==se||t[43]!==ae||t[44]!==c||t[45]!==ne||t[46]!==k||t[47]!==x||t[48]!==T||t[49]!==n||t[50]!==l||t[51]!==u||t[52]!==E||t[53]!==y||t[54]!==m||t[55]!==_||t[56]!==h||t[57]!==v||t[58]!==p||t[59]!==te||t[60]!==j||t[61]!==A||t[62]!==de||t[63]!==ue||t[64]!==w||t[65]!==o?(me=(0,Z.jsx)(Wo,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{G(),p(`file`,$k(n.path))},children:[(0,Z.jsx)(Kl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`MW64zN`})]}),F?(0,Z.jsxs)(Ko,{children:[(0,Z.jsxs)(Oo,{disabled:a,children:[(0,Z.jsx)(Ao,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(es,{children:(0,Z.jsx)(LH,{parentDir:$k(n.path),onSelectTemplate:e=>{G(),m($k(n.path),e)},ItemComponent:$o})})]}):null,(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{G(),p(`folder`,$k(n.path))},children:[(0,Z.jsx)(fl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`tX5yOZ`})]}),(0,Z.jsx)(To,{}),(0,Z.jsx)(IU,{item:n,workspace:o,onClose:K}),(0,Z.jsx)(aU,{input:ne,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!1}),(0,Z.jsx)(LU,{dirAbsPath:U,onClose:K}),(0,Z.jsxs)(Ko,{children:[(0,Z.jsxs)(Oo,{children:[(0,Z.jsx)(tt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(es,{children:[(0,Z.jsx)($o,{disabled:!o,onSelect:()=>{o&&(K(),SU(ig(o.contentDir,dA(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)($o,{onSelect:()=>{K(),SU(dA(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(To,{}),(0,Z.jsx)(rs,{checked:A,onCheckedChange:ae,disabled:!M,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`K_wz1u`})}),(0,Z.jsx)(rs,{checked:j,onCheckedChange:se,disabled:!M,"data-testid":`file-tree-menu-show-all-files`,children:(0,Z.jsx)(s,{id:`i8dKs-`})}),ue||de?(0,Z.jsx)(To,{}):null,ue?(0,Z.jsxs)($o,{onSelect:()=>{K(),v(n.path)},children:[(0,Z.jsx)(eu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}):null,de?(0,Z.jsxs)($o,{onSelect:()=>{K(),y(n.path)},children:[(0,Z.jsx)(ul,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]}):null,(0,Z.jsx)(To,{}),(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{w.kind!==`asset`&&(K(),h(w))},children:[(0,Z.jsx)(Qe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{G(),l.startRenaming(n.path)},children:[(0,Z.jsx)(I,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)($o,{"data-testid":`file-tree-menu-hide`,disabled:!D,onSelect:()=>{if(!u||!E)return;K();let e=oH(E),t=is(u.current()),n=Go(t,e);if(n===t)return;u.patch(qo(n));let r=E.path.split(`/`).pop()||E.path;X.success(C({id:`4xtLTl`,values:{basename:r}}),{description:C({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Ot,{"aria-hidden":`true`}),k]}),(0,Z.jsxs)($o,{variant:`destructive`,disabled:a,onSelect:()=>{K(),_(z)},children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),V]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(IU,{item:n,workspace:o,onClose:K}),!x&&(0,Z.jsx)(aU,{input:ne,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!0}),(0,Z.jsx)(LU,{dirAbsPath:te,onClose:K}),(0,Z.jsxs)(Ko,{children:[(0,Z.jsxs)(Oo,{children:[(0,Z.jsx)(tt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(es,{children:[(0,Z.jsx)($o,{disabled:!o,onSelect:()=>{o&&(K(),SU(ig(o.contentDir,dA(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)($o,{onSelect:()=>{K(),SU(dA(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(To,{}),x?null:(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{K(),h(w)},children:[(0,Z.jsx)(Qe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{G(),l.startRenaming(n.path)},children:[(0,Z.jsx)(I,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),E?(0,Z.jsxs)($o,{"data-testid":`file-tree-menu-hide`,disabled:!D,onSelect:()=>{if(!u)return;K();let e=oH(E),t=is(u.current()),n=Go(t,e);if(n===t)return;u.patch(qo(n));let r=E.path.split(`/`).pop()||E.path;X.success(C({id:`OD0FCX`,values:{basename:r}}),{description:C({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Ot,{"aria-hidden":`true`}),k]}):null,(0,Z.jsxs)($o,{variant:`destructive`,disabled:a,onSelect:()=>{K(),_(z)},children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),V]})]})}),t[32]=C,t[33]=a,t[34]=D,t[35]=M,t[36]=K,t[37]=G,t[38]=V,t[39]=z,t[40]=U,t[41]=F,t[42]=se,t[43]=ae,t[44]=c,t[45]=ne,t[46]=k,t[47]=x,t[48]=T,t[49]=n,t[50]=l,t[51]=u,t[52]=E,t[53]=y,t[54]=m,t[55]=_,t[56]=h,t[57]=v,t[58]=p,t[59]=te,t[60]=j,t[61]=A,t[62]=de,t[63]=ue,t[64]=w,t[65]=o,t[66]=me):me=t[66];let he;return t[67]!==fe||t[68]!==me?(he=(0,Z.jsxs)(jo,{open:!0,modal:!1,onOpenChange:fe,children:[pe,me]}),t[67]=fe,t[68]=me,t[69]=he):he=t[69],he}function KU(e){let t=(0,$.c)(285),{ref:n}=e,{_:r}=i(),{activeDocName:a,activeTarget:o,closeTabs:c,closeDocument:l,closeAndClearForRename:u,getPoolActiveDocName:d,poolHas:f,isNewTabActive:p,openTarget:m,prewarm:h,remapTabsForRename:g}=yt(),{notifySidebarFileSelected:_}=PO(),{resolvedTheme:v}=Li(),{addPage:y,pageMeta:b}=si(),x;t[0]===b?x=t[1]:(x=function(e,t){return Ii(e,t??b.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=b,t[1]=x);let S=x,C;t[2]!==S||t[3]!==_||t[4]!==m?(C=function(e,t){m(S(e,t),{tabBehavior:`replace-active`}),cr(yr(e)),_()},t[2]=S,t[3]=_,t[4]=m,t[5]=C):C=t[5];let w=C,T;t[6]!==_||t[7]!==m?(T=function(e){let t=Tr(e);m({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),cr(t),_()},t[6]=_,t[7]=m,t[8]=T):T=t[8];let E=T,D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[9]=D):D=t[9];let[O,k]=(0,Q.useState)(D),[A,j]=(0,Q.useState)(!0),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[I,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),{conflicts:U}=lo(),[ee,te]=(0,Q.useState)(null),[W,ne]=(0,Q.useState)(null),re=(0,Q.useRef)(O),G=(0,Q.useRef)(b),ie;t[10]!==O||t[11]!==E||t[12]!==w||t[13]!==_||t[14]!==m?(ie=function(e,t){let n=t===void 0?O:t,r=wH(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,tA(e));return}if(r.kind===`asset`){m({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),cr(r.hash),_();return}if(r.kind===`folder`){E(r.path);return}let i=n.find(e=>Gi(e)&&e.docName===r.path);w(r.path,i?.size)},t[10]=O,t[11]=E,t[12]=w,t[13]=_,t[14]=m,t[15]=ie):ie=t[15];let K=ie,q;t[16]!==_||t[17]!==m?(q=function(e){m({kind:`asset`,target:e,assetPath:e,mediaKind:re.current.find(t=>Jn(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),cr(gr(e)),_()},t[16]=_,t[17]=m,t[18]=q):q=t[18];let ae=q,oe=(0,Q.useRef)(a),se;t[19]===O?se=t[20]:(se=new Set(O.filter(Jn).map(gW)),t[19]=O,t[20]=se);let ce=se,le=(0,Q.useRef)(ce),de;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(de=[],t[21]=de):de=t[21];let fe=(0,Q.useRef)(de),me=(0,Q.useRef)(null),he=(0,Q.useRef)(hW),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(!1),ye=(0,Q.useRef)(!1),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(null),Ce;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=new Map,t[22]=Ce):Ce=t[22];let we=(0,Q.useRef)(Ce),Te=(0,Q.useRef)(!1),De=(0,Q.useRef)(!1),Oe=(0,Q.useRef)(null),ke=(0,Q.useRef)(null),Ae=(0,Q.useRef)(mW),je=(0,Q.useRef)(pW),Me=(0,Q.useRef)(fW),Ne=(0,Q.useRef)(dW),Pe=(0,Q.useRef)(o),Fe,Ie;t[23]!==O.length||t[24]!==A?(Fe=()=>{if(A||O.length===0)return;let e=ke.current?.querySelector(UM)?.shadowRoot;if(!e)return;let t=function(){xe.current!==null&&clearTimeout(xe.current),xe.current=setTimeout(()=>{ye.current=!1,xe.current=null},0)},n=function(e){if(!(e instanceof DragEvent))return;let t=vW(e),n=t?.dataset.itemPath;if(!n)return;let r=kH(t.dataset.itemType===`folder`?eA(n):n,re.current,G.current);r&&(xe.current!==null&&(clearTimeout(xe.current),xe.current=null),ye.current=!0,e.dataTransfer?.setData(fT,mT(r)))};return e.addEventListener(`dragstart`,n,{capture:!0}),e.addEventListener(`dragend`,t,{capture:!0}),window.addEventListener(`drop`,t,!0),window.addEventListener(`dragend`,t,!0),()=>{e.removeEventListener(`dragstart`,n,{capture:!0}),e.removeEventListener(`dragend`,t,{capture:!0}),window.removeEventListener(`drop`,t,!0),window.removeEventListener(`dragend`,t,!0),xe.current!==null&&(clearTimeout(xe.current),xe.current=null),ye.current=!1}},Ie=[O.length,A],t[23]=O.length,t[24]=A,t[25]=Fe,t[26]=Ie):(Fe=t[25],Ie=t[26]),(0,Q.useEffect)(Fe,Ie);let{selectedFilePath:Re,selectedFolderPath:ze,navigationPath:Be}=CH(o,p?null:a),Ve=Re?Yk(Re,O.find(e=>Gi(e)&&e.docName===Re)?.docExt):ze?eA(ze):o?.kind===`asset`?o.assetPath:null,He=jg().states,{dispatch:Ue}=bg(),We;t[27]!==Ue||t[28]!==He?(We={installStates:He,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Ue},t[27]=Ue,t[28]=He,t[29]=We):We=t[29];let Ge=We,{okignoreBinding:Ke,projectLocalBinding:qe,merged:Je}=be(),Ye=Je?.appearance?.sidebar?.showHiddenFiles??!1,Xe=Je?.appearance?.sidebar?.showAllFiles??!1,Ze;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=()=>Se.current===null,t[30]=Ze):Ze=t[30];let Qe=Ze,$e;t[31]===Symbol.for(`react.memo_cache_sentinel`)?($e=[],t[31]=$e):$e=t[31];let et;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(et={set:`complete`,spriteSheet:jU,byFileExtension:{md:{name:EU,viewBox:DU},mdx:{name:EU,viewBox:DU}}},t[32]=et):et=t[32];let tt;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(tt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[33]=tt):tt=t[33];let nt;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(nt={canDrag:Qe,canDrop:Qe,onDropComplete:e=>Ne.current(e),onDropError:uW},t[34]=nt):nt=t[34];let rt,it;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(rt={canRename:Qe,onRename:e=>je.current(e),onError:e=>Me.current(e)},it=e=>Ae.current(e),t[35]=rt,t[36]=it):(rt=t[35],it=t[36]);let at;t[37]===r?at=t[38]:(at={paths:$e,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:et,unsafeCSS:MU,composition:tt,dragAndDrop:nt,renaming:rt,onSelectionChange:it,renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=re.current.find(e=>Gi(e)&&Yk(e.docName,e.docExt)===t.path);if(n?.isSymlink){let e=n.targetPath;return{icon:wU,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return PU(t.path)?{icon:TU,title:r({id:`i9toLO`})}:null}},t[37]=r,t[38]=at);let{model:J}=qV(at),ot;t[39]===J?ot=t[40]:(ot=function(e){let t=J.getItem(e)??J.getItem(eA(e));return t?.isDirectory()?eA($k(t.getPath())):e},t[39]=J,t[40]=ot);let st=ot,ct,lt;t[41]===O?(ct=t[42],lt=t[43]):(lt=nA(O),ct=rA(lt),t[41]=O,t[42]=ct,t[43]=lt);let ut=ct,dt=(0,Q.useRef)(lt),ft;t[44]===O?ft=t[45]:(ft=aA(O),t[44]=O,t[45]=ft);let pt=ft,mt=(0,Q.useRef)(pt),ht=ze?oA(eA(ze)).slice(0,-1):oA(Ve??Be),gt=ht.join(`\0`),_t;if(t[46]!==J){let e=()=>{let e=new Set;for(let t of mt.current)RH(J.getItem(t))?.isExpanded()&&e.add(t);return e};_t=t=>{let n=new Set(aA(t??re.current)),r=e();for(let e of fe.current)r.add(e);return[...r].filter(e=>n.has(e))},t[46]=J,t[47]=_t}else _t=t[47];let vt=_t,bt;t[48]!==vt||t[49]!==J?(bt=e=>{let t=nA(e??re.current);J.resetPaths(t,{initialExpandedPaths:vt(e)})},t[48]=vt,t[49]=J,t[50]=bt):bt=t[50];let xt=bt,St;t[51]!==J||t[52]!==xt?(St=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:t,toDocName:r}of n){let n=e.find(e=>Gi(e)&&e.docName===t);if(n==null||J.getItem(r)==null)continue;let i=Yk(r,n.docExt);J.move(r,i),o=i,a+=1}for(let{toPath:e}of i){let t=JV(e);if(t===``)continue;let n=e.slice(0,-t.length);J.getItem(n)!=null&&(J.getItem(e)??J.move(n,e),o=e,a+=1)}a!==0&&(xt(t),o!=null&&J.focusPath(o))},t[51]=J,t[52]=xt,t[53]=St):St=t[53];let Ct=St,wt;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(wt=e=>{ge.current=iA(e)},t[54]=wt):wt=t[54];let Tt=wt,Et;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Et=e=>le.current.has(e),t[55]=Et):Et=t[55];let Dt=Et,Ot;t[56]!==r||t[57]!==y||t[58]!==E||t[59]!==w||t[60]!==xt?(Ot=async function(e){if(e.kind===`asset`||Se.current!==null)return;let t=()=>{R(null),Se.current=null};Se.current=e.path,R(e.path),N(null);try{let n=await L(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){X.error(n.title),xt(),t();return}let i=Ee(vr,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});X.error(e),N(e),vi([`files`,`backlinks`,`graph`]),xt(),t();return}for(let e of i.duplicatedDocNames)y(e);k(t=>{let n=wA(t,e,i);return xt(n),Tt(n),n}),vi([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?E(i.path):w(i.path)),X.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),X.error(r({id:`EBVbtP`}),{description:i}),xt(),t()}},t[56]=r,t[57]=y,t[58]=E,t[59]=w,t[60]=xt,t[61]=Ot):Ot=t[61];let kt=Ot,At=(0,Q.useRef)(kt),jt;t[62]===kt?jt=t[63]:(jt=()=>{At.current=kt},t[62]=kt,t[63]=jt),(0,Q.useEffect)(jt);let Mt=function(e){let t=bU(e);if(!t||xU(t))return!1;let n=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||Dt(n))return!1;let r=xU(n);if(!r)return!1;let i=eA(t);if(!mt.current.includes(i))return!1;let a=`${t}${r}`;return dt.current.includes(a)?!1:(on({sourcePath:n,destinationPath:a,isFolder:!1}),J.move(n,a),!0)},Nt;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=e=>{let t=e??me.current;!t||me.current!==t||(t.disposeCommitListener(),me.current=null)},t[64]=Nt):Nt=t[64];let Pt=Nt,Ft;t[65]!==r||t[66]!==Pt||t[67]!==l||t[68]!==c||t[69]!==xt?(Ft=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;Pt(e),i&&R(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=e.kind,a=e.createdPath,o=await L(t,r({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=r({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});i?X.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(R(null),xt());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;X.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(R(null),xt());return}i&&(e.kind===`file`?l(e.createdPath):c([Le(e.createdPath)],{force:!0})),i&&k(t=>{let n=SA(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return Tt(n),n}),vi([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&R(null)},t[65]=r,t[66]=Pt,t[67]=l,t[68]=c,t[69]=xt,t[70]=Ft):Ft=t[70];let It=Ft,Lt,Rt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=()=>()=>{let e=me.current;e&&he.current(e,{restoreLocation:!1,updateUi:!1}).catch(lW)},Rt=[],t[71]=Lt,t[72]=Rt):(Lt=t[71],Rt=t[72]),(0,Q.useEffect)(Lt,Rt);let zt,Bt;t[73]===r?(zt=t[74],Bt=t[75]):(zt=()=>{let e=!0,t=null,n=ZH(async function(){t?.abort();let n=new AbortController;t=n;try{let t=De.current,i=await fetch(t?`/api/documents?showAll=true`:`/api/documents`,{signal:n.signal,headers:t?QH:void 0});if(t&&$H(i)){let{entries:n,truncated:r}=await nU(i);if(!e)return;k(rU(Mr(n,Te.current||t),re.current,we.current)),N(null),F(r?n.length:null)}else{let n=await L(i,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)N(n.title),F(null);else{let e=fi.safeParse(n.body);if(!e.success)N(r({id:`HlmZBk`})),F(null);else{let n=Te.current||t;k(rU(Mr(e.data.documents,n),re.current,we.current)),N(null),F(t&&e.data.truncated===!0?e.data.documents.length:null)}}}}catch(t){let i=t;if(n.signal.aborted)return;e&&N(r({id:`34qyH5`})),console.warn(`[FileTree] fetch failed:`,i)}e&&j(!1)},()=>t?.abort());Oe.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=Kr(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Oe.current=null,n.dispose(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},Bt=[r],t[73]=r,t[74]=zt,t[75]=Bt),(0,Q.useEffect)(zt,Bt);let Vt=(0,Q.useRef)(!0),Ht;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Ht=()=>{if(Vt.current){Vt.current=!1;return}Oe.current?.()},t[76]=Ht):Ht=t[76];let Ut;t[77]===Ye?Ut=t[78]:(Ut=[Ye],t[77]=Ye,t[78]=Ut),(0,Q.useEffect)(Ht,Ut);let Wt=(0,Q.useRef)(!0),Gt;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=()=>{if(Wt.current){Wt.current=!1;return}Oe.current?.()},t[79]=Gt):Gt=t[79];let Kt;t[80]===Xe?Kt=t[81]:(Kt=[Xe],t[80]=Xe,t[81]=Kt),(0,Q.useEffect)(Gt,Kt);let qt,Jt;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(qt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=Ee(Qn,n,`workspace`,null);r&&ne({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(cW),()=>{e=!1}},Jt=[],t[82]=qt,t[83]=Jt):(qt=t[82],Jt=t[83]),(0,Q.useEffect)(qt,Jt);let Yt;t[84]!==vt||t[85]!==J||t[86]!==ut?(Yt=()=>{if(ge.current===ut){ge.current=null;return}J.resetPaths(dt.current,{initialExpandedPaths:vt()})},t[84]=vt,t[85]=J,t[86]=ut,t[87]=Yt):Yt=t[87];let Xt;t[88]!==J||t[89]!==ut?(Xt=[J,ut],t[88]=J,t[89]=ut,t[90]=Xt):Xt=t[90],(0,Q.useEffect)(Yt,Xt),BH(J,Ve,gt,ve,ut);let Zt;t[91]!==Ve||t[92]!==A||t[93]!==J?(Zt=()=>{A||!Ve||xH(ke.current,J)},t[91]=Ve,t[92]=A,t[93]=J,t[94]=Zt):Zt=t[94];let Qt;t[95]!==gt||t[96]!==Ve||t[97]!==A||t[98]!==J||t[99]!==ut?(Qt=[Ve,gt,ut,A,J],t[95]=gt,t[96]=Ve,t[97]=A,t[98]=J,t[99]=ut,t[100]=Qt):Qt=t[100],(0,Q.useEffect)(Zt,Qt);let $t,en;t[101]===J?($t=t[102],en=t[103]):($t=()=>J.subscribe(()=>{if(!J.isSearchOpen())for(let e of fe.current){let t=RH(J.getItem(e));t&&!t.isExpanded()&&t.expand()}}),en=[J],t[101]=J,t[102]=$t,t[103]=en),(0,Q.useEffect)($t,en);let tn,nn;t[104]===J?(tn=t[105],nn=t[106]):(tn=()=>J.onMutation(`remove`,e=>{let t=me.current;!t||e.path!==t.renamePath||he.current(t)}),nn=[J],t[104]=J,t[105]=tn,t[106]=nn),(0,Q.useEffect)(tn,nn);let rn;t[107]!==y||t[108]!==u||t[109]!==d||t[110]!==ae||t[111]!==E||t[112]!==f||t[113]!==Ct||t[114]!==g?(rn=async(e,t,n,r)=>{let i=t===void 0?[]:t,a=n===void 0?[]:n,o=r?.docName??oe.current,s=TA(o,e),c=r?.folderPath??(Pe.current?.kind===`folder`?Pe.current.folderPath:null),l=c?ue(c,i):null,p=r?.assetPath??(Pe.current?.kind===`asset`?Pe.current.assetPath:null),m=p?a.find(e=>e.fromPath===p)?.toPath??ue(p,i):null;pe(e);let h=EA(e,d(),f);await Promise.all(h.map(e=>u(e)));for(let t of e)y(t.toDocName);g(e,i,a),k(t=>{let n=xA(t,e,i,a);return Ct(t,n,e,a),Tt(n),n}),c&&l&&l!==c?E(l):s&&s!==o?window.location.hash=yr(s):p&&m&&m!==p&&ae(m),vi([`files`,`backlinks`,`graph`])},t[107]=y,t[108]=u,t[109]=d,t[110]=ae,t[111]=E,t[112]=f,t[113]=Ct,t[114]=g,t[115]=rn):rn=t[115];let an=rn;async function on(e){let t=!e.isFolder&&Dt(e.sourcePath),n=t?e.sourcePath:fA(e.sourcePath,e.isFolder);R(n),N(null);try{let i=XV(e.sourcePath,e.destinationPath,e.isFolder,t);if(i.kind===`block`){X.error(r({id:`FaBZwp`})),queueMicrotask(()=>{xt()}),Pt(),R(null);return}let a=t?i.destinationPath:fA(i.destinationPath,e.isFolder),o=e.isFolder?{kind:`folder`,fromPath:$k(n),toPath:$k(a)}:t?{kind:`asset`,fromPath:n,toPath:a}:{kind:`file`,fromPath:Xk(n),toPath:Xk(a)},s={docName:oe.current,folderPath:Pe.current?.kind===`folder`?Pe.current.folderPath:null,assetPath:Pe.current?.kind===`asset`?Pe.current.assetPath:null},c=await L(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o)}),r({id:`gijbne`}));if(!c.ok){X.error(c.title),xt();let e=me.current;e&&e.renamePath===n?await It(e):Pt(),R(null);return}let l=Ee(Hi,c.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await an(l.renamed,e.isFolder?[{fromPath:$k(n),toPath:$k(a)}]:[],l.renamedAssets,s)}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:a,renamedCount:l.renamed.length,renamedAssetCount:l.renamedAssets.length}),X.error(r({id:`dDpCOp`}))}Pt(),R(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});X.error(t),N(t),xt();let i=me.current;i&&i.renamePath===n?await It(i):Pt(),R(null)}}let sn;t[116]!==r||t[117]!==an||t[118]!==xt?(sn=async function(e){let t=e.draggedPaths.map(t=>{let n=hA(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(sW);if(t.length!==0){R(t[0]?.sourcePath??null),N(null);try{let e=[],n=[],i=[],a={docName:oe.current,folderPath:Pe.current?.kind===`folder`?Pe.current.folderPath:null,assetPath:Pe.current?.kind===`asset`?Pe.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&Dt(a.sourcePath),s=t?{kind:`folder`,fromPath:$k(a.sourcePath),toPath:$k(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:Xk(a.sourcePath),toPath:Xk(a.destinationTreePath)},c=await L(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){X.error(c.title),xt(),R(null);return}let l=Ee(Hi,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:$k(a.sourcePath),toPath:$k(a.destinationTreePath)})}try{await an(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),X.error(r({id:`8OxKZy`}))}R(null)}catch(e){console.warn(`[FileTree] move failed:`,e),X.error(r({id:`HIb0vl`})),xt(),R(null)}}},t[116]=r,t[117]=an,t[118]=xt,t[119]=sn):sn=t[119];let cn=sn,ln;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(ln=function(e){te({parentDir:e})},t[120]=ln):ln=t[120];let un=ln,dn;t[121]!==r||t[122]!==y||t[123]!==It||t[124]!==Pt||t[125]!==J||t[126]!==E||t[127]!==w||t[128]!==xt||t[129]!==lt?(dn=async function(e,t,n){if(Se.current)return;let i=me.current;i&&Pt(i);try{let i=pA(e,t,[...lt,...mt.current]);R(i.renamePath),Se.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=mA(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await L(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){X.error(a.title),R(null),Se.current=null;return}let s=Xk(e),c=Ee(tr,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};y(c),k(e=>{if(e.some(e=>Gi(e)&&e.docName===c))return e;let t=[...e,l];return Tt(t),we.current.set(Zk(l),Date.now()),t}),vi([`files`,`backlinks`,`graph`]),w(c)}else{let e=$k(i.addPath),t=await L(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){X.error(t.title),R(null),Se.current=null;return}o=Ee(Fr,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};k(e=>{if(e.some(e=>Pr(e)&&e.path===o))return e;let t=[...e,n];return Tt(t),we.current.set(Zk(n),Date.now()),t}),vi([`files`]),E(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=me.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>Pt(t))};document.addEventListener(`keydown`,c,!0),me.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},R(null),Se.current=null,J.add(i.addPath),J.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),X.error(r({id:`S6l5dv`}));let t=me.current;t?await It(t):Pt(),R(null),Se.current=null,xt()}},t[121]=r,t[122]=y,t[123]=It,t[124]=Pt,t[125]=J,t[126]=E,t[127]=w,t[128]=xt,t[129]=lt,t[130]=dn):dn=t[130];let fn=dn,pn;t[131]===J?pn=t[132]:(pn=function(e){let t=eA(e);(0,Q.startTransition)(()=>{for(let e of mt.current)if(e===t||e.startsWith(t)){let t=RH(J.getItem(e));t&&t.expand()}})},t[131]=J,t[132]=pn);let mn=pn,hn;t[133]===J?hn=t[134]:(hn=function(e){let t=eA(e),n=new Set(fe.current);(0,Q.startTransition)(()=>{for(let e of[...mt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=RH(J.getItem(e));t&&t.collapse()}})},t[133]=J,t[134]=hn);let gn=hn,_n;t[135]!==K||t[136]!==ht||t[137]!==a||t[138]!==o||t[139]!==ce||t[140]!==I||t[141]!==It||t[142]!==O||t[143]!==pt||t[144]!==cn||t[145]!==on||t[146]!==st||t[147]!==b||t[148]!==Mt||t[149]!==Xe||t[150]!==Ye||t[151]!==lt?(_n=()=>{re.current=O,G.current=b,oe.current=a,Pe.current=o,le.current=ce,Se.current=I,Te.current=Ye,De.current=Xe,dt.current=lt,mt.current=pt,fe.current=ht,he.current=It,Ae.current=e=>{if(ve.current||ye.current||e.length!==1)return;let t=e[0];t&&K(st(t),O)},Me.current=e=>{Mt(e)||X.error(e)},je.current=on,Ne.current=cn},t[135]=K,t[136]=ht,t[137]=a,t[138]=o,t[139]=ce,t[140]=I,t[141]=It,t[142]=O,t[143]=pt,t[144]=cn,t[145]=on,t[146]=st,t[147]=b,t[148]=Mt,t[149]=Xe,t[150]=Ye,t[151]=lt,t[152]=_n):_n=t[152],(0,Q.useLayoutEffect)(_n);let vn,yn;t[153]===J?(vn=t[154],yn=t[155]):(vn=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||HU(e.target))return;let a=ke.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!t)return;let n=J.getItem(t)??J.getItem(eA(t)),r=n?.isDirectory()?eA($k(n.getPath())):t;if(le.current.has(r))return;At.current(RU(r,re.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...mt.current,...dt.current]);ve.current=!0;for(let e of u)e&&J.getItem(e)?.select();queueMicrotask(()=>{ve.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},yn=[J],t[153]=J,t[154]=vn,t[155]=yn),(0,Q.useEffect)(vn,yn);let bn,xn;t[156]!==O.length||t[157]!==A?(bn=()=>{if(A||O.length===0)return;let e=ke.current?.querySelector(UM)?.shadowRoot;if(!e)return;let t=oW,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()},xn=[A,O.length],t[156]=O.length,t[157]=A,t[158]=bn,t[159]=xn):(bn=t[158],xn=t[159]),(0,Q.useEffect)(bn,xn);let Sn,Cn;t[160]!==O.length||t[161]!==A?(Sn=()=>{if(A||O.length===0)return;let e=ke.current?.querySelector(UM)?.shadowRoot;if(!e)return;let t=()=>eH(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Cn=[A,O.length],t[160]=O.length,t[161]=A,t[162]=Sn,t[163]=Cn):(Sn=t[162],Cn=t[163]),(0,Q.useEffect)(Sn,Cn);let wn,Tn;t[164]!==O.length||t[165]!==A?(wn=()=>{if(A||O.length===0)return;let e=ke.current?.querySelector(UM)?.shadowRoot;if(!e)return;let t=()=>mH(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Tn=[A,O.length],t[164]=O.length,t[165]=A,t[166]=wn,t[167]=Tn):(wn=t[166],Tn=t[167]),(0,Q.useEffect)(wn,Tn);let En;t[168]===Symbol.for(`react.memo_cache_sentinel`)?(En={folderCount:0,expandedCount:0},t[168]=En):En=t[168];let Dn=(0,Q.useRef)(En),On=(0,Q.useRef)(fn),kn=(0,Q.useRef)(un),An;t[169]===fn?An=t[170]:(An=()=>{On.current=fn,kn.current=un},t[169]=fn,t[170]=An),(0,Q.useEffect)(An);let jn,Mn;t[171]===J?(jn=t[172],Mn=t[173]):(jn=()=>({startCreating(e,t){On.current(e,t)},startCreatingFromTemplate(e){kn.current(e)},createFromTemplate(e,t){On.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of mt.current){let t=RH(J.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(fe.current);(0,Q.startTransition)(()=>{for(let t of[...mt.current].reverse()){if(e.has(t))continue;let n=RH(J.getItem(t));n&&n.collapse()}})},getFolderState(){let e=mt.current,t=0;for(let n of e)RH(J.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Dn.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Dn.current=i,i},subscribe(e){return J.subscribe(e)}}),Mn=[J],t[171]=J,t[172]=jn,t[173]=Mn),(0,Q.useImperativeHandle)(n,jn,Mn);let Nn;t[174]!==Pt||t[175]!==u||t[176]!==c||t[177]!==J?(Nn=async function(e,t,n){let r=UU(e,re.current,mt.current),i=me.current;i&&e.some(e=>WU(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Pt(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(aW).map(iW)]);c([...[...a].map(rW),...[...o].map(nW),...[...s].map(tW)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?eA(t.path):t.kind===`asset`?t.path:Yk(t.path,t.docExt);J.getItem(e)&&J.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}k(e=>{let t=SA(e,[...a],void 0,[...s]);for(let e of o)t=SA(t,[],e);return Tt(t),t}),vi([`files`,`backlinks`,`graph`])},t[174]=Pt,t[175]=u,t[176]=c,t[177]=J,t[178]=Nn):Nn=t[178];let Pn=Nn,Fn;t[179]!==r||t[180]!==Pn?(Fn=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;R(a.path);let o=await L(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!o.ok)return i.length>0&&await Pn(i,t,n),X.error(o.title),!1;let s=Ee(mi,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await Pn(i,t,n),!0},t[179]=r,t[180]=Pn,t[181]=Fn):Fn=t[181];let In=Fn,Ln;t[182]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=async function(e,t,n){let r=[],i=[];for(let a of e){R(a.path);let e=DA(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:jH(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[182]=Ln):Ln=t[182];let Rn=Ln,zn;t[183]===r?zn=t[184]:(zn=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await L(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),i.push({target:a,reason:o.title});continue}let s=Ee(Yi,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length;X.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`vEJDlt`})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[183]=r,t[184]=zn);let Bn=zn,Vn;t[185]!==r||t[186]!==U||t[187]!==Pn||t[188]!==In||t[189]!==Bn||t[190]!==xt||t[191]!==W?(Vn=async function(e){let t=e.map(e=>CA(e,re.current)),n=t[0];if(!n)return;let i=U.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(eW),t=i.length>e.length?`, +${i.length-e.length} more`:``;X.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}R(n.path),B(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&W){let{trashed:e,failed:n}=await Rn(t,a,W);if(e.length>0){let t=await Bn(e);t?await Pn(e,t.deletedDocNames,t.deletedFolderPaths):await Pn(e,e.filter($U).map(QU),e.filter(ZU).map(XU))}n.length>0&&H({failed:n,originalTargets:[...t]}),R(null)}else{let e=await In(t);R(null),e||xt()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),R(null),xt()}},t[185]=r,t[186]=U,t[187]=Pn,t[188]=In,t[189]=Bn,t[190]=xt,t[191]=W,t[192]=Vn):Vn=t[192];let Hn=Vn,Un;t[193]!==r||t[194]!==In||t[195]!==xt||t[196]!==V?(Un=async function(){if(!V)return;let e=new Set(V.failed.map(YU)),t=V.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(H(null),t.length!==0){R(t[0]?.path??null);try{let e=await In(t);R(null),e||xt()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),R(null),xt()}}},t[193]=r,t[194]=In,t[195]=xt,t[196]=V,t[197]=Un):Un=t[197];let Wn=Un,Gn;t[198]!==Hn||t[199]!==V?(Gn=async function(){if(!V)return;let e=new Set(V.failed.map(JU)),t=V.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));H(null),await Hn(t)},t[198]=Hn,t[199]=V,t[200]=Gn):Gn=t[200];let Kn=Gn,qn=(0,Q.useRef)(Hn),Yn;t[201]===Hn?Yn=t[202]:(Yn=()=>{qn.current=Hn},t[201]=Hn,t[202]=Yn),(0,Q.useEffect)(Yn);let Xn,Zn;t[203]===Symbol.for(`react.memo_cache_sentinel`)?(Xn=()=>KH(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=re.current.find(e=>Gi(e)&&e.docName===t);qn.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){qn.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){qn.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),Zn=[],t[203]=Xn,t[204]=Zn):(Xn=t[203],Zn=t[204]),(0,Q.useEffect)(Xn,Zn);let $n,er;t[205]===Symbol.for(`react.memo_cache_sentinel`)?($n=()=>XH(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=re.current.find(e=>Gi(e)&&e.docName===t);At.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){At.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),er=[],t[205]=$n,t[206]=er):($n=t[205],er=t[206]),(0,Q.useEffect)($n,er);let nr,rr;t[207]===J?(nr=t[208],rr=t[209]):(nr=()=>JH(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=Yk(t,re.current.find(e=>Gi(e)&&e.docName===t)?.docExt);J.startRenaming(n);return}if(e.kind===`folder`){J.startRenaming(e.folderPath);return}if(e.kind===`asset`){J.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),rr=[J],t[207]=J,t[208]=nr,t[209]=rr),(0,Q.useEffect)(nr,rr);let ir;t[210]===Symbol.for(`react.memo_cache_sentinel`)?(ir=function(){let e=_e.current;e&&vU(e),_e.current=null},t[210]=ir):ir=t[210];let ar=ir,or;t[211]===h?or=t[212]:(or=function(e){let t=_W(e.nativeEvent);if(!t||t.endsWith(`/`)){ar();return}let n=Xk(t),r=re.current.find(e=>Zk(e)===t);if(r&&Jn(r)){ar();return}if(r&&Gi(r)&&wr(r.size)){ar();return}_e.current!==n&&(ar(),_e.current=n,_U(n,e=>h(e)))},t[211]=h,t[212]=or);let sr=or,lr;t[213]!==K||t[214]!==J||t[215]!==E?(lr=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=vW(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?eA(n):n;if(J.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=$k(r);if(window.location.hash===Tr(e))return;queueMicrotask(()=>E(e));return}let i=Xk(r);window.location.hash!==yr(i)&&queueMicrotask(()=>K(r))},t[213]=K,t[214]=J,t[215]=E,t[216]=lr):lr=t[216];let ur=lr;if(A){let e;return t[217]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(bW,{}),t[217]=e):e=t[217],e}if(O.length===0){if(M){let e;return t[218]===M?e=t[219]:(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:M})}),t[218]=M,t[219]=e),e}let e;t[220]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(s,{id:`xiv-dW`})}),t[220]=e):e=t[220];let n;t[221]===fn?n=t[222]:(n=()=>fn(`file`,``),t[221]=fn,t[222]=n);let r;t[223]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(s,{id:`6ibbCg`}),t[223]=r):r=t[223];let i;return t[224]===n?i=t[225]:(i=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(sa,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:n,children:r})]}),t[224]=n,t[225]=i),i}let dr=I!==null,fr=z?.targets[0]??null,pr;t[226]!==M||t[227]!==P?(pr=(M||P!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[M&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:M}),P!==null&&(0,Z.jsx)(`span`,{role:`status`,className:`px-3 pb-1 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`_HekAK`,values:{truncatedShownCount:P}})})]}),t[226]=M,t[227]=P,t[228]=pr):pr=t[228];let mr;t[229]===v?mr=t[230]:(mr=NU(v),t[229]=v,t[230]=mr);let hr;t[231]!==dr||t[232]!==ce||t[233]!==gn||t[234]!==O||t[235]!==mn||t[236]!==pt||t[237]!==kt||t[238]!==Ge||t[239]!==Je||t[240]!==J||t[241]!==Ke||t[242]!==qe||t[243]!==fn||t[244]!==W?(hr=(e,t)=>(0,Z.jsx)(GU,{item:e,context:t,anyActionBusy:dr,workspace:W,handoff:Ge,model:J,okignoreBinding:Ke,projectLocalBinding:qe,mergedConfig:Je,onStartCreating:fn,onCreateFromTemplate:(e,t)=>fn(`file`,e,{template:t}),onDuplicate:kt,onDelete:e=>B({targets:e}),onExpandSubtree:mn,onCollapseSubtree:gn,folderTreePaths:pt,isAsset:ce.has(e.path),documents:O}),t[231]=dr,t[232]=ce,t[233]=gn,t[234]=O,t[235]=mn,t[236]=pt,t[237]=kt,t[238]=Ge,t[239]=Je,t[240]=J,t[241]=Ke,t[242]=qe,t[243]=fn,t[244]=W,t[245]=hr):hr=t[245];let _r;t[246]!==ur||t[247]!==sr||t[248]!==J||t[249]!==pr||t[250]!==mr||t[251]!==hr?(_r=(0,Z.jsx)(`div`,{ref:ke,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(KV,{header:pr,model:J,style:mr,onClickCapture:ur,onMouseMove:sr,onMouseLeave:ar,renderContextMenu:hr})}),t[246]=ur,t[247]=sr,t[248]=J,t[249]=pr,t[250]=mr,t[251]=hr,t[252]=_r):_r=t[252];let br=!!z,xr;t[253]===I?xr=t[254]:(xr=e=>{!e&&!I&&B(null)},t[253]=I,t[254]=xr);let Sr;t[255]!==r||t[256]!==I||t[257]!==z||t[258]!==Hn||t[259]!==fr?(Sr=z&&fr&&(0,Z.jsx)(Ta,{...(()=>{let e=DH(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,z.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(qU)}):null};let t=z.targets.length,n=fr.name;return{itemName:t===1?fr.kind===`folder`?`${fr.name}/`:fr.kind===`file`?`${fr.name}${fr.docExt??`.md`}`:fr.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):fr.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:I!==null,onDelete:()=>Hn(z.targets)}),t[255]=r,t[256]=I,t[257]=z,t[258]=Hn,t[259]=fr,t[260]=Sr):Sr=t[260];let Cr;t[261]!==br||t[262]!==xr||t[263]!==Sr?(Cr=(0,Z.jsx)(Ts,{open:br,onOpenChange:xr,children:Sr}),t[261]=br,t[262]=xr,t[263]=Sr,t[264]=Cr):Cr=t[264];let Er=!!V,Dr;t[265]===I?Dr=t[266]:(Dr=e=>{!e&&!I&&H(null)},t[265]=I,t[266]=Dr);let Or;t[267]!==I||t[268]!==Wn||t[269]!==Kn||t[270]!==V?(Or=V&&(0,Z.jsx)(FH,{failedTargets:V.failed,isSubmitting:I!==null,onDeletePermanently:Wn,onRetry:Kn,onCancel:()=>H(null)}),t[267]=I,t[268]=Wn,t[269]=Kn,t[270]=V,t[271]=Or):Or=t[271];let kr;t[272]!==Er||t[273]!==Dr||t[274]!==Or?(kr=(0,Z.jsx)(Ts,{open:Er,onOpenChange:Dr,children:Or}),t[272]=Er,t[273]=Dr,t[274]=Or,t[275]=kr):kr=t[275];let Ar=ee!==null,jr;t[276]===Symbol.for(`react.memo_cache_sentinel`)?(jr=e=>{e||te(null)},t[276]=jr):jr=t[276];let Nr=ee?.parentDir??``,Ir;t[277]!==Ar||t[278]!==Nr?(Ir=(0,Z.jsx)(Gm,{open:Ar,onOpenChange:jr,kind:`file`,initialDir:Nr,defaultToTemplate:!0}),t[277]=Ar,t[278]=Nr,t[279]=Ir):Ir=t[279];let Lr;return t[280]!==kr||t[281]!==Ir||t[282]!==_r||t[283]!==Cr?(Lr=(0,Z.jsxs)(Z.Fragment,{children:[_r,Cr,kr,Ir]}),t[280]=kr,t[281]=Ir,t[282]=_r,t[283]=Cr,t[284]=Lr):Lr=t[284],Lr}function qU(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:OH(e)},`${e.kind}:${e.path}`)}function JU(e){return`${e.kind}:${e.path}`}function YU(e){return`${e.kind}:${e.path}`}function XU(e){return e.path}function ZU(e){return e.kind===`folder`}function QU(e){return e.path}function $U(e){return e.kind===`file`}function eW(e){return e.file}function tW(e){return je(e)}function nW(e){return Le(e)}function rW(e){return Yt(e)}function iW(e){return e.path}function aW(e){return e.kind===`asset`}function oW(e){return e.endsWith(`/`)?e.slice(0,-1):e}function sW(e){return!!e}function cW(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function lW(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function uW(e){X.error(e)}function dW(){}function fW(e){return X.error(e)}function pW(){}function mW(){}async function hW(){}function gW(e){return Zk(e)}function _W(e){return vW(e)?.dataset.itemPath??null}function vW(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var yW=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function bW(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=yW.map(xW),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function xW(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Pa,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Pa,{className:`h-3 ${e}`})]},t)}function SW(e){return e?Y._({id:`wTcjov`}):null}function CW(e){let t=(0,$.c)(37),{_:n}=i(),r=bh(),{merged:a}=be(),o=a?.appearance?.preview?.autoOpen??!0;if(r)return null;let{input:c,installStates:l,dispatch:u,webFallbackVisible:d}=e,f=d===void 0?!0:d,p=c===null,m,h,g,_,v,y,b;if(t[0]!==n||t[1]!==o||t[2]!==u||t[3]!==c||t[4]!==p||t[5]!==l||t[6]!==f){b=Symbol.for(`react.early_return_sentinel`);bb0:{let e=SW(p),r;t[14]===l?r=t[15]:(r=e=>l[e.id]?.installed===!0,t[14]=l,t[15]=r);let i=Ch.filter(r);g=l[`claude-code`]?.installed===!0;let a;t[16]!==o||t[17]!==c?(a=c!==null&&c.docContext!==null?fr(c.docContext.relativePath,o):``,t[16]=o,t[17]=c,t[18]=a):a=t[18];let d=a,x;t[19]!==c||t[20]!==d?(x=()=>{c!==null&&Yb(d)},t[19]=c,t[20]=d,t[21]=x):x=t[21],_=x;let S=f&&!g;if(i.length===0&&!S){b=null;break bb0}h=FA,t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(RA,{children:[(0,Z.jsx)(ya,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[22]=y):y=t[22],m=zA,v=i.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(LA,{disabled:!r,onSelect:()=>{c&&u(t.id,c)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Ub,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})}t[0]=n,t[1]=o,t[2]=u,t[3]=c,t[4]=p,t[5]=l,t[6]=f,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b}else m=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],b=t[13];if(b!==Symbol.for(`react.early_return_sentinel`))return b;let x;t[23]!==n||t[24]!==g||t[25]!==_||t[26]!==p||t[27]!==f?(x=f&&!g?(0,Z.jsxs)(LA,{onSelect:_,disabled:p,"data-testid":`empty-space-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(_t,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[23]=n,t[24]=g,t[25]=_,t[26]=p,t[27]=f,t[28]=x):x=t[28];let S;t[29]!==m||t[30]!==v||t[31]!==x?(S=(0,Z.jsxs)(m,{children:[v,x]}),t[29]=m,t[30]=v,t[31]=x,t[32]=S):S=t[32];let C;return t[33]!==h||t[34]!==y||t[35]!==S?(C=(0,Z.jsxs)(h,{children:[y,S]}),t[33]=h,t[34]=y,t[35]=S,t[36]=C):C=t[36],C}var wW=(e,t,n)=>au(e,t,n,`ProjectSwitcher`);function TW(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h=ek(),g=typeof window<`u`&&window.okDesktop!=null,_=(0,Q.useRef)(!1),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{u(e),e||f(``)},t[1]=v):v=t[1];let y=v,b;t[2]!==r||t[3]!==n.project||t[4]!==l?(b=()=>{if(!l)return;let e=!1;return wW(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=l,t[5]=b):b=t[5];let x;t[6]!==r||t[7]!==n||t[8]!==l?(x=[l,n,r],t[6]=r,t[7]=n,t[8]=l,t[9]=x):x=t[9],(0,Q.useEffect)(b,x);let S;t[10]!==r||t[11]!==n.project?(S=e=>{u(!1),wW(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=S):S=t[12];let C=S,w;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(w=()=>{u(!1),wW(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=w):w=t[16];let T=w,E;t[17]!==r||t[18]!==n.navigator?(E=()=>{u(!1),wW(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=E):E=t[19];let D=E,k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{u(!1),m(!0)},t[20]=k):k=t[20];let A=k,j=n.config.projectPath,M,N,P,F,I,L,R,z,B,V,H;if(t[21]!==r||t[22]!==h||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==j||t[26]!==l||t[27]!==C||t[28]!==o||t[29]!==d){let e;t[41]===j?e=t[42]:(e=e=>e.path!==j,t[41]=j,t[42]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;N=jo,R=l,z=y,B=!1;let u=h!==null&&`h-auto py-1.5`,p;t[43]===u?p=t[44]:(p=ea(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,u),t[43]=u,t[44]=p);let m;t[45]===r?m=t[46]:(m=r({id:`zZ_I5K`}),t[45]=r,t[46]=m);let v;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(v=g?()=>{_.current=!0}:void 0,t[47]=v):v=t[47];let b;t[48]===l?b=t[49]:(b=g?()=>{if(_.current){_.current=!1;return}y(!l)}:void 0,t[48]=l,t[49]=b);let x;t[50]===n.config.projectName?x=t[51]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=x);let S;t[52]===h?S=t[53]:(S=h===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(Be,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:h})]}),t[52]=h,t[53]=S);let w;t[54]!==x||t[55]!==S?(w=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x,S]}),t[54]=x,t[55]=S,t[56]=w):w=t[56];let T;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Zc,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=T):T=t[57],t[58]!==n.config.projectPath||t[59]!==p||t[60]!==m||t[61]!==b||t[62]!==w?(V=(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsxs)(JO,{className:p,"data-testid":`project-switcher-trigger`,"aria-label":m,title:n.config.projectPath,onPointerDown:v,onClick:b,children:[w,T]})}),t[58]=n.config.projectPath,t[59]=p,t[60]=m,t[61]=b,t[62]=w,t[63]=V):V=t[63],M=Wo,H=`start`,P=`top`,F=`min-w-[260px]`,I=`project-switcher-menu`,L=i.length===0?(0,Z.jsx)(Fo,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(qS,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(QS,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:EW,"data-testid":`project-switcher-search`}),(0,Z.jsx)(YS,{children:(0,Z.jsx)(O,{"aria-hidden":`true`})})]}),(0,Z.jsx)(To,{}),c.length===0?(0,Z.jsx)(Fo,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(s,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)($o,{disabled:e.missing,onSelect:()=>C(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?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[21]=r,t[22]=h,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=j,t[26]=l,t[27]=C,t[28]=o,t[29]=d,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=R,t[37]=z,t[38]=B,t[39]=V,t[40]=H}else M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35],R=t[36],z=t[37],B=t[38],V=t[39],H=t[40];let U;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(To,{}),t[64]=U):U=t[64];let ee,te;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(mt,{"aria-hidden":`true`,className:`text-muted-foreground`}),te=(0,Z.jsx)(s,{id:`PVUn_c`}),t[65]=ee,t[66]=te):(ee=t[65],te=t[66]);let W;t[67]===T?W=t[68]:(W=(0,Z.jsxs)($o,{onSelect:T,"data-testid":`project-switcher-open-folder`,children:[ee,te]}),t[67]=T,t[68]=W);let ne,re;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(xt,{"aria-hidden":`true`,className:`text-muted-foreground`}),re=(0,Z.jsx)(s,{id:`2Xs2jo`}),t[69]=ne,t[70]=re):(ne=t[69],re=t[70]);let G;t[71]===D?G=t[72]:(G=(0,Z.jsxs)($o,{onSelect:D,"data-testid":`project-switcher-switch-project`,children:[ne,re]}),t[71]=D,t[72]=G);let ie;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsxs)($o,{onSelect:A,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(At,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[73]=ie):ie=t[73];let K;t[74]!==M||t[75]!==P||t[76]!==F||t[77]!==I||t[78]!==L||t[79]!==W||t[80]!==G||t[81]!==H?(K=(0,Z.jsxs)(M,{align:H,side:P,className:F,"data-testid":I,children:[L,U,W,G,ie]}),t[74]=M,t[75]=P,t[76]=F,t[77]=I,t[78]=L,t[79]=W,t[80]=G,t[81]=H,t[82]=K):K=t[82];let q;t[83]!==N||t[84]!==R||t[85]!==z||t[86]!==B||t[87]!==V||t[88]!==K?(q=(0,Z.jsxs)(N,{open:R,onOpenChange:z,modal:B,children:[V,K]}),t[83]=N,t[84]=R,t[85]=z,t[86]=B,t[87]=V,t[88]=K,t[89]=q):q=t[89];let ae;t[90]!==n||t[91]!==p?(ae=(0,Z.jsx)(Nd,{open:p,onOpenChange:m,bridge:n}),t[90]=n,t[91]=p,t[92]=ae):ae=t[92];let oe;return t[93]!==q||t[94]!==ae?(oe=(0,Z.jsxs)(Z.Fragment,{children:[q,ae]}),t[93]=q,t[94]=ae,t[95]=oe):oe=t[95],oe}function EW(e){return e.stopPropagation()}function DW(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),qi(`sidebarSearchPill`)}function OW(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=ea(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(O,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(s,{id:`A1taO8`})}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(D,{className:`text-foreground/70`,children:Us(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(sa,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function kW(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:a}=i(),o=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,s;t[0]!==a||t[1]!==n.dismissible||t[2]!==r?(s=n.dismissible===!1?null:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":a({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(ys,{"aria-hidden":`true`,className:`size-3`})}),t[0]=a,t[1]=n.dismissible,t[2]=r,t[3]=s):s=t[3];let c=s,l=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${o}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let a;t[6]!==c||t[7]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,c]}),t[6]=c,t[7]=i,t[8]=a):a=t[8];let s;t[9]!==l||t[10]!==n.action?(s=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=l,t[10]=n.action,t[11]=s):s=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==l||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:u,children:n.secondaryAction.label}),t[14]=l,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==s||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[s,d]}),t[18]=s,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==a||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[a,f]}),t[21]=e,t[22]=r,t[23]=a,t[24]=f,t[25]=p):p=t[25],p}let u=`update-notice-${n.id}`,d=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${o}`,f;t[26]===n.body?f=t[27]:(f=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=f);let p;t[28]!==l||t[29]!==n.action?(p=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=l,t[29]=n.action,t[30]=p):p=t[30];let m;return t[31]!==c||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":u,className:d,children:[f,p,c]}),t[31]=c,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m):m=t[36],m}function AW(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 jW(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Yp,Jp,Jp),n;e[0]===t?n=e[1]:(n=AW(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),qp(r.id)},e[2]=r,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)(kW,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function MW(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?ig(n.contentDir,ag(t),n.pathSeparator):e?.kind===`folder`?ig(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?ig(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function NW(e,t,n){if((e?.kind===`doc`||e?.kind===`folder-index`)&&t){let e=t.lastIndexOf(`/`);return e<0?n.contentDir:ig(n.contentDir,t.slice(0,e),n.pathSeparator)}if(e?.kind===`folder`)return ig(n.contentDir,e.folderPath,n.pathSeparator);if(e?.kind===`asset`){let t=e.assetPath.lastIndexOf(`/`);return t<0?n.contentDir:ig(n.contentDir,e.assetPath.slice(0,t),n.pathSeparator)}return n.contentDir}function PW(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?ag(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function FW(e,t,n){return e===null?sg({workspace:n}):e.kind===`folder`?n?cg({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?og({docName:t,workspace:n}):null}var IW={folderCount:0,expandedCount:0},LW=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function RW(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(LW)!==null}function zW(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(G,{name:`file-sidebar`,children:(0,Z.jsx)(VW,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var BW=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)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{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)(Ar,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(pr,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function VW(e){let t=(0,$.c)(195),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=yt(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:Ji(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f=typeof window<`u`&&window.okDesktop!=null,{state:p,toggleSidebar:m}=PO(),h=bh(),g=p===`expanded`,_=f&&p===`collapsed`,[v,y]=(0,Q.useState)(IW),b,x;t[3]===a?(b=t[4],x=t[5]):(b=()=>{if(a!==null)return y(a.getFolderState()),a.subscribe(()=>{y(a.getFolderState())})},x=[a],t[3]=a,t[4]=b,t[5]=x),(0,Q.useEffect)(b,x);let S,C;t[6]===a?(S=t[7],C=t[8]):(S=()=>{if(a!==null)return Nx(e=>{let t=e.initialDir??``;if(e.template){a.createFromTemplate(e.template.folder,e.template.name);return}a.startCreating(`file`,t)})},C=[a],t[6]=a,t[7]=S,t[8]=C),(0,Q.useEffect)(S,C);let w=v.folderCount>0,T=w&&v.expandedCount===v.folderCount,E=v.expandedCount===0,D=uo(``),O=uo(d===``?null:d),k=d===``?D:O,A=D.state.status===`ready`?(D.state.data.folder.templates_available?.length??0)>0:!0,j=k.state.status===`ready`?(k.state.data.folder.templates_available?.length??0)>0:!0,M=typeof window<`u`?window.okDesktop:void 0,N=No(),P=jg().states,{dispatch:F}=bg(),I;t[9]===N?I=t[10]:(I=sg({workspace:N}),t[9]=N,t[10]=I);let L=I,{projectLocalBinding:R,merged:z}=be(),B=z?.appearance?.sidebar?.showHiddenFiles??!1,V=z?.appearance?.sidebar?.showAllFiles??!1,H=w&&!T,U=w&&!E,ee=H||U,te=UW,W;t[11]!==a||t[12]!==N?(W=()=>{N&&a?.startCreating(`file`,``)},t[11]=a,t[12]=N,t[13]=W):W=t[13];let ne=W,G;t[14]!==a||t[15]!==N?(G=e=>{N&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=N,t[16]=G):G=t[16];let ie=G,K;t[17]!==a||t[18]!==N?(K=()=>{N&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=N,t[19]=K):K=t[19];let q=K,ae;t[20]===N?ae=t[21]:(ae=()=>{!N||!M||M.shell.showItemInFolder(N.contentDir)},t[20]=N,t[21]=ae);let oe=ae,se;t[22]===N?se=t[23]:(se=()=>{!N||!M||VH(M,N.contentDir)},t[22]=N,t[23]=se);let ce=se,le;t[24]!==r||t[25]!==N?(le=async()=>{if(N)try{await navigator.clipboard.writeText(N.contentDir),X.success(r({id:`6_ZOw4`}),{description:N.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))}},t[24]=r,t[25]=N,t[26]=le):le=t[26];let ue=le,de;t[27]!==r||t[28]!==R?(de=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,zr(t.error)),X.error(r({id:`P47EWZ`}),{description:zr(t.error)}))},t[27]=r,t[28]=R,t[29]=de):de=t[29];let fe=de,pe;t[30]!==r||t[31]!==R?(pe=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,zr(t.error)),X.error(r({id:`P47EWZ`}),{description:zr(t.error)}))},t[30]=r,t[31]=R,t[32]=pe):pe=t[32];let me=pe,he;t[33]===a?he=t[34]:(he=()=>{a?.expandAll()},t[33]=a,t[34]=he);let ge=he,_e;t[35]===a?_e=t[36]:(_e=()=>{a?.collapseAll()},t[35]=a,t[36]=_e);let ve=_e,ye,xe;t[37]!==V||t[38]!==U||t[39]!==H||t[40]!==B||t[41]!==p?(ye=()=>{M&&M.editor.notifyViewMenuStateChanged({showHiddenFiles:B,showAllFiles:V,canExpandAll:H,canCollapseAll:U,sidebarVisible:p===`expanded`})},xe=[M,B,V,H,U,p],t[37]=V,t[38]=U,t[39]=H,t[40]=B,t[41]=p,t[42]=ye,t[43]=xe):(ye=t[42],xe=t[43]),(0,Q.useEffect)(ye,xe);let Se,Ce;t[44]!==r||t[45]!==c||t[46]!==l||t[47]!==F||t[48]!==P||t[49]!==d||t[50]!==R||t[51]!==V||t[52]!==B||t[53]!==m||t[54]!==a||t[55]!==N?(Se=()=>{if(M)return M.onMenuAction(e=>{switch(e){case`new-doc`:if(!N||!a)return;a.startCreating(`file`,d);return;case`new-folder`:if(!N||!a)return;a.startCreating(`folder`,d);return;case`new-from-template`:if(!N||!a)return;a.startCreatingFromTemplate(d);return;case`rename`:if(!l)return;qH(l);return;case`duplicate`:if(!l)return;YH(l);return;case`move-to-trash`:if(!l)return;GH(l);return;case`reveal-in-finder`:{if(!M||!N)return;let e=MW(l,c,N);M.shell.showItemInFolder(e);return}case`open-in-terminal`:if(!M||!N)return;VH(M,NW(l,c,N));return;case`send-to-ai`:{let e=Ch.filter(e=>P[e.id]?.installed===!0);if(e.length===0){X.error(r({id:`LKOLNn`}));return}let t=FW(l,c,N);if(!t)return;let[n]=e;if(!n)return;F(n.id,t);return}case`copy-full-path`:{if(!N)return;let e=MW(l,c,N);navigator.clipboard.writeText(e).then(()=>X.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=PW(l,c);if(e===``){X.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>X.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(R===null)return;let e=R.patch({appearance:{sidebar:{showHiddenFiles:!B}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,zr(e.error)),X.error(r({id:`P47EWZ`}),{description:zr(e.error)}));return}case`toggle-show-all-files`:{if(R===null)return;let e=R.patch({appearance:{sidebar:{showAllFiles:!V}}});e.ok||(console.warn(`[FileSidebar] toggle-show-all-files rejected:`,zr(e.error)),X.error(r({id:`P47EWZ`}),{description:zr(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`toggle-sidebar`:m();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},Ce=[M,a,N,l,c,d,R,B,V,P,F,m,r],t[44]=r,t[45]=c,t[46]=l,t[47]=F,t[48]=P,t[49]=d,t[50]=R,t[51]=V,t[52]=B,t[53]=m,t[54]=a,t[55]=N,t[56]=Se,t[57]=Ce):(Se=t[56],Ce=t[57]),(0,Q.useEffect)(Se,Ce);let we=f&&g&&`motion-safe:delay-100`,Te=_&&`opacity-0`,Ee;t[58]!==we||t[59]!==Te?(Ee=ea(`flex-row h-12 items-center py-0 px-3`,f?`justify-end`:`justify-between`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,we,Te,f&&`[-webkit-app-region:drag]`),t[58]=we,t[59]=Te,t[60]=Ee):Ee=t[60];let De;t[61]===g?De=t[62]:(De=g&&!f?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(s,{id:`sER-bs`})}):null,t[61]=g,t[62]=De);let Oe;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=ea(`flex items-center gap-1`,f&&`[&>*]:[-webkit-app-region:no-drag]`),t[63]=Oe):Oe=t[63];let ke;t[64]!==r||t[65]!==T||t[66]!==w||t[67]!==E||t[68]!==a?(ke=w?(0,Z.jsxs)(jo,{children:[(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsx)(BW,{icon:xl,label:r({id:`Lu_dOh`})})}),(0,Z.jsxs)(Wo,{align:`end`,children:[T?null:(0,Z.jsxs)($o,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(eu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}),E?null:(0,Z.jsxs)($o,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(ul,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]})]})]}):null,t[64]=r,t[65]=T,t[66]=w,t[67]=E,t[68]=a,t[69]=ke):ke=t[69];let Ae;t[70]===r?Ae=t[71]:(Ae=r({id:`MW64zN`}),t[70]=r,t[71]=Ae);let je;t[72]!==d||t[73]!==a?(je=()=>a?.startCreating(`file`,d),t[72]=d,t[73]=a,t[74]=je):je=t[74];let Me;t[75]!==Ae||t[76]!==je?(Me=(0,Z.jsx)(BW,{icon:Kl,label:Ae,onClick:je}),t[75]=Ae,t[76]=je,t[77]=Me):Me=t[77];let Ne;t[78]!==r||t[79]!==j||t[80]!==d||t[81]!==a?(Ne=j?(0,Z.jsxs)(jo,{children:[(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsx)(BW,{icon:Ao,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(Wo,{align:`end`,children:(0,Z.jsx)(LH,{parentDir:d,onSelectTemplate:e=>a?.createFromTemplate(d,e),ItemComponent:$o})})]}):null,t[78]=r,t[79]=j,t[80]=d,t[81]=a,t[82]=Ne):Ne=t[82];let Pe;t[83]===r?Pe=t[84]:(Pe=r({id:`tX5yOZ`}),t[83]=r,t[84]=Pe);let Fe;t[85]!==d||t[86]!==a?(Fe=()=>a?.startCreating(`folder`,d),t[85]=d,t[86]=a,t[87]=Fe):Fe=t[87];let Ie;t[88]!==Pe||t[89]!==Fe?(Ie=(0,Z.jsx)(BW,{icon:fl,label:Pe,onClick:Fe}),t[88]=Pe,t[89]=Fe,t[90]=Ie):Ie=t[90];let Le;t[91]!==ke||t[92]!==Me||t[93]!==Ne||t[94]!==Ie?(Le=(0,Z.jsxs)(`div`,{className:Oe,children:[ke,Me,Ne,Ie]}),t[91]=ke,t[92]=Me,t[93]=Ne,t[94]=Ie,t[95]=Le):Le=t[95];let Re;t[96]!==Ee||t[97]!==De||t[98]!==Le?(Re=(0,Z.jsxs)(HO,{"data-electron-drag":f?``:void 0,className:Ee,children:[De,Le]}),t[96]=Ee,t[97]=De,t[98]=Le,t[99]=Re):Re=t[99];let ze=f&&g&&`motion-safe:delay-100`,Be=_&&`opacity-0`,Ve;t[100]!==ze||t[101]!==Be?(Ve=ea(`px-2 pb-2`,f&&`[-webkit-app-region:no-drag]`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,ze,Be),t[100]=ze,t[101]=Be,t[102]=Ve):Ve=t[102];let He;t[103]===p?He=t[104]:(He=[p],t[103]=p,t[104]=He);let Ue;t[105]===n?Ue=t[106]:(Ue=(0,Z.jsx)(OW,{onClick:n}),t[105]=n,t[106]=Ue);let We;t[107]!==He||t[108]!==Ue?(We=(0,Z.jsx)(re,{fallbackRender:HW,onError:DW,resetKeys:He,children:Ue}),t[107]=He,t[108]=Ue,t[109]=We):We=t[109];let Ge;t[110]!==Ve||t[111]!==We?(Ge=(0,Z.jsx)(`div`,{className:Ve,children:We}),t[110]=Ve,t[111]=We,t[112]=Ge):Ge=t[112];let Ke;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Z.jsxs)(WO,{children:[(0,Z.jsx)(Aj,{}),(0,Z.jsx)(KU,{ref:o})]}),t[113]=Ke):Ke=t[113];let qe;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsxs)(UO,{className:`px-0`,children:[(0,Z.jsx)(jW,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(GO,{children:(0,Z.jsx)(KO,{children:(0,Z.jsx)(TW,{bridge:window.okDesktop})})}):null]}),t[114]=qe):qe=t[114];let Je=!(h&&p===`collapsed`),Ye;t[115]===Je?Ye=t[116]:(Ye=(0,Z.jsx)(BO,{enableToggle:!1,enableDrag:Je}),t[115]=Je,t[116]=Ye);let Xe;t[117]!==Re||t[118]!==Ge||t[119]!==Ye?(Xe=(0,Z.jsx)(PA,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:te,children:[Re,Ge,Ke,qe,Ye]})}),t[117]=Re,t[118]=Ge,t[119]=Ye,t[120]=Xe):Xe=t[120];let Ze=!N,Qe,$e;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Kl,{"aria-hidden":`true`}),$e=(0,Z.jsx)(s,{id:`MW64zN`}),t[121]=Qe,t[122]=$e):(Qe=t[121],$e=t[122]);let et;t[123]!==ne||t[124]!==Ze?(et=(0,Z.jsxs)(LA,{disabled:Ze,onSelect:ne,"data-testid":`empty-space-menu-new-file`,children:[Qe,$e]}),t[123]=ne,t[124]=Ze,t[125]=et):et=t[125];let nt;t[126]!==ie||t[127]!==A||t[128]!==N?(nt=A?(0,Z.jsxs)(FA,{children:[(0,Z.jsxs)(RA,{disabled:!N,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(Ao,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(zA,{children:(0,Z.jsx)(LH,{parentDir:``,onSelectTemplate:ie,ItemComponent:LA})})]}):null,t[126]=ie,t[127]=A,t[128]=N,t[129]=nt):nt=t[129];let rt=!N,it,at;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(fl,{"aria-hidden":`true`}),at=(0,Z.jsx)(s,{id:`tX5yOZ`}),t[130]=it,t[131]=at):(it=t[130],at=t[131]);let J;t[132]!==q||t[133]!==rt?(J=(0,Z.jsxs)(LA,{disabled:rt,onSelect:q,"data-testid":`empty-space-menu-new-folder`,children:[it,at]}),t[132]=q,t[133]=rt,t[134]=J):J=t[134];let ot;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(ot=(0,Z.jsx)(VA,{}),t[135]=ot):ot=t[135];let st;t[136]!==r||t[137]!==oe||t[138]!==N?(st=M?(0,Z.jsxs)(LA,{disabled:!N,onSelect:oe,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(N?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(mt,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[136]=r,t[137]=oe,t[138]=N,t[139]=st):st=t[139];let ct;t[140]!==F||t[141]!==L||t[142]!==P?(ct=(0,Z.jsx)(CW,{input:L,installStates:P,dispatch:F,webFallbackVisible:!1}),t[140]=F,t[141]=L,t[142]=P,t[143]=ct):ct=t[143];let lt;t[144]!==r||t[145]!==ce||t[146]!==N?(lt=M?(0,Z.jsxs)(LA,{disabled:!N,onSelect:ce,"data-testid":`empty-space-menu-open-in-terminal`,"aria-label":r(N?{id:`BJpGCq`}:{id:`_6IEmc`}),children:[(0,Z.jsx)(Zl,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`BJpGCq`})}),N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[144]=r,t[145]=ce,t[146]=N,t[147]=lt):lt=t[147];let ut=!N,dt;t[148]!==r||t[149]!==N?(dt=r(N?{id:`Up2_7p`}:{id:`U8CD-l`}),t[148]=r,t[149]=N,t[150]=dt):dt=t[150];let ft;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(tt,{"aria-hidden":`true`}),t[151]=ft):ft=t[151];let pt;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(pt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[152]=pt):pt=t[152];let ht;t[153]===N?ht=t[154]:(ht=N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[153]=N,t[154]=ht);let gt;t[155]!==ue||t[156]!==ut||t[157]!==dt||t[158]!==ht?(gt=(0,Z.jsxs)(LA,{disabled:ut,onSelect:ue,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":dt,children:[ft,pt,ht]}),t[155]=ue,t[156]=ut,t[157]=dt,t[158]=ht,t[159]=gt):gt=t[159];let _t;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(VA,{}),t[160]=_t):_t=t[160];let vt=R===null,bt;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(s,{id:`K_wz1u`}),t[161]=bt):bt=t[161];let xt;t[162]!==fe||t[163]!==B||t[164]!==vt?(xt=(0,Z.jsx)(BA,{checked:B,onCheckedChange:fe,disabled:vt,"data-testid":`empty-space-menu-show-hidden-files`,children:bt}),t[162]=fe,t[163]=B,t[164]=vt,t[165]=xt):xt=t[165];let St=R===null,Ct;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(s,{id:`i8dKs-`}),t[166]=Ct):Ct=t[166];let wt;t[167]!==me||t[168]!==V||t[169]!==St?(wt=(0,Z.jsx)(BA,{checked:V,onCheckedChange:me,disabled:St,"data-testid":`empty-space-menu-show-all-files`,children:Ct}),t[167]=me,t[168]=V,t[169]=St,t[170]=wt):wt=t[170];let Tt;t[171]===ee?Tt=t[172]:(Tt=ee?(0,Z.jsx)(VA,{}):null,t[171]=ee,t[172]=Tt);let Et;t[173]!==ge||t[174]!==H?(Et=H?(0,Z.jsxs)(LA,{onSelect:ge,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(eu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[173]=ge,t[174]=H,t[175]=Et):Et=t[175];let Dt;t[176]!==ve||t[177]!==U?(Dt=U?(0,Z.jsxs)(LA,{onSelect:ve,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(ul,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[176]=ve,t[177]=U,t[178]=Dt):Dt=t[178];let Ot;t[179]!==et||t[180]!==nt||t[181]!==J||t[182]!==st||t[183]!==ct||t[184]!==lt||t[185]!==gt||t[186]!==xt||t[187]!==wt||t[188]!==Tt||t[189]!==Et||t[190]!==Dt?(Ot=(0,Z.jsxs)(IA,{children:[et,nt,J,ot,st,ct,lt,gt,_t,xt,wt,Tt,Et,Dt]}),t[179]=et,t[180]=nt,t[181]=J,t[182]=st,t[183]=ct,t[184]=lt,t[185]=gt,t[186]=xt,t[187]=wt,t[188]=Tt,t[189]=Et,t[190]=Dt,t[191]=Ot):Ot=t[191];let kt;return t[192]!==Xe||t[193]!==Ot?(kt=(0,Z.jsx)(RO,{variant:`inset`,children:(0,Z.jsxs)(NA,{children:[Xe,Ot]})}),t[192]=Xe,t[193]=Ot,t[194]=kt):kt=t[194],kt}function HW(){return null}function UW(e){RW(e.target)&&(e.preventDefault(),e.stopPropagation())}function WW(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function GW(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function KW(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var qW={phase:`loading`};function JW(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function YW(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function XW(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=KW(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function ZW(e){return e!==null&&e.kind===`project-branch-switch`}function QW(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,a=r===void 0?rf:r,{_:o}=i(),c=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,iG),[l,u]=(0,Q.useState)(qW),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(!1),p;t[0]===c?p=t[1]:(p=ZW(c)?c:null,t[0]=c,t[1]=p);let m=p,h;t[2]!==o||t[3]!==m?.share.target.kind?(h=m?.share.target.kind===`folder`?o({id:`ugoTXs`}):o({id:`XH30C4`}),t[2]=o,t[3]=m?.share.target.kind,t[4]=h):h=t[4];let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{u(qW),d.current=!1,f.current=!1},t[5]=_):_=t[5];let v;t[6]===c?v=t[7]:(v=[c],t[6]=c,t[7]=v),(0,Q.useEffect)(_,v);let y;t[8]!==m||t[9]!==n?(y=()=>{m&&(d.current||(d.current=!0,n.project.fetchBranchInfo({projectPath:m.projectPath,branch:m.share.branch,kind:m.share.target.kind,path:H(m.share.target)}).then(e=>{u(t=>JW(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),u(rG)})))},t[8]=m,t[9]=n,t[10]=y):y=t[10];let b;t[11]===m?b=t[12]:(b=[m],t[11]=m,t[12]=b),(0,Q.useEffect)(y,b);let x;t[13]!==o||t[14]!==m||t[15]!==l.phase||t[16]!==n||t[17]!==a||t[18]!==g?(x=()=>{if(l.phase!==`awaiting-cc1-recycle`||!m)return;let e=m.share.branch;if(!e){a.dismiss();return}if(f.current)return;f.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:m.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(lu({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:m.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:m.share.target.kind,path:H(m.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),X.error(o({id:`gQV-9w`,values:{targetNoun:g}}))}),a.dismiss();return}console.log(lu({branch_dialog_action:`branch-switch-timeout`,branch:e})),X.error(o({id:`LBwUR6`,values:{targetNoun:g}})),a.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),X.error(o({id:`Jw6EC4`,values:{targetNoun:g}})),a.dismiss())}),()=>{t=!0}},t[13]=o,t[14]=m,t[15]=l.phase,t[16]=n,t[17]=a,t[18]=g,t[19]=x):x=t[19];let S;if(t[20]!==m||t[21]!==l.phase?(S=[l.phase,m],t[20]=m,t[21]=l.phase,t[22]=S):S=t[22],(0,Q.useEffect)(x,S),!m)return null;let{share:C,projectPath:w,currentBranch:T}=m,E=C.branch,D;t[23]!==o||t[24]!==l.info||t[25]!==l.phase||t[26]!==n.project||t[27]!==w||t[28]!==C.target||t[29]!==E||t[30]!==a?(D=function(){l.phase===`ready`&&WW(l.info).switchEnabled&&(console.log(lu({branch_dialog_action:`switch`,branch_action:`switch`,branch:E})),u(e=>YW(e,H(C.target))),n.project.runCheckout({projectPath:w,branch:E}).then(e=>{let t=null,n=!1;u(r=>{let{state:i,sideEffect:a}=XW(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?X.error(o({id:`NJyQi_`,values:{shareBranch:E}})):t===`fetch-failed`?X.error(o({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&X.error(o({id:`c863eW`,values:{shareBranch:E}})),n&&a.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),u(nG),X.error(o({id:`c863eW`,values:{shareBranch:E}}))}))},t[23]=o,t[24]=l.info,t[25]=l.phase,t[26]=n.project,t[27]=w,t[28]=C.target,t[29]=E,t[30]=a,t[31]=D):D=t[31];let O=D,k;t[32]!==o||t[33]!==n.project||t[34]!==w||t[35]!==C.target||t[36]!==E||t[37]!==a||t[38]!==g?(k=function(){console.log(lu({branch_dialog_action:`open-current`,branch:E})),n.project.open({path:w,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:H(C.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),X.error(o({id:`b5aNbi`,values:{targetNoun:g}}))}),a.dismiss()},t[32]=o,t[33]=n.project,t[34]=w,t[35]=C.target,t[36]=E,t[37]=a,t[38]=g,t[39]=k):k=t[39];let A=k,j;t[40]!==o||t[41]!==l.otherWorktreePath||t[42]!==l.phase||t[43]!==n.project||t[44]!==C.target||t[45]!==E||t[46]!==a?(j=function(){if(l.phase!==`branch-in-other-worktree`)return;let e=l.otherWorktreePath;console.log(lu({branch_dialog_action:`pivot-to-other-worktree`,branch:E})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:H(C.target)},pendingBranch:E}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),X.error(o({id:`LdABLa`,values:{target:e}}))}),a.dismiss()},t[40]=o,t[41]=l.otherWorktreePath,t[42]=l.phase,t[43]=n.project,t[44]=C.target,t[45]=E,t[46]=a,t[47]=j):j=t[47];let M=j,N;t[48]===a?N=t[49]:(N=function(){console.log(lu({branch_dialog_action:`cancel`})),a.dismiss()},t[48]=a,t[49]=N);let P=N,F,I,L,R,z,B,V,U,ee,te,W,ne,re,G,ie,K,q;if(t[50]!==o||t[51]!==l.info||t[52]!==l.otherWorktreePath||t[53]!==l.phase||t[54]!==P||t[55]!==T||t[56]!==C.branch||t[57]!==C.owner||t[58]!==C.repo||t[59]!==C.target||t[60]!==E||t[61]!==g){q=l.phase===`ready`||l.phase===`switching`?WW(l.info):null;let e;t[79]!==l.info||t[80]!==l.phase||t[81]!==T?(e=l.phase===`ready`||l.phase===`switching`?GW(l.info):T??`HEAD`,t[79]=l.info,t[80]=l.phase,t[81]=T,t[82]=e):e=t[82];let n=e;B=l.phase===`switching`||l.phase===`awaiting-cc1-recycle`;let r;t[83]===o?r=t[84]:(r=o({id:`OuY8t9`}),t[83]=o,t[84]=r),R=r;let i;t[85]!==o||t[86]!==E?(i=o({id:`_BthEY`,values:{shareBranch:E}}),t[85]=o,t[86]=E,t[87]=i):i=t[87],z=i;let a=l.phase===`loading`,c=l.phase===`error`;L=Ts,ie=!0,t[88]===P?K=t[89]:(K=e=>{e||P()},t[88]=P,t[89]=K),I=xs,te=`sm:max-w-xl`,W=`share-branch-switch-dialog`,ne=tG,re=eG;let u;t[90]===g?u=t[91]:(u=(0,Z.jsx)(bs,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:g}})}),t[90]=g,t[91]=u);let d=C.owner,f=C.repo,p;t[92]===C.target?p=t[93]:(p=H(C.target),t[92]=C.target,t[93]=p);let m;t[94]!==C.owner||t[95]!==C.repo||t[96]!==p?(m=(0,Z.jsx)(vs,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`f8jU-L`,values:{0:d,1:f,2:p}})}),t[94]=C.owner,t[95]=C.repo,t[96]=p,t[97]=m):m=t[97],t[98]!==u||t[99]!==m?(G=(0,Z.jsxs)(ws,{children:[u,m]}),t[98]=u,t[99]=m,t[100]=G):G=t[100],F=Ss;let h=C.owner,_=C.repo,v;t[101]===C.target?v=t[102]:(v=H(C.target),t[101]=C.target,t[102]=v),t[103]!==C.branch||t[104]!==C.owner||t[105]!==C.repo||t[106]!==C.target.kind||t[107]!==v?(V=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(Yd,{owner:h,repo:_,path:v,kind:C.target.kind,branch:C.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=C.branch,t[104]=C.owner,t[105]=C.repo,t[106]=C.target.kind,t[107]=v,t[108]=V):V=t[108],U=l.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(s,{id:`yjExfe`,values:{shareBranch:E},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:l.otherWorktreePath})]}):a?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Ce,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`w4hMYl`})}):q?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XnoA1k`,values:{targetNoun:g,shareBranch:E},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`sZ2IOu`,values:{targetNoun:g,shareBranch:E,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_902BE`,values:{targetNoun:g,shareBranch:E,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),ee=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(s,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map($W)})]}):null,t[50]=o,t[51]=l.info,t[52]=l.otherWorktreePath,t[53]=l.phase,t[54]=P,t[55]=T,t[56]=C.branch,t[57]=C.owner,t[58]=C.repo,t[59]=C.target,t[60]=E,t[61]=g,t[62]=F,t[63]=I,t[64]=L,t[65]=R,t[66]=z,t[67]=B,t[68]=V,t[69]=U,t[70]=ee,t[71]=te,t[72]=W,t[73]=ne,t[74]=re,t[75]=G,t[76]=ie,t[77]=K,t[78]=q}else F=t[62],I=t[63],L=t[64],R=t[65],z=t[66],B=t[67],V=t[68],U=t[69],ee=t[70],te=t[71],W=t[72],ne=t[73],re=t[74],G=t[75],ie=t[76],K=t[77],q=t[78];let ae;t[109]===B?ae=t[110]:(ae=B?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Ce,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CU3AiE`})]}):null,t[109]=B,t[110]=ae);let oe;t[111]!==F||t[112]!==V||t[113]!==U||t[114]!==ee||t[115]!==ae?(oe=(0,Z.jsxs)(F,{children:[V,U,ee,ae]}),t[111]=F,t[112]=V,t[113]=U,t[114]=ee,t[115]=ae,t[116]=oe):oe=t[116];let se;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(s,{id:`dEgA5A`}),t[117]=se):se=t[117];let ce;t[118]===P?ce=t[119]:(ce=(0,Z.jsx)(sa,{variant:`ghost`,className:`font-mono uppercase`,onClick:P,"data-testid":`share-branch-switch-cancel`,children:se}),t[118]=P,t[119]=ce);let le;t[120]!==l.phase||t[121]!==A||t[122]!==M||t[123]!==O||t[124]!==R||t[125]!==z||t[126]!==B||t[127]!==q?(le=l.phase===`branch-in-other-worktree`?(0,Z.jsx)(sa,{onClick:M,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(s,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[q?.openCurrentEnabled?(0,Z.jsxs)(sa,{variant:`outline`,className:`font-mono uppercase`,onClick:A,disabled:B,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(Tl,{className:`size-3.5`,"aria-hidden":!0}),R]}):null,(0,Z.jsx)(sa,{onClick:O,disabled:!q?.switchEnabled||B,"aria-disabled":!q?.switchEnabled||B,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:B?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ce,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),z]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0}),z]})})]}),t[120]=l.phase,t[121]=A,t[122]=M,t[123]=O,t[124]=R,t[125]=z,t[126]=B,t[127]=q,t[128]=le):le=t[128];let ue;t[129]!==ce||t[130]!==le?(ue=(0,Z.jsxs)(Cs,{className:`sm:justify-between`,children:[ce,le]}),t[129]=ce,t[130]=le,t[131]=ue):ue=t[131];let de;t[132]!==I||t[133]!==te||t[134]!==W||t[135]!==ne||t[136]!==re||t[137]!==G||t[138]!==oe||t[139]!==ue?(de=(0,Z.jsxs)(I,{className:te,"data-testid":W,onInteractOutside:ne,onPointerDownOutside:re,children:[G,oe,ue]}),t[132]=I,t[133]=te,t[134]=W,t[135]=ne,t[136]=re,t[137]=G,t[138]=oe,t[139]=ue,t[140]=de):de=t[140];let fe;return t[141]!==L||t[142]!==ie||t[143]!==K||t[144]!==de?(fe=(0,Z.jsx)(L,{open:ie,onOpenChange:K,children:de}),t[141]=L,t[142]=ie,t[143]=K,t[144]=de,t[145]=fe):fe=t[145],fe}function $W(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function eG(e){e.preventDefault()}function tG(e){e.preventDefault()}function nG(e){return XW(e,null).state}function rG(e){return JW(e,null)}function iG(){return null}function aG(){let e=(0,$.c)(17),t=Mn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=yt(),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 Ye,i=new $e({url:n,name:ki,document:e,onStateless:e=>{let{payload:t}=e;Se(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:dG,onConfigValidationRejected:uG,onConfigIgnoreNestedError:lG,onUnknown:cG})},onClose:sG,onDisconnect:oG}),a=Kr(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=B(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{vi([`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 oG(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function sG(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function cG(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function lG(e){Zo(e)}function uG(e){ts(e)}function dG(e){vi([e.ch])}var fG=`#install-claude-desktop`;function pG(e){return e===`#settings`||e===fG}function mG(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function hG(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=yt(),{openTargetTransition:i}=Mt(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=si(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=mG(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(pG(window.location.hash))return;let e=Sr(window.location.hash);if(e){let t=Kn(e.split(`.`).pop()??``);ut(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}if(nr(window.location.hash)){ut(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let n=pi(window.location.hash);if(!n){ut(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){ut(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=Zr(n,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(r.kind===`missing`&&/\/+$/.test(n.trim())){ut(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=hi(wi(r),c);ut(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function gG(){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)(_G,t),null}function _G(){let e=bG;if(!e(window.location.hash))return;let t=new AbortController;return k(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(yG))}).catch(vG),()=>t.abort()}function vG(){}function yG(){}function bG(e){return!pG(e)&&!Sr(e)&&!pi(e)&&(e===``||e===`#`||e===`#/`)}function xG(){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)(SG,t),null}function SG(){let e=function(e){let t=e.target;Ah({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=kh))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function CG(){let e=(0,$.c)(4),{activeTarget:t}=yt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function wG(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=yt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Ji(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;Um({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)(Gm,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function TG(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(G,{name:`app`,children:(0,Z.jsx)(Bt,{children:(0,Z.jsx)(me,{children:(0,Z.jsx)(Th,{children:(0,Z.jsx)(EG,{})})})})}),e[0]=t):t=e[0],t}function EG(){let e=(0,$.c)(24),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=Oh(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Yg,{}),e[0]=o):o=e[0];let s,c,l,u,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(aG,{}),c=(0,Z.jsx)(hG,{}),l=(0,Z.jsx)(gG,{}),u=(0,Z.jsx)(CG,{}),d=(0,Z.jsx)(wG,{}),e[1]=s,e[2]=c,e[3]=l,e[4]=u,e[5]=d):(s=e[1],c=e[2],l=e[3],u=e[4],d=e[5]);let f;e[6]===a?f=e[7]:(f=!a&&(0,Z.jsx)(xG,{}),e[6]=a,e[7]=f);let p,m,h,g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=!1,h=t?(0,Z.jsx)(Xg,{bridge:t}):null,g=(0,Z.jsx)(Gd,{}),p=t?(0,Z.jsx)(QW,{bridge:t}):null,e[8]=p,e[9]=m,e[10]=h,e[11]=g):(p=e[8],m=e[9],h=e[10],g=e[11]);let _;e[12]===r?_=e[13]:(_=(0,Z.jsx)(Vg,{bridge:t,open:r,onOpenChange:i}),e[12]=r,e[13]=_);let v;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[14]=v):v=e[14];let y;e[15]===a?y=e[16]:(y=!a&&(0,Z.jsx)(zW,{onOpenSearch:()=>i(!0)}),e[15]=a,e[16]=y);let b;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(VO,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(Oj,{onOpenSearch:()=>i(!0)})}),e[17]=b):b=e[17];let x;e[18]===y?x=e[19]:(x=(0,Z.jsxs)(FO,{className:`h-screen overflow-hidden`,children:[y,b]}),e[18]=y,e[19]=x);let S;return e[20]!==_||e[21]!==x||e[22]!==f?(S=(0,Z.jsxs)(Z.Fragment,{children:[o,(0,Z.jsxs)(xi,{children:[s,c,l,u,d,f,m,h,g,p,_,v,x]})]}),e[20]=_,e[21]=x,e[22]=f,e[23]=S):S=e[23],S}Dc(),Ef({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),zf(),pp()&&yp(),Xp(),typeof window<`u`&&Vf({bridge:window.okDesktop}),typeof window<`u`&&ep({bridge:window.okDesktop}),typeof window<`u`&&Vs({bridge:window.okDesktop}),typeof window<`u`&&Ls({bridge:window.okDesktop}),typeof window<`u`&&Wf({bridge:window.okDesktop}),typeof window<`u`&&af({bridge:window.okDesktop}),xp();var DG=new Ic({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),OG=document.getElementById(`root`);if(!OG)throw Error(`Root element not found`);var kG=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,qc.createRoot)(OG).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:Y,children:(0,Z.jsx)(wn,{client:DG,children:(0,Z.jsxs)(Ti,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Xi,{children:kG&&window.okDesktop?(0,Z.jsx)(yf,{bridge:window.okDesktop}):(0,Z.jsx)(TG,{})}),(0,Z.jsx)(wf,{richColors:!0,closeButton:!0})]})})})}));
1911
+ `)||s(o)}finally{n.releaseLock()}return{entries:i,truncated:a}}function xU(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>hA(e))),a=[];for(let e of t){let t=hA(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function SU(e){return e?Y._({id:`wTcjov`}):null}function CU(e){let t=(0,$.c)(35),{_:n}=i(),r=bh(),{merged:a}=be(),o=a?.appearance?.preview?.autoOpen??!0;if(r)return null;let{input:c,installStates:l,dispatch:u,webFallbackVisible:d}=e,f=d===void 0?!0:d,p=c===null,m,h,g,_,v,y;if(t[0]!==n||t[1]!==o||t[2]!==u||t[3]!==c||t[4]!==p||t[5]!==l){let e=SU(p),r;t[12]===l?r=t[13]:(r=e=>l[e.id]?.installed===!0,t[12]=l,t[13]=r);let i=Ch.filter(r);g=l[`claude-code`]?.installed===!0;let a;t[14]!==o||t[15]!==c?(a=c!==null&&c.docContext!==null?fr(c.docContext.relativePath,o):``,t[14]=o,t[15]=c,t[16]=a):a=t[16];let d=a,f;t[17]!==c||t[18]!==d?(f=()=>{c!==null&&Yb(d)},t[17]=c,t[18]=d,t[19]=f):f=t[19],_=f,h=Ko,t[20]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(Oo,{children:[(0,Z.jsx)(ya,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[20]=y):y=t[20],m=es,v=i.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)($o,{disabled:!r,onSelect:()=>{c&&u(t.id,c)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Ub,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)}),t[0]=n,t[1]=o,t[2]=u,t[3]=c,t[4]=p,t[5]=l,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y}else m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11];let b;t[21]!==n||t[22]!==g||t[23]!==_||t[24]!==p||t[25]!==f?(b=f&&!g?(0,Z.jsxs)($o,{onSelect:_,disabled:p,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(_t,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[21]=n,t[22]=g,t[23]=_,t[24]=p,t[25]=f,t[26]=b):b=t[26];let x;t[27]!==m||t[28]!==v||t[29]!==b?(x=(0,Z.jsxs)(m,{children:[v,b]}),t[27]=m,t[28]=v,t[29]=b,t[30]=x):x=t[30];let S;return t[31]!==h||t[32]!==y||t[33]!==x?(S=(0,Z.jsxs)(h,{children:[y,x]}),t[31]=h,t[32]=y,t[33]=x,t[34]=S):S=t[34],S}var wU=p(`HOVER_INTENT_MS`,80),TU=3,EU=20,DU=new Map,OU=new Set,kU=[],AU=new Map;function jU(e){for(AU.delete(e),AU.set(e,!0);AU.size>EU;){let e=AU.keys().next().value;if(e===void 0)break;AU.delete(e)}}function MU(e){OU.delete(e),PU()}function NU(e,t){let n=Date.now();ut(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),jt(e,t,n)}function PU(){for(;OU.size<TU&&kU.length>0;){let e=kU.shift();if(!e)break;if(!AU.has(e.docName)){OU.add(e.docName),jU(e.docName);try{let t=e.prewarm(e.docName);t&&NU(e.docName,t)}catch(t){ut(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{MU(e.docName)}}}}function FU(e,t){if(Je(e)||AU.has(e))return;let n=DU.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(DU.delete(e),OU.size>=TU){kU.push({docName:e,prewarm:t});return}jU(e),OU.add(e);try{let n=t(e);n&&NU(e,n)}catch(t){ut(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{MU(e)}},wU);DU.set(e,{timer:r,prewarm:t})}function IU(e){let t=DU.get(e);t&&(clearTimeout(t.timer),DU.delete(e))}var LU=/\.(md|mdx)$/i;function RU(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function zU(e){let t=e.match(LU);return t?t[0]:null}async function BU(e,t){try{await navigator.clipboard.writeText(e),X.success(t===`full`?Y._({id:`6_ZOw4`}):Y._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),X.error(t===`full`?Y._({id:`vfRlCI`}):Y._({id:`5QGTaA`}))}}var VU=new Set([`agents`,`agent`,`claude`,`skill`]),HU=`ok-file-tree-link-decoration`,UU=`ok-file-tree-agent-decoration`,WU=`ok-file-tree-markdown`,GU=`0 0 48 48`,KU=`<symbol id="${WU}" viewBox="${GU}" fill="none" stroke="currentColor" stroke-width="4.62651" stroke-linecap="round" stroke-linejoin="round"><path d="M3.18066 33.4398V13.5603L12.4337 22.8133L21.6867 13.5603V33.4398"/><path d="M38 13.5L38 33"/><path d="M44.8195 26.5L37.8797 33.4398L30.9399 26.5"/></symbol>`;function qU(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function JU(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${qU(t)}</symbol>`}var YU=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1912
+ ${JU(HU,Ht)}
1913
+ ${JU(UU,Jc)}
1914
+ ${KU}
1915
+ </svg>`,XU=`${_H}\n${jH}`;function ZU(e){return{...ON({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-file-icon-color-image":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`}}function QU(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&VU.has(t)}function $U(e){return e===`darwin`?Y._({id:`LtSYdi`}):e===`win32`?Y._({id:`qi1F96`}):Y._({id:`hz7n6T`})}function eW(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:a}=e,{_:o}=i(),s=typeof window<`u`?window.okDesktop:void 0;if(!s)return null;let c=s.platform,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=$U(c),t[0]=l):l=t[0];let u=l,d,f;t[1]!==o||t[2]!==r?(d=r?null:o({id:`wTcjov`}),f=o(c===`darwin`?d?{id:`FvpFSZ`,values:{hint:d}}:{id:`LtSYdi`}:c===`win32`?d?{id:`o4dcAf`,values:{hint:d}}:{id:`qi1F96`}:d?{id:`ScUTHW`,values:{hint:d}}:{id:`hz7n6T`}),t[1]=o,t[2]=r,t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=f,m=!r,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=()=>{if(!r)return;a();let e=ig(r.contentDir,kA(n),r.pathSeparator);s.shell.showItemInFolder(e)},t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(mt,{"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{className:`flex-1`,children:u}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===d?v=t[12]:(v=d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null,t[11]=d,t[12]=v);let y;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)($o,{disabled:m,onSelect:h,"aria-label":p,children:[g,_,v]}),t[13]=p,t[14]=m,t[15]=h,t[16]=v,t[17]=y):y=t[17],y}function tW(e){let t=(0,$.c)(21),{dirAbsPath:n,onClose:r}=e,{_:a}=i(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let c,l,u,d,f;t[0]!==a||t[1]!==n||t[2]!==r?(l=n===null?a({id:`wTcjov`}):null,c=$o,u=n===null,t[8]!==n||t[9]!==r?(d=()=>{n!==null&&(r(),aU(o,n))},t[8]=n,t[9]=r,t[10]=d):d=t[10],f=a(l?{id:`ehLu5O`,values:{hint:l}}:{id:`BJpGCq`}),t[0]=a,t[1]=n,t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d,t[7]=f):(c=t[3],l=t[4],u=t[5],d=t[6],f=t[7]);let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Zl,{"aria-hidden":`true`}),t[11]=p):p=t[11];let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`BJpGCq`})}),t[12]=m):m=t[12];let h;t[13]===l?h=t[14]:(h=l?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null,t[13]=l,t[14]=h);let g;return t[15]!==c||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==h?(g=(0,Z.jsxs)(c,{disabled:u,onSelect:d,"aria-label":f,children:[p,m,h]}),t[15]=c,t[16]=u,t[17]=d,t[18]=f,t[19]=h,t[20]=g):g=t[20],g}function nW(e,t){return OA({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function rW(e,t){return e!==t&&e.startsWith(t)}function iW(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>rW(e,t))).map(e=>nW(e,t))}function aW(e,t){return e===t||e.startsWith(`${t}/`)}function oW(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 sW(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)Gi(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):Jn(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=_A(e);aW(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function cW(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:aW(t.createdPath,e.path)}function lW(e){let t=(0,$.c)(70),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:u,projectLocalBinding:d,mergedConfig:f,onStartCreating:p,onCreateFromTemplate:m,onDuplicate:h,onDelete:_,onExpandSubtree:v,onCollapseSubtree:y,folderTreePaths:b,isAsset:x,documents:S}=e,{_:C}=i(),w=OA(n,S),T=n.kind===`directory`,E=w.kind===`asset`?null:w,D=E!==null&&u!==null,O;t[0]!==C||t[1]!==T?(O=C(T?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=C,t[1]=T,t[2]=O):O=t[2];let k=O,A=f?.appearance?.sidebar?.showHiddenFiles??!1,j=f?.appearance?.sidebar?.showAllFiles??!1,M=d!==null,N;t[3]!==T||t[4]!==n.path?(N=T?_A(n.path):null,t[3]=T,t[4]=n.path,t[5]=N):N=t[5];let P=uo(N),F=P.state.status===`ready`?(P.state.data.folder.templates_available?.length??0)>0:!0,L=l.getSelectedPaths(),R=L.includes(w.treePath)?iW(L,S):[],z=R.length>1?R:[w],B=z.length,V=Y._({id:`44_vJP`,values:{deleteCount:B}}),H;t[6]!==T||t[7]!==n||t[8]!==o?(H=T&&o?ig(o.contentDir,kA(n),o.pathSeparator):null,t[6]=T,t[7]=n,t[8]=o,t[9]=H):H=t[9];let U=H,ee;if(t[10]!==T||t[11]!==n||t[12]!==o){bb0:{if(!o||T){ee=null;break bb0}let e=kA(n),t=e.lastIndexOf(`/`);if(t===-1){ee=o.contentDir;break bb0}ee=ig(o.contentDir,e.slice(0,t),o.pathSeparator)}t[10]=T,t[11]=n,t[12]=o,t[13]=ee}else ee=t[13];let te=ee,W;t[14]!==x||t[15]!==T||t[16]!==n||t[17]!==o?(W=x?null:T?cg({folderRelativePath:kA(n),workspace:o}):og({docName:mA(n.path),workspace:o}),t[14]=x,t[15]=T,t[16]=n,t[17]=o,t[18]=W):W=t[18];let ne=W,re;t[19]===r?re=t[20]:(re=()=>r.close({restoreFocus:!1}),t[19]=r,t[20]=re);let G=re,ie;t[21]===r?ie=t[22]:(ie=()=>r.close(),t[21]=r,t[22]=ie);let K=ie,q;t[23]!==C||t[24]!==d?(q=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,zr(t.error)),X.error(C({id:`P47EWZ`}),{description:zr(t.error)}))},t[23]=C,t[24]=d,t[25]=q):q=t[25];let ae=q,oe;t[26]!==C||t[27]!==d?(oe=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,zr(t.error)),X.error(C({id:`P47EWZ`}),{description:zr(t.error)}))},t[26]=C,t[27]=d,t[28]=oe):oe=t[28];let se=oe,ce=0,le=0;if(T){let e=vA(n.path);for(let t of b)(t===e||t.startsWith(e))&&(ce++,nU(l.getItem(t))?.isExpanded()&&le++)}let ue=T&&le<ce,de=T&&le>0,fe;t[29]===K?fe=t[30]:(fe=e=>{e||K()},t[29]=K,t[30]=fe);let pe;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[31]=pe):pe=t[31];let me;t[32]!==C||t[33]!==a||t[34]!==D||t[35]!==M||t[36]!==K||t[37]!==G||t[38]!==V||t[39]!==z||t[40]!==U||t[41]!==F||t[42]!==se||t[43]!==ae||t[44]!==c||t[45]!==ne||t[46]!==k||t[47]!==x||t[48]!==T||t[49]!==n||t[50]!==l||t[51]!==u||t[52]!==E||t[53]!==y||t[54]!==m||t[55]!==_||t[56]!==h||t[57]!==v||t[58]!==p||t[59]!==te||t[60]!==j||t[61]!==A||t[62]!==de||t[63]!==ue||t[64]!==w||t[65]!==o?(me=(0,Z.jsx)(Wo,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{G(),p(`file`,_A(n.path))},children:[(0,Z.jsx)(Kl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`MW64zN`})]}),F?(0,Z.jsxs)(Ko,{children:[(0,Z.jsxs)(Oo,{disabled:a,children:[(0,Z.jsx)(Ao,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(es,{children:(0,Z.jsx)(tU,{parentDir:_A(n.path),onSelectTemplate:e=>{G(),m(_A(n.path),e)},ItemComponent:$o})})]}):null,(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{G(),p(`folder`,_A(n.path))},children:[(0,Z.jsx)(fl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`tX5yOZ`})]}),(0,Z.jsx)(To,{}),(0,Z.jsx)(eW,{item:n,workspace:o,onClose:K}),(0,Z.jsx)(CU,{input:ne,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!1}),(0,Z.jsx)(tW,{dirAbsPath:U,onClose:K}),(0,Z.jsxs)(Ko,{children:[(0,Z.jsxs)(Oo,{children:[(0,Z.jsx)(tt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(es,{children:[(0,Z.jsx)($o,{disabled:!o,onSelect:()=>{o&&(K(),BU(ig(o.contentDir,kA(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)($o,{onSelect:()=>{K(),BU(kA(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(To,{}),(0,Z.jsx)(rs,{checked:A,onCheckedChange:ae,disabled:!M,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`K_wz1u`})}),(0,Z.jsx)(rs,{checked:j,onCheckedChange:se,disabled:!M,"data-testid":`file-tree-menu-show-all-files`,children:(0,Z.jsx)(s,{id:`i8dKs-`})}),ue||de?(0,Z.jsx)(To,{}):null,ue?(0,Z.jsxs)($o,{onSelect:()=>{K(),v(n.path)},children:[(0,Z.jsx)(eu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}):null,de?(0,Z.jsxs)($o,{onSelect:()=>{K(),y(n.path)},children:[(0,Z.jsx)(ul,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]}):null,(0,Z.jsx)(To,{}),(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{w.kind!==`asset`&&(K(),h(w))},children:[(0,Z.jsx)(Qe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{G(),l.startRenaming(n.path)},children:[(0,Z.jsx)(I,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)($o,{"data-testid":`file-tree-menu-hide`,disabled:!D,onSelect:()=>{if(!u||!E)return;K();let e=wH(E),t=is(u.current()),n=Go(t,e);if(n===t)return;u.patch(qo(n));let r=E.path.split(`/`).pop()||E.path;X.success(C({id:`4xtLTl`,values:{basename:r}}),{description:C({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Ot,{"aria-hidden":`true`}),k]}),(0,Z.jsxs)($o,{variant:`destructive`,disabled:a,onSelect:()=>{K(),_(z)},children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),V]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(eW,{item:n,workspace:o,onClose:K}),!x&&(0,Z.jsx)(CU,{input:ne,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!0}),(0,Z.jsx)(tW,{dirAbsPath:te,onClose:K}),(0,Z.jsxs)(Ko,{children:[(0,Z.jsxs)(Oo,{children:[(0,Z.jsx)(tt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(es,{children:[(0,Z.jsx)($o,{disabled:!o,onSelect:()=>{o&&(K(),BU(ig(o.contentDir,kA(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)($o,{onSelect:()=>{K(),BU(kA(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(To,{}),x?null:(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{K(),h(w)},children:[(0,Z.jsx)(Qe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)($o,{disabled:a,onSelect:()=>{G(),l.startRenaming(n.path)},children:[(0,Z.jsx)(I,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),E?(0,Z.jsxs)($o,{"data-testid":`file-tree-menu-hide`,disabled:!D,onSelect:()=>{if(!u)return;K();let e=wH(E),t=is(u.current()),n=Go(t,e);if(n===t)return;u.patch(qo(n));let r=E.path.split(`/`).pop()||E.path;X.success(C({id:`OD0FCX`,values:{basename:r}}),{description:C({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Ot,{"aria-hidden":`true`}),k]}):null,(0,Z.jsxs)($o,{variant:`destructive`,disabled:a,onSelect:()=>{K(),_(z)},children:[(0,Z.jsx)(g,{"aria-hidden":`true`}),V]})]})}),t[32]=C,t[33]=a,t[34]=D,t[35]=M,t[36]=K,t[37]=G,t[38]=V,t[39]=z,t[40]=U,t[41]=F,t[42]=se,t[43]=ae,t[44]=c,t[45]=ne,t[46]=k,t[47]=x,t[48]=T,t[49]=n,t[50]=l,t[51]=u,t[52]=E,t[53]=y,t[54]=m,t[55]=_,t[56]=h,t[57]=v,t[58]=p,t[59]=te,t[60]=j,t[61]=A,t[62]=de,t[63]=ue,t[64]=w,t[65]=o,t[66]=me):me=t[66];let he;return t[67]!==fe||t[68]!==me?(he=(0,Z.jsxs)(jo,{open:!0,modal:!1,onOpenChange:fe,children:[pe,me]}),t[67]=fe,t[68]=me,t[69]=he):he=t[69],he}function uW(e){let t=(0,$.c)(285),{ref:n}=e,{_:r}=i(),{activeDocName:a,activeTarget:o,closeTabs:c,closeDocument:l,closeAndClearForRename:u,getPoolActiveDocName:d,poolHas:f,isNewTabActive:p,openTarget:m,prewarm:h,remapTabsForRename:g}=yt(),{notifySidebarFileSelected:_}=QO(),{resolvedTheme:v}=Li(),{addPage:y,pageMeta:b}=si(),x;t[0]===b?x=t[1]:(x=function(e,t){return Ii(e,t??b.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=b,t[1]=x);let S=x,C;t[2]!==S||t[3]!==_||t[4]!==m?(C=function(e,t){m(S(e,t),{tabBehavior:`replace-active`}),cr(yr(e)),_()},t[2]=S,t[3]=_,t[4]=m,t[5]=C):C=t[5];let w=C,T;t[6]!==_||t[7]!==m?(T=function(e){let t=Tr(e);m({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),cr(t),_()},t[6]=_,t[7]=m,t[8]=T):T=t[8];let E=T,D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[9]=D):D=t[9];let[O,k]=(0,Q.useState)(D),[A,j]=(0,Q.useState)(!0),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(null),[I,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),{conflicts:U}=lo(),[ee,te]=(0,Q.useState)(null),[W,ne]=(0,Q.useState)(null),re=(0,Q.useRef)(O),G=(0,Q.useRef)(b),ie;t[10]!==O||t[11]!==E||t[12]!==w||t[13]!==_||t[14]!==m?(ie=function(e,t){let n=t===void 0?O:t,r=HH(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,yA(e));return}if(r.kind===`asset`){m({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),cr(r.hash),_();return}if(r.kind===`folder`){E(r.path);return}let i=n.find(e=>Gi(e)&&e.docName===r.path);w(r.path,i?.size)},t[10]=O,t[11]=E,t[12]=w,t[13]=_,t[14]=m,t[15]=ie):ie=t[15];let K=ie,q;t[16]!==_||t[17]!==m?(q=function(e){m({kind:`asset`,target:e,assetPath:e,mediaKind:re.current.find(t=>Jn(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),cr(gr(e)),_()},t[16]=_,t[17]=m,t[18]=q):q=t[18];let ae=q,oe=(0,Q.useRef)(a),se;t[19]===O?se=t[20]:(se=new Set(O.filter(Jn).map(PW)),t[19]=O,t[20]=se);let ce=se,le=(0,Q.useRef)(ce),de;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(de=[],t[21]=de):de=t[21];let fe=(0,Q.useRef)(de),me=(0,Q.useRef)(null),he=(0,Q.useRef)(NW),ge=(0,Q.useRef)(null),_e=(0,Q.useRef)(null),ve=(0,Q.useRef)(!1),ye=(0,Q.useRef)(!1),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(null),Ce;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=new Map,t[22]=Ce):Ce=t[22];let we=(0,Q.useRef)(Ce),Te=(0,Q.useRef)(!1),De=(0,Q.useRef)(!1),Oe=(0,Q.useRef)(null),ke=(0,Q.useRef)(null),Ae=(0,Q.useRef)(MW),je=(0,Q.useRef)(jW),Me=(0,Q.useRef)(AW),Ne=(0,Q.useRef)(kW),Pe=(0,Q.useRef)(o),Fe,Ie;t[23]!==O.length||t[24]!==A?(Fe=()=>{if(A||O.length===0)return;let e=ke.current?.querySelector(sN)?.shadowRoot;if(!e)return;let t=function(){xe.current!==null&&clearTimeout(xe.current),xe.current=setTimeout(()=>{ye.current=!1,xe.current=null},0)},n=function(e){if(!(e instanceof DragEvent))return;let t=IW(e),n=t?.dataset.itemPath;if(!n)return;let r=qH(t.dataset.itemType===`folder`?vA(n):n,re.current,G.current);r&&(xe.current!==null&&(clearTimeout(xe.current),xe.current=null),ye.current=!0,e.dataTransfer?.setData(AT,MT(r)))};return e.addEventListener(`dragstart`,n,{capture:!0}),e.addEventListener(`dragend`,t,{capture:!0}),window.addEventListener(`drop`,t,!0),window.addEventListener(`dragend`,t,!0),()=>{e.removeEventListener(`dragstart`,n,{capture:!0}),e.removeEventListener(`dragend`,t,{capture:!0}),window.removeEventListener(`drop`,t,!0),window.removeEventListener(`dragend`,t,!0),xe.current!==null&&(clearTimeout(xe.current),xe.current=null),ye.current=!1}},Ie=[O.length,A],t[23]=O.length,t[24]=A,t[25]=Fe,t[26]=Ie):(Fe=t[25],Ie=t[26]),(0,Q.useEffect)(Fe,Ie);let{selectedFilePath:Re,selectedFolderPath:ze,navigationPath:Be}=VH(o,p?null:a),Ve=Re?pA(Re,O.find(e=>Gi(e)&&e.docName===Re)?.docExt):ze?vA(ze):o?.kind===`asset`?o.assetPath:null,He=jg().states,{dispatch:Ue}=bg(),We;t[27]!==Ue||t[28]!==He?(We={installStates:He,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Ue},t[27]=Ue,t[28]=He,t[29]=We):We=t[29];let Ge=We,{okignoreBinding:Ke,projectLocalBinding:qe,merged:Je}=be(),Ye=Je?.appearance?.sidebar?.showHiddenFiles??!1,Xe=Je?.appearance?.sidebar?.showAllFiles??!1,Ze;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=()=>Se.current===null,t[30]=Ze):Ze=t[30];let Qe=Ze,$e;t[31]===Symbol.for(`react.memo_cache_sentinel`)?($e=[],t[31]=$e):$e=t[31];let et;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(et={set:`complete`,spriteSheet:YU,byFileExtension:{md:{name:WU,viewBox:GU},mdx:{name:WU,viewBox:GU}}},t[32]=et):et=t[32];let tt;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(tt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[33]=tt):tt=t[33];let nt;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(nt={canDrag:Qe,canDrop:Qe,onDropComplete:e=>Ne.current(e),onDropError:OW},t[34]=nt):nt=t[34];let rt,it;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(rt={canRename:Qe,onRename:e=>je.current(e),onError:e=>Me.current(e)},it=e=>Ae.current(e),t[35]=rt,t[36]=it):(rt=t[35],it=t[36]);let at;t[37]===r?at=t[38]:(at={paths:$e,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:et,unsafeCSS:XU,composition:tt,dragAndDrop:nt,renaming:rt,onSelectionChange:it,renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=re.current.find(e=>Gi(e)&&pA(e.docName,e.docExt)===t.path);if(n?.isSymlink){let e=n.targetPath;return{icon:HU,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return QU(t.path)?{icon:UU,title:r({id:`i9toLO`})}:null}},t[37]=r,t[38]=at);let{model:J}=dH(at),ot;t[39]===J?ot=t[40]:(ot=function(e){let t=J.getItem(e)??J.getItem(vA(e));return t?.isDirectory()?vA(_A(t.getPath())):e},t[39]=J,t[40]=ot);let st=ot,ct,lt;t[41]===O?(ct=t[42],lt=t[43]):(lt=bA(O),ct=xA(lt),t[41]=O,t[42]=ct,t[43]=lt);let ut=ct,dt=(0,Q.useRef)(lt),ft;t[44]===O?ft=t[45]:(ft=CA(O),t[44]=O,t[45]=ft);let pt=ft,mt=(0,Q.useRef)(pt),ht=ze?wA(vA(ze)).slice(0,-1):wA(Ve??Be),gt=ht.join(`\0`),_t;if(t[46]!==J){let e=()=>{let e=new Set;for(let t of mt.current)nU(J.getItem(t))?.isExpanded()&&e.add(t);return e};_t=t=>{let n=new Set(CA(t??re.current)),r=e();for(let e of fe.current)r.add(e);return[...r].filter(e=>n.has(e))},t[46]=J,t[47]=_t}else _t=t[47];let vt=_t,bt;t[48]!==vt||t[49]!==J?(bt=e=>{let t=bA(e??re.current);J.resetPaths(t,{initialExpandedPaths:vt(e)})},t[48]=vt,t[49]=J,t[50]=bt):bt=t[50];let xt=bt,St;t[51]!==J||t[52]!==xt?(St=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:t,toDocName:r}of n){let n=e.find(e=>Gi(e)&&e.docName===t);if(n==null||J.getItem(r)==null)continue;let i=pA(r,n.docExt);J.move(r,i),o=i,a+=1}for(let{toPath:e}of i){let t=fH(e);if(t===``)continue;let n=e.slice(0,-t.length);J.getItem(n)!=null&&(J.getItem(e)??J.move(n,e),o=e,a+=1)}a!==0&&(xt(t),o!=null&&J.focusPath(o))},t[51]=J,t[52]=xt,t[53]=St):St=t[53];let Ct=St,wt;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(wt=e=>{ge.current=SA(e)},t[54]=wt):wt=t[54];let Tt=wt,Et;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Et=e=>le.current.has(e),t[55]=Et):Et=t[55];let Dt=Et,Ot;t[56]!==r||t[57]!==y||t[58]!==E||t[59]!==w||t[60]!==xt?(Ot=async function(e){if(e.kind===`asset`||Se.current!==null)return;let t=()=>{R(null),Se.current=null};Se.current=e.path,R(e.path),N(null);try{let n=await L(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){X.error(n.title),xt(),t();return}let i=Ee(vr,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});X.error(e),N(e),vi([`files`,`backlinks`,`graph`]),xt(),t();return}for(let e of i.duplicatedDocNames)y(e);k(t=>{let n=HA(t,e,i);return xt(n),Tt(n),n}),vi([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?E(i.path):w(i.path)),X.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),X.error(r({id:`EBVbtP`}),{description:i}),xt(),t()}},t[56]=r,t[57]=y,t[58]=E,t[59]=w,t[60]=xt,t[61]=Ot):Ot=t[61];let kt=Ot,At=(0,Q.useRef)(kt),jt;t[62]===kt?jt=t[63]:(jt=()=>{At.current=kt},t[62]=kt,t[63]=jt),(0,Q.useEffect)(jt);let Mt=function(e){let t=RU(e);if(!t||zU(t))return!1;let n=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||Dt(n))return!1;let r=zU(n);if(!r)return!1;let i=vA(t);if(!mt.current.includes(i))return!1;let a=`${t}${r}`;return dt.current.includes(a)?!1:(on({sourcePath:n,destinationPath:a,isFolder:!1}),J.move(n,a),!0)},Nt;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=e=>{let t=e??me.current;!t||me.current!==t||(t.disposeCommitListener(),me.current=null)},t[64]=Nt):Nt=t[64];let Pt=Nt,Ft;t[65]!==r||t[66]!==Pt||t[67]!==l||t[68]!==c||t[69]!==xt?(Ft=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;Pt(e),i&&R(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=e.kind,a=e.createdPath,o=await L(t,r({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=r({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});i?X.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(R(null),xt());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;X.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(R(null),xt());return}i&&(e.kind===`file`?l(e.createdPath):c([Le(e.createdPath)],{force:!0})),i&&k(t=>{let n=BA(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return Tt(n),n}),vi([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&R(null)},t[65]=r,t[66]=Pt,t[67]=l,t[68]=c,t[69]=xt,t[70]=Ft):Ft=t[70];let It=Ft,Lt,Rt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=()=>()=>{let e=me.current;e&&he.current(e,{restoreLocation:!1,updateUi:!1}).catch(DW)},Rt=[],t[71]=Lt,t[72]=Rt):(Lt=t[71],Rt=t[72]),(0,Q.useEffect)(Lt,Rt);let zt,Bt;t[73]===r?(zt=t[74],Bt=t[75]):(zt=()=>{let e=!0,t=null,n=hU(async function(){t?.abort();let n=new AbortController;t=n;try{let t=De.current,i=await fetch(t?`/api/documents?showAll=true`:`/api/documents`,{signal:n.signal,headers:t?gU:void 0});if(t&&_U(i)){let{entries:n,truncated:r}=await bU(i);if(!e)return;k(xU(Mr(n,Te.current||t),re.current,we.current)),N(null),F(r?n.length:null)}else{let n=await L(i,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)N(n.title),F(null);else{let e=fi.safeParse(n.body);if(!e.success)N(r({id:`HlmZBk`})),F(null);else{let n=Te.current||t;k(xU(Mr(e.data.documents,n),re.current,we.current)),N(null),F(t&&e.data.truncated===!0?e.data.documents.length:null)}}}}catch(t){let i=t;if(n.signal.aborted)return;e&&N(r({id:`34qyH5`})),console.warn(`[FileTree] fetch failed:`,i)}e&&j(!1)},()=>t?.abort());Oe.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=Kr(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Oe.current=null,n.dispose(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},Bt=[r],t[73]=r,t[74]=zt,t[75]=Bt),(0,Q.useEffect)(zt,Bt);let Vt=(0,Q.useRef)(!0),Ht;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Ht=()=>{if(Vt.current){Vt.current=!1;return}Oe.current?.()},t[76]=Ht):Ht=t[76];let Ut;t[77]===Ye?Ut=t[78]:(Ut=[Ye],t[77]=Ye,t[78]=Ut),(0,Q.useEffect)(Ht,Ut);let Wt=(0,Q.useRef)(!0),Gt;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=()=>{if(Wt.current){Wt.current=!1;return}Oe.current?.()},t[79]=Gt):Gt=t[79];let Kt;t[80]===Xe?Kt=t[81]:(Kt=[Xe],t[80]=Xe,t[81]=Kt),(0,Q.useEffect)(Gt,Kt);let qt,Jt;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(qt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=Ee(Qn,n,`workspace`,null);r&&ne({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(EW),()=>{e=!1}},Jt=[],t[82]=qt,t[83]=Jt):(qt=t[82],Jt=t[83]),(0,Q.useEffect)(qt,Jt);let Yt;t[84]!==vt||t[85]!==J||t[86]!==ut?(Yt=()=>{if(ge.current===ut){ge.current=null;return}J.resetPaths(dt.current,{initialExpandedPaths:vt()})},t[84]=vt,t[85]=J,t[86]=ut,t[87]=Yt):Yt=t[87];let Xt;t[88]!==J||t[89]!==ut?(Xt=[J,ut],t[88]=J,t[89]=ut,t[90]=Xt):Xt=t[90],(0,Q.useEffect)(Yt,Xt),iU(J,Ve,gt,ve,ut);let Zt;t[91]!==Ve||t[92]!==A||t[93]!==J?(Zt=()=>{A||!Ve||zH(ke.current,J)},t[91]=Ve,t[92]=A,t[93]=J,t[94]=Zt):Zt=t[94];let Qt;t[95]!==gt||t[96]!==Ve||t[97]!==A||t[98]!==J||t[99]!==ut?(Qt=[Ve,gt,ut,A,J],t[95]=gt,t[96]=Ve,t[97]=A,t[98]=J,t[99]=ut,t[100]=Qt):Qt=t[100],(0,Q.useEffect)(Zt,Qt);let $t,en;t[101]===J?($t=t[102],en=t[103]):($t=()=>J.subscribe(()=>{if(!J.isSearchOpen())for(let e of fe.current){let t=nU(J.getItem(e));t&&!t.isExpanded()&&t.expand()}}),en=[J],t[101]=J,t[102]=$t,t[103]=en),(0,Q.useEffect)($t,en);let tn,nn;t[104]===J?(tn=t[105],nn=t[106]):(tn=()=>J.onMutation(`remove`,e=>{let t=me.current;!t||e.path!==t.renamePath||he.current(t)}),nn=[J],t[104]=J,t[105]=tn,t[106]=nn),(0,Q.useEffect)(tn,nn);let rn;t[107]!==y||t[108]!==u||t[109]!==d||t[110]!==ae||t[111]!==E||t[112]!==f||t[113]!==Ct||t[114]!==g?(rn=async(e,t,n,r)=>{let i=t===void 0?[]:t,a=n===void 0?[]:n,o=r?.docName??oe.current,s=UA(o,e),c=r?.folderPath??(Pe.current?.kind===`folder`?Pe.current.folderPath:null),l=c?ue(c,i):null,p=r?.assetPath??(Pe.current?.kind===`asset`?Pe.current.assetPath:null),m=p?a.find(e=>e.fromPath===p)?.toPath??ue(p,i):null;pe(e);let h=WA(e,d(),f);await Promise.all(h.map(e=>u(e)));for(let t of e)y(t.toDocName);g(e,i,a),k(t=>{let n=zA(t,e,i,a);return Ct(t,n,e,a),Tt(n),n}),c&&l&&l!==c?E(l):s&&s!==o?window.location.hash=yr(s):p&&m&&m!==p&&ae(m),vi([`files`,`backlinks`,`graph`])},t[107]=y,t[108]=u,t[109]=d,t[110]=ae,t[111]=E,t[112]=f,t[113]=Ct,t[114]=g,t[115]=rn):rn=t[115];let an=rn;async function on(e){let t=!e.isFolder&&Dt(e.sourcePath),n=t?e.sourcePath:AA(e.sourcePath,e.isFolder);R(n),N(null);try{let i=mH(e.sourcePath,e.destinationPath,e.isFolder,t);if(i.kind===`block`){X.error(r({id:`FaBZwp`})),queueMicrotask(()=>{xt()}),Pt(),R(null);return}let a=t?i.destinationPath:AA(i.destinationPath,e.isFolder),o=e.isFolder?{kind:`folder`,fromPath:_A(n),toPath:_A(a)}:t?{kind:`asset`,fromPath:n,toPath:a}:{kind:`file`,fromPath:mA(n),toPath:mA(a)},s={docName:oe.current,folderPath:Pe.current?.kind===`folder`?Pe.current.folderPath:null,assetPath:Pe.current?.kind===`asset`?Pe.current.assetPath:null},c=await L(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o)}),r({id:`gijbne`}));if(!c.ok){X.error(c.title),xt();let e=me.current;e&&e.renamePath===n?await It(e):Pt(),R(null);return}let l=Ee(Hi,c.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await an(l.renamed,e.isFolder?[{fromPath:_A(n),toPath:_A(a)}]:[],l.renamedAssets,s)}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:a,renamedCount:l.renamed.length,renamedAssetCount:l.renamedAssets.length}),X.error(r({id:`dDpCOp`}))}Pt(),R(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});X.error(t),N(t),xt();let i=me.current;i&&i.renamePath===n?await It(i):Pt(),R(null)}}let sn;t[116]!==r||t[117]!==an||t[118]!==xt?(sn=async function(e){let t=e.draggedPaths.map(t=>{let n=NA(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(TW);if(t.length!==0){R(t[0]?.sourcePath??null),N(null);try{let e=[],n=[],i=[],a={docName:oe.current,folderPath:Pe.current?.kind===`folder`?Pe.current.folderPath:null,assetPath:Pe.current?.kind===`asset`?Pe.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&Dt(a.sourcePath),s=t?{kind:`folder`,fromPath:_A(a.sourcePath),toPath:_A(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:mA(a.sourcePath),toPath:mA(a.destinationTreePath)},c=await L(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){X.error(c.title),xt(),R(null);return}let l=Ee(Hi,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:_A(a.sourcePath),toPath:_A(a.destinationTreePath)})}try{await an(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),X.error(r({id:`8OxKZy`}))}R(null)}catch(e){console.warn(`[FileTree] move failed:`,e),X.error(r({id:`HIb0vl`})),xt(),R(null)}}},t[116]=r,t[117]=an,t[118]=xt,t[119]=sn):sn=t[119];let cn=sn,ln;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(ln=function(e){te({parentDir:e})},t[120]=ln):ln=t[120];let un=ln,dn;t[121]!==r||t[122]!==y||t[123]!==It||t[124]!==Pt||t[125]!==J||t[126]!==E||t[127]!==w||t[128]!==xt||t[129]!==lt?(dn=async function(e,t,n){if(Se.current)return;let i=me.current;i&&Pt(i);try{let i=jA(e,t,[...lt,...mt.current]);R(i.renamePath),Se.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=MA(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await L(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){X.error(a.title),R(null),Se.current=null;return}let s=mA(e),c=Ee(tr,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};y(c),k(e=>{if(e.some(e=>Gi(e)&&e.docName===c))return e;let t=[...e,l];return Tt(t),we.current.set(hA(l),Date.now()),t}),vi([`files`,`backlinks`,`graph`]),w(c)}else{let e=_A(i.addPath),t=await L(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){X.error(t.title),R(null),Se.current=null;return}o=Ee(Fr,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};k(e=>{if(e.some(e=>Pr(e)&&e.path===o))return e;let t=[...e,n];return Tt(t),we.current.set(hA(n),Date.now()),t}),vi([`files`]),E(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=me.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>Pt(t))};document.addEventListener(`keydown`,c,!0),me.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},R(null),Se.current=null,J.add(i.addPath),J.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),X.error(r({id:`S6l5dv`}));let t=me.current;t?await It(t):Pt(),R(null),Se.current=null,xt()}},t[121]=r,t[122]=y,t[123]=It,t[124]=Pt,t[125]=J,t[126]=E,t[127]=w,t[128]=xt,t[129]=lt,t[130]=dn):dn=t[130];let fn=dn,pn;t[131]===J?pn=t[132]:(pn=function(e){let t=vA(e);(0,Q.startTransition)(()=>{for(let e of mt.current)if(e===t||e.startsWith(t)){let t=nU(J.getItem(e));t&&t.expand()}})},t[131]=J,t[132]=pn);let mn=pn,hn;t[133]===J?hn=t[134]:(hn=function(e){let t=vA(e),n=new Set(fe.current);(0,Q.startTransition)(()=>{for(let e of[...mt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=nU(J.getItem(e));t&&t.collapse()}})},t[133]=J,t[134]=hn);let gn=hn,_n;t[135]!==K||t[136]!==ht||t[137]!==a||t[138]!==o||t[139]!==ce||t[140]!==I||t[141]!==It||t[142]!==O||t[143]!==pt||t[144]!==cn||t[145]!==on||t[146]!==st||t[147]!==b||t[148]!==Mt||t[149]!==Xe||t[150]!==Ye||t[151]!==lt?(_n=()=>{re.current=O,G.current=b,oe.current=a,Pe.current=o,le.current=ce,Se.current=I,Te.current=Ye,De.current=Xe,dt.current=lt,mt.current=pt,fe.current=ht,he.current=It,Ae.current=e=>{if(ve.current||ye.current||e.length!==1)return;let t=e[0];t&&K(st(t),O)},Me.current=e=>{Mt(e)||X.error(e)},je.current=on,Ne.current=cn},t[135]=K,t[136]=ht,t[137]=a,t[138]=o,t[139]=ce,t[140]=I,t[141]=It,t[142]=O,t[143]=pt,t[144]=cn,t[145]=on,t[146]=st,t[147]=b,t[148]=Mt,t[149]=Xe,t[150]=Ye,t[151]=lt,t[152]=_n):_n=t[152],(0,Q.useLayoutEffect)(_n);let vn,yn;t[153]===J?(vn=t[154],yn=t[155]):(vn=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||oW(e.target))return;let a=ke.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!t)return;let n=J.getItem(t)??J.getItem(vA(t)),r=n?.isDirectory()?vA(_A(n.getPath())):t;if(le.current.has(r))return;At.current(nW(r,re.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...mt.current,...dt.current]);ve.current=!0;for(let e of u)e&&J.getItem(e)?.select();queueMicrotask(()=>{ve.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},yn=[J],t[153]=J,t[154]=vn,t[155]=yn),(0,Q.useEffect)(vn,yn);let bn,xn;t[156]!==O.length||t[157]!==A?(bn=()=>{if(A||O.length===0)return;let e=ke.current?.querySelector(sN)?.shadowRoot;if(!e)return;let t=wW,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()},xn=[A,O.length],t[156]=O.length,t[157]=A,t[158]=bn,t[159]=xn):(bn=t[158],xn=t[159]),(0,Q.useEffect)(bn,xn);let Sn,Cn;t[160]!==O.length||t[161]!==A?(Sn=()=>{if(A||O.length===0)return;let e=ke.current?.querySelector(sN)?.shadowRoot;if(!e)return;let t=()=>vH(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Cn=[A,O.length],t[160]=O.length,t[161]=A,t[162]=Sn,t[163]=Cn):(Sn=t[162],Cn=t[163]),(0,Q.useEffect)(Sn,Cn);let wn,Tn;t[164]!==O.length||t[165]!==A?(wn=()=>{if(A||O.length===0)return;let e=ke.current?.querySelector(sN)?.shadowRoot;if(!e)return;let t=()=>MH(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Tn=[A,O.length],t[164]=O.length,t[165]=A,t[166]=wn,t[167]=Tn):(wn=t[166],Tn=t[167]),(0,Q.useEffect)(wn,Tn);let En;t[168]===Symbol.for(`react.memo_cache_sentinel`)?(En={folderCount:0,expandedCount:0},t[168]=En):En=t[168];let Dn=(0,Q.useRef)(En),On=(0,Q.useRef)(fn),kn=(0,Q.useRef)(un),An;t[169]===fn?An=t[170]:(An=()=>{On.current=fn,kn.current=un},t[169]=fn,t[170]=An),(0,Q.useEffect)(An);let jn,Mn;t[171]===J?(jn=t[172],Mn=t[173]):(jn=()=>({startCreating(e,t){On.current(e,t)},startCreatingFromTemplate(e){kn.current(e)},createFromTemplate(e,t){On.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of mt.current){let t=nU(J.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(fe.current);(0,Q.startTransition)(()=>{for(let t of[...mt.current].reverse()){if(e.has(t))continue;let n=nU(J.getItem(t));n&&n.collapse()}})},getFolderState(){let e=mt.current,t=0;for(let n of e)nU(J.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Dn.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Dn.current=i,i},subscribe(e){return J.subscribe(e)}}),Mn=[J],t[171]=J,t[172]=jn,t[173]=Mn),(0,Q.useImperativeHandle)(n,jn,Mn);let Nn;t[174]!==Pt||t[175]!==u||t[176]!==c||t[177]!==J?(Nn=async function(e,t,n){let r=sW(e,re.current,mt.current),i=me.current;i&&e.some(e=>cW(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Pt(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(CW).map(SW)]);c([...[...a].map(xW),...[...o].map(bW),...[...s].map(yW)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?vA(t.path):t.kind===`asset`?t.path:pA(t.path,t.docExt);J.getItem(e)&&J.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}k(e=>{let t=BA(e,[...a],void 0,[...s]);for(let e of o)t=BA(t,[],e);return Tt(t),t}),vi([`files`,`backlinks`,`graph`])},t[174]=Pt,t[175]=u,t[176]=c,t[177]=J,t[178]=Nn):Nn=t[178];let Pn=Nn,Fn;t[179]!==r||t[180]!==Pn?(Fn=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;R(a.path);let o=await L(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!o.ok)return i.length>0&&await Pn(i,t,n),X.error(o.title),!1;let s=Ee(mi,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await Pn(i,t,n),!0},t[179]=r,t[180]=Pn,t[181]=Fn):Fn=t[181];let In=Fn,Ln;t[182]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=async function(e,t,n){let r=[],i=[];for(let a of e){R(a.path);let e=GA(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:YH(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[182]=Ln):Ln=t[182];let Rn=Ln,zn;t[183]===r?zn=t[184]:(zn=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await L(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),i.push({target:a,reason:o.title});continue}let s=Ee(Yi,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length;X.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`vEJDlt`})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[183]=r,t[184]=zn);let Bn=zn,Vn;t[185]!==r||t[186]!==U||t[187]!==Pn||t[188]!==In||t[189]!==Bn||t[190]!==xt||t[191]!==W?(Vn=async function(e){let t=e.map(e=>VA(e,re.current)),n=t[0];if(!n)return;let i=U.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(vW),t=i.length>e.length?`, +${i.length-e.length} more`:``;X.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}R(n.path),B(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&W){let{trashed:e,failed:n}=await Rn(t,a,W);if(e.length>0){let t=await Bn(e);t?await Pn(e,t.deletedDocNames,t.deletedFolderPaths):await Pn(e,e.filter(_W).map(gW),e.filter(hW).map(mW))}n.length>0&&H({failed:n,originalTargets:[...t]}),R(null)}else{let e=await In(t);R(null),e||xt()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),R(null),xt()}},t[185]=r,t[186]=U,t[187]=Pn,t[188]=In,t[189]=Bn,t[190]=xt,t[191]=W,t[192]=Vn):Vn=t[192];let Hn=Vn,Un;t[193]!==r||t[194]!==In||t[195]!==xt||t[196]!==V?(Un=async function(){if(!V)return;let e=new Set(V.failed.map(pW)),t=V.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(H(null),t.length!==0){R(t[0]?.path??null);try{let e=await In(t);R(null),e||xt()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),R(null),xt()}}},t[193]=r,t[194]=In,t[195]=xt,t[196]=V,t[197]=Un):Un=t[197];let Wn=Un,Gn;t[198]!==Hn||t[199]!==V?(Gn=async function(){if(!V)return;let e=new Set(V.failed.map(fW)),t=V.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));H(null),await Hn(t)},t[198]=Hn,t[199]=V,t[200]=Gn):Gn=t[200];let Kn=Gn,qn=(0,Q.useRef)(Hn),Yn;t[201]===Hn?Yn=t[202]:(Yn=()=>{qn.current=Hn},t[201]=Hn,t[202]=Yn),(0,Q.useEffect)(Yn);let Xn,Zn;t[203]===Symbol.for(`react.memo_cache_sentinel`)?(Xn=()=>uU(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=re.current.find(e=>Gi(e)&&e.docName===t);qn.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){qn.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){qn.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),Zn=[],t[203]=Xn,t[204]=Zn):(Xn=t[203],Zn=t[204]),(0,Q.useEffect)(Xn,Zn);let $n,er;t[205]===Symbol.for(`react.memo_cache_sentinel`)?($n=()=>mU(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=re.current.find(e=>Gi(e)&&e.docName===t);At.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){At.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),er=[],t[205]=$n,t[206]=er):($n=t[205],er=t[206]),(0,Q.useEffect)($n,er);let nr,rr;t[207]===J?(nr=t[208],rr=t[209]):(nr=()=>fU(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=pA(t,re.current.find(e=>Gi(e)&&e.docName===t)?.docExt);J.startRenaming(n);return}if(e.kind===`folder`){J.startRenaming(e.folderPath);return}if(e.kind===`asset`){J.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),rr=[J],t[207]=J,t[208]=nr,t[209]=rr),(0,Q.useEffect)(nr,rr);let ir;t[210]===Symbol.for(`react.memo_cache_sentinel`)?(ir=function(){let e=_e.current;e&&IU(e),_e.current=null},t[210]=ir):ir=t[210];let ar=ir,or;t[211]===h?or=t[212]:(or=function(e){let t=FW(e.nativeEvent);if(!t||t.endsWith(`/`)){ar();return}let n=mA(t),r=re.current.find(e=>hA(e)===t);if(r&&Jn(r)){ar();return}if(r&&Gi(r)&&wr(r.size)){ar();return}_e.current!==n&&(ar(),_e.current=n,FU(n,e=>h(e)))},t[211]=h,t[212]=or);let sr=or,lr;t[213]!==K||t[214]!==J||t[215]!==E?(lr=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=IW(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?vA(n):n;if(J.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=_A(r);if(window.location.hash===Tr(e))return;queueMicrotask(()=>E(e));return}let i=mA(r);window.location.hash!==yr(i)&&queueMicrotask(()=>K(r))},t[213]=K,t[214]=J,t[215]=E,t[216]=lr):lr=t[216];let ur=lr;if(A){let e;return t[217]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(RW,{}),t[217]=e):e=t[217],e}if(O.length===0){if(M){let e;return t[218]===M?e=t[219]:(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:M})}),t[218]=M,t[219]=e),e}let e;t[220]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(s,{id:`xiv-dW`})}),t[220]=e):e=t[220];let n;t[221]===fn?n=t[222]:(n=()=>fn(`file`,``),t[221]=fn,t[222]=n);let r;t[223]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(s,{id:`6ibbCg`}),t[223]=r):r=t[223];let i;return t[224]===n?i=t[225]:(i=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(sa,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:n,children:r})]}),t[224]=n,t[225]=i),i}let dr=I!==null,fr=z?.targets[0]??null,pr;t[226]!==M||t[227]!==P?(pr=(M||P!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[M&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:M}),P!==null&&(0,Z.jsx)(`span`,{role:`status`,className:`px-3 pb-1 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`_HekAK`,values:{truncatedShownCount:P}})})]}),t[226]=M,t[227]=P,t[228]=pr):pr=t[228];let mr;t[229]===v?mr=t[230]:(mr=ZU(v),t[229]=v,t[230]=mr);let hr;t[231]!==dr||t[232]!==ce||t[233]!==gn||t[234]!==O||t[235]!==mn||t[236]!==pt||t[237]!==kt||t[238]!==Ge||t[239]!==Je||t[240]!==J||t[241]!==Ke||t[242]!==qe||t[243]!==fn||t[244]!==W?(hr=(e,t)=>(0,Z.jsx)(lW,{item:e,context:t,anyActionBusy:dr,workspace:W,handoff:Ge,model:J,okignoreBinding:Ke,projectLocalBinding:qe,mergedConfig:Je,onStartCreating:fn,onCreateFromTemplate:(e,t)=>fn(`file`,e,{template:t}),onDuplicate:kt,onDelete:e=>B({targets:e}),onExpandSubtree:mn,onCollapseSubtree:gn,folderTreePaths:pt,isAsset:ce.has(e.path),documents:O}),t[231]=dr,t[232]=ce,t[233]=gn,t[234]=O,t[235]=mn,t[236]=pt,t[237]=kt,t[238]=Ge,t[239]=Je,t[240]=J,t[241]=Ke,t[242]=qe,t[243]=fn,t[244]=W,t[245]=hr):hr=t[245];let _r;t[246]!==ur||t[247]!==sr||t[248]!==J||t[249]!==pr||t[250]!==mr||t[251]!==hr?(_r=(0,Z.jsx)(`div`,{ref:ke,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(uH,{header:pr,model:J,style:mr,onClickCapture:ur,onMouseMove:sr,onMouseLeave:ar,renderContextMenu:hr})}),t[246]=ur,t[247]=sr,t[248]=J,t[249]=pr,t[250]=mr,t[251]=hr,t[252]=_r):_r=t[252];let br=!!z,xr;t[253]===I?xr=t[254]:(xr=e=>{!e&&!I&&B(null)},t[253]=I,t[254]=xr);let Sr;t[255]!==r||t[256]!==I||t[257]!==z||t[258]!==Hn||t[259]!==fr?(Sr=z&&fr&&(0,Z.jsx)(Ta,{...(()=>{let e=GH(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,z.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(dW)}):null};let t=z.targets.length,n=fr.name;return{itemName:t===1?fr.kind===`folder`?`${fr.name}/`:fr.kind===`file`?`${fr.name}${fr.docExt??`.md`}`:fr.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):fr.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:I!==null,onDelete:()=>Hn(z.targets)}),t[255]=r,t[256]=I,t[257]=z,t[258]=Hn,t[259]=fr,t[260]=Sr):Sr=t[260];let Cr;t[261]!==br||t[262]!==xr||t[263]!==Sr?(Cr=(0,Z.jsx)(Ts,{open:br,onOpenChange:xr,children:Sr}),t[261]=br,t[262]=xr,t[263]=Sr,t[264]=Cr):Cr=t[264];let Er=!!V,Dr;t[265]===I?Dr=t[266]:(Dr=e=>{!e&&!I&&H(null)},t[265]=I,t[266]=Dr);let Or;t[267]!==I||t[268]!==Wn||t[269]!==Kn||t[270]!==V?(Or=V&&(0,Z.jsx)($H,{failedTargets:V.failed,isSubmitting:I!==null,onDeletePermanently:Wn,onRetry:Kn,onCancel:()=>H(null)}),t[267]=I,t[268]=Wn,t[269]=Kn,t[270]=V,t[271]=Or):Or=t[271];let kr;t[272]!==Er||t[273]!==Dr||t[274]!==Or?(kr=(0,Z.jsx)(Ts,{open:Er,onOpenChange:Dr,children:Or}),t[272]=Er,t[273]=Dr,t[274]=Or,t[275]=kr):kr=t[275];let Ar=ee!==null,jr;t[276]===Symbol.for(`react.memo_cache_sentinel`)?(jr=e=>{e||te(null)},t[276]=jr):jr=t[276];let Nr=ee?.parentDir??``,Ir;t[277]!==Ar||t[278]!==Nr?(Ir=(0,Z.jsx)(Gm,{open:Ar,onOpenChange:jr,kind:`file`,initialDir:Nr,defaultToTemplate:!0}),t[277]=Ar,t[278]=Nr,t[279]=Ir):Ir=t[279];let Lr;return t[280]!==kr||t[281]!==Ir||t[282]!==_r||t[283]!==Cr?(Lr=(0,Z.jsxs)(Z.Fragment,{children:[_r,Cr,kr,Ir]}),t[280]=kr,t[281]=Ir,t[282]=_r,t[283]=Cr,t[284]=Lr):Lr=t[284],Lr}function dW(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:KH(e)},`${e.kind}:${e.path}`)}function fW(e){return`${e.kind}:${e.path}`}function pW(e){return`${e.kind}:${e.path}`}function mW(e){return e.path}function hW(e){return e.kind===`folder`}function gW(e){return e.path}function _W(e){return e.kind===`file`}function vW(e){return e.file}function yW(e){return je(e)}function bW(e){return Le(e)}function xW(e){return Yt(e)}function SW(e){return e.path}function CW(e){return e.kind===`asset`}function wW(e){return e.endsWith(`/`)?e.slice(0,-1):e}function TW(e){return!!e}function EW(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function DW(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function OW(e){X.error(e)}function kW(){}function AW(e){return X.error(e)}function jW(){}function MW(){}async function NW(){}function PW(e){return hA(e)}function FW(e){return IW(e)?.dataset.itemPath??null}function IW(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var LW=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function RW(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=LW.map(zW),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function zW(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Pa,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Pa,{className:`h-3 ${e}`})]},t)}function BW(e){return e?Y._({id:`wTcjov`}):null}function VW(e){let t=(0,$.c)(37),{_:n}=i(),r=bh(),{merged:a}=be(),o=a?.appearance?.preview?.autoOpen??!0;if(r)return null;let{input:c,installStates:l,dispatch:u,webFallbackVisible:d}=e,f=d===void 0?!0:d,p=c===null,m,h,g,_,v,y,b;if(t[0]!==n||t[1]!==o||t[2]!==u||t[3]!==c||t[4]!==p||t[5]!==l||t[6]!==f){b=Symbol.for(`react.early_return_sentinel`);bb0:{let e=BW(p),r;t[14]===l?r=t[15]:(r=e=>l[e.id]?.installed===!0,t[14]=l,t[15]=r);let i=Ch.filter(r);g=l[`claude-code`]?.installed===!0;let a;t[16]!==o||t[17]!==c?(a=c!==null&&c.docContext!==null?fr(c.docContext.relativePath,o):``,t[16]=o,t[17]=c,t[18]=a):a=t[18];let d=a,x;t[19]!==c||t[20]!==d?(x=()=>{c!==null&&Yb(d)},t[19]=c,t[20]=d,t[21]=x):x=t[21],_=x;let S=f&&!g;if(i.length===0&&!S){b=null;break bb0}h=$A,t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(nj,{children:[(0,Z.jsx)(ya,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[22]=y):y=t[22],m=rj,v=i.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(tj,{disabled:!r,onSelect:()=>{c&&u(t.id,c)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Ub,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})}t[0]=n,t[1]=o,t[2]=u,t[3]=c,t[4]=p,t[5]=l,t[6]=f,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b}else m=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],b=t[13];if(b!==Symbol.for(`react.early_return_sentinel`))return b;let x;t[23]!==n||t[24]!==g||t[25]!==_||t[26]!==p||t[27]!==f?(x=f&&!g?(0,Z.jsxs)(tj,{onSelect:_,disabled:p,"data-testid":`empty-space-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(_t,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[23]=n,t[24]=g,t[25]=_,t[26]=p,t[27]=f,t[28]=x):x=t[28];let S;t[29]!==m||t[30]!==v||t[31]!==x?(S=(0,Z.jsxs)(m,{children:[v,x]}),t[29]=m,t[30]=v,t[31]=x,t[32]=S):S=t[32];let C;return t[33]!==h||t[34]!==y||t[35]!==S?(C=(0,Z.jsxs)(h,{children:[y,S]}),t[33]=h,t[34]=y,t[35]=S,t[36]=C):C=t[36],C}var HW=(e,t,n)=>au(e,t,n,`ProjectSwitcher`);function UW(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h=vk(),g=typeof window<`u`&&window.okDesktop!=null,_=(0,Q.useRef)(!1),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{u(e),e||f(``)},t[1]=v):v=t[1];let y=v,b;t[2]!==r||t[3]!==n.project||t[4]!==l?(b=()=>{if(!l)return;let e=!1;return HW(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=l,t[5]=b):b=t[5];let x;t[6]!==r||t[7]!==n||t[8]!==l?(x=[l,n,r],t[6]=r,t[7]=n,t[8]=l,t[9]=x):x=t[9],(0,Q.useEffect)(b,x);let S;t[10]!==r||t[11]!==n.project?(S=e=>{u(!1),HW(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=S):S=t[12];let C=S,w;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(w=()=>{u(!1),HW(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=w):w=t[16];let T=w,E;t[17]!==r||t[18]!==n.navigator?(E=()=>{u(!1),HW(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=E):E=t[19];let D=E,k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{u(!1),m(!0)},t[20]=k):k=t[20];let A=k,j=n.config.projectPath,M,N,P,F,I,L,R,z,B,V,H;if(t[21]!==r||t[22]!==h||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==j||t[26]!==l||t[27]!==C||t[28]!==o||t[29]!==d){let e;t[41]===j?e=t[42]:(e=e=>e.path!==j,t[41]=j,t[42]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;N=jo,R=l,z=y,B=!1;let u=h!==null&&`h-auto py-1.5`,p;t[43]===u?p=t[44]:(p=ea(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,u),t[43]=u,t[44]=p);let m;t[45]===r?m=t[46]:(m=r({id:`zZ_I5K`}),t[45]=r,t[46]=m);let v;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(v=g?()=>{_.current=!0}:void 0,t[47]=v):v=t[47];let b;t[48]===l?b=t[49]:(b=g?()=>{if(_.current){_.current=!1;return}y(!l)}:void 0,t[48]=l,t[49]=b);let x;t[50]===n.config.projectName?x=t[51]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=x);let S;t[52]===h?S=t[53]:(S=h===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(Be,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:h})]}),t[52]=h,t[53]=S);let w;t[54]!==x||t[55]!==S?(w=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x,S]}),t[54]=x,t[55]=S,t[56]=w):w=t[56];let T;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Zc,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=T):T=t[57],t[58]!==n.config.projectPath||t[59]!==p||t[60]!==m||t[61]!==b||t[62]!==w?(V=(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsxs)(fk,{className:p,"data-testid":`project-switcher-trigger`,"aria-label":m,title:n.config.projectPath,onPointerDown:v,onClick:b,children:[w,T]})}),t[58]=n.config.projectPath,t[59]=p,t[60]=m,t[61]=b,t[62]=w,t[63]=V):V=t[63],M=Wo,H=`start`,P=`top`,F=`min-w-[260px]`,I=`project-switcher-menu`,L=i.length===0?(0,Z.jsx)(Fo,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(qS,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(QS,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:WW,"data-testid":`project-switcher-search`}),(0,Z.jsx)(YS,{children:(0,Z.jsx)(O,{"aria-hidden":`true`})})]}),(0,Z.jsx)(To,{}),c.length===0?(0,Z.jsx)(Fo,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(s,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)($o,{disabled:e.missing,onSelect:()=>C(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?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[21]=r,t[22]=h,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=j,t[26]=l,t[27]=C,t[28]=o,t[29]=d,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=R,t[37]=z,t[38]=B,t[39]=V,t[40]=H}else M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35],R=t[36],z=t[37],B=t[38],V=t[39],H=t[40];let U;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(To,{}),t[64]=U):U=t[64];let ee,te;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(mt,{"aria-hidden":`true`,className:`text-muted-foreground`}),te=(0,Z.jsx)(s,{id:`PVUn_c`}),t[65]=ee,t[66]=te):(ee=t[65],te=t[66]);let W;t[67]===T?W=t[68]:(W=(0,Z.jsxs)($o,{onSelect:T,"data-testid":`project-switcher-open-folder`,children:[ee,te]}),t[67]=T,t[68]=W);let ne,re;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(xt,{"aria-hidden":`true`,className:`text-muted-foreground`}),re=(0,Z.jsx)(s,{id:`2Xs2jo`}),t[69]=ne,t[70]=re):(ne=t[69],re=t[70]);let G;t[71]===D?G=t[72]:(G=(0,Z.jsxs)($o,{onSelect:D,"data-testid":`project-switcher-switch-project`,children:[ne,re]}),t[71]=D,t[72]=G);let ie;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsxs)($o,{onSelect:A,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(At,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[73]=ie):ie=t[73];let K;t[74]!==M||t[75]!==P||t[76]!==F||t[77]!==I||t[78]!==L||t[79]!==W||t[80]!==G||t[81]!==H?(K=(0,Z.jsxs)(M,{align:H,side:P,className:F,"data-testid":I,children:[L,U,W,G,ie]}),t[74]=M,t[75]=P,t[76]=F,t[77]=I,t[78]=L,t[79]=W,t[80]=G,t[81]=H,t[82]=K):K=t[82];let q;t[83]!==N||t[84]!==R||t[85]!==z||t[86]!==B||t[87]!==V||t[88]!==K?(q=(0,Z.jsxs)(N,{open:R,onOpenChange:z,modal:B,children:[V,K]}),t[83]=N,t[84]=R,t[85]=z,t[86]=B,t[87]=V,t[88]=K,t[89]=q):q=t[89];let ae;t[90]!==n||t[91]!==p?(ae=(0,Z.jsx)(Nd,{open:p,onOpenChange:m,bridge:n}),t[90]=n,t[91]=p,t[92]=ae):ae=t[92];let oe;return t[93]!==q||t[94]!==ae?(oe=(0,Z.jsxs)(Z.Fragment,{children:[q,ae]}),t[93]=q,t[94]=ae,t[95]=oe):oe=t[95],oe}function WW(e){return e.stopPropagation()}function GW(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),qi(`sidebarSearchPill`)}function KW(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=ea(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(O,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(s,{id:`A1taO8`})}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(D,{className:`text-foreground/70`,children:Us(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(sa,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function qW(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:a}=i(),o=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,s;t[0]!==a||t[1]!==n.dismissible||t[2]!==r?(s=n.dismissible===!1?null:(0,Z.jsx)(sa,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":a({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(ys,{"aria-hidden":`true`,className:`size-3`})}),t[0]=a,t[1]=n.dismissible,t[2]=r,t[3]=s):s=t[3];let c=s,l=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${o}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let a;t[6]!==c||t[7]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,c]}),t[6]=c,t[7]=i,t[8]=a):a=t[8];let s;t[9]!==l||t[10]!==n.action?(s=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=l,t[10]=n.action,t[11]=s):s=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==l||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:u,children:n.secondaryAction.label}),t[14]=l,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==s||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[s,d]}),t[18]=s,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==a||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[a,f]}),t[21]=e,t[22]=r,t[23]=a,t[24]=f,t[25]=p):p=t[25],p}let u=`update-notice-${n.id}`,d=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${o}`,f;t[26]===n.body?f=t[27]:(f=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=f);let p;t[28]!==l||t[29]!==n.action?(p=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=l,t[29]=n.action,t[30]=p):p=t[30];let m;return t[31]!==c||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":u,className:d,children:[f,p,c]}),t[31]=c,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m):m=t[36],m}function JW(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 YW(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Yp,Jp,Jp),n;e[0]===t?n=e[1]:(n=JW(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),qp(r.id)},e[2]=r,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)(qW,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function XW(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?ig(n.contentDir,ag(t),n.pathSeparator):e?.kind===`folder`?ig(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?ig(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function ZW(e,t,n){if((e?.kind===`doc`||e?.kind===`folder-index`)&&t){let e=t.lastIndexOf(`/`);return e<0?n.contentDir:ig(n.contentDir,t.slice(0,e),n.pathSeparator)}if(e?.kind===`folder`)return ig(n.contentDir,e.folderPath,n.pathSeparator);if(e?.kind===`asset`){let t=e.assetPath.lastIndexOf(`/`);return t<0?n.contentDir:ig(n.contentDir,e.assetPath.slice(0,t),n.pathSeparator)}return n.contentDir}function QW(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?ag(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function $W(e,t,n){return e===null?sg({workspace:n}):e.kind===`folder`?n?cg({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?og({docName:t,workspace:n}):null}var eG={folderCount:0,expandedCount:0},tG=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function nG(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(tG)!==null}function rG(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(G,{name:`file-sidebar`,children:(0,Z.jsx)(aG,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var iG=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)(Gn,{asChild:!0,children:(0,Z.jsx)(sa,{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)(Ar,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(pr,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function aG(e){let t=(0,$.c)(195),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=yt(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:Ji(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f=typeof window<`u`&&window.okDesktop!=null,{state:p,toggleSidebar:m}=QO(),h=bh(),g=p===`expanded`,_=f&&p===`collapsed`,[v,y]=(0,Q.useState)(eG),b,x;t[3]===a?(b=t[4],x=t[5]):(b=()=>{if(a!==null)return y(a.getFolderState()),a.subscribe(()=>{y(a.getFolderState())})},x=[a],t[3]=a,t[4]=b,t[5]=x),(0,Q.useEffect)(b,x);let S,C;t[6]===a?(S=t[7],C=t[8]):(S=()=>{if(a!==null)return Nx(e=>{let t=e.initialDir??``;if(e.template){a.createFromTemplate(e.template.folder,e.template.name);return}a.startCreating(`file`,t)})},C=[a],t[6]=a,t[7]=S,t[8]=C),(0,Q.useEffect)(S,C);let w=v.folderCount>0,T=w&&v.expandedCount===v.folderCount,E=v.expandedCount===0,D=uo(``),O=uo(d===``?null:d),k=d===``?D:O,A=D.state.status===`ready`?(D.state.data.folder.templates_available?.length??0)>0:!0,j=k.state.status===`ready`?(k.state.data.folder.templates_available?.length??0)>0:!0,M=typeof window<`u`?window.okDesktop:void 0,N=No(),P=jg().states,{dispatch:F}=bg(),I;t[9]===N?I=t[10]:(I=sg({workspace:N}),t[9]=N,t[10]=I);let L=I,{projectLocalBinding:R,merged:z}=be(),B=z?.appearance?.sidebar?.showHiddenFiles??!1,V=z?.appearance?.sidebar?.showAllFiles??!1,H=w&&!T,U=w&&!E,ee=H||U,te=sG,W;t[11]!==a||t[12]!==N?(W=()=>{N&&a?.startCreating(`file`,``)},t[11]=a,t[12]=N,t[13]=W):W=t[13];let ne=W,G;t[14]!==a||t[15]!==N?(G=e=>{N&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=N,t[16]=G):G=t[16];let ie=G,K;t[17]!==a||t[18]!==N?(K=()=>{N&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=N,t[19]=K):K=t[19];let q=K,ae;t[20]===N?ae=t[21]:(ae=()=>{!N||!M||M.shell.showItemInFolder(N.contentDir)},t[20]=N,t[21]=ae);let oe=ae,se;t[22]===N?se=t[23]:(se=()=>{!N||!M||aU(M,N.contentDir)},t[22]=N,t[23]=se);let ce=se,le;t[24]!==r||t[25]!==N?(le=async()=>{if(N)try{await navigator.clipboard.writeText(N.contentDir),X.success(r({id:`6_ZOw4`}),{description:N.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))}},t[24]=r,t[25]=N,t[26]=le):le=t[26];let ue=le,de;t[27]!==r||t[28]!==R?(de=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,zr(t.error)),X.error(r({id:`P47EWZ`}),{description:zr(t.error)}))},t[27]=r,t[28]=R,t[29]=de):de=t[29];let fe=de,pe;t[30]!==r||t[31]!==R?(pe=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,zr(t.error)),X.error(r({id:`P47EWZ`}),{description:zr(t.error)}))},t[30]=r,t[31]=R,t[32]=pe):pe=t[32];let me=pe,he;t[33]===a?he=t[34]:(he=()=>{a?.expandAll()},t[33]=a,t[34]=he);let ge=he,_e;t[35]===a?_e=t[36]:(_e=()=>{a?.collapseAll()},t[35]=a,t[36]=_e);let ve=_e,ye,xe;t[37]!==V||t[38]!==U||t[39]!==H||t[40]!==B||t[41]!==p?(ye=()=>{M&&M.editor.notifyViewMenuStateChanged({showHiddenFiles:B,showAllFiles:V,canExpandAll:H,canCollapseAll:U,sidebarVisible:p===`expanded`})},xe=[M,B,V,H,U,p],t[37]=V,t[38]=U,t[39]=H,t[40]=B,t[41]=p,t[42]=ye,t[43]=xe):(ye=t[42],xe=t[43]),(0,Q.useEffect)(ye,xe);let Se,Ce;t[44]!==r||t[45]!==c||t[46]!==l||t[47]!==F||t[48]!==P||t[49]!==d||t[50]!==R||t[51]!==V||t[52]!==B||t[53]!==m||t[54]!==a||t[55]!==N?(Se=()=>{if(M)return M.onMenuAction(e=>{switch(e){case`new-doc`:if(!N||!a)return;a.startCreating(`file`,d);return;case`new-folder`:if(!N||!a)return;a.startCreating(`folder`,d);return;case`new-from-template`:if(!N||!a)return;a.startCreatingFromTemplate(d);return;case`rename`:if(!l)return;dU(l);return;case`duplicate`:if(!l)return;pU(l);return;case`move-to-trash`:if(!l)return;lU(l);return;case`reveal-in-finder`:{if(!M||!N)return;let e=XW(l,c,N);M.shell.showItemInFolder(e);return}case`open-in-terminal`:if(!M||!N)return;aU(M,ZW(l,c,N));return;case`send-to-ai`:{let e=Ch.filter(e=>P[e.id]?.installed===!0);if(e.length===0){X.error(r({id:`LKOLNn`}));return}let t=$W(l,c,N);if(!t)return;let[n]=e;if(!n)return;F(n.id,t);return}case`copy-full-path`:{if(!N)return;let e=XW(l,c,N);navigator.clipboard.writeText(e).then(()=>X.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=QW(l,c);if(e===``){X.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>X.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(R===null)return;let e=R.patch({appearance:{sidebar:{showHiddenFiles:!B}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,zr(e.error)),X.error(r({id:`P47EWZ`}),{description:zr(e.error)}));return}case`toggle-show-all-files`:{if(R===null)return;let e=R.patch({appearance:{sidebar:{showAllFiles:!V}}});e.ok||(console.warn(`[FileSidebar] toggle-show-all-files rejected:`,zr(e.error)),X.error(r({id:`P47EWZ`}),{description:zr(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`toggle-sidebar`:m();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},Ce=[M,a,N,l,c,d,R,B,V,P,F,m,r],t[44]=r,t[45]=c,t[46]=l,t[47]=F,t[48]=P,t[49]=d,t[50]=R,t[51]=V,t[52]=B,t[53]=m,t[54]=a,t[55]=N,t[56]=Se,t[57]=Ce):(Se=t[56],Ce=t[57]),(0,Q.useEffect)(Se,Ce);let we=f&&g&&`motion-safe:delay-100`,Te=_&&`opacity-0`,Ee;t[58]!==we||t[59]!==Te?(Ee=ea(`flex-row h-12 items-center py-0 px-3`,f?`justify-end`:`justify-between`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,we,Te,f&&`[-webkit-app-region:drag]`),t[58]=we,t[59]=Te,t[60]=Ee):Ee=t[60];let De;t[61]===g?De=t[62]:(De=g&&!f?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(s,{id:`sER-bs`})}):null,t[61]=g,t[62]=De);let Oe;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=ea(`flex items-center gap-1`,f&&`[&>*]:[-webkit-app-region:no-drag]`),t[63]=Oe):Oe=t[63];let ke;t[64]!==r||t[65]!==T||t[66]!==w||t[67]!==E||t[68]!==a?(ke=w?(0,Z.jsxs)(jo,{children:[(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsx)(iG,{icon:xl,label:r({id:`Lu_dOh`})})}),(0,Z.jsxs)(Wo,{align:`end`,children:[T?null:(0,Z.jsxs)($o,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(eu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}),E?null:(0,Z.jsxs)($o,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(ul,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]})]})]}):null,t[64]=r,t[65]=T,t[66]=w,t[67]=E,t[68]=a,t[69]=ke):ke=t[69];let Ae;t[70]===r?Ae=t[71]:(Ae=r({id:`MW64zN`}),t[70]=r,t[71]=Ae);let je;t[72]!==d||t[73]!==a?(je=()=>a?.startCreating(`file`,d),t[72]=d,t[73]=a,t[74]=je):je=t[74];let Me;t[75]!==Ae||t[76]!==je?(Me=(0,Z.jsx)(iG,{icon:Kl,label:Ae,onClick:je}),t[75]=Ae,t[76]=je,t[77]=Me):Me=t[77];let Ne;t[78]!==r||t[79]!==j||t[80]!==d||t[81]!==a?(Ne=j?(0,Z.jsxs)(jo,{children:[(0,Z.jsx)(Bo,{asChild:!0,children:(0,Z.jsx)(iG,{icon:Ao,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(Wo,{align:`end`,children:(0,Z.jsx)(tU,{parentDir:d,onSelectTemplate:e=>a?.createFromTemplate(d,e),ItemComponent:$o})})]}):null,t[78]=r,t[79]=j,t[80]=d,t[81]=a,t[82]=Ne):Ne=t[82];let Pe;t[83]===r?Pe=t[84]:(Pe=r({id:`tX5yOZ`}),t[83]=r,t[84]=Pe);let Fe;t[85]!==d||t[86]!==a?(Fe=()=>a?.startCreating(`folder`,d),t[85]=d,t[86]=a,t[87]=Fe):Fe=t[87];let Ie;t[88]!==Pe||t[89]!==Fe?(Ie=(0,Z.jsx)(iG,{icon:fl,label:Pe,onClick:Fe}),t[88]=Pe,t[89]=Fe,t[90]=Ie):Ie=t[90];let Le;t[91]!==ke||t[92]!==Me||t[93]!==Ne||t[94]!==Ie?(Le=(0,Z.jsxs)(`div`,{className:Oe,children:[ke,Me,Ne,Ie]}),t[91]=ke,t[92]=Me,t[93]=Ne,t[94]=Ie,t[95]=Le):Le=t[95];let Re;t[96]!==Ee||t[97]!==De||t[98]!==Le?(Re=(0,Z.jsxs)(ok,{"data-electron-drag":f?``:void 0,className:Ee,children:[De,Le]}),t[96]=Ee,t[97]=De,t[98]=Le,t[99]=Re):Re=t[99];let ze=f&&g&&`motion-safe:delay-100`,Be=_&&`opacity-0`,Ve;t[100]!==ze||t[101]!==Be?(Ve=ea(`px-2 pb-2`,f&&`[-webkit-app-region:no-drag]`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,ze,Be),t[100]=ze,t[101]=Be,t[102]=Ve):Ve=t[102];let He;t[103]===p?He=t[104]:(He=[p],t[103]=p,t[104]=He);let Ue;t[105]===n?Ue=t[106]:(Ue=(0,Z.jsx)(KW,{onClick:n}),t[105]=n,t[106]=Ue);let We;t[107]!==He||t[108]!==Ue?(We=(0,Z.jsx)(re,{fallbackRender:oG,onError:GW,resetKeys:He,children:Ue}),t[107]=He,t[108]=Ue,t[109]=We):We=t[109];let Ge;t[110]!==Ve||t[111]!==We?(Ge=(0,Z.jsx)(`div`,{className:Ve,children:We}),t[110]=Ve,t[111]=We,t[112]=Ge):Ge=t[112];let Ke;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Z.jsxs)(ck,{children:[(0,Z.jsx)(Jj,{}),(0,Z.jsx)(uW,{ref:o})]}),t[113]=Ke):Ke=t[113];let qe;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsxs)(sk,{className:`px-0`,children:[(0,Z.jsx)(YW,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(lk,{children:(0,Z.jsx)(uk,{children:(0,Z.jsx)(UW,{bridge:window.okDesktop})})}):null]}),t[114]=qe):qe=t[114];let Je=!(h&&p===`collapsed`),Ye;t[115]===Je?Ye=t[116]:(Ye=(0,Z.jsx)(ik,{enableToggle:!1,enableDrag:Je}),t[115]=Je,t[116]=Ye);let Xe;t[117]!==Re||t[118]!==Ge||t[119]!==Ye?(Xe=(0,Z.jsx)(QA,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:te,children:[Re,Ge,Ke,qe,Ye]})}),t[117]=Re,t[118]=Ge,t[119]=Ye,t[120]=Xe):Xe=t[120];let Ze=!N,Qe,$e;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Kl,{"aria-hidden":`true`}),$e=(0,Z.jsx)(s,{id:`MW64zN`}),t[121]=Qe,t[122]=$e):(Qe=t[121],$e=t[122]);let et;t[123]!==ne||t[124]!==Ze?(et=(0,Z.jsxs)(tj,{disabled:Ze,onSelect:ne,"data-testid":`empty-space-menu-new-file`,children:[Qe,$e]}),t[123]=ne,t[124]=Ze,t[125]=et):et=t[125];let nt;t[126]!==ie||t[127]!==A||t[128]!==N?(nt=A?(0,Z.jsxs)($A,{children:[(0,Z.jsxs)(nj,{disabled:!N,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(Ao,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(rj,{children:(0,Z.jsx)(tU,{parentDir:``,onSelectTemplate:ie,ItemComponent:tj})})]}):null,t[126]=ie,t[127]=A,t[128]=N,t[129]=nt):nt=t[129];let rt=!N,it,at;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(fl,{"aria-hidden":`true`}),at=(0,Z.jsx)(s,{id:`tX5yOZ`}),t[130]=it,t[131]=at):(it=t[130],at=t[131]);let J;t[132]!==q||t[133]!==rt?(J=(0,Z.jsxs)(tj,{disabled:rt,onSelect:q,"data-testid":`empty-space-menu-new-folder`,children:[it,at]}),t[132]=q,t[133]=rt,t[134]=J):J=t[134];let ot;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(ot=(0,Z.jsx)(aj,{}),t[135]=ot):ot=t[135];let st;t[136]!==r||t[137]!==oe||t[138]!==N?(st=M?(0,Z.jsxs)(tj,{disabled:!N,onSelect:oe,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(N?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(mt,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[136]=r,t[137]=oe,t[138]=N,t[139]=st):st=t[139];let ct;t[140]!==F||t[141]!==L||t[142]!==P?(ct=(0,Z.jsx)(VW,{input:L,installStates:P,dispatch:F,webFallbackVisible:!1}),t[140]=F,t[141]=L,t[142]=P,t[143]=ct):ct=t[143];let lt;t[144]!==r||t[145]!==ce||t[146]!==N?(lt=M?(0,Z.jsxs)(tj,{disabled:!N,onSelect:ce,"data-testid":`empty-space-menu-open-in-terminal`,"aria-label":r(N?{id:`BJpGCq`}:{id:`_6IEmc`}),children:[(0,Z.jsx)(Zl,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`BJpGCq`})}),N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[144]=r,t[145]=ce,t[146]=N,t[147]=lt):lt=t[147];let ut=!N,dt;t[148]!==r||t[149]!==N?(dt=r(N?{id:`Up2_7p`}:{id:`U8CD-l`}),t[148]=r,t[149]=N,t[150]=dt):dt=t[150];let ft;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(tt,{"aria-hidden":`true`}),t[151]=ft):ft=t[151];let pt;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(pt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[152]=pt):pt=t[152];let ht;t[153]===N?ht=t[154]:(ht=N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[153]=N,t[154]=ht);let gt;t[155]!==ue||t[156]!==ut||t[157]!==dt||t[158]!==ht?(gt=(0,Z.jsxs)(tj,{disabled:ut,onSelect:ue,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":dt,children:[ft,pt,ht]}),t[155]=ue,t[156]=ut,t[157]=dt,t[158]=ht,t[159]=gt):gt=t[159];let _t;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(aj,{}),t[160]=_t):_t=t[160];let vt=R===null,bt;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(s,{id:`K_wz1u`}),t[161]=bt):bt=t[161];let xt;t[162]!==fe||t[163]!==B||t[164]!==vt?(xt=(0,Z.jsx)(ij,{checked:B,onCheckedChange:fe,disabled:vt,"data-testid":`empty-space-menu-show-hidden-files`,children:bt}),t[162]=fe,t[163]=B,t[164]=vt,t[165]=xt):xt=t[165];let St=R===null,Ct;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(s,{id:`i8dKs-`}),t[166]=Ct):Ct=t[166];let wt;t[167]!==me||t[168]!==V||t[169]!==St?(wt=(0,Z.jsx)(ij,{checked:V,onCheckedChange:me,disabled:St,"data-testid":`empty-space-menu-show-all-files`,children:Ct}),t[167]=me,t[168]=V,t[169]=St,t[170]=wt):wt=t[170];let Tt;t[171]===ee?Tt=t[172]:(Tt=ee?(0,Z.jsx)(aj,{}):null,t[171]=ee,t[172]=Tt);let Et;t[173]!==ge||t[174]!==H?(Et=H?(0,Z.jsxs)(tj,{onSelect:ge,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(eu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[173]=ge,t[174]=H,t[175]=Et):Et=t[175];let Dt;t[176]!==ve||t[177]!==U?(Dt=U?(0,Z.jsxs)(tj,{onSelect:ve,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(ul,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[176]=ve,t[177]=U,t[178]=Dt):Dt=t[178];let Ot;t[179]!==et||t[180]!==nt||t[181]!==J||t[182]!==st||t[183]!==ct||t[184]!==lt||t[185]!==gt||t[186]!==xt||t[187]!==wt||t[188]!==Tt||t[189]!==Et||t[190]!==Dt?(Ot=(0,Z.jsxs)(ej,{children:[et,nt,J,ot,st,ct,lt,gt,_t,xt,wt,Tt,Et,Dt]}),t[179]=et,t[180]=nt,t[181]=J,t[182]=st,t[183]=ct,t[184]=lt,t[185]=gt,t[186]=xt,t[187]=wt,t[188]=Tt,t[189]=Et,t[190]=Dt,t[191]=Ot):Ot=t[191];let kt;return t[192]!==Xe||t[193]!==Ot?(kt=(0,Z.jsx)(nk,{variant:`inset`,children:(0,Z.jsxs)(ZA,{children:[Xe,Ot]})}),t[192]=Xe,t[193]=Ot,t[194]=kt):kt=t[194],kt}function oG(){return null}function sG(e){nG(e.target)&&(e.preventDefault(),e.stopPropagation())}function cG(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function lG(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function uG(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var dG={phase:`loading`};function fG(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function pG(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function mG(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=uG(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function hG(e){return e!==null&&e.kind===`project-branch-switch`}function gG(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,a=r===void 0?rf:r,{_:o}=i(),c=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,SG),[l,u]=(0,Q.useState)(dG),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(!1),p;t[0]===c?p=t[1]:(p=hG(c)?c:null,t[0]=c,t[1]=p);let m=p,h;t[2]!==o||t[3]!==m?.share.target.kind?(h=m?.share.target.kind===`folder`?o({id:`ugoTXs`}):o({id:`XH30C4`}),t[2]=o,t[3]=m?.share.target.kind,t[4]=h):h=t[4];let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{u(dG),d.current=!1,f.current=!1},t[5]=_):_=t[5];let v;t[6]===c?v=t[7]:(v=[c],t[6]=c,t[7]=v),(0,Q.useEffect)(_,v);let y;t[8]!==m||t[9]!==n?(y=()=>{m&&(d.current||(d.current=!0,n.project.fetchBranchInfo({projectPath:m.projectPath,branch:m.share.branch,kind:m.share.target.kind,path:H(m.share.target)}).then(e=>{u(t=>fG(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),u(xG)})))},t[8]=m,t[9]=n,t[10]=y):y=t[10];let b;t[11]===m?b=t[12]:(b=[m],t[11]=m,t[12]=b),(0,Q.useEffect)(y,b);let x;t[13]!==o||t[14]!==m||t[15]!==l.phase||t[16]!==n||t[17]!==a||t[18]!==g?(x=()=>{if(l.phase!==`awaiting-cc1-recycle`||!m)return;let e=m.share.branch;if(!e){a.dismiss();return}if(f.current)return;f.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:m.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(lu({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:m.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:m.share.target.kind,path:H(m.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),X.error(o({id:`gQV-9w`,values:{targetNoun:g}}))}),a.dismiss();return}console.log(lu({branch_dialog_action:`branch-switch-timeout`,branch:e})),X.error(o({id:`LBwUR6`,values:{targetNoun:g}})),a.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),X.error(o({id:`Jw6EC4`,values:{targetNoun:g}})),a.dismiss())}),()=>{t=!0}},t[13]=o,t[14]=m,t[15]=l.phase,t[16]=n,t[17]=a,t[18]=g,t[19]=x):x=t[19];let S;if(t[20]!==m||t[21]!==l.phase?(S=[l.phase,m],t[20]=m,t[21]=l.phase,t[22]=S):S=t[22],(0,Q.useEffect)(x,S),!m)return null;let{share:C,projectPath:w,currentBranch:T}=m,E=C.branch,D;t[23]!==o||t[24]!==l.info||t[25]!==l.phase||t[26]!==n.project||t[27]!==w||t[28]!==C.target||t[29]!==E||t[30]!==a?(D=function(){l.phase===`ready`&&cG(l.info).switchEnabled&&(console.log(lu({branch_dialog_action:`switch`,branch_action:`switch`,branch:E})),u(e=>pG(e,H(C.target))),n.project.runCheckout({projectPath:w,branch:E}).then(e=>{let t=null,n=!1;u(r=>{let{state:i,sideEffect:a}=mG(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?X.error(o({id:`NJyQi_`,values:{shareBranch:E}})):t===`fetch-failed`?X.error(o({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&X.error(o({id:`c863eW`,values:{shareBranch:E}})),n&&a.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),u(bG),X.error(o({id:`c863eW`,values:{shareBranch:E}}))}))},t[23]=o,t[24]=l.info,t[25]=l.phase,t[26]=n.project,t[27]=w,t[28]=C.target,t[29]=E,t[30]=a,t[31]=D):D=t[31];let O=D,k;t[32]!==o||t[33]!==n.project||t[34]!==w||t[35]!==C.target||t[36]!==E||t[37]!==a||t[38]!==g?(k=function(){console.log(lu({branch_dialog_action:`open-current`,branch:E})),n.project.open({path:w,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:H(C.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),X.error(o({id:`b5aNbi`,values:{targetNoun:g}}))}),a.dismiss()},t[32]=o,t[33]=n.project,t[34]=w,t[35]=C.target,t[36]=E,t[37]=a,t[38]=g,t[39]=k):k=t[39];let A=k,j;t[40]!==o||t[41]!==l.otherWorktreePath||t[42]!==l.phase||t[43]!==n.project||t[44]!==C.target||t[45]!==E||t[46]!==a?(j=function(){if(l.phase!==`branch-in-other-worktree`)return;let e=l.otherWorktreePath;console.log(lu({branch_dialog_action:`pivot-to-other-worktree`,branch:E})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:H(C.target)},pendingBranch:E}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),X.error(o({id:`LdABLa`,values:{target:e}}))}),a.dismiss()},t[40]=o,t[41]=l.otherWorktreePath,t[42]=l.phase,t[43]=n.project,t[44]=C.target,t[45]=E,t[46]=a,t[47]=j):j=t[47];let M=j,N;t[48]===a?N=t[49]:(N=function(){console.log(lu({branch_dialog_action:`cancel`})),a.dismiss()},t[48]=a,t[49]=N);let P=N,F,I,L,R,z,B,V,U,ee,te,W,ne,re,G,ie,K,q;if(t[50]!==o||t[51]!==l.info||t[52]!==l.otherWorktreePath||t[53]!==l.phase||t[54]!==P||t[55]!==T||t[56]!==C.branch||t[57]!==C.owner||t[58]!==C.repo||t[59]!==C.target||t[60]!==E||t[61]!==g){q=l.phase===`ready`||l.phase===`switching`?cG(l.info):null;let e;t[79]!==l.info||t[80]!==l.phase||t[81]!==T?(e=l.phase===`ready`||l.phase===`switching`?lG(l.info):T??`HEAD`,t[79]=l.info,t[80]=l.phase,t[81]=T,t[82]=e):e=t[82];let n=e;B=l.phase===`switching`||l.phase===`awaiting-cc1-recycle`;let r;t[83]===o?r=t[84]:(r=o({id:`OuY8t9`}),t[83]=o,t[84]=r),R=r;let i;t[85]!==o||t[86]!==E?(i=o({id:`_BthEY`,values:{shareBranch:E}}),t[85]=o,t[86]=E,t[87]=i):i=t[87],z=i;let a=l.phase===`loading`,c=l.phase===`error`;L=Ts,ie=!0,t[88]===P?K=t[89]:(K=e=>{e||P()},t[88]=P,t[89]=K),I=xs,te=`sm:max-w-xl`,W=`share-branch-switch-dialog`,ne=yG,re=vG;let u;t[90]===g?u=t[91]:(u=(0,Z.jsx)(bs,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:g}})}),t[90]=g,t[91]=u);let d=C.owner,f=C.repo,p;t[92]===C.target?p=t[93]:(p=H(C.target),t[92]=C.target,t[93]=p);let m;t[94]!==C.owner||t[95]!==C.repo||t[96]!==p?(m=(0,Z.jsx)(vs,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`f8jU-L`,values:{0:d,1:f,2:p}})}),t[94]=C.owner,t[95]=C.repo,t[96]=p,t[97]=m):m=t[97],t[98]!==u||t[99]!==m?(G=(0,Z.jsxs)(ws,{children:[u,m]}),t[98]=u,t[99]=m,t[100]=G):G=t[100],F=Ss;let h=C.owner,_=C.repo,v;t[101]===C.target?v=t[102]:(v=H(C.target),t[101]=C.target,t[102]=v),t[103]!==C.branch||t[104]!==C.owner||t[105]!==C.repo||t[106]!==C.target.kind||t[107]!==v?(V=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(Yd,{owner:h,repo:_,path:v,kind:C.target.kind,branch:C.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=C.branch,t[104]=C.owner,t[105]=C.repo,t[106]=C.target.kind,t[107]=v,t[108]=V):V=t[108],U=l.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(s,{id:`yjExfe`,values:{shareBranch:E},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:l.otherWorktreePath})]}):a?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Ce,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`w4hMYl`})}):q?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XnoA1k`,values:{targetNoun:g,shareBranch:E},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`sZ2IOu`,values:{targetNoun:g,shareBranch:E,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_902BE`,values:{targetNoun:g,shareBranch:E,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),ee=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(s,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(_G)})]}):null,t[50]=o,t[51]=l.info,t[52]=l.otherWorktreePath,t[53]=l.phase,t[54]=P,t[55]=T,t[56]=C.branch,t[57]=C.owner,t[58]=C.repo,t[59]=C.target,t[60]=E,t[61]=g,t[62]=F,t[63]=I,t[64]=L,t[65]=R,t[66]=z,t[67]=B,t[68]=V,t[69]=U,t[70]=ee,t[71]=te,t[72]=W,t[73]=ne,t[74]=re,t[75]=G,t[76]=ie,t[77]=K,t[78]=q}else F=t[62],I=t[63],L=t[64],R=t[65],z=t[66],B=t[67],V=t[68],U=t[69],ee=t[70],te=t[71],W=t[72],ne=t[73],re=t[74],G=t[75],ie=t[76],K=t[77],q=t[78];let ae;t[109]===B?ae=t[110]:(ae=B?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Ce,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CU3AiE`})]}):null,t[109]=B,t[110]=ae);let oe;t[111]!==F||t[112]!==V||t[113]!==U||t[114]!==ee||t[115]!==ae?(oe=(0,Z.jsxs)(F,{children:[V,U,ee,ae]}),t[111]=F,t[112]=V,t[113]=U,t[114]=ee,t[115]=ae,t[116]=oe):oe=t[116];let se;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(s,{id:`dEgA5A`}),t[117]=se):se=t[117];let ce;t[118]===P?ce=t[119]:(ce=(0,Z.jsx)(sa,{variant:`ghost`,className:`font-mono uppercase`,onClick:P,"data-testid":`share-branch-switch-cancel`,children:se}),t[118]=P,t[119]=ce);let le;t[120]!==l.phase||t[121]!==A||t[122]!==M||t[123]!==O||t[124]!==R||t[125]!==z||t[126]!==B||t[127]!==q?(le=l.phase===`branch-in-other-worktree`?(0,Z.jsx)(sa,{onClick:M,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(s,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[q?.openCurrentEnabled?(0,Z.jsxs)(sa,{variant:`outline`,className:`font-mono uppercase`,onClick:A,disabled:B,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(Tl,{className:`size-3.5`,"aria-hidden":!0}),R]}):null,(0,Z.jsx)(sa,{onClick:O,disabled:!q?.switchEnabled||B,"aria-disabled":!q?.switchEnabled||B,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:B?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ce,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),z]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0}),z]})})]}),t[120]=l.phase,t[121]=A,t[122]=M,t[123]=O,t[124]=R,t[125]=z,t[126]=B,t[127]=q,t[128]=le):le=t[128];let ue;t[129]!==ce||t[130]!==le?(ue=(0,Z.jsxs)(Cs,{className:`sm:justify-between`,children:[ce,le]}),t[129]=ce,t[130]=le,t[131]=ue):ue=t[131];let de;t[132]!==I||t[133]!==te||t[134]!==W||t[135]!==ne||t[136]!==re||t[137]!==G||t[138]!==oe||t[139]!==ue?(de=(0,Z.jsxs)(I,{className:te,"data-testid":W,onInteractOutside:ne,onPointerDownOutside:re,children:[G,oe,ue]}),t[132]=I,t[133]=te,t[134]=W,t[135]=ne,t[136]=re,t[137]=G,t[138]=oe,t[139]=ue,t[140]=de):de=t[140];let fe;return t[141]!==L||t[142]!==ie||t[143]!==K||t[144]!==de?(fe=(0,Z.jsx)(L,{open:ie,onOpenChange:K,children:de}),t[141]=L,t[142]=ie,t[143]=K,t[144]=de,t[145]=fe):fe=t[145],fe}function _G(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function vG(e){e.preventDefault()}function yG(e){e.preventDefault()}function bG(e){return mG(e,null).state}function xG(e){return fG(e,null)}function SG(){return null}function CG(){let e=(0,$.c)(17),t=Mn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=yt(),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 Ye,i=new $e({url:n,name:ki,document:e,onStateless:e=>{let{payload:t}=e;Se(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:kG,onConfigValidationRejected:OG,onConfigIgnoreNestedError:DG,onUnknown:EG})},onClose:TG,onDisconnect:wG}),a=Kr(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=B(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{vi([`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 wG(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function TG(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function EG(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function DG(e){Zo(e)}function OG(e){ts(e)}function kG(e){vi([e.ch])}var AG=`#install-claude-desktop`;function jG(e){return e===`#settings`||e===AG}function MG(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function NG(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=yt(),{openTargetTransition:i}=Mt(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=si(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=MG(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(jG(window.location.hash))return;let e=Sr(window.location.hash);if(e){let t=Kn(e.split(`.`).pop()??``);ut(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}if(nr(window.location.hash)){ut(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let n=pi(window.location.hash);if(!n){ut(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){ut(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=Zr(n,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(r.kind===`missing`&&/\/+$/.test(n.trim())){ut(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=hi(wi(r),c);ut(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function PG(){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)(FG,t),null}function FG(){let e=RG;if(!e(window.location.hash))return;let t=new AbortController;return k(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(LG))}).catch(IG),()=>t.abort()}function IG(){}function LG(){}function RG(e){return!jG(e)&&!Sr(e)&&!pi(e)&&(e===``||e===`#`||e===`#/`)}function zG(){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)(BG,t),null}function BG(){let e=function(e){let t=e.target;Ah({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=kh))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function VG(){let e=(0,$.c)(4),{activeTarget:t}=yt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function HG(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=yt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Ji(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;Um({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)(Gm,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function UG(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(G,{name:`app`,children:(0,Z.jsx)(Bt,{children:(0,Z.jsx)(me,{children:(0,Z.jsx)(Th,{children:(0,Z.jsx)(WG,{})})})})}),e[0]=t):t=e[0],t}function WG(){let e=(0,$.c)(24),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=Oh(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Yg,{}),e[0]=o):o=e[0];let s,c,l,u,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(CG,{}),c=(0,Z.jsx)(NG,{}),l=(0,Z.jsx)(PG,{}),u=(0,Z.jsx)(VG,{}),d=(0,Z.jsx)(HG,{}),e[1]=s,e[2]=c,e[3]=l,e[4]=u,e[5]=d):(s=e[1],c=e[2],l=e[3],u=e[4],d=e[5]);let f;e[6]===a?f=e[7]:(f=!a&&(0,Z.jsx)(zG,{}),e[6]=a,e[7]=f);let p,m,h,g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=!1,h=t?(0,Z.jsx)(Xg,{bridge:t}):null,g=(0,Z.jsx)(Gd,{}),p=t?(0,Z.jsx)(gG,{bridge:t}):null,e[8]=p,e[9]=m,e[10]=h,e[11]=g):(p=e[8],m=e[9],h=e[10],g=e[11]);let _;e[12]===r?_=e[13]:(_=(0,Z.jsx)(Vg,{bridge:t,open:r,onOpenChange:i}),e[12]=r,e[13]=_);let v;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[14]=v):v=e[14];let y;e[15]===a?y=e[16]:(y=!a&&(0,Z.jsx)(rG,{onOpenSearch:()=>i(!0)}),e[15]=a,e[16]=y);let b;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ak,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(Kj,{onOpenSearch:()=>i(!0)})}),e[17]=b):b=e[17];let x;e[18]===y?x=e[19]:(x=(0,Z.jsxs)($O,{className:`h-screen overflow-hidden`,children:[y,b]}),e[18]=y,e[19]=x);let S;return e[20]!==_||e[21]!==x||e[22]!==f?(S=(0,Z.jsxs)(Z.Fragment,{children:[o,(0,Z.jsxs)(xi,{children:[s,c,l,u,d,f,m,h,g,p,_,v,x]})]}),e[20]=_,e[21]=x,e[22]=f,e[23]=S):S=e[23],S}Dc(),Ef({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),zf(),pp()&&yp(),Xp(),typeof window<`u`&&Vf({bridge:window.okDesktop}),typeof window<`u`&&ep({bridge:window.okDesktop}),typeof window<`u`&&Vs({bridge:window.okDesktop}),typeof window<`u`&&Ls({bridge:window.okDesktop}),typeof window<`u`&&Wf({bridge:window.okDesktop}),typeof window<`u`&&af({bridge:window.okDesktop}),xp();var GG=new Ic({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),KG=document.getElementById(`root`);if(!KG)throw Error(`Root element not found`);var qG=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,qc.createRoot)(KG).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:Y,children:(0,Z.jsx)(wn,{client:GG,children:(0,Z.jsxs)(Ti,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Xi,{children:qG&&window.okDesktop?(0,Z.jsx)(yf,{bridge:window.okDesktop}):(0,Z.jsx)(UG,{})}),(0,Z.jsx)(wf,{richColors:!0,closeButton:!0})]})})})}));