@inkeep/open-knowledge 0.16.0-beta.10 → 0.16.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-DQGR1Ezb.mjs +2 -0
- package/dist/{dist-C8vZvWXx.mjs → dist-CqZTnpf5.mjs} +4 -4
- package/dist/{dist-B4KfITEx.mjs → dist-DPVfhYhN.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/init-3YNTYSn6.mjs +1 -0
- package/dist/{init-Cs3Wy1Db.mjs → init-DCBnQfGA.mjs} +4 -4
- package/dist/loader-C6hizjnk.mjs +1 -0
- package/dist/{loader-DIkxBt6Z.mjs → loader-DtD44ey8.mjs} +2 -2
- package/dist/{preview-DFWLUdPh.mjs → preview-Bc8AwBfy.mjs} +2 -2
- package/dist/preview-Do4s6RvY.mjs +1 -0
- package/dist/public/assets/index-Ch1_o2WE.css +1 -0
- package/dist/public/assets/{index-BUqQLsUm.js → index-FnpKwfHR.js} +3 -3
- package/dist/public/index.html +2 -2
- package/dist/{repair-launch-json-CDw99k_9.mjs → repair-launch-json--ngpmu-q.mjs} +2 -2
- package/dist/{repair-mcp-configs-Bg4XD3-n.mjs → repair-mcp-configs-BSMWvL0s.mjs} +2 -2
- package/dist/repair-skills-DsrSL9CR.mjs +1 -0
- package/dist/{repair-skills-BcVvR7s4.mjs → repair-skills-GKB8vMKU.mjs} +2 -2
- package/dist/{src-BlzVC-Zd.mjs → src-8eqet9EJ.mjs} +2 -2
- package/dist/start-BxXyben1.mjs +1 -0
- package/dist/{start-CmNmlqNL.mjs → start-CupaJc1T.mjs} +2 -2
- package/dist/{write-project-skill-BgcwKkOH.mjs → write-project-skill-VPh5xx8a.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-De-R77If.mjs +0 -2
- package/dist/init-D7I5ryQ5.mjs +0 -1
- package/dist/loader-D22jaE-I.mjs +0 -1
- package/dist/preview-DLcfiZlx.mjs +0 -1
- package/dist/public/assets/index-C428DlDI.css +0 -1
- package/dist/repair-skills-5F3DDM4z.mjs +0 -1
- package/dist/start-C8aaBdT3.mjs +0 -1
|
@@ -21,12 +21,12 @@ Error generating stack: `+e.message+`
|
|
|
21
21
|
`}function Yv(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;qv(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Jv(e,o.headerOptions):void 0)}}))}else{let s=qv(e,t,n,r,i,a,o);return s?Jv(s,o?.headerOptions):void 0}}function Xv(e,t,n,r,i,a){return Yv(e,e,t,n,r,i,a)}function Zv(e){let t=e.endsWith(`
|
|
22
22
|
`),n=e.split(`
|
|
23
23
|
`).map(e=>e+`
|
|
24
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Qv(e,t){return`${e}\u0000${t}`}function $v(e,t,n){let r=Ur(e).body,i=Ur(t).body;return r===i?``:Xv(n,r,i,``,``,{context:3})}function ey(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ht(),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=Qv(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=$v(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 ty=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-InYkbArk.js`),__vite__mapDeps([19,1,6,20]),import.meta.url)).ActivityPanelDiffView})),ny=1e4,ry=6e4;async function iy(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(e=>e.type!==`checkpoint`)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function ay(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return hs._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return hs._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return hs._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return hs._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?hs._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function oy(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function sy(e){return e.slice(0,7)}function cy(e){return e.type===`upstream`?hs._({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`?hs._({id:`B2DrPb`}):e.author}function ly(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)(pi,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(yi,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(di,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(gi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(wi,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(Si,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(bi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function uy(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)(ke,{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=$r(i),t[1]=i,t[2]=a);let o=a,s=r?Br[o]??Yr[o]:Yr[o],c;t[3]!==s||t[4]!==i?(c=s??Gn(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)(ly,{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)(El,{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)(Qc,{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)(hu,{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)(bi,{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)(Qc,{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)(hu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function dy(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function fy(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(my),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(py)},children:[r?(0,Z.jsx)(He,{className:`size-3`}):(0,Z.jsx)(Po,{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 py(e){return!e}function my(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 hy(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=ey(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)(h,{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)(h,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(ty,{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 gy(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:a,cache:o,docName:c,expanded:l,onToggleExpanded:u,onRestoreSuccess:d}=e,{_:f}=i(),p;t[0]===n.timestamp?p=t[1]:(p=ay(n.timestamp),t[0]=n.timestamp,t[1]=p);let m=p,g;t[2]===n?g=t[3]:(g=cy(n),t[2]=n,t[3]=g);let _=g,v;t[4]===n.timestamp?v=t[5]:(v=oy(n.timestamp),t[4]=n.timestamp,t[5]=v);let y=v,b;t[6]===n.sha?b=t[7]:(b=sy(n.sha),t[6]=n.sha,t[7]=b);let x=b,S=n.contributors.flatMap(_y),C;t[8]===n?C=t[9]:(C=dy(n),t[8]=n,t[9]=C);let w=C,[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useId)(),j,M;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>k.current?.abort(),M=[],t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N;t[12]!==n.sha||t[13]!==u?(N=()=>u(n.sha),t[12]=n.sha,t[13]=u,t[14]=N):N=t[14];let P=N,F;t[15]===E?F=t[16]:(F=function(){k.current?.abort(),k.current=null,O(!1),E(!1)},t[15]=E,t[16]=F);let I=F,L;t[17]!==f||t[18]!==c||t[19]!==n.sha||t[20]!==d||t[21]!==E?(L=async function(){O(!0);let e=new AbortController;k.current=e;let t=function(){e.signal.aborted||O(!1),k.current===e&&(k.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:c,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:c,sha:n.sha,err:i}),X.error(f({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)E(!1),d();else{let e=`HTTP ${r.status}`;try{let t=hr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:c,sha:n.sha,status:r.status,detail:e}),X.error(f({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=f,t[18]=c,t[19]=n.sha,t[20]=d,t[21]=E,t[22]=L):L=t[22];let R=L,z;t[23]!==n||t[24]!==r?(z=(0,Z.jsx)(uy,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=z):z=t[25];let B=z,V=l?A:void 0,H=l?`bg-muted`:`hover:bg-muted/80`,U;t[26]===H?U=t[27]:(U=[`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`,H],t[26]=H,t[27]=U);let W=U.join(` `),G;t[28]===P?G=t[29]:(G=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[28]=P,t[29]=G);let K;t[30]===B?K=t[31]:(K=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[30]=B,t[31]=K);let q;t[32]===_?q=t[33]:(q=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:_}),t[32]=_,t[33]=q);let J;t[34]!==n.timestamp||t[35]!==m?(J=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:m}),t[34]=n.timestamp,t[35]=m,t[36]=J):J=t[36];let ee;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=ee):ee=t[37];let te;t[38]===f?te=t[39]:(te=f({id:`Yea-K5`}),t[38]=f,t[39]=te);let ne;t[40]===E?ne=t[41]:(ne=e=>{e.stopPropagation(),E(!0)},t[40]=E,t[41]=ne);let re;t[42]===D?re=t[43]:(re=D?(0,Z.jsx)(h,{className:`size-3 animate-spin`}):(0,Z.jsx)(mi,{className:`size-3`}),t[42]=D,t[43]=re);let Y;t[44]!==D||t[45]!==te||t[46]!==ne||t[47]!==re?(Y=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":te,disabled:D,onClick:ne,children:re})}),t[44]=D,t[45]=te,t[46]=ne,t[47]=re,t[48]=Y):Y=t[48];let ie;t[49]===f?ie=t[50]:(ie=f({id:`Yea-K5`}),t[49]=f,t[50]=ie);let ae;t[51]===ie?ae=t[52]:(ae=(0,Z.jsx)(Ns,{side:`top`,children:ie}),t[51]=ie,t[52]=ae);let oe;t[53]!==Y||t[54]!==ae?(oe=(0,Z.jsxs)(Is,{children:[Y,ae]}),t[53]=Y,t[54]=ae,t[55]=oe):oe=t[55];let se;t[56]!==q||t[57]!==J||t[58]!==oe?(se=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[q,J,ee,oe]}),t[56]=q,t[57]=J,t[58]=oe,t[59]=se):se=t[59];let ce;t[60]===w?ce=t[61]:(ce=w.length>0&&(0,Z.jsx)(fy,{summaries:w}),t[60]=w,t[61]=ce);let le=S.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:S.join(`, `),children:S.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),ue;t[62]!==se||t[63]!==ce||t[64]!==le?(ue=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[se,ce,le]}),t[62]=se,t[63]=ce,t[64]=le,t[65]=ue):ue=t[65];let de;t[66]!==l||t[67]!==P||t[68]!==V||t[69]!==W||t[70]!==G||t[71]!==K||t[72]!==ue?(de=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":l,"aria-controls":V,"data-testid":`timeline-entry-expand`,className:W,onClick:P,onKeyDown:G,children:[K,ue]}),t[66]=l,t[67]=P,t[68]=V,t[69]=W,t[70]=G,t[71]=K,t[72]=ue,t[73]=de):de=t[73];let fe;t[74]!==o||t[75]!==a||t[76]!==A||t[77]!==c||t[78]!==n.sha||t[79]!==l?(fe=l&&(0,Z.jsx)(hy,{sha:n.sha,docName:c,cache:o,diffLayout:a,panelId:A}),t[74]=o,t[75]=a,t[76]=A,t[77]=c,t[78]=n.sha,t[79]=l,t[80]=fe):fe=t[80];let pe;t[81]!==de||t[82]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[de,fe]}),t[81]=de,t[82]=fe,t[83]=pe):pe=t[83];let me;t[84]!==I||t[85]!==E?(me=e=>{e?E(!0):I()},t[84]=I,t[85]=E,t[86]=me):me=t[86];let he;t[87]===f?he=t[88]:(he=f({id:`Pyp1NA`}),t[87]=f,t[88]=he);let ge;t[89]===he?ge=t[90]:(ge=(0,Z.jsx)(wo,{children:he}),t[89]=he,t[90]=ge);let _e;t[91]!==y||t[92]!==_||t[93]!==x||t[94]!==m?(_e={relative:m,absoluteTime:y,entrySha:x,authorName:_},t[91]=y,t[92]=_,t[93]=x,t[94]=m,t[95]=_e):_e=t[95];let ve;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(ve={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=ve):ve=t[96];let ye;t[97]===_e?ye=t[98]:(ye=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:_e,components:ve})}),t[97]=_e,t[98]=ye);let be;t[99]!==ge||t[100]!==ye?(be=(0,Z.jsxs)(Oo,{children:[ge,ye]}),t[99]=ge,t[100]=ye,t[101]=be):be=t[101];let xe;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(s,{id:`dEgA5A`}),t[102]=xe):xe=t[102];let Se;t[103]===I?Se=t[104]:(Se=(0,Z.jsx)(li,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:xe}),t[103]=I,t[104]=Se);let Ce;t[105]===R?Ce=t[106]:(Ce=()=>R(),t[105]=R,t[106]=Ce);let we;t[107]===D?we=t[108]:(we=D?(0,Z.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,t[107]=D,t[108]=we);let Te;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[109]=Te):Te=t[109];let Ee;t[110]!==D||t[111]!==Ce||t[112]!==we?(Ee=(0,Z.jsxs)(li,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:D,onClick:Ce,children:[we,Te]}),t[110]=D,t[111]=Ce,t[112]=we,t[113]=Ee):Ee=t[113];let De;t[114]!==Se||t[115]!==Ee?(De=(0,Z.jsxs)(Do,{children:[Se,Ee]}),t[114]=Se,t[115]=Ee,t[116]=De):De=t[116];let Oe;t[117]!==be||t[118]!==De?(Oe=(0,Z.jsxs)(To,{children:[be,De]}),t[117]=be,t[118]=De,t[119]=Oe):Oe=t[119];let ke;t[120]!==T||t[121]!==me||t[122]!==Oe?(ke=(0,Z.jsx)(ko,{open:T,onOpenChange:me,children:Oe}),t[120]=T,t[121]=me,t[122]=Oe,t[123]=ke):ke=t[123];let Ae;return t[124]!==pe||t[125]!==ke?(Ae=(0,Z.jsxs)(Z.Fragment,{children:[pe,ke]}),t[124]=pe,t[125]=ke,t[126]=Ae):Ae=t[126],Ae}function _y(e){return e.docs}function vy(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:a}=e,{_:o}=i(),{resolvedTheme:c}=Pr(),l=c===`dark`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_]=(0,Q.useState)(Sy),[v,y]=(0,Q.useState)(xy),b;t[1]===_?b=t[2]:(b=()=>{y(new Set),_.clear()},t[1]=_,t[2]=b);let x;t[3]===n?x=t[4]:(x=[n],t[3]=n,t[4]=x),(0,Q.useEffect)(b,x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=S):S=t[5];let C=S,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){y(new Set)},t[6]=w):w=t[6];let T=w,E,D;t[7]!==o||t[8]!==n?(E=()=>{if(!n){f([]);return}m(!0);let e=wv({baseMs:ny,maxBackoffMs:ry,isPaused:by,poll:e=>iy(n,e,{setEntries:f,setError:g,setLoading:m,unavailableMessage:o({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},D=[n,o],t[7]=o,t[8]=n,t[9]=E,t[10]=D):(E=t[9],D=t[10]),(0,Q.useEffect)(E,D);let O=!p&&!h&&d.length>0,k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Sn,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[11]=k):k=t[11];let A;t[12]!==o||t[13]!==r||t[14]!==O||t[15]!==a?(A=O&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(So,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":o({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)(bo,{value:`unified`,"aria-label":o({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Xl,{className:`size-3.5`})}),(0,Z.jsx)(bo,{value:`split`,"aria-label":o({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(ul,{className:`size-3.5`})})]})}),(0,Z.jsx)(Ns,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[12]=o,t[13]=r,t[14]=O,t[15]=a,t[16]=A):A=t[16];let j;t[17]===A?j=t[18]:(j=(0,Z.jsxs)(yn,{children:[k,A]}),t[17]=A,t[18]=j);let M;t[19]!==o||t[20]!==p?(M=p&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":o({id:`o49mDZ`}),children:[1,2,3].map(yy)}),t[19]=o,t[20]=p,t[21]=M):M=t[21];let N;t[22]!==h||t[23]!==p?(N=!p&&h&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:h})}),t[22]=h,t[23]=p,t[24]=N):N=t[24];let P;t[25]!==d||t[26]!==h||t[27]!==p?(P=!p&&!h&&d.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[25]=d,t[26]=h,t[27]=p,t[28]=P):P=t[28];let F;t[29]!==_||t[30]!==r||t[31]!==n||t[32]!==d||t[33]!==h||t[34]!==v||t[35]!==l||t[36]!==p?(F=!p&&!h&&d.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:d.map(e=>(0,Z.jsx)(gy,{entry:e,isDark:l,diffLayout:r,cache:_,docName:n,expanded:v.has(e.sha),onToggleExpanded:C,onRestoreSuccess:T},e.sha))}),t[29]=_,t[30]=r,t[31]=n,t[32]=d,t[33]=h,t[34]=v,t[35]=l,t[36]=p,t[37]=F):F=t[37];let I;t[38]!==M||t[39]!==N||t[40]!==P||t[41]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[M,N,P,F]}),t[38]=M,t[39]=N,t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;return t[43]!==j||t[44]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[j,I]}),t[43]=j,t[44]=I,t[45]=L):L=t[45],L}function yy(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Oi,{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)(Oi,{className:`h-3 w-28`}),(0,Z.jsx)(Oi,{className:`h-3 w-40`})]})]},e)}function by(){return typeof document<`u`&&document.visibilityState===`hidden`}function xy(){return new Set}function Sy(){return new hi(32)}var Cy=[{id:`outline`,icon:Pl},{id:`links`,icon:be},{id:`graph`,icon:Ll},{id:`timeline`,icon:ll}];function wy(e){return e===`outline`?hs._({id:`dD7NPy`}):e===`links`?hs._({id:`Rj01Fz`}):e===`graph`?hs._({id:`x2fr_j`}):hs._({id:`cklVjM`})}function Ty(){return n(()=>import(`./GraphPanel-_FO8Dj1z.js`),__vite__mapDeps([21,1,14,6,8,9,22,3,23,24,25,15,26,27,28,29,30,31,32,33,34,35]),import.meta.url)}var Ey=(0,Q.lazy)(async()=>({default:(await Ty()).GraphPanel})),Dy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BYzNZP-E.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent}));function Oy(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(`unified`),f=xg(),p,m,h;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==o||t[4]!==f){let e=f?Cy.filter(Ay):Cy;p=e.some(e=>e.id===a)?a:`outline`,m=c===`doc`&&e.length>1,h=m?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(So,{type:`single`,variant:`outline`,value:p,onValueChange:e=>{e&&o(e)},"aria-label":l({id:`SrOuyg`}),children:e.map(ky)})}):null,t[0]=l,t[1]=a,t[2]=c,t[3]=o,t[4]=f,t[5]=p,t[6]=m,t[7]=h}else p=t[5],m=t[6],h=t[7];let g;t[8]!==u||t[9]!==n||t[10]!==p||t[11]!==r||t[12]!==c||t[13]!==m?(g=c===`doc`?(0,Z.jsxs)(`div`,{...m?{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`}:{},className:`min-h-0 flex-1`,children:[p===`outline`&&(0,Z.jsx)(Dc,{docName:n,isSourceMode:r}),p===`links`&&(0,Z.jsx)(Cv,{docName:n}),p===`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)(Ey,{activeDocName:n})}),p===`timeline`&&(0,Z.jsx)(vy,{docName:n,diffLayout:u,onDiffLayoutChange:d})]}):(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)(Dy,{})})}),t[8]=u,t[9]=n,t[10]=p,t[11]=r,t[12]=c,t[13]=m,t[14]=g):g=t[14];let _;return t[15]!==h||t[16]!==g?(_=(0,Z.jsxs)(Z.Fragment,{children:[h,g]}),t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function ky(e){let{id:t,icon:n}=e,r=wy(t);return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(bo,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:r})]},t)}function Ay(e){return e.id===`outline`}function jy(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function My(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Ny(e){return e/100*window.innerHeight}function Py(e){return e/100*window.innerWidth}function Fy(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 Iy({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Fy(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=My(t,i);break;case`em`:r=jy(t,i);break;case`vh`:r=Ny(i);break;case`vw`:r=Py(i);break}return r}function Ly(e){return parseFloat(e.toFixed(3))}function Ry({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 zy(e){let{panels:t}=e,n=Ry({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=Ly(Iy({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Ly(Iy({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Ly(Iy({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Ly(Iy({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 By(e,t=`Assertion error`){if(!e)throw Error(t)}function Vy(e,t){return Array.from(t).sort(e===`horizontal`?Hy:Uy)}function Hy(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Uy(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Wy(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Gy(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 Ky({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}=Gy(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return By(i,`No rect found`),i}var qy;function Jy(){return qy===void 0&&(qy=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),qy}function Yy(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Vy(n,Array.from(t.children).filter(Wy).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,Ky({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=Jy()?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:Ry({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 Xy=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)}}},Zy=new Map,Qy=new Xy;function $y(e){Zy=new Map(Zy),Zy.delete(e)}function eb(e,t){for(let[t]of Zy)if(t.id===e)return t}function tb(e,t){for(let[t,n]of Zy)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function nb(){return Zy}function rb(e,t){return Qy.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function ib(e,t){let n=Zy.get(e);Zy=new Map(Zy),Zy.set(e,t),Qy.emit(`groupChange`,{group:e,prev:n,next:t})}function ab(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Gy(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 ob(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function sb(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:pb(e),b:pb(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();By(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:fb(db(n.a)),b:fb(db(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 cb=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function lb(e){let t=getComputedStyle(mb(e)??e).display;return t===`flex`||t===`inline-flex`}function ub(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||lb(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`||cb.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function db(e){let t=e.length;for(;t--;){let n=e[t];if(By(n,`Missing node`),ub(n))return n}return null}function fb(e){return e&&Number(getComputedStyle(e).zIndex)||0}function pb(e){let t=[];for(;e;)t.push(e),e=mb(e);return t}function mb(e){let{parentNode:t}=e;return ob(t)?t.host:t}function hb(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 gb({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Wy(n)||n.contains(e)||e.contains(n))return!0;if(sb(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(hb(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function _b(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Yy(r),a=ab(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&gb({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function vb(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 yb(e,t,n=0){return Math.abs(Ly(e)-Ly(t))<=n}function bb(e,t){return yb(e,t)?0:e>t?1:-1}function xb({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(bb(r,c)<0)if(a){let e=(i+c)/2;r=bb(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Ly(r),r}function Sb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(yb(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;By(u!=null,`Invalid first pivot index`),By(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];By(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(By(n!=null,`Previous layout not found for panel index ${t}`),yb(n,i)){let t=o-n;bb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];By(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(By(n!=null,`Previous layout not found for panel index ${t}`),yb(n,o)){let t=n-i;bb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];By(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&bb(i,c)<0)if(e>0){let t=c-o,n=t/2;bb(i+e,c)<0&&(e=bb(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;bb(i-e,c)<0&&(e=bb(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];By(e!=null,`Previous layout not found for panel index ${r}`);let a=xb({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];By(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=xb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!yb(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(vb(c,l))return i;{let t=e<0?d:u,r=s[t];By(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=xb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!yb(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];By(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=xb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(yb(i,s)||(t-=s-i,l[r]=s),yb(t,0))break;e>0?r--:r++}}}if(!yb(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 Cb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||bb(e[n],t[n])!==0)return!1;return!0}function wb({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(!yb(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];By(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];By(i!=null,`No layout data found for index ${e}`);let o=r[e];By(o!=null,`No layout data found for index ${e}`);let s=xb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!yb(a,0))for(let e=0;e<t.length;e++){let n=r[e];By(n!=null,`No layout data found for index ${e}`);let i=n+a,o=xb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,yb(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Tb({groupId:e,panelId:t}){let n=()=>{let t=nb();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=wb({layout:Sb({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});Cb(l,p)||ib(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&&yb(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Ry({group:t});o(Ly(Iy({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Eb(e){e.defaultPrevented||_b(e,nb()).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=Tb({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Db(e){let t=nb();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 Ob({groupId:e}){let t=()=>{let t=nb();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=wb({layout:e,panelConstraints:r});return n?o:(Cb(o,c)||ib(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function kb(e,t){let n=Db(e),r=tb(n.id,!0),i=n.separators.find(t=>t.element===e);By(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);By(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Ob({groupId:n.id}).getLayout(),c=wb({layout:Sb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Cb(s,c)||ib(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Ab(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Db(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&kb(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&kb(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&kb(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&kb(t,-5);break;case`End`:e.preventDefault(),kb(t,100);break;case`Enter`:{e.preventDefault();let n=Db(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=tb(n.id,!0),o=n.separators.find(e=>e.element===t);By(o,`Matching separator not found`);let s=a.get(o);By(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(By(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];kb(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Db(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);By(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(),kb(t,-100);break}}var jb={cursorFlags:0,state:`inactive`},Mb=new Xy;function Nb(){return jb}function Pb(e){return Mb.addListener(`change`,e)}function Fb(e){let t=jb,n={...jb};n.cursorFlags=e,jb=n,Mb.emit(`change`,{prev:t,next:n})}function Ib(e){let t=jb;jb=e,Mb.emit(`change`,{prev:t,next:e})}function Lb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=nb(),n=_b(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)}),Ib({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Rb=e=>e,zb=()=>{},Bb=1,Vb=2,Hb=4,Ub=8,Wb=3,Gb=12,Kb;function qb(){return Kb===void 0&&(Kb=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Kb=!0)),Kb}function Jb({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&&qb()){let t=(e&Bb)!==0,n=(e&Vb)!==0,r=(e&Hb)!==0,i=(e&Ub)!==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 qb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Yb=new WeakMap;function Xb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Yb.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Nb();switch(r.state){case`active`:case`hover`:{let e=Jb({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}Yb.set(e,{prevStyle:t,styleSheet:n})}function Zb({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=Sb({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Cb(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Bb:Vb;break;case`vertical`:s|=d<0?Hb:Ub;break}}else ib(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Wb:c|=s&Wb,t.movementY===0?c|=o&Gb:c|=s&Gb,Fb(c),Xb(e)}function Qb(e){let t=nb(),n=Nb();switch(n.state){case`active`:Zb({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function $b(e){if(e.defaultPrevented)return;let t=Nb(),n=nb();switch(t.state){case`active`:if(e.buttons===0){Ib({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=tb(e.group.id,!0);ib(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)}Zb({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=_b(e,n);r.length===0?t.state!==`inactive`&&Ib({cursorFlags:0,state:`inactive`}):Ib({cursorFlags:0,hitRegions:r,state:`hover`}),Xb(e.currentTarget);break}}}function ex(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Nb().state){case`hover`:Ib({cursorFlags:0,state:`inactive`})}}function tx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Nb();switch(t.state){case`active`:Ib({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Xb(e.currentTarget),t.hitRegions.forEach(e=>{let t=tb(e.group.id,!0);ib(e.group,t)}),e.preventDefault())}}function nx(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Ly(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Ly((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function rx(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Ry({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Ly(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function ix(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 ax({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=Ly(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]=Ly((r[e]??0)/a*l);else{let e=Ly(l/c.length);for(let t of c)u[t]=e}return u}function ox(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 sx=new Map;function cx(e){let t=!0;By(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=Ry({group:e});if(t===0)return;let n=tb(e.id);if(!n)return;let r=zy(e),i=n.defaultLayoutDeferred?nx(r):n.layout,a=wb({layout:ax({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Cb(n.layout,a)&&ix(n.derivedPanelConstraints,r)&&n.groupSize===t)return;ib(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else rx(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{By(!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=Ry({group:e}),s=zy(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(ox(e.panels,l)||(l=void 0));let u=wb({layout:e.mutableState.layouts[c]??l??nx(s),panelConstraints:s}),d=e.element.ownerDocument;sx.set(d,(sx.get(d)??0)+1);let f=new Map;return Yy(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),ib(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{By(!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`,Ab)}),sx.get(d)===1&&(d.addEventListener(`dblclick`,Eb,!0),d.addEventListener(`pointerdown`,Lb,!0),d.addEventListener(`pointerleave`,Qb),d.addEventListener(`pointermove`,$b),d.addEventListener(`pointerout`,ex),d.addEventListener(`pointerup`,tx,!0)),function(){t=!1,sx.set(d,Math.max(0,(sx.get(d)??0)-1)),$y(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Ab)}),sx.get(d)||(d.removeEventListener(`dblclick`,Eb,!0),d.removeEventListener(`pointerdown`,Lb,!0),d.removeEventListener(`pointerleave`,Qb),d.removeEventListener(`pointermove`,$b),d.removeEventListener(`pointerout`,ex),d.removeEventListener(`pointerup`,tx,!0)),a.disconnect()}}function lx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function ux(e){let t=(0,Q.useId)();return`${e??t}`}var dx=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function fx(e){let t=(0,Q.useRef)(e);return dx(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function px(...e){return fx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function mx(e){let t=(0,Q.useRef)({...e});return dx(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var hx=(0,Q.createContext)(null);function gx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Rb});(0,Q.useImperativeHandle)(t,()=>n.current,[]),dx(()=>{Object.assign(n.current,Ob({groupId:e}))})}function _x({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=fx(e=>{Cb(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=fx(e=>{Cb(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=ux(s),v=(0,Q.useRef)(null),[y,b]=lx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=px(v,a);gx(_,o);let C=fx((e,t)=>{let r=Nb(),i=eb(e),a=tb(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=mx({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=Vy(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Vy(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=eb(_),i=tb(_);r&&i&&ib(r,{...i,derivedPanelConstraints:zy(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 dx(()=>{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=cx(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=tb(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=rb(_,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=yb(t.collapsedSize,i[t.panelId]),a=yb(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Nb().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)(hx.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})})}_x.displayName=`Group`;function vx(){let e=(0,Q.useContext)(hx);return By(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function yx(e,t){let{id:n}=vx(),r=(0,Q.useRef)({collapse:zb,expand:zb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:zb});(0,Q.useImperativeHandle)(t,()=>r.current,[]),dx(()=>{Object.assign(r.current,Tb({groupId:n,panelId:e}))})}function bx({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=ux(c),_=mx({disabled:a}),v=(0,Q.useRef)(null),y=px(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=vx(),T=d!==null,E=fx((e,t,n)=>{d?.(e,c,n)});dx(()=>{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]),yx(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>rb(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:{...xx,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})})}bx.displayName=`Panel`;var xx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Sx(){return(0,Q.useRef)(null)}function Cx({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=wb({layout:Sb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=wb({layout:Sb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function wx({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=ux(a),l=mx({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=px(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=vx(),x=v===`horizontal`?`vertical`:`horizontal`;dx(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Pb(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=rb(_,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(Cx({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})}wx.displayName=`Separator`;var Tx=new Map;function Ex(e){let t=Tx.get(e);if(t)return t;let n=Dx(e);return Tx.set(e,n),n}async function Dx(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-CpYUNWOc.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-DrSwTBuw.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-DrSwTBuw.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-DrSwTBuw.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-Mxq-zflt.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([38,1,39,23,40]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-D0_HBszs.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-DdpCnkcu.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-4lW4ME5D.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-DrSwTBuw.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-DrSwTBuw.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-BrsGSRvH.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-B9B58-J_.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([45,1,43,39,23,41,38,40,42]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-DrSwTBuw.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-BvKrvbRb.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-D1rVZYi52.js`);return{python:e}},__vite__mapDeps([50,43,39,1,23,40]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-CfD_nMxU.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-CEHR0ONp.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-CjXb6uie.js`);return{rust:e}},__vite__mapDeps([51,39,1,23,40]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-m6QogzU7.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-CmJiKyqD.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-Bn0QvNGs.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([41,1,38,39,23,40,42,43]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-pSQcUvmU.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([46,1,39,23,40]),import.meta.url)).yaml().language;default:return null}}async function Ox(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;if(t){let e=await Ex(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-CSZcBb2g.js`);return{toml:e}},[],import.meta.url)).toml):null}var kx=te({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Ax=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function jx(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 Mx(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}=Pr(),l=jx(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=i.toLowerCase(),t=sr(e),n=c===`dark`?kx:Ax,r=!1,s=null;return Ox(e,t).then(e=>{if(r||!a.current)return;let t=[Fc,...e?[e]:[],_c.editable.of(!0),sc.readOnly.of(!0),_c.lineWrapping,n];s=new _c({state:sc.create({doc:u,extensions:t}),parent:a.current}),o.current=s}),()=>{r=!0,s?.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 Nx(e){return Jr(`/api/asset?path=${encodeURIComponent(e)}`)}function Px(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Fx(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=Nx(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)(Y,{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=Px(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(Mx,{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)(Ke,{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-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:u})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(li,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(s,{id:`qFWMl-`})}),(0,Z.jsx)(li,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{it({url:c,projectRelPath:n,ext:p.toLowerCase(),title:u,forceOsDelegation:!1})},children:(0,Z.jsx)(s,{id:`9npOH9`})})]})]})}),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 Ix(){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)(Oi,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Oi,{className:`h-4 w-full`}),(0,Z.jsx)(Oi,{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}function Lx(e){let{_:t}=i();return e===`existing-repo`?[{id:`draft-spec`,icon:_l,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Pl,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Ll,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:cu,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:_l,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:tl,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function Rx(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:a}=i(),o=Lx(n),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(void 0),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>clearTimeout(l.current),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,Q.useEffect)(u,d);let f,p;if(t[2]!==a||t[3]!==r||t[4]!==s||t[5]!==o){let e=function(e,t){Pa(t).then(()=>{c(e),clearTimeout(l.current),l.current=setTimeout(()=>c(null),1600)}).catch(zx)};t[8]===r?f=t[9]:(f=si(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=f),p=o.map(t=>{let n=t.icon,r=s===t.id;return(0,Z.jsxs)(`li`,{className:`group flex items-start gap-3 p-3.5`,"data-testid":`copy-prompt-${t.id}`,children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:t.label}),(0,Z.jsx)(`span`,{className:`truncate text-1sm leading-relaxed text-muted-foreground`,children:t.prompt})]}),(0,Z.jsxs)(li,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":a(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:si(`shrink-0 gap-1.5 transition-opacity focus-visible:opacity-100 uppercase font-mono`,r?`opacity-100`:`opacity-0 group-hover:opacity-100`),"data-testid":`copy-prompt-button-${t.id}`,children:[r?(0,Z.jsx)(Ao,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(nt,{className:`size-3.5`,"aria-hidden":`true`}),a(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=a,t[3]=r,t[4]=s,t[5]=o,t[6]=f,t[7]=p}else f=t[6],p=t[7];let m;return t[10]!==f||t[11]!==p?(m=(0,Z.jsx)(`ul`,{className:f,children:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12],m}function zx(){}var Bx={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Vx(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}=Pr(),s=Bx[r],c=s?(o===`dark`?Br[s]:void 0)??Yr[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=si(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)(pi,{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)(fi,{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)(yi,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}var Hx=(0,Q.createContext)(null);function Ux(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(Hx,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Wx(){return(0,Q.use)(Hx)}var Gx=ai(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function Kx(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=si(Gx({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var qx=`ok-preferred-agent-v1`,Jx=new Set(gg.map(e=>e.id));function Yx(e){return typeof e==`string`&&Jx.has(e)}function Xx(e){try{let t=(e??localStorage).getItem(qx);return Yx(t)?t:null}catch{return null}}function Zx(e,t){try{(t??localStorage).setItem(qx,e)}catch{}}function Qx(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:gg.find(e=>n[e.id]?.installed===!0)?.id??null}function $x(e){let t=(0,$.c)(52),{scenario:n,className:r}=e,{_:a}=i(),{states:o,refresh:c}=D_(),{dispatch:l}=g_(),u=ka(),d=Wx(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(tS),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(!1),y=_&&d!==null,b=(0,Q.useRef)(null),x=Lx(n),S;t[0]===o?S=t[1]:(S=e=>o[e.id]?.installed===!0,t[0]=o,t[1]=S);let C=gg.filter(S),w;t[2]===o?w=t[3]:(w=gg.every(e=>o[e.id]?.installed!=null),t[2]=o,t[3]=w);let T=w,E=T&&C.length===0,D,O;t[4]!==T||t[5]!==o?(D=()=>{if(!T||g.current)return;let e=Qx({lastUsed:Xx(),states:o});h(t=>e===t?t:e)},O=[T,o],t[4]=T,t[5]=o,t[6]=D,t[7]=O):(D=t[6],O=t[7]),(0,Q.useEffect)(D,O);let k=function(e){g.current=!0,v(!1),h(e),Zx(e)},A;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){g.current=!0,v(!0)},t[8]=A):A=t[8];let j=A,M;t[9]!==f||t[10]!==n||t[11]!==d||t[12]!==u?(M=function(){if(d===null)return;let e=t_({workspace:u,description:f.trim(),scenario:n});e!==null&&d.launchInTerminal(e)},t[9]=f,t[10]=n,t[11]=d,t[12]=u,t[13]=M):M=t[13];let N=M,P;t[14]!==f||t[15]!==l||t[16]!==n||t[17]!==u?(P=function(e){let t=f.trim();Zx(e);let r=t_({workspace:u,description:t,scenario:n});r!==null&&l(e,r)},t[14]=f,t[15]=l,t[16]=n,t[17]=u,t[18]=P):P=t[18];let F=P,I;t[19]!==y||t[20]!==F||t[21]!==N||t[22]!==m?(I=function(e){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),y?N():m!==null&&F(m))},t[19]=y,t[20]=F,t[21]=N,t[22]=m,t[23]=I):I=t[23];let L=I,R=function(e){p(e),b.current?.focus()};if(E){let e;t[24]===r?e=t[25]:(e=si(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[24]=r,t[25]=e);let n;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(bi,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[26]=n):n=t[26];let i;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`3IseAk`})})]}),t[27]=i):i=t[27];let a;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:gg.map(eS)}),t[28]=a):a=t[28];let o;return t[29]===e?o=t[30]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[29]=e,t[30]=o),o}let z=C.length>0,B=d!==null,V;t[31]===r?V=t[32]:(V=si(`flex w-full flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,r),t[31]=r,t[32]=V);let H;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>p(e.target.value),t[33]=H):H=t[33];let U;t[34]===a?U=t[35]:(U=a({id:`0jD-Gn`}),t[34]=a,t[35]=U);let W;t[36]===a?W=t[37]:(W=a({id:`7hctf2`}),t[36]=a,t[37]=W);let G;t[38]!==f||t[39]!==L||t[40]!==U||t[41]!==W?(G=(0,Z.jsx)(qs,{ref:b,value:f,onChange:H,onKeyDown:L,rows:4,placeholder:U,"aria-label":W,className:`min-h-[112px] resize-none rounded-2xl border-0 bg-transparent dark:bg-transparent px-4 py-3.5 text-sm leading-relaxed shadow-none focus-visible:border-0 focus-visible:ring-0`}),t[38]=f,t[39]=L,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K=x.map(e=>{let t=e.icon;return(0,Z.jsxs)(li,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>R(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)}),q;t[43]===K?q=t[44]:(q=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:K}),t[43]=K,t[44]=q);let J=m===null?(0,Z.jsx)(li,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(s,{id:`hYgDIe`})}):(0,Z.jsxs)(Kx,{children:[(0,Z.jsx)(li,{type:`button`,onClick:()=>y?N():F(m),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ru,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`hozzkE`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vx,{id:m,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`9dw5bW`,values:{0:p_(m)}})]})}),(0,Z.jsxs)(oo,{onOpenChange:e=>{e&&c()},children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,"aria-label":a({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(He,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(to,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(Ra,{"aria-label":a({id:`BBqGS9`}),children:[(0,Z.jsx)(Xa,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),C.map(e=>(0,Z.jsxs)(Da,{onSelect:()=>k(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Vx,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!y&&e.id===m?(0,Z.jsx)(Ao,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,B?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(ro,{}):null,(0,Z.jsxs)(Ra,{"aria-label":a({id:`ALhMYW`}),children:[(0,Z.jsx)(Xa,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(Da,{onSelect:()=>j(),"data-testid":`create-with-claude-cli`,"aria-label":a({id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),y?(0,Z.jsx)(Ao,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]})]})]}):null]})]})]}),ee;t[45]!==q||t[46]!==J?(ee=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[q,J]}),t[45]=q,t[46]=J,t[47]=ee):ee=t[47];let te;return t[48]!==G||t[49]!==ee||t[50]!==V?(te=(0,Z.jsxs)(`div`,{className:V,children:[G,ee]}),t[48]=G,t[49]=ee,t[50]=V,t[51]=te):te=t[51],te}function eS(e){return(0,Z.jsxs)(li,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void n_(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(Vx,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(yo,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function tS(){return Xx()}var nS=3100,rS=3;function iS(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??rS;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var aS={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}},oS=[`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 sS(e,t={}){let n=t.rng??Math.random,r=t.colors??oS,i=aS[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 cS=1.8,lS=90,uS=16,dS=380,fS=.025,pS=.1,mS=.18,hS=400,gS=9.2736,_S=18.1799,vS=14.5244,yS={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function bS(e,t){let{halfWidth:n,apexLift:r}=yS[t];return`M${e-n} ${vS+.3} Q${e} ${vS-r}, ${e+n} ${vS+.3}`}function xS(e){let t=1.5,n=.3;return`M${e-t} ${vS-n} Q${e} ${vS+1.4}, ${e+t} ${vS-n}`}var SS=15,CS=15;function wS(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 TS(e){let t=(0,$.c)(72),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o,gaze:s}=e,c=n===void 0?48:n,l=i===void 0?!0:i,u=a===void 0?`default`:a,d=o===void 0?0:o,f=s===void 0?`cursor`:s,p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={x:0,y:0},t[0]=g):g=t[0];let _=(0,Q.useRef)(g),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(0),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[1]=S):S=t[1];let[C,w]=(0,Q.useState)(S),T=(0,Q.useRef)(0),E=(0,Q.useRef)(void 0),D=u===`sleeping`,O;t[2]!==v||t[3]!==D?(O=function(){if(D)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=T.current===0?1/0:e-T.current;T.current=e;let n=iS(v,t);y(n),x(kS),w(sS(n)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},nS)},t[2]=v,t[3]=D,t[4]=O):O=t[4];let k=O,A,j;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>clearTimeout(E.current),A=[],t[5]=A,t[6]=j):(A=t[5],j=t[6]),(0,Q.useEffect)(j,A);let M,N;t[7]!==d||t[8]!==D?(M=()=>{d===0||D||(y(3),x(OS),w(sS(3)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},nS))},N=[d,D],t[7]=d,t[8]=D,t[9]=M,t[10]=N):(M=t[9],N=t[10]),(0,Q.useEffect)(M,N);let P,F;t[11]!==f||t[12]!==D||t[13]!==l?(P=()=>{if(!l||D)return;let e=f===`down`;if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=0,n=0,r=!1,i=0,a=0,o=0,s=0,c=0,u=function(){c===0&&(c=requestAnimationFrame(g))},d=function(e){t=e.clientX,n=e.clientY,r=!0,u()};function g(){c=0;let l=m.current,d=p.current;if(!l||!d){u();return}let f=r;r=!1;let g=l.getBoundingClientRect(),v=g.left+g.width/2,y=g.top+g.height*.48,b=t-v,x=n-y,S=Math.hypot(b,x),C,w,T=0,E=0;if(e)w=0,C=-uS*.8,E=cS;else{let e=Math.max(-1,Math.min(1,b/dS)),t=Math.max(-1,Math.min(1,x/dS));if(w=e*uS,C=-t*uS,S>=1){let e=Math.min(S/lS,1)*cS;T=b/S*e,E=x/S*e}}let D=Math.abs(C-i)<.01&&Math.abs(w-a)<.01&&Math.abs(T-o)<.01&&Math.abs(E-s)<.01;if(!f&&D)return;u(),i+=(C-i)*pS,a+=(w-a)*pS,d.style.transform=`perspective(${hS}px) rotateX(${i.toFixed(3)}deg) rotateY(${a.toFixed(3)}deg)`,o+=(T-o)*mS,s+=(E-s)*mS;let O=a*fS,k=-i*fS,A=o+O,j=s+k;_.current.x=A,_.current.y=j,h.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,d,{passive:!0}),u(),()=>{document.removeEventListener(`mousemove`,d),c!==0&&cancelAnimationFrame(c),c=0,p.current&&(p.current.style.transform=``),_.current={x:0,y:0},h.current?.removeAttribute(`transform`)}},F=[l,D,f],t[11]=f,t[12]=D,t[13]=l,t[14]=P,t[15]=F):(P=t[14],F=t[15]),(0,Q.useEffect)(P,F);let I;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{let e=h.current;if(!e)return;let{x:t,y:n}=_.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[16]=I):I=t[16],(0,Q.useLayoutEffect)(I);let L=v>0,R=L?v:1,z=L?`ok-blob-clicked-${v}`:null,B;t[17]===r?B=t[18]:(B=si(`ok-blob-3d-wrapper`,r),t[17]=r,t[18]=B);let V=D?`cursor-default`:`cursor-pointer`,H=`body-${b}`,U=D&&`ok-blob-sleeping`,W;t[19]!==z||t[20]!==U?(W=si(`ok-blob-group`,U,z),t[19]=z,t[20]=U,t[21]=W):W=t[21];let G;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(G=(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[22]=G):G=t[22];let K=(L||D)&&`ok-blob-eye-hidden`,q;t[23]===K?q=t[24]:(q=si(`ok-blob-eye`,K),t[23]=K,t[24]=q);let J;t[25]===q?J=t[26]:(J=(0,Z.jsx)(`ellipse`,{cx:gS,cy:vS,rx:1.2722,ry:1.9083,className:q}),t[25]=q,t[26]=J);let ee=(L||D)&&`ok-blob-eye-hidden`,te;t[27]===ee?te=t[28]:(te=si(`ok-blob-eye ok-blob-eye-right`,ee),t[27]=ee,t[28]=te);let ne;t[29]===te?ne=t[30]:(ne=(0,Z.jsx)(`ellipse`,{cx:_S,cy:vS,rx:1.2722,ry:1.9083,className:te}),t[29]=te,t[30]=ne);let re;t[31]===R?re=t[32]:(re=bS(gS,R),t[31]=R,t[32]=re);let Y=(!L||D)&&`ok-blob-eye-hidden`,ie;t[33]===Y?ie=t[34]:(ie=si(`ok-blob-happy-eye`,Y),t[33]=Y,t[34]=ie);let ae;t[35]!==re||t[36]!==ie?(ae=(0,Z.jsx)(`path`,{d:re,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[35]=re,t[36]=ie,t[37]=ae):ae=t[37];let oe;t[38]===R?oe=t[39]:(oe=bS(_S,R),t[38]=R,t[39]=oe);let se=(!L||D)&&`ok-blob-eye-hidden`,ce;t[40]===se?ce=t[41]:(ce=si(`ok-blob-happy-eye`,se),t[40]=se,t[41]=ce);let le;t[42]!==oe||t[43]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[42]=oe,t[43]=ce,t[44]=le):le=t[44];let ue;t[45]===D?ue=t[46]:(ue=D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:xS(gS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:xS(_S),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=D,t[46]=ue);let de;t[47]!==J||t[48]!==ne||t[49]!==ae||t[50]!==le||t[51]!==ue?(de=(0,Z.jsxs)(`g`,{ref:h,children:[J,ne,ae,le,ue]}),t[47]=J,t[48]=ne,t[49]=ae,t[50]=le,t[51]=ue,t[52]=de):de=t[52];let fe;t[53]!==H||t[54]!==W||t[55]!==de?(fe=(0,Z.jsxs)(`g`,{className:W,children:[G,de]},H),t[53]=H,t[54]=W,t[55]=de,t[56]=fe):fe=t[56];let pe;t[57]===D?pe=t[58]:(pe=D?(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[57]=D,t[58]=pe);let me;t[59]!==b||t[60]!==C?(me=C.length>0&&(0,Z.jsx)(`g`,{children:C.map(ES)},`firework-${b}`),t[59]=b,t[60]=C,t[61]=me):me=t[61];let he;t[62]!==k||t[63]!==c||t[64]!==V||t[65]!==fe||t[66]!==pe||t[67]!==me?(he=(0,Z.jsxs)(`svg`,{ref:m,width:c,height:c,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:V,"aria-hidden":`true`,onClick:k,onMouseDown:DS,children:[fe,pe,me]}),t[62]=k,t[63]=c,t[64]=V,t[65]=fe,t[66]=pe,t[67]=me,t[68]=he):he=t[68];let ge;return t[69]!==B||t[70]!==he?(ge=(0,Z.jsx)(`span`,{ref:p,className:B,children:he}),t[69]=B,t[70]=he,t[71]=ge):ge=t[71],ge}function ES(e){return(0,Z.jsx)(`circle`,{cx:SS+e.originDx,cy:CS+e.originDy,r:e.size,className:`ok-blob-firework`,style:wS(e)},e.id)}function DS(e){return e.preventDefault()}function OS(e){return e+1}function kS(e){return e+1}function AS(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(TS,{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}var jS=`open-knowledge:create-top-level-file`;function MS(e={}){window.dispatchEvent(new CustomEvent(jS,{detail:e}))}function NS(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(jS,t),()=>window.removeEventListener(jS,t)}function PS(e){let t=(0,$.c)(32),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=pg(),c=na(),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]===a?p=t[4]:(p=a({id:`FOGD7m`}),t[3]=a,t[4]=p);let m;t[5]!==a||t[6]!==o?(m=a(o?{id:`3DTatP`}:{id:`MqQoV-`}),t[5]=a,t[6]=o,t[7]=m):m=t[7];let h;t[8]!==n||t[9]!==p||t[10]!==m?(h=(0,Z.jsx)(AS,{title:p,subtitle:m,celebrateSignal:n}),t[8]=n,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===o?g=t[13]:(g=o?(0,Z.jsx)(Rx,{scenario:`existing-repo`}):(0,Z.jsx)($x,{scenario:`existing-repo`}),t[12]=o,t[13]=g);let _;t[14]!==u||t[15]!==f||t[16]!==d?(_=d||f||u.length>0?(0,Z.jsx)(LS,{templates:u,loading:d,error:f,onSelect:IS}):null,t[14]=u,t[15]=f,t[16]=d,t[17]=_):_=t[17];let v,y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(V,{"aria-hidden":`true`,className:`size-3`}),y=(0,Z.jsx)(s,{id:`IajAbS`}),t[18]=v,t[19]=y):(v=t[18],y=t[19]);let b;t[20]===r?b=t[21]:(b=(0,Z.jsxs)(li,{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:[v,y]}),t[20]=r,t[21]=b);let x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(li,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:FS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(no,{"aria-hidden":`true`,className:`size-3`})}})}),t[22]=x):x=t[22];let S;t[23]===b?S=t[24]:(S=(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[b,x]}),t[23]=b,t[24]=S);let C;t[25]!==S||t[26]!==_?(C=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[_,S]}),t[25]=S,t[26]=_,t[27]=C):C=t[27];let w;return t[28]!==C||t[29]!==h||t[30]!==g?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[h,g,C]}),t[28]=C,t[29]=h,t[30]=g,t[31]=w):w=t[31],w}function FS(){return MS({initialDir:``})}function IS(e,t){return MS({template:{folder:e,name:t}})}function LS(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)(ct,{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)(RS,{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 RS(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)(li,{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 zS(e){let t=(0,$.c)(15),{terminalVisible:n}=e,r=n===void 0?!1:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(US);if(e)return;let r=t.ok?jr.safeParse(n):null;r?.success?(l(WS(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=es(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(HS),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(VS);if(!e.ok)return;let n=jr.safeParse(t);n.success&&l(WS(n.data.documents))}).catch(BS)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 pb-8 pt-10`,children:(0,Z.jsx)(TS,{size:64,gaze:`down`})}),t[4]=e):e=t[4],e}let S;t[5]!==u||t[6]!==y||t[7]!==v?(S=v?y?(0,Z.jsx)(GS,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(PS,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[5]=u,t[6]=y,t[7]=v,t[8]=S):S=t[8];let C;t[9]!==o||t[10]!==i?(C=(0,Z.jsx)(cg,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[9]=o,t[10]=i,t[11]=C):C=t[11];let w;return t[12]!==S||t[13]!==C?(w=(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:[S,C]}),t[12]=S,t[13]=C,t[14]=w):w=t[14],w}function BS(){}function VS(){return null}function HS(e){return e+1}function US(){return null}function WS(e){return Zo(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function GS(e){let t=(0,$.c)(26),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o=pg(),c;t[0]===a?c=t[1]:(c=a({id:`6h4zVU`}),t[0]=a,t[1]=c);let l;t[2]!==a||t[3]!==o?(l=a(o?{id:`vGeNNQ`}:{id:`qpQwGC`}),t[2]=a,t[3]=o,t[4]=l):l=t[4];let u;t[5]!==n||t[6]!==c||t[7]!==l?(u=(0,Z.jsx)(AS,{title:c,subtitle:l,celebrateSignal:n}),t[5]=n,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===o?d=t[10]:(d=o?(0,Z.jsx)(Rx,{scenario:`new-project`}):(0,Z.jsx)($x,{scenario:`new-project`}),t[9]=o,t[10]=d);let f;t[11]!==a||t[12]!==o?(f=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[11]=a,t[12]=o,t[13]=f):f=t[13];let p;t[14]===f?p=t[15]:(p=(0,Z.jsx)(qS,{label:f}),t[14]=f,t[15]=p);let m;t[16]===r?m=t[17]:(m=(0,Z.jsx)(ng,{onPackSelect:r}),t[16]=r,t[17]=m);let h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(li,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:KS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(no,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=h):h=t[18];let g;t[19]!==p||t[20]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[p,m,h]}),t[19]=p,t[20]=m,t[21]=g):g=t[21];let _;return t[22]!==u||t[23]!==d||t[24]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[u,d,g]}),t[22]=u,t[23]=d,t[24]=g,t[25]=_):_=t[25],_}function KS(){return MS()}function qS(e){let t=(0,$.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n})}),t[0]=n,t[1]=r),r}function JS(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function YS(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)(ZS,{}),(0,Z.jsx)(Oi,{className:`h-7 w-full`}),(0,Z.jsx)(Oi,{className:`h-7 w-full`}),(0,Z.jsx)(Oi,{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=JS(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 $i(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 $i(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,sa(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):Yi[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(Yn(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 $i(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 $i(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 H=B,U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(){p(null)},t[38]=U):U=t[38];let W=U,G=!c,K;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>l(!e),t[39]=K):K=t[39];let q=`size-3 transition-transform ${c?``:`rotate-90`}`,J;t[40]===q?J=t[41]:(J=(0,Z.jsx)(Po,{className:q,"aria-hidden":!0}),t[40]=q,t[41]=J);let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=ee):ee=t[42];let te;t[43]===J?te=t[44]:(te=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[J,ee]}),t[43]=J,t[44]=te);let ne;t[45]===_?ne=t[46]:(ne=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:XS,children:_}),t[45]=_,t[46]=ne);let re;t[47]!==te||t[48]!==ne?(re=(0,Z.jsxs)(Fo,{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:[te,ne]}),t[47]=te,t[48]=ne,t[49]=re):re=t[49];let Y;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hSBIG-`})}),t[50]=Y):Y=t[50];let ie;t[51]!==u||t[52]!==x||t[53]!==H||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(ie=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)(Li,{keyName:e,value:t,declared:_o(t,jn(t)),rename:{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:z,onCommit:H,onCancel:W},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]=H,t[54]=y,t[55]=h,t[56]=C,t[57]=f,t[58]=T,t[59]=ie):ie=t[59];let ae;t[60]!==u||t[61]!==F?(ae=u?(0,Z.jsx)(ra,{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)(li,{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)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=F,t[62]=ae):ae=t[62];let oe;t[63]!==ie||t[64]!==ae?(oe=(0,Z.jsx)(No,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[Y,ie,ae]})}),t[63]=ie,t[64]=ae,t[65]=oe):oe=t[65];let se;return t[66]!==G||t[67]!==re||t[68]!==oe?(se=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Io,{open:G,onOpenChange:K,children:[re,oe]})}),t[66]=G,t[67]=re,t[68]=oe,t[69]=se):se=t[69],se}function XS(e){return e.stopPropagation()}function ZS(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Sl,{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 QS(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?hs._({id:`xOTzt5`}):t<3600?hs._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?hs._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?hs._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function $S(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function eC(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:La,label:hs._({id:`QR5SP1`}),detail:$S(i)};case`template-edit`:return{Icon:se,label:hs._({id:`-LHLx7`}),detail:$S(i)};case`template-delete`:return{Icon:K,label:hs._({id:`_gkGSK`}),detail:$S(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:$c,label:hs._({id:`KPW5WC`}),detail:`${$S(e??``)} → ${$S(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Sl,label:hs._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Sl,label:hs._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Sl,label:hs._({id:`ZQLDTl`}),detail:``};default:return{Icon:Ol,label:r.replace(/-/g,` `),detail:$S(i)}}}function tC(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?hs._({id:`B2DrPb`}):e.author||hs._({id:`Ef7StM`})}function nC(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=fs(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)(ct,{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)(Oi,{className:`h-8 w-full`}),(0,Z.jsx)(Oi,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(rC)})}),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 rC(e){let{Icon:t,label:n,detail:r}=eC(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)(hu,{className:`size-3`,"aria-hidden":!0}),tC(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:QS(e.timestamp)})]},e.sha)}function iC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function aC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=iC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function oC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function sC(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:aC(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:oC(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:aC(e,t.pageTitles),children:a}}function cC(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)(Oi,{className:`h-12 w-full`}),(0,Z.jsx)(Oi,{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)(ct,{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)(li,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(V,{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)(ta,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Ui,{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)(Va,{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)(Di,{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(lC)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Zi,{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)(zh,{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 lC(e){return e.name}function uC(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=si(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=si(`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 dC(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=si(`[&_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 fC(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=si(`[&_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 pC(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=si(`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 mC(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=si(`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 hC(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=si(`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 gC(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return hs._({id:`xOTzt5`});if(r<60)return hs._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return hs._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?hs._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function _C(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 vC(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)(pt,{className:`ml-1 size-3`}):(0,Z.jsx)($e,{className:`ml-1 size-3`}):(0,Z.jsx)(el,{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)(li,{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 yC(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=is(),d=Ha(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)(Oi,{className:`size-5 rounded`}),(0,Z.jsx)(Oi,{className:`h-7 w-48`})]}),(0,Z.jsx)(Oi,{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)(Oi,{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)(Oi,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(SC)]})]}),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=sC(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=_C(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(xC):(_(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)(ie,{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)(li,{onClick:()=>h(!0),children:[(0,Z.jsx)(V,{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)(YS,{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)(cC,{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)(nC,{folderPath:n}),t[44]=n,t[45]=k),w=`rounded-lg border`,x=uC;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)(vC,{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)(mC,{"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 H;t[58]!==j||t[59]!==v||t[60]!==g||t[61]!==B?(H=(0,Z.jsx)(vC,{label:B,sortKey:`modified`,activeKey:g,activeDir:v,onSort:j}),t[58]=j,t[59]=v,t[60]=g,t[61]=B,t[62]=H):H=t[62];let U;t[63]!==z||t[64]!==H?(U=(0,Z.jsx)(mC,{className:`w-32`,"aria-sort":z,children:H}),t[63]=z,t[64]=H,t[65]=U):U=t[65],t[66]!==R||t[67]!==U?(C=(0,Z.jsx)(dC,{children:(0,Z.jsxs)(pC,{children:[R,U]})}),t[66]=R,t[67]=U,t[68]=C):C=t[68],b=fC,S=i.length?i.map(bC):(0,Z.jsx)(pC,{children:(0,Z.jsx)(hC,{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)(zh,{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 bC(e){return(0,Z.jsxs)(pC,{children:[(0,Z.jsx)(hC,{children:(0,Z.jsxs)(`a`,{href:Ho(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)(wl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(u,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(hC,{className:`text-muted-foreground`,children:e.kind===`file`?gC(e.modified):`—`})]},e.path)}function xC(e){return e===`asc`?`desc`:`asc`}function SC(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)(Oi,{className:`size-4 rounded`}),(0,Z.jsx)(Oi,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Oi,{className:`h-4 w-16`})})]},e)}function CC(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)(vl,{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=Zr(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Zr(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)(li,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(_i,{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 wC(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(TC),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>lt(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(){C(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)(li,{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 TC(){return new Set}var EC=(0,Q.createContext)(null);function DC(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(OC),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)(EC,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function OC(){return new Map}function kC(){let e=(0,Q.use)(EC);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function AC(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var jC=AC(()=>n(()=>import(`./SettingsDialogBody-Im-nZuQD.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([52,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,53,7,13,15,25,54]),import.meta.url));function MC(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)(li,{variant:`default`,onClick:NC,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 NC(){return window.location.reload()}function PC(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(le,{fallbackRender:IC,onError:FC,children:n}),t[0]=n,t[1]=r),r}function FC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function IC(e){return(0,Z.jsx)(MC,{...e})}function LC(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function RC(e){let t=(0,$.c)(89),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=ht(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=oe(),{desktopPresent:f}=Ni(),[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=typeof window<`u`&&window.okDesktop!=null,y;t[3]===a?y=t[4]:(y=a({id:`7PzzBU`}),t[3]=a,t[4]=y);let b;t[5]===a?b=t[6]:(b=a({id:`Q6hhn8`}),t[5]=a,t[6]=b);let x;t[7]===b?x=t[8]:(x={id:`preferences`,label:b},t[7]=b,t[8]=x);let S;t[9]===a?S=t[10]:(S=a({id:`4KmEoC`}),t[9]=a,t[10]=S);let C;t[11]===S?C=t[12]:(C={id:`hotkeys`,label:S},t[11]=S,t[12]=C);let w;t[13]===a?w=t[14]:(w=a({id:`AeXO77`}),t[13]=a,t[14]=w);let T;t[15]===w?T=t[16]:(T={id:`account`,label:w},t[15]=w,t[16]=T);let E;t[17]!==x||t[18]!==C||t[19]!==T?(E=[x,C,T],t[17]=x,t[18]=C,t[19]=T,t[20]=E):E=t[20];let D;t[21]!==E||t[22]!==y?(D={id:`user`,label:y,enabled:!0,items:E},t[21]=E,t[22]=y,t[23]=D):D=t[23];let O;t[24]===a?O=t[25]:(O=a({id:`ZWyHmq`}),t[24]=a,t[25]=O);let k;t[26]===a?k=t[27]:(k=a({id:`Nu4DdT`}),t[26]=a,t[27]=k);let A;t[28]===k?A=t[29]:(A={id:`sync`,label:k},t[28]=k,t[29]=A);let j;t[30]===a?j=t[31]:(j=a({id:`A1taO8`}),t[30]=a,t[31]=j);let M;t[32]===j?M=t[33]:(M={id:`search`,label:j},t[32]=j,t[33]=M);let N;t[34]===a?N=t[35]:(N=v?[{id:`terminal`,label:a({id:`ALhMYW`})}]:[],t[34]=a,t[35]=N);let P;t[36]===a?P=t[37]:(P=a({id:`iTylMl`}),t[36]=a,t[37]=P);let F;t[38]===P?F=t[39]:(F={id:`project-templates`,label:P},t[38]=P,t[39]=F);let I;t[40]===a?I=t[41]:(I=a({id:`3zyg_A`}),t[40]=a,t[41]=I);let L;t[42]===I?L=t[43]:(L={id:`okignore`,label:I},t[42]=I,t[43]=L);let R;t[44]===a?R=t[45]:(R=a({id:`cs4mps`}),t[44]=a,t[45]=R);let z;t[46]===R?z=t[47]:(z={id:`sharing`,label:R},t[46]=R,t[47]=z);let B;t[48]!==A||t[49]!==M||t[50]!==N||t[51]!==F||t[52]!==L||t[53]!==z?(B=[A,M,...N,F,L,z],t[48]=A,t[49]=M,t[50]=N,t[51]=F,t[52]=L,t[53]=z,t[54]=B):B=t[54];let V;t[55]!==_||t[56]!==O||t[57]!==B?(V={id:`project`,label:O,enabled:_,items:B},t[55]=_,t[56]=O,t[57]=B,t[58]=V):V=t[58];let H;t[59]===a?H=t[60]:(H=a({id:`nbfdhU`}),t[59]=a,t[60]=H);let U;t[61]!==a||t[62]!==f?(U=[],t[61]=a,t[62]=f,t[63]=U):U=t[63];let W;t[64]!==H||t[65]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[64]=H,t[65]=U,t[66]=W):W=t[66];let G;t[67]!==D||t[68]!==V||t[69]!==W?(G=[D,V,W],t[67]=D,t[68]=V,t[69]=W,t[70]=G):G=t[70];let K=G,q;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(wo,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[71]=q):q=t[71];let J;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(Co,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[72]=J):J=t[72];let ee;t[73]!==p||t[74]!==K?(ee=(0,Z.jsx)(zC,{groups:K,activeId:p,onSelect:m}),t[73]=p,t[74]=K,t[75]=ee):ee=t[75];let te;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(HC,{}),t[76]=te):te=t[76];let ne=l?c:null,re;t[77]!==p||t[78]!==u||t[79]!==d||t[80]!==ne?(re=(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)(PC,{children:(0,Z.jsx)(Q.Suspense,{fallback:te,children:(0,Z.jsx)(jC,{activeId:p,userBinding:ne,okignoreBinding:u,okignoreSynced:d})})})}),t[77]=p,t[78]=u,t[79]=d,t[80]=ne,t[81]=re):re=t[81];let Y;t[82]!==ee||t[83]!==re?(Y=(0,Z.jsxs)(To,{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:[q,J,ee,re]}),t[82]=ee,t[83]=re,t[84]=Y):Y=t[84];let ie;return t[85]!==r||t[86]!==n||t[87]!==Y?(ie=(0,Z.jsx)(ko,{open:n,onOpenChange:r,children:Y}),t[85]=r,t[86]=n,t[87]=Y,t[88]=ie):ie=t[88],ie}function zC(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)(VC,{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)(BC,{}),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 BC(){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=LC(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:si(`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)(yo,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function VC(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=si(`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:si(`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 HC(){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)(Oi,{className:`h-5 w-32`}),r=(0,Z.jsx)(Oi,{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)(Oi,{className:`h-9 w-full`}),(0,Z.jsx)(Oi,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function UC(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=si(`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)(_x,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WC(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)(bx,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function GC(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=si(`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)(wx,{"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 KC(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=si(`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 qC=ai(`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 JC(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=si(qC({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:YC,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function YC(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ai(`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 XC(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=si(`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 ZC(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=si(`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)(Mo,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QC(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)(ZC,{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)(ol,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(xo,{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)(Ns,{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)(Is,{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)(gu,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(xo,{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 W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=W):W=t[43];let G;t[44]===U?G=t[45]:(G=(0,Z.jsxs)(Is,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(JC,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=K):K=t[48];let q;t[49]!==K||t[50]!==F?(q=(0,Z.jsxs)(KC,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,K]}),t[49]=K,t[50]=F,t[51]=q):q=t[51];let J;t[52]===E?J=t[53]:(J=(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]=J);let ee;t[54]===S?ee=t[55]:(ee=S({id:`oqB2ez`}),t[54]=S,t[55]=ee);let te=!w,ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(Lt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=ne):ne=t[56];let re;t[57]!==v||t[58]!==ee||t[59]!==te?(re=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:te,onClick:v,children:ne})}),t[57]=v,t[58]=ee,t[59]=te,t[60]=re):re=t[60];let Y;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=Y):Y=t[61];let ie;t[62]===re?ie=t[63]:(ie=(0,Z.jsxs)(Is,{children:[re,Y]}),t[62]=re,t[63]=ie);let ae;t[64]===S?ae=t[65]:(ae=S({id:`SiUUCS`}),t[64]=S,t[65]=ae);let oe=!w,se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(He,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=se):se=t[66];let ce;t[67]!==_||t[68]!==ae||t[69]!==oe?(ce=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ae,disabled:oe,onClick:_,children:se})}),t[67]=_,t[68]=ae,t[69]=oe,t[70]=ce):ce=t[70];let le;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=le):le=t[71];let ue;t[72]===ce?ue=t[73]:(ue=(0,Z.jsxs)(Is,{children:[ce,le]}),t[72]=ce,t[73]=ue);let de=o?`secondary`:`ghost`,fe;t[74]!==S||t[75]!==o?(fe=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=fe):fe=t[76];let pe=o?`ok-replace-input`:void 0,me;t[77]!==m||t[78]!==o?(me=()=>m(!o),t[77]=m,t[78]=o,t[79]=me):me=t[79];let he;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=he):he=t[80];let ge;t[81]!==o||t[82]!==de||t[83]!==fe||t[84]!==pe||t[85]!==me?(ge=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:de,size:`icon-sm`,"aria-label":fe,"aria-expanded":o,"aria-controls":pe,onClick:me,children:he})}),t[81]=o,t[82]=de,t[83]=fe,t[84]=pe,t[85]=me,t[86]=ge):ge=t[86];let _e;t[87]===o?_e=t[88]:(_e=(0,Z.jsx)(Ns,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=_e);let ve;t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsxs)(Is,{children:[ge,_e]}),t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(ye=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)(Mo,{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)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Jl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{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]=ye):ye=t[100];let be;t[101]===S?be=t[102]:(be=S({id:`wJo9oS`}),t[101]=S,t[102]=be);let xe;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(gs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=xe):xe=t[103];let Se;t[104]!==x||t[105]!==be?(Se=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":be,onClick:x,children:xe})}),t[104]=x,t[105]=be,t[106]=Se):Se=t[106];let Ce;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Ce):Ce=t[107];let we;t[108]===Se?we=t[109]:(we=(0,Z.jsxs)(Is,{children:[Se,Ce]}),t[108]=Se,t[109]=we);let Te;return t[110]!==q||t[111]!==J||t[112]!==ie||t[113]!==ue||t[114]!==j||t[115]!==ve||t[116]!==ye||t[117]!==we?(Te=(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,q,J,ie,ue,ve,ye,we]}),t[110]=q,t[111]=J,t[112]=ie,t[113]=ue,t[114]=j,t[115]=ve,t[116]=ye,t[117]=we,t[118]=Te):Te=t[118],Te}var $C={current:0,total:0},ew=120,tw=100;function nw(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?q(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(E,n,rw)}function rw(){return null}function iw(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
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Qv(e,t){return`${e}\u0000${t}`}function $v(e,t,n){let r=Ur(e).body,i=Ur(t).body;return r===i?``:Xv(n,r,i,``,``,{context:3})}function ey(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ht(),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=Qv(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=$v(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 ty=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-InYkbArk.js`),__vite__mapDeps([19,1,6,20]),import.meta.url)).ActivityPanelDiffView})),ny=1e4,ry=6e4;async function iy(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(e=>e.type!==`checkpoint`)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function ay(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return hs._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return hs._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return hs._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return hs._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?hs._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function oy(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function sy(e){return e.slice(0,7)}function cy(e){return e.type===`upstream`?hs._({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`?hs._({id:`B2DrPb`}):e.author}function ly(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)(pi,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(yi,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(di,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(gi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(wi,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(Si,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(bi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function uy(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)(ke,{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=$r(i),t[1]=i,t[2]=a);let o=a,s=r?Br[o]??Yr[o]:Yr[o],c;t[3]!==s||t[4]!==i?(c=s??Gn(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)(ly,{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)(El,{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)(Qc,{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)(hu,{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)(bi,{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)(Qc,{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)(hu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function dy(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function fy(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(my),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(py)},children:[r?(0,Z.jsx)(He,{className:`size-3`}):(0,Z.jsx)(Po,{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 py(e){return!e}function my(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 hy(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=ey(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)(h,{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)(h,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(ty,{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 gy(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:a,cache:o,docName:c,expanded:l,onToggleExpanded:u,onRestoreSuccess:d}=e,{_:f}=i(),p;t[0]===n.timestamp?p=t[1]:(p=ay(n.timestamp),t[0]=n.timestamp,t[1]=p);let m=p,g;t[2]===n?g=t[3]:(g=cy(n),t[2]=n,t[3]=g);let _=g,v;t[4]===n.timestamp?v=t[5]:(v=oy(n.timestamp),t[4]=n.timestamp,t[5]=v);let y=v,b;t[6]===n.sha?b=t[7]:(b=sy(n.sha),t[6]=n.sha,t[7]=b);let x=b,S=n.contributors.flatMap(_y),C;t[8]===n?C=t[9]:(C=dy(n),t[8]=n,t[9]=C);let w=C,[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useId)(),j,M;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>k.current?.abort(),M=[],t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N;t[12]!==n.sha||t[13]!==u?(N=()=>u(n.sha),t[12]=n.sha,t[13]=u,t[14]=N):N=t[14];let P=N,F;t[15]===E?F=t[16]:(F=function(){k.current?.abort(),k.current=null,O(!1),E(!1)},t[15]=E,t[16]=F);let I=F,L;t[17]!==f||t[18]!==c||t[19]!==n.sha||t[20]!==d||t[21]!==E?(L=async function(){O(!0);let e=new AbortController;k.current=e;let t=function(){e.signal.aborted||O(!1),k.current===e&&(k.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:c,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:c,sha:n.sha,err:i}),X.error(f({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)E(!1),d();else{let e=`HTTP ${r.status}`;try{let t=hr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:c,sha:n.sha,status:r.status,detail:e}),X.error(f({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=f,t[18]=c,t[19]=n.sha,t[20]=d,t[21]=E,t[22]=L):L=t[22];let R=L,z;t[23]!==n||t[24]!==r?(z=(0,Z.jsx)(uy,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=z):z=t[25];let B=z,V=l?A:void 0,H=l?`bg-muted`:`hover:bg-muted/80`,U;t[26]===H?U=t[27]:(U=[`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`,H],t[26]=H,t[27]=U);let W=U.join(` `),G;t[28]===P?G=t[29]:(G=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[28]=P,t[29]=G);let K;t[30]===B?K=t[31]:(K=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[30]=B,t[31]=K);let q;t[32]===_?q=t[33]:(q=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:_}),t[32]=_,t[33]=q);let J;t[34]!==n.timestamp||t[35]!==m?(J=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:m}),t[34]=n.timestamp,t[35]=m,t[36]=J):J=t[36];let ee;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=ee):ee=t[37];let te;t[38]===f?te=t[39]:(te=f({id:`Yea-K5`}),t[38]=f,t[39]=te);let ne;t[40]===E?ne=t[41]:(ne=e=>{e.stopPropagation(),E(!0)},t[40]=E,t[41]=ne);let re;t[42]===D?re=t[43]:(re=D?(0,Z.jsx)(h,{className:`size-3 animate-spin`}):(0,Z.jsx)(mi,{className:`size-3`}),t[42]=D,t[43]=re);let Y;t[44]!==D||t[45]!==te||t[46]!==ne||t[47]!==re?(Y=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":te,disabled:D,onClick:ne,children:re})}),t[44]=D,t[45]=te,t[46]=ne,t[47]=re,t[48]=Y):Y=t[48];let ie;t[49]===f?ie=t[50]:(ie=f({id:`Yea-K5`}),t[49]=f,t[50]=ie);let ae;t[51]===ie?ae=t[52]:(ae=(0,Z.jsx)(Ns,{side:`top`,children:ie}),t[51]=ie,t[52]=ae);let oe;t[53]!==Y||t[54]!==ae?(oe=(0,Z.jsxs)(Is,{children:[Y,ae]}),t[53]=Y,t[54]=ae,t[55]=oe):oe=t[55];let se;t[56]!==q||t[57]!==J||t[58]!==oe?(se=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[q,J,ee,oe]}),t[56]=q,t[57]=J,t[58]=oe,t[59]=se):se=t[59];let ce;t[60]===w?ce=t[61]:(ce=w.length>0&&(0,Z.jsx)(fy,{summaries:w}),t[60]=w,t[61]=ce);let le=S.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:S.join(`, `),children:S.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),ue;t[62]!==se||t[63]!==ce||t[64]!==le?(ue=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[se,ce,le]}),t[62]=se,t[63]=ce,t[64]=le,t[65]=ue):ue=t[65];let de;t[66]!==l||t[67]!==P||t[68]!==V||t[69]!==W||t[70]!==G||t[71]!==K||t[72]!==ue?(de=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":l,"aria-controls":V,"data-testid":`timeline-entry-expand`,className:W,onClick:P,onKeyDown:G,children:[K,ue]}),t[66]=l,t[67]=P,t[68]=V,t[69]=W,t[70]=G,t[71]=K,t[72]=ue,t[73]=de):de=t[73];let fe;t[74]!==o||t[75]!==a||t[76]!==A||t[77]!==c||t[78]!==n.sha||t[79]!==l?(fe=l&&(0,Z.jsx)(hy,{sha:n.sha,docName:c,cache:o,diffLayout:a,panelId:A}),t[74]=o,t[75]=a,t[76]=A,t[77]=c,t[78]=n.sha,t[79]=l,t[80]=fe):fe=t[80];let pe;t[81]!==de||t[82]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[de,fe]}),t[81]=de,t[82]=fe,t[83]=pe):pe=t[83];let me;t[84]!==I||t[85]!==E?(me=e=>{e?E(!0):I()},t[84]=I,t[85]=E,t[86]=me):me=t[86];let he;t[87]===f?he=t[88]:(he=f({id:`Pyp1NA`}),t[87]=f,t[88]=he);let ge;t[89]===he?ge=t[90]:(ge=(0,Z.jsx)(wo,{children:he}),t[89]=he,t[90]=ge);let _e;t[91]!==y||t[92]!==_||t[93]!==x||t[94]!==m?(_e={relative:m,absoluteTime:y,entrySha:x,authorName:_},t[91]=y,t[92]=_,t[93]=x,t[94]=m,t[95]=_e):_e=t[95];let ve;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(ve={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=ve):ve=t[96];let ye;t[97]===_e?ye=t[98]:(ye=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:_e,components:ve})}),t[97]=_e,t[98]=ye);let be;t[99]!==ge||t[100]!==ye?(be=(0,Z.jsxs)(Oo,{children:[ge,ye]}),t[99]=ge,t[100]=ye,t[101]=be):be=t[101];let xe;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(s,{id:`dEgA5A`}),t[102]=xe):xe=t[102];let Se;t[103]===I?Se=t[104]:(Se=(0,Z.jsx)(li,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:xe}),t[103]=I,t[104]=Se);let Ce;t[105]===R?Ce=t[106]:(Ce=()=>R(),t[105]=R,t[106]=Ce);let we;t[107]===D?we=t[108]:(we=D?(0,Z.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,t[107]=D,t[108]=we);let Te;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[109]=Te):Te=t[109];let Ee;t[110]!==D||t[111]!==Ce||t[112]!==we?(Ee=(0,Z.jsxs)(li,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:D,onClick:Ce,children:[we,Te]}),t[110]=D,t[111]=Ce,t[112]=we,t[113]=Ee):Ee=t[113];let De;t[114]!==Se||t[115]!==Ee?(De=(0,Z.jsxs)(Do,{children:[Se,Ee]}),t[114]=Se,t[115]=Ee,t[116]=De):De=t[116];let Oe;t[117]!==be||t[118]!==De?(Oe=(0,Z.jsxs)(To,{children:[be,De]}),t[117]=be,t[118]=De,t[119]=Oe):Oe=t[119];let ke;t[120]!==T||t[121]!==me||t[122]!==Oe?(ke=(0,Z.jsx)(ko,{open:T,onOpenChange:me,children:Oe}),t[120]=T,t[121]=me,t[122]=Oe,t[123]=ke):ke=t[123];let Ae;return t[124]!==pe||t[125]!==ke?(Ae=(0,Z.jsxs)(Z.Fragment,{children:[pe,ke]}),t[124]=pe,t[125]=ke,t[126]=Ae):Ae=t[126],Ae}function _y(e){return e.docs}function vy(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:a}=e,{_:o}=i(),{resolvedTheme:c}=Pr(),l=c===`dark`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_]=(0,Q.useState)(Sy),[v,y]=(0,Q.useState)(xy),b;t[1]===_?b=t[2]:(b=()=>{y(new Set),_.clear()},t[1]=_,t[2]=b);let x;t[3]===n?x=t[4]:(x=[n],t[3]=n,t[4]=x),(0,Q.useEffect)(b,x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=S):S=t[5];let C=S,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){y(new Set)},t[6]=w):w=t[6];let T=w,E,D;t[7]!==o||t[8]!==n?(E=()=>{if(!n){f([]);return}m(!0);let e=wv({baseMs:ny,maxBackoffMs:ry,isPaused:by,poll:e=>iy(n,e,{setEntries:f,setError:g,setLoading:m,unavailableMessage:o({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},D=[n,o],t[7]=o,t[8]=n,t[9]=E,t[10]=D):(E=t[9],D=t[10]),(0,Q.useEffect)(E,D);let O=!p&&!h&&d.length>0,k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Sn,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[11]=k):k=t[11];let A;t[12]!==o||t[13]!==r||t[14]!==O||t[15]!==a?(A=O&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(So,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":o({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)(bo,{value:`unified`,"aria-label":o({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Xl,{className:`size-3.5`})}),(0,Z.jsx)(bo,{value:`split`,"aria-label":o({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(ul,{className:`size-3.5`})})]})}),(0,Z.jsx)(Ns,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[12]=o,t[13]=r,t[14]=O,t[15]=a,t[16]=A):A=t[16];let j;t[17]===A?j=t[18]:(j=(0,Z.jsxs)(yn,{children:[k,A]}),t[17]=A,t[18]=j);let M;t[19]!==o||t[20]!==p?(M=p&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":o({id:`o49mDZ`}),children:[1,2,3].map(yy)}),t[19]=o,t[20]=p,t[21]=M):M=t[21];let N;t[22]!==h||t[23]!==p?(N=!p&&h&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:h})}),t[22]=h,t[23]=p,t[24]=N):N=t[24];let P;t[25]!==d||t[26]!==h||t[27]!==p?(P=!p&&!h&&d.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[25]=d,t[26]=h,t[27]=p,t[28]=P):P=t[28];let F;t[29]!==_||t[30]!==r||t[31]!==n||t[32]!==d||t[33]!==h||t[34]!==v||t[35]!==l||t[36]!==p?(F=!p&&!h&&d.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:d.map(e=>(0,Z.jsx)(gy,{entry:e,isDark:l,diffLayout:r,cache:_,docName:n,expanded:v.has(e.sha),onToggleExpanded:C,onRestoreSuccess:T},e.sha))}),t[29]=_,t[30]=r,t[31]=n,t[32]=d,t[33]=h,t[34]=v,t[35]=l,t[36]=p,t[37]=F):F=t[37];let I;t[38]!==M||t[39]!==N||t[40]!==P||t[41]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[M,N,P,F]}),t[38]=M,t[39]=N,t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;return t[43]!==j||t[44]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[j,I]}),t[43]=j,t[44]=I,t[45]=L):L=t[45],L}function yy(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Oi,{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)(Oi,{className:`h-3 w-28`}),(0,Z.jsx)(Oi,{className:`h-3 w-40`})]})]},e)}function by(){return typeof document<`u`&&document.visibilityState===`hidden`}function xy(){return new Set}function Sy(){return new hi(32)}var Cy=[{id:`outline`,icon:Pl},{id:`links`,icon:be},{id:`graph`,icon:Ll},{id:`timeline`,icon:ll}];function wy(e){return e===`outline`?hs._({id:`dD7NPy`}):e===`links`?hs._({id:`Rj01Fz`}):e===`graph`?hs._({id:`x2fr_j`}):hs._({id:`cklVjM`})}function Ty(){return n(()=>import(`./GraphPanel-_FO8Dj1z.js`),__vite__mapDeps([21,1,14,6,8,9,22,3,23,24,25,15,26,27,28,29,30,31,32,33,34,35]),import.meta.url)}var Ey=(0,Q.lazy)(async()=>({default:(await Ty()).GraphPanel})),Dy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BYzNZP-E.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent}));function Oy(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(`unified`),f=xg(),p,m,h;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==o||t[4]!==f){let e=f?Cy.filter(Ay):Cy;p=e.some(e=>e.id===a)?a:`outline`,m=c===`doc`&&e.length>1,h=m?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(So,{type:`single`,variant:`outline`,value:p,onValueChange:e=>{e&&o(e)},"aria-label":l({id:`SrOuyg`}),children:e.map(ky)})}):null,t[0]=l,t[1]=a,t[2]=c,t[3]=o,t[4]=f,t[5]=p,t[6]=m,t[7]=h}else p=t[5],m=t[6],h=t[7];let g;t[8]!==u||t[9]!==n||t[10]!==p||t[11]!==r||t[12]!==c||t[13]!==m?(g=c===`doc`?(0,Z.jsxs)(`div`,{...m?{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`}:{},className:`min-h-0 flex-1`,children:[p===`outline`&&(0,Z.jsx)(Dc,{docName:n,isSourceMode:r}),p===`links`&&(0,Z.jsx)(Cv,{docName:n}),p===`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)(Ey,{activeDocName:n})}),p===`timeline`&&(0,Z.jsx)(vy,{docName:n,diffLayout:u,onDiffLayoutChange:d})]}):(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)(Dy,{})})}),t[8]=u,t[9]=n,t[10]=p,t[11]=r,t[12]=c,t[13]=m,t[14]=g):g=t[14];let _;return t[15]!==h||t[16]!==g?(_=(0,Z.jsxs)(Z.Fragment,{children:[h,g]}),t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function ky(e){let{id:t,icon:n}=e,r=wy(t);return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(bo,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:r})]},t)}function Ay(e){return e.id===`outline`}function jy(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function My(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Ny(e){return e/100*window.innerHeight}function Py(e){return e/100*window.innerWidth}function Fy(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 Iy({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Fy(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=My(t,i);break;case`em`:r=jy(t,i);break;case`vh`:r=Ny(i);break;case`vw`:r=Py(i);break}return r}function Ly(e){return parseFloat(e.toFixed(3))}function Ry({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 zy(e){let{panels:t}=e,n=Ry({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=Ly(Iy({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Ly(Iy({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Ly(Iy({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Ly(Iy({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 By(e,t=`Assertion error`){if(!e)throw Error(t)}function Vy(e,t){return Array.from(t).sort(e===`horizontal`?Hy:Uy)}function Hy(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Uy(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Wy(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Gy(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 Ky({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}=Gy(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return By(i,`No rect found`),i}var qy;function Jy(){return qy===void 0&&(qy=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),qy}function Yy(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Vy(n,Array.from(t.children).filter(Wy).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,Ky({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=Jy()?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:Ry({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 Xy=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)}}},Zy=new Map,Qy=new Xy;function $y(e){Zy=new Map(Zy),Zy.delete(e)}function eb(e,t){for(let[t]of Zy)if(t.id===e)return t}function tb(e,t){for(let[t,n]of Zy)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function nb(){return Zy}function rb(e,t){return Qy.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function ib(e,t){let n=Zy.get(e);Zy=new Map(Zy),Zy.set(e,t),Qy.emit(`groupChange`,{group:e,prev:n,next:t})}function ab(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Gy(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 ob(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function sb(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:pb(e),b:pb(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();By(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:fb(db(n.a)),b:fb(db(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 cb=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function lb(e){let t=getComputedStyle(mb(e)??e).display;return t===`flex`||t===`inline-flex`}function ub(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||lb(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`||cb.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function db(e){let t=e.length;for(;t--;){let n=e[t];if(By(n,`Missing node`),ub(n))return n}return null}function fb(e){return e&&Number(getComputedStyle(e).zIndex)||0}function pb(e){let t=[];for(;e;)t.push(e),e=mb(e);return t}function mb(e){let{parentNode:t}=e;return ob(t)?t.host:t}function hb(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 gb({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Wy(n)||n.contains(e)||e.contains(n))return!0;if(sb(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(hb(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function _b(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Yy(r),a=ab(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&gb({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function vb(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 yb(e,t,n=0){return Math.abs(Ly(e)-Ly(t))<=n}function bb(e,t){return yb(e,t)?0:e>t?1:-1}function xb({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(bb(r,c)<0)if(a){let e=(i+c)/2;r=bb(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Ly(r),r}function Sb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(yb(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;By(u!=null,`Invalid first pivot index`),By(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];By(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(By(n!=null,`Previous layout not found for panel index ${t}`),yb(n,i)){let t=o-n;bb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];By(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(By(n!=null,`Previous layout not found for panel index ${t}`),yb(n,o)){let t=n-i;bb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];By(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&bb(i,c)<0)if(e>0){let t=c-o,n=t/2;bb(i+e,c)<0&&(e=bb(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;bb(i-e,c)<0&&(e=bb(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];By(e!=null,`Previous layout not found for panel index ${r}`);let a=xb({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];By(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=xb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!yb(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(vb(c,l))return i;{let t=e<0?d:u,r=s[t];By(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=xb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!yb(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];By(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=xb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(yb(i,s)||(t-=s-i,l[r]=s),yb(t,0))break;e>0?r--:r++}}}if(!yb(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 Cb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||bb(e[n],t[n])!==0)return!1;return!0}function wb({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(!yb(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];By(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];By(i!=null,`No layout data found for index ${e}`);let o=r[e];By(o!=null,`No layout data found for index ${e}`);let s=xb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!yb(a,0))for(let e=0;e<t.length;e++){let n=r[e];By(n!=null,`No layout data found for index ${e}`);let i=n+a,o=xb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,yb(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Tb({groupId:e,panelId:t}){let n=()=>{let t=nb();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=wb({layout:Sb({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});Cb(l,p)||ib(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&&yb(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Ry({group:t});o(Ly(Iy({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Eb(e){e.defaultPrevented||_b(e,nb()).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=Tb({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Db(e){let t=nb();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 Ob({groupId:e}){let t=()=>{let t=nb();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=wb({layout:e,panelConstraints:r});return n?o:(Cb(o,c)||ib(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function kb(e,t){let n=Db(e),r=tb(n.id,!0),i=n.separators.find(t=>t.element===e);By(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);By(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Ob({groupId:n.id}).getLayout(),c=wb({layout:Sb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Cb(s,c)||ib(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Ab(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Db(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&kb(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&kb(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&kb(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&kb(t,-5);break;case`End`:e.preventDefault(),kb(t,100);break;case`Enter`:{e.preventDefault();let n=Db(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=tb(n.id,!0),o=n.separators.find(e=>e.element===t);By(o,`Matching separator not found`);let s=a.get(o);By(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(By(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];kb(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Db(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);By(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(),kb(t,-100);break}}var jb={cursorFlags:0,state:`inactive`},Mb=new Xy;function Nb(){return jb}function Pb(e){return Mb.addListener(`change`,e)}function Fb(e){let t=jb,n={...jb};n.cursorFlags=e,jb=n,Mb.emit(`change`,{prev:t,next:n})}function Ib(e){let t=jb;jb=e,Mb.emit(`change`,{prev:t,next:e})}function Lb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=nb(),n=_b(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)}),Ib({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Rb=e=>e,zb=()=>{},Bb=1,Vb=2,Hb=4,Ub=8,Wb=3,Gb=12,Kb;function qb(){return Kb===void 0&&(Kb=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Kb=!0)),Kb}function Jb({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&&qb()){let t=(e&Bb)!==0,n=(e&Vb)!==0,r=(e&Hb)!==0,i=(e&Ub)!==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 qb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Yb=new WeakMap;function Xb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Yb.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Nb();switch(r.state){case`active`:case`hover`:{let e=Jb({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}Yb.set(e,{prevStyle:t,styleSheet:n})}function Zb({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=Sb({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Cb(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Bb:Vb;break;case`vertical`:s|=d<0?Hb:Ub;break}}else ib(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Wb:c|=s&Wb,t.movementY===0?c|=o&Gb:c|=s&Gb,Fb(c),Xb(e)}function Qb(e){let t=nb(),n=Nb();switch(n.state){case`active`:Zb({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function $b(e){if(e.defaultPrevented)return;let t=Nb(),n=nb();switch(t.state){case`active`:if(e.buttons===0){Ib({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=tb(e.group.id,!0);ib(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)}Zb({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=_b(e,n);r.length===0?t.state!==`inactive`&&Ib({cursorFlags:0,state:`inactive`}):Ib({cursorFlags:0,hitRegions:r,state:`hover`}),Xb(e.currentTarget);break}}}function ex(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Nb().state){case`hover`:Ib({cursorFlags:0,state:`inactive`})}}function tx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Nb();switch(t.state){case`active`:Ib({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Xb(e.currentTarget),t.hitRegions.forEach(e=>{let t=tb(e.group.id,!0);ib(e.group,t)}),e.preventDefault())}}function nx(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Ly(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Ly((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function rx(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Ry({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Ly(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function ix(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 ax({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=Ly(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]=Ly((r[e]??0)/a*l);else{let e=Ly(l/c.length);for(let t of c)u[t]=e}return u}function ox(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 sx=new Map;function cx(e){let t=!0;By(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=Ry({group:e});if(t===0)return;let n=tb(e.id);if(!n)return;let r=zy(e),i=n.defaultLayoutDeferred?nx(r):n.layout,a=wb({layout:ax({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Cb(n.layout,a)&&ix(n.derivedPanelConstraints,r)&&n.groupSize===t)return;ib(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else rx(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{By(!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=Ry({group:e}),s=zy(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(ox(e.panels,l)||(l=void 0));let u=wb({layout:e.mutableState.layouts[c]??l??nx(s),panelConstraints:s}),d=e.element.ownerDocument;sx.set(d,(sx.get(d)??0)+1);let f=new Map;return Yy(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),ib(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{By(!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`,Ab)}),sx.get(d)===1&&(d.addEventListener(`dblclick`,Eb,!0),d.addEventListener(`pointerdown`,Lb,!0),d.addEventListener(`pointerleave`,Qb),d.addEventListener(`pointermove`,$b),d.addEventListener(`pointerout`,ex),d.addEventListener(`pointerup`,tx,!0)),function(){t=!1,sx.set(d,Math.max(0,(sx.get(d)??0)-1)),$y(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Ab)}),sx.get(d)||(d.removeEventListener(`dblclick`,Eb,!0),d.removeEventListener(`pointerdown`,Lb,!0),d.removeEventListener(`pointerleave`,Qb),d.removeEventListener(`pointermove`,$b),d.removeEventListener(`pointerout`,ex),d.removeEventListener(`pointerup`,tx,!0)),a.disconnect()}}function lx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function ux(e){let t=(0,Q.useId)();return`${e??t}`}var dx=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function fx(e){let t=(0,Q.useRef)(e);return dx(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function px(...e){return fx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function mx(e){let t=(0,Q.useRef)({...e});return dx(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var hx=(0,Q.createContext)(null);function gx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Rb});(0,Q.useImperativeHandle)(t,()=>n.current,[]),dx(()=>{Object.assign(n.current,Ob({groupId:e}))})}function _x({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=fx(e=>{Cb(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=fx(e=>{Cb(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=ux(s),v=(0,Q.useRef)(null),[y,b]=lx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=px(v,a);gx(_,o);let C=fx((e,t)=>{let r=Nb(),i=eb(e),a=tb(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=mx({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=Vy(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Vy(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=eb(_),i=tb(_);r&&i&&ib(r,{...i,derivedPanelConstraints:zy(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 dx(()=>{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=cx(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=tb(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=rb(_,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=yb(t.collapsedSize,i[t.panelId]),a=yb(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Nb().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)(hx.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})})}_x.displayName=`Group`;function vx(){let e=(0,Q.useContext)(hx);return By(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function yx(e,t){let{id:n}=vx(),r=(0,Q.useRef)({collapse:zb,expand:zb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:zb});(0,Q.useImperativeHandle)(t,()=>r.current,[]),dx(()=>{Object.assign(r.current,Tb({groupId:n,panelId:e}))})}function bx({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=ux(c),_=mx({disabled:a}),v=(0,Q.useRef)(null),y=px(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=vx(),T=d!==null,E=fx((e,t,n)=>{d?.(e,c,n)});dx(()=>{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]),yx(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>rb(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:{...xx,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})})}bx.displayName=`Panel`;var xx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Sx(){return(0,Q.useRef)(null)}function Cx({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=wb({layout:Sb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=wb({layout:Sb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function wx({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=ux(a),l=mx({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=px(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=vx(),x=v===`horizontal`?`vertical`:`horizontal`;dx(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Pb(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=rb(_,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(Cx({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})}wx.displayName=`Separator`;var Tx=new Map;function Ex(e){let t=Tx.get(e);if(t)return t;let n=Dx(e);return Tx.set(e,n),n}async function Dx(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-CpYUNWOc.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-DrSwTBuw.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-DrSwTBuw.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-DrSwTBuw.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-Mxq-zflt.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([38,1,39,23,40]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-D0_HBszs.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-DdpCnkcu.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-4lW4ME5D.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-DrSwTBuw.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-DrSwTBuw.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-BrsGSRvH.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-B9B58-J_.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([45,1,43,39,23,41,38,40,42]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-DrSwTBuw.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-BvKrvbRb.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-D1rVZYi52.js`);return{python:e}},__vite__mapDeps([50,43,39,1,23,40]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-CfD_nMxU.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-CEHR0ONp.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-CjXb6uie.js`);return{rust:e}},__vite__mapDeps([51,39,1,23,40]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-m6QogzU7.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-CmJiKyqD.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-Bn0QvNGs.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([41,1,38,39,23,40,42,43]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-pSQcUvmU.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([46,1,39,23,40]),import.meta.url)).yaml().language;default:return null}}async function Ox(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;if(t){let e=await Ex(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-CSZcBb2g.js`);return{toml:e}},[],import.meta.url)).toml):null}var kx=te({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Ax=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function jx(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 Mx(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}=Pr(),l=jx(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=i.toLowerCase(),t=sr(e),n=c===`dark`?kx:Ax,r=!1,s=null;return Ox(e,t).then(e=>{if(r||!a.current)return;let t=[Fc,...e?[e]:[],_c.editable.of(!0),sc.readOnly.of(!0),_c.lineWrapping,n];s=new _c({state:sc.create({doc:u,extensions:t}),parent:a.current}),o.current=s}),()=>{r=!0,s?.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 Nx(e){return Jr(`/api/asset?path=${encodeURIComponent(e)}`)}function Px(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Fx(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=Nx(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)(Y,{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=Px(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(Mx,{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)(Ke,{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-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:u})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(li,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(s,{id:`qFWMl-`})}),(0,Z.jsx)(li,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{it({url:c,projectRelPath:n,ext:p.toLowerCase(),title:u,forceOsDelegation:!1})},children:(0,Z.jsx)(s,{id:`9npOH9`})})]})]})}),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 Ix(){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)(Oi,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Oi,{className:`h-4 w-full`}),(0,Z.jsx)(Oi,{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}function Lx(e){let{_:t}=i();return e===`existing-repo`?[{id:`draft-spec`,icon:_l,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Pl,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Ll,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:cu,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:_l,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:tl,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function Rx(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:a}=i(),o=Lx(n),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(void 0),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>clearTimeout(l.current),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,Q.useEffect)(u,d);let f,p;if(t[2]!==a||t[3]!==r||t[4]!==s||t[5]!==o){let e=function(e,t){Pa(t).then(()=>{c(e),clearTimeout(l.current),l.current=setTimeout(()=>c(null),1600)}).catch(zx)};t[8]===r?f=t[9]:(f=si(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=f),p=o.map(t=>{let n=t.icon,r=s===t.id;return(0,Z.jsxs)(`li`,{className:`group flex items-start gap-3 p-3.5`,"data-testid":`copy-prompt-${t.id}`,children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:t.label}),(0,Z.jsx)(`span`,{className:`truncate text-1sm leading-relaxed text-muted-foreground`,children:t.prompt})]}),(0,Z.jsxs)(li,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":a(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:si(`shrink-0 gap-1.5 transition-opacity focus-visible:opacity-100 uppercase font-mono`,r?`opacity-100`:`opacity-0 group-hover:opacity-100`),"data-testid":`copy-prompt-button-${t.id}`,children:[r?(0,Z.jsx)(Ao,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(nt,{className:`size-3.5`,"aria-hidden":`true`}),a(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=a,t[3]=r,t[4]=s,t[5]=o,t[6]=f,t[7]=p}else f=t[6],p=t[7];let m;return t[10]!==f||t[11]!==p?(m=(0,Z.jsx)(`ul`,{className:f,children:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12],m}function zx(){}var Bx={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Vx(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}=Pr(),s=Bx[r],c=s?(o===`dark`?Br[s]:void 0)??Yr[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=si(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)(pi,{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)(fi,{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)(yi,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}var Hx=(0,Q.createContext)(null);function Ux(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(Hx,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function Wx(){return(0,Q.use)(Hx)}var Gx=ai(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function Kx(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=si(Gx({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var qx=`ok-preferred-agent-v1`,Jx=new Set(gg.map(e=>e.id));function Yx(e){return typeof e==`string`&&Jx.has(e)}function Xx(e){try{let t=(e??localStorage).getItem(qx);return Yx(t)?t:null}catch{return null}}function Zx(e,t){try{(t??localStorage).setItem(qx,e)}catch{}}function Qx(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:gg.find(e=>n[e.id]?.installed===!0)?.id??null}function $x(e){let t=(0,$.c)(54),{scenario:n,className:r}=e,{_:a}=i(),{states:o,refresh:c}=D_(),{dispatch:l}=g_(),u=ka(),d=Wx(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(tS),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(!1),y=_&&d!==null,b=(0,Q.useRef)(null),x=Lx(n),S;t[0]===o?S=t[1]:(S=e=>o[e.id]?.installed===!0,t[0]=o,t[1]=S);let C=gg.filter(S),w;t[2]===o?w=t[3]:(w=gg.every(e=>o[e.id]?.installed!=null),t[2]=o,t[3]=w);let T=w,E=T&&C.length===0,D,O;t[4]!==T||t[5]!==o?(D=()=>{if(!T||g.current)return;let e=Qx({lastUsed:Xx(),states:o});h(t=>e===t?t:e)},O=[T,o],t[4]=T,t[5]=o,t[6]=D,t[7]=O):(D=t[6],O=t[7]),(0,Q.useEffect)(D,O);let k=function(e){g.current=!0,v(!1),h(e),Zx(e)},A;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){g.current=!0,v(!0)},t[8]=A):A=t[8];let j=A,M;t[9]!==f||t[10]!==n||t[11]!==d||t[12]!==u?(M=function(){if(d===null)return;let e=t_({workspace:u,description:f.trim(),scenario:n});e!==null&&d.launchInTerminal(e)},t[9]=f,t[10]=n,t[11]=d,t[12]=u,t[13]=M):M=t[13];let N=M,P;t[14]!==f||t[15]!==l||t[16]!==n||t[17]!==u?(P=function(e){let t=f.trim();Zx(e);let r=t_({workspace:u,description:t,scenario:n});r!==null&&l(e,r)},t[14]=f,t[15]=l,t[16]=n,t[17]=u,t[18]=P):P=t[18];let F=P,I;t[19]!==y||t[20]!==F||t[21]!==N||t[22]!==m?(I=function(e){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),y?N():m!==null&&F(m))},t[19]=y,t[20]=F,t[21]=N,t[22]=m,t[23]=I):I=t[23];let L=I,R=function(e){p(e),b.current?.focus()};if(E){let e;t[24]===r?e=t[25]:(e=si(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[24]=r,t[25]=e);let n;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(bi,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[26]=n):n=t[26];let i;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`3IseAk`})})]}),t[27]=i):i=t[27];let a;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:gg.map(eS)}),t[28]=a):a=t[28];let o;return t[29]===e?o=t[30]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[29]=e,t[30]=o),o}let z=C.length>0,B=d!==null,V;t[31]===r?V=t[32]:(V=si(`flex w-full flex-col gap-3`,r),t[31]=r,t[32]=V);let H;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>p(e.target.value),t[33]=H):H=t[33];let U;t[34]===a?U=t[35]:(U=a({id:`0jD-Gn`}),t[34]=a,t[35]=U);let W;t[36]===a?W=t[37]:(W=a({id:`7hctf2`}),t[36]=a,t[37]=W);let G;t[38]!==f||t[39]!==L||t[40]!==U||t[41]!==W?(G=(0,Z.jsx)(qs,{ref:b,value:f,onChange:H,onKeyDown:L,rows:4,placeholder:U,"aria-label":W,className:`min-h-12 resize-none rounded-2xl border-0 bg-transparent dark:bg-transparent px-4 py-3.5 text-sm leading-relaxed shadow-none focus-visible:border-0 focus-visible:ring-0 max-h-96 subtle-scrollbar`}),t[38]=f,t[39]=L,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K=m===null?(0,Z.jsx)(li,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(s,{id:`hYgDIe`})}):(0,Z.jsxs)(Kx,{children:[(0,Z.jsx)(li,{type:`button`,onClick:()=>y?N():F(m),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ru,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`hozzkE`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vx,{id:m,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`9dw5bW`,values:{0:p_(m)}})]})}),(0,Z.jsxs)(oo,{onOpenChange:e=>{e&&c()},children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,"aria-label":a({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(He,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(to,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(Ra,{"aria-label":a({id:`BBqGS9`}),children:[(0,Z.jsx)(Xa,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),C.map(e=>(0,Z.jsxs)(Da,{onSelect:()=>k(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Vx,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!y&&e.id===m?(0,Z.jsx)(Ao,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,B?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(ro,{}):null,(0,Z.jsxs)(Ra,{"aria-label":a({id:`ALhMYW`}),children:[(0,Z.jsx)(Xa,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(Da,{onSelect:()=>j(),"data-testid":`create-with-claude-cli`,"aria-label":a({id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),y?(0,Z.jsx)(Ao,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]})]})]}):null]})]})]}),q;t[43]===K?q=t[44]:(q=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 px-3 pb-3`,children:K}),t[43]=K,t[44]=q);let J;t[45]!==G||t[46]!==q?(J=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[G,q]}),t[45]=G,t[46]=q,t[47]=J):J=t[47];let ee=x.map(e=>{let t=e.icon;return(0,Z.jsxs)(li,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>R(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)}),te;t[48]===ee?te=t[49]:(te=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:ee}),t[48]=ee,t[49]=te);let ne;return t[50]!==J||t[51]!==te||t[52]!==V?(ne=(0,Z.jsxs)(`div`,{className:V,children:[J,te]}),t[50]=J,t[51]=te,t[52]=V,t[53]=ne):ne=t[53],ne}function eS(e){return(0,Z.jsxs)(li,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void n_(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(Vx,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(yo,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function tS(){return Xx()}var nS=3100,rS=3;function iS(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??rS;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var aS={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}},oS=[`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 sS(e,t={}){let n=t.rng??Math.random,r=t.colors??oS,i=aS[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 cS=1.8,lS=90,uS=16,dS=380,fS=.025,pS=.1,mS=.18,hS=400,gS=9.2736,_S=18.1799,vS=14.5244,yS={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function bS(e,t){let{halfWidth:n,apexLift:r}=yS[t];return`M${e-n} ${vS+.3} Q${e} ${vS-r}, ${e+n} ${vS+.3}`}function xS(e){let t=1.5,n=.3;return`M${e-t} ${vS-n} Q${e} ${vS+1.4}, ${e+t} ${vS-n}`}var SS=15,CS=15;function wS(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 TS(e){let t=(0,$.c)(72),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o,gaze:s}=e,c=n===void 0?48:n,l=i===void 0?!0:i,u=a===void 0?`default`:a,d=o===void 0?0:o,f=s===void 0?`cursor`:s,p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={x:0,y:0},t[0]=g):g=t[0];let _=(0,Q.useRef)(g),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(0),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[1]=S):S=t[1];let[C,w]=(0,Q.useState)(S),T=(0,Q.useRef)(0),E=(0,Q.useRef)(void 0),D=u===`sleeping`,O;t[2]!==v||t[3]!==D?(O=function(){if(D)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=T.current===0?1/0:e-T.current;T.current=e;let n=iS(v,t);y(n),x(kS),w(sS(n)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},nS)},t[2]=v,t[3]=D,t[4]=O):O=t[4];let k=O,A,j;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>clearTimeout(E.current),A=[],t[5]=A,t[6]=j):(A=t[5],j=t[6]),(0,Q.useEffect)(j,A);let M,N;t[7]!==d||t[8]!==D?(M=()=>{d===0||D||(y(3),x(OS),w(sS(3)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},nS))},N=[d,D],t[7]=d,t[8]=D,t[9]=M,t[10]=N):(M=t[9],N=t[10]),(0,Q.useEffect)(M,N);let P,F;t[11]!==f||t[12]!==D||t[13]!==l?(P=()=>{if(!l||D)return;let e=f===`down`;if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=0,n=0,r=!1,i=0,a=0,o=0,s=0,c=0,u=function(){c===0&&(c=requestAnimationFrame(g))},d=function(e){t=e.clientX,n=e.clientY,r=!0,u()};function g(){c=0;let l=m.current,d=p.current;if(!l||!d){u();return}let f=r;r=!1;let g=l.getBoundingClientRect(),v=g.left+g.width/2,y=g.top+g.height*.48,b=t-v,x=n-y,S=Math.hypot(b,x),C,w,T=0,E=0;if(e)w=0,C=-uS*.8,E=cS;else{let e=Math.max(-1,Math.min(1,b/dS)),t=Math.max(-1,Math.min(1,x/dS));if(w=e*uS,C=-t*uS,S>=1){let e=Math.min(S/lS,1)*cS;T=b/S*e,E=x/S*e}}let D=Math.abs(C-i)<.01&&Math.abs(w-a)<.01&&Math.abs(T-o)<.01&&Math.abs(E-s)<.01;if(!f&&D)return;u(),i+=(C-i)*pS,a+=(w-a)*pS,d.style.transform=`perspective(${hS}px) rotateX(${i.toFixed(3)}deg) rotateY(${a.toFixed(3)}deg)`,o+=(T-o)*mS,s+=(E-s)*mS;let O=a*fS,k=-i*fS,A=o+O,j=s+k;_.current.x=A,_.current.y=j,h.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,d,{passive:!0}),u(),()=>{document.removeEventListener(`mousemove`,d),c!==0&&cancelAnimationFrame(c),c=0,p.current&&(p.current.style.transform=``),_.current={x:0,y:0},h.current?.removeAttribute(`transform`)}},F=[l,D,f],t[11]=f,t[12]=D,t[13]=l,t[14]=P,t[15]=F):(P=t[14],F=t[15]),(0,Q.useEffect)(P,F);let I;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{let e=h.current;if(!e)return;let{x:t,y:n}=_.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[16]=I):I=t[16],(0,Q.useLayoutEffect)(I);let L=v>0,R=L?v:1,z=L?`ok-blob-clicked-${v}`:null,B;t[17]===r?B=t[18]:(B=si(`ok-blob-3d-wrapper`,r),t[17]=r,t[18]=B);let V=D?`cursor-default`:`cursor-pointer`,H=`body-${b}`,U=D&&`ok-blob-sleeping`,W;t[19]!==z||t[20]!==U?(W=si(`ok-blob-group`,U,z),t[19]=z,t[20]=U,t[21]=W):W=t[21];let G;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(G=(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[22]=G):G=t[22];let K=(L||D)&&`ok-blob-eye-hidden`,q;t[23]===K?q=t[24]:(q=si(`ok-blob-eye`,K),t[23]=K,t[24]=q);let J;t[25]===q?J=t[26]:(J=(0,Z.jsx)(`ellipse`,{cx:gS,cy:vS,rx:1.2722,ry:1.9083,className:q}),t[25]=q,t[26]=J);let ee=(L||D)&&`ok-blob-eye-hidden`,te;t[27]===ee?te=t[28]:(te=si(`ok-blob-eye ok-blob-eye-right`,ee),t[27]=ee,t[28]=te);let ne;t[29]===te?ne=t[30]:(ne=(0,Z.jsx)(`ellipse`,{cx:_S,cy:vS,rx:1.2722,ry:1.9083,className:te}),t[29]=te,t[30]=ne);let re;t[31]===R?re=t[32]:(re=bS(gS,R),t[31]=R,t[32]=re);let Y=(!L||D)&&`ok-blob-eye-hidden`,ie;t[33]===Y?ie=t[34]:(ie=si(`ok-blob-happy-eye`,Y),t[33]=Y,t[34]=ie);let ae;t[35]!==re||t[36]!==ie?(ae=(0,Z.jsx)(`path`,{d:re,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[35]=re,t[36]=ie,t[37]=ae):ae=t[37];let oe;t[38]===R?oe=t[39]:(oe=bS(_S,R),t[38]=R,t[39]=oe);let se=(!L||D)&&`ok-blob-eye-hidden`,ce;t[40]===se?ce=t[41]:(ce=si(`ok-blob-happy-eye`,se),t[40]=se,t[41]=ce);let le;t[42]!==oe||t[43]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[42]=oe,t[43]=ce,t[44]=le):le=t[44];let ue;t[45]===D?ue=t[46]:(ue=D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:xS(gS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:xS(_S),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=D,t[46]=ue);let de;t[47]!==J||t[48]!==ne||t[49]!==ae||t[50]!==le||t[51]!==ue?(de=(0,Z.jsxs)(`g`,{ref:h,children:[J,ne,ae,le,ue]}),t[47]=J,t[48]=ne,t[49]=ae,t[50]=le,t[51]=ue,t[52]=de):de=t[52];let fe;t[53]!==H||t[54]!==W||t[55]!==de?(fe=(0,Z.jsxs)(`g`,{className:W,children:[G,de]},H),t[53]=H,t[54]=W,t[55]=de,t[56]=fe):fe=t[56];let pe;t[57]===D?pe=t[58]:(pe=D?(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[57]=D,t[58]=pe);let me;t[59]!==b||t[60]!==C?(me=C.length>0&&(0,Z.jsx)(`g`,{children:C.map(ES)},`firework-${b}`),t[59]=b,t[60]=C,t[61]=me):me=t[61];let he;t[62]!==k||t[63]!==c||t[64]!==V||t[65]!==fe||t[66]!==pe||t[67]!==me?(he=(0,Z.jsxs)(`svg`,{ref:m,width:c,height:c,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:V,"aria-hidden":`true`,onClick:k,onMouseDown:DS,children:[fe,pe,me]}),t[62]=k,t[63]=c,t[64]=V,t[65]=fe,t[66]=pe,t[67]=me,t[68]=he):he=t[68];let ge;return t[69]!==B||t[70]!==he?(ge=(0,Z.jsx)(`span`,{ref:p,className:B,children:he}),t[69]=B,t[70]=he,t[71]=ge):ge=t[71],ge}function ES(e){return(0,Z.jsx)(`circle`,{cx:SS+e.originDx,cy:CS+e.originDy,r:e.size,className:`ok-blob-firework`,style:wS(e)},e.id)}function DS(e){return e.preventDefault()}function OS(e){return e+1}function kS(e){return e+1}function AS(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(TS,{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}var jS=`open-knowledge:create-top-level-file`;function MS(e={}){window.dispatchEvent(new CustomEvent(jS,{detail:e}))}function NS(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(jS,t),()=>window.removeEventListener(jS,t)}function PS(e){let t=(0,$.c)(32),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=pg(),c=na(),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]===a?p=t[4]:(p=a({id:`FOGD7m`}),t[3]=a,t[4]=p);let m;t[5]!==a||t[6]!==o?(m=a(o?{id:`3DTatP`}:{id:`MqQoV-`}),t[5]=a,t[6]=o,t[7]=m):m=t[7];let h;t[8]!==n||t[9]!==p||t[10]!==m?(h=(0,Z.jsx)(AS,{title:p,subtitle:m,celebrateSignal:n}),t[8]=n,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===o?g=t[13]:(g=o?(0,Z.jsx)(Rx,{scenario:`existing-repo`}):(0,Z.jsx)($x,{scenario:`existing-repo`}),t[12]=o,t[13]=g);let _;t[14]!==u||t[15]!==f||t[16]!==d?(_=d||f||u.length>0?(0,Z.jsx)(LS,{templates:u,loading:d,error:f,onSelect:IS}):null,t[14]=u,t[15]=f,t[16]=d,t[17]=_):_=t[17];let v,y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(V,{"aria-hidden":`true`,className:`size-3`}),y=(0,Z.jsx)(s,{id:`IajAbS`}),t[18]=v,t[19]=y):(v=t[18],y=t[19]);let b;t[20]===r?b=t[21]:(b=(0,Z.jsxs)(li,{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:[v,y]}),t[20]=r,t[21]=b);let x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(li,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:FS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(no,{"aria-hidden":`true`,className:`size-3`})}})}),t[22]=x):x=t[22];let S;t[23]===b?S=t[24]:(S=(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[b,x]}),t[23]=b,t[24]=S);let C;t[25]!==S||t[26]!==_?(C=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[_,S]}),t[25]=S,t[26]=_,t[27]=C):C=t[27];let w;return t[28]!==C||t[29]!==h||t[30]!==g?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[h,g,C]}),t[28]=C,t[29]=h,t[30]=g,t[31]=w):w=t[31],w}function FS(){return MS({initialDir:``})}function IS(e,t){return MS({template:{folder:e,name:t}})}function LS(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)(ct,{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)(RS,{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 RS(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)(li,{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 zS(e){let t=(0,$.c)(15),{terminalVisible:n}=e,r=n===void 0?!1:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(US);if(e)return;let r=t.ok?jr.safeParse(n):null;r?.success?(l(WS(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=es(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(HS),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(VS);if(!e.ok)return;let n=jr.safeParse(t);n.success&&l(WS(n.data.documents))}).catch(BS)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 pb-8 pt-10`,children:(0,Z.jsx)(TS,{size:64,gaze:`down`})}),t[4]=e):e=t[4],e}let S;t[5]!==u||t[6]!==y||t[7]!==v?(S=v?y?(0,Z.jsx)(GS,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(PS,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[5]=u,t[6]=y,t[7]=v,t[8]=S):S=t[8];let C;t[9]!==o||t[10]!==i?(C=(0,Z.jsx)(cg,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[9]=o,t[10]=i,t[11]=C):C=t[11];let w;return t[12]!==S||t[13]!==C?(w=(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:[S,C]}),t[12]=S,t[13]=C,t[14]=w):w=t[14],w}function BS(){}function VS(){return null}function HS(e){return e+1}function US(){return null}function WS(e){return Zo(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function GS(e){let t=(0,$.c)(26),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o=pg(),c;t[0]===a?c=t[1]:(c=a({id:`6h4zVU`}),t[0]=a,t[1]=c);let l;t[2]!==a||t[3]!==o?(l=a(o?{id:`vGeNNQ`}:{id:`qpQwGC`}),t[2]=a,t[3]=o,t[4]=l):l=t[4];let u;t[5]!==n||t[6]!==c||t[7]!==l?(u=(0,Z.jsx)(AS,{title:c,subtitle:l,celebrateSignal:n}),t[5]=n,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===o?d=t[10]:(d=o?(0,Z.jsx)(Rx,{scenario:`new-project`}):(0,Z.jsx)($x,{scenario:`new-project`}),t[9]=o,t[10]=d);let f;t[11]!==a||t[12]!==o?(f=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[11]=a,t[12]=o,t[13]=f):f=t[13];let p;t[14]===f?p=t[15]:(p=(0,Z.jsx)(qS,{label:f}),t[14]=f,t[15]=p);let m;t[16]===r?m=t[17]:(m=(0,Z.jsx)(ng,{onPackSelect:r}),t[16]=r,t[17]=m);let h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(li,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:KS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(no,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=h):h=t[18];let g;t[19]!==p||t[20]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[p,m,h]}),t[19]=p,t[20]=m,t[21]=g):g=t[21];let _;return t[22]!==u||t[23]!==d||t[24]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[u,d,g]}),t[22]=u,t[23]=d,t[24]=g,t[25]=_):_=t[25],_}function KS(){return MS()}function qS(e){let t=(0,$.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n})}),t[0]=n,t[1]=r),r}function JS(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function YS(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)(ZS,{}),(0,Z.jsx)(Oi,{className:`h-7 w-full`}),(0,Z.jsx)(Oi,{className:`h-7 w-full`}),(0,Z.jsx)(Oi,{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=JS(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 $i(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 $i(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,sa(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):Yi[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(Yn(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 $i(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 $i(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 H=B,U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(){p(null)},t[38]=U):U=t[38];let W=U,G=!c,K;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>l(!e),t[39]=K):K=t[39];let q=`size-3 transition-transform ${c?``:`rotate-90`}`,J;t[40]===q?J=t[41]:(J=(0,Z.jsx)(Po,{className:q,"aria-hidden":!0}),t[40]=q,t[41]=J);let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=ee):ee=t[42];let te;t[43]===J?te=t[44]:(te=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[J,ee]}),t[43]=J,t[44]=te);let ne;t[45]===_?ne=t[46]:(ne=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:XS,children:_}),t[45]=_,t[46]=ne);let re;t[47]!==te||t[48]!==ne?(re=(0,Z.jsxs)(Fo,{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:[te,ne]}),t[47]=te,t[48]=ne,t[49]=re):re=t[49];let Y;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hSBIG-`})}),t[50]=Y):Y=t[50];let ie;t[51]!==u||t[52]!==x||t[53]!==H||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(ie=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)(Li,{keyName:e,value:t,declared:_o(t,jn(t)),rename:{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:z,onCommit:H,onCancel:W},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]=H,t[54]=y,t[55]=h,t[56]=C,t[57]=f,t[58]=T,t[59]=ie):ie=t[59];let ae;t[60]!==u||t[61]!==F?(ae=u?(0,Z.jsx)(ra,{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)(li,{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)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=F,t[62]=ae):ae=t[62];let oe;t[63]!==ie||t[64]!==ae?(oe=(0,Z.jsx)(No,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[Y,ie,ae]})}),t[63]=ie,t[64]=ae,t[65]=oe):oe=t[65];let se;return t[66]!==G||t[67]!==re||t[68]!==oe?(se=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Io,{open:G,onOpenChange:K,children:[re,oe]})}),t[66]=G,t[67]=re,t[68]=oe,t[69]=se):se=t[69],se}function XS(e){return e.stopPropagation()}function ZS(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Sl,{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 QS(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?hs._({id:`xOTzt5`}):t<3600?hs._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?hs._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?hs._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function $S(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function eC(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:La,label:hs._({id:`QR5SP1`}),detail:$S(i)};case`template-edit`:return{Icon:se,label:hs._({id:`-LHLx7`}),detail:$S(i)};case`template-delete`:return{Icon:K,label:hs._({id:`_gkGSK`}),detail:$S(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:$c,label:hs._({id:`KPW5WC`}),detail:`${$S(e??``)} → ${$S(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Sl,label:hs._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Sl,label:hs._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Sl,label:hs._({id:`ZQLDTl`}),detail:``};default:return{Icon:Ol,label:r.replace(/-/g,` `),detail:$S(i)}}}function tC(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?hs._({id:`B2DrPb`}):e.author||hs._({id:`Ef7StM`})}function nC(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=fs(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)(ct,{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)(Oi,{className:`h-8 w-full`}),(0,Z.jsx)(Oi,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(rC)})}),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 rC(e){let{Icon:t,label:n,detail:r}=eC(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)(hu,{className:`size-3`,"aria-hidden":!0}),tC(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:QS(e.timestamp)})]},e.sha)}function iC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function aC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=iC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function oC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function sC(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:aC(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:oC(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:aC(e,t.pageTitles),children:a}}function cC(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)(Oi,{className:`h-12 w-full`}),(0,Z.jsx)(Oi,{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)(ct,{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)(li,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(V,{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)(ta,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Ui,{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)(Va,{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)(Di,{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(lC)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Zi,{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)(zh,{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 lC(e){return e.name}function uC(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=si(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=si(`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 dC(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=si(`[&_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 fC(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=si(`[&_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 pC(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=si(`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 mC(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=si(`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 hC(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=si(`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 gC(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return hs._({id:`xOTzt5`});if(r<60)return hs._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return hs._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?hs._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function _C(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 vC(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)(pt,{className:`ml-1 size-3`}):(0,Z.jsx)($e,{className:`ml-1 size-3`}):(0,Z.jsx)(el,{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)(li,{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 yC(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=is(),d=Ha(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)(Oi,{className:`size-5 rounded`}),(0,Z.jsx)(Oi,{className:`h-7 w-48`})]}),(0,Z.jsx)(Oi,{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)(Oi,{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)(Oi,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(SC)]})]}),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=sC(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=_C(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(xC):(_(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)(ie,{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)(li,{onClick:()=>h(!0),children:[(0,Z.jsx)(V,{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)(YS,{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)(cC,{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)(nC,{folderPath:n}),t[44]=n,t[45]=k),w=`rounded-lg border`,x=uC;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)(vC,{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)(mC,{"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 H;t[58]!==j||t[59]!==v||t[60]!==g||t[61]!==B?(H=(0,Z.jsx)(vC,{label:B,sortKey:`modified`,activeKey:g,activeDir:v,onSort:j}),t[58]=j,t[59]=v,t[60]=g,t[61]=B,t[62]=H):H=t[62];let U;t[63]!==z||t[64]!==H?(U=(0,Z.jsx)(mC,{className:`w-32`,"aria-sort":z,children:H}),t[63]=z,t[64]=H,t[65]=U):U=t[65],t[66]!==R||t[67]!==U?(C=(0,Z.jsx)(dC,{children:(0,Z.jsxs)(pC,{children:[R,U]})}),t[66]=R,t[67]=U,t[68]=C):C=t[68],b=fC,S=i.length?i.map(bC):(0,Z.jsx)(pC,{children:(0,Z.jsx)(hC,{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)(zh,{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 bC(e){return(0,Z.jsxs)(pC,{children:[(0,Z.jsx)(hC,{children:(0,Z.jsxs)(`a`,{href:Ho(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)(wl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(u,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(hC,{className:`text-muted-foreground`,children:e.kind===`file`?gC(e.modified):`—`})]},e.path)}function xC(e){return e===`asc`?`desc`:`asc`}function SC(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)(Oi,{className:`size-4 rounded`}),(0,Z.jsx)(Oi,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Oi,{className:`h-4 w-16`})})]},e)}function CC(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)(vl,{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=Zr(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Zr(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)(li,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(_i,{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 wC(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(TC),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>lt(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(){C(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)(li,{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 TC(){return new Set}var EC=(0,Q.createContext)(null);function DC(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(OC),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)(EC,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function OC(){return new Map}function kC(){let e=(0,Q.use)(EC);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function AC(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var jC=AC(()=>n(()=>import(`./SettingsDialogBody-Im-nZuQD.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([52,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,53,7,13,15,25,54]),import.meta.url));function MC(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)(li,{variant:`default`,onClick:NC,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 NC(){return window.location.reload()}function PC(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(le,{fallbackRender:IC,onError:FC,children:n}),t[0]=n,t[1]=r),r}function FC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function IC(e){return(0,Z.jsx)(MC,{...e})}function LC(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function RC(e){let t=(0,$.c)(89),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=ht(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=oe(),{desktopPresent:f}=Ni(),[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=typeof window<`u`&&window.okDesktop!=null,y;t[3]===a?y=t[4]:(y=a({id:`7PzzBU`}),t[3]=a,t[4]=y);let b;t[5]===a?b=t[6]:(b=a({id:`Q6hhn8`}),t[5]=a,t[6]=b);let x;t[7]===b?x=t[8]:(x={id:`preferences`,label:b},t[7]=b,t[8]=x);let S;t[9]===a?S=t[10]:(S=a({id:`4KmEoC`}),t[9]=a,t[10]=S);let C;t[11]===S?C=t[12]:(C={id:`hotkeys`,label:S},t[11]=S,t[12]=C);let w;t[13]===a?w=t[14]:(w=a({id:`AeXO77`}),t[13]=a,t[14]=w);let T;t[15]===w?T=t[16]:(T={id:`account`,label:w},t[15]=w,t[16]=T);let E;t[17]!==x||t[18]!==C||t[19]!==T?(E=[x,C,T],t[17]=x,t[18]=C,t[19]=T,t[20]=E):E=t[20];let D;t[21]!==E||t[22]!==y?(D={id:`user`,label:y,enabled:!0,items:E},t[21]=E,t[22]=y,t[23]=D):D=t[23];let O;t[24]===a?O=t[25]:(O=a({id:`ZWyHmq`}),t[24]=a,t[25]=O);let k;t[26]===a?k=t[27]:(k=a({id:`Nu4DdT`}),t[26]=a,t[27]=k);let A;t[28]===k?A=t[29]:(A={id:`sync`,label:k},t[28]=k,t[29]=A);let j;t[30]===a?j=t[31]:(j=a({id:`A1taO8`}),t[30]=a,t[31]=j);let M;t[32]===j?M=t[33]:(M={id:`search`,label:j},t[32]=j,t[33]=M);let N;t[34]===a?N=t[35]:(N=v?[{id:`terminal`,label:a({id:`ALhMYW`})}]:[],t[34]=a,t[35]=N);let P;t[36]===a?P=t[37]:(P=a({id:`iTylMl`}),t[36]=a,t[37]=P);let F;t[38]===P?F=t[39]:(F={id:`project-templates`,label:P},t[38]=P,t[39]=F);let I;t[40]===a?I=t[41]:(I=a({id:`3zyg_A`}),t[40]=a,t[41]=I);let L;t[42]===I?L=t[43]:(L={id:`okignore`,label:I},t[42]=I,t[43]=L);let R;t[44]===a?R=t[45]:(R=a({id:`cs4mps`}),t[44]=a,t[45]=R);let z;t[46]===R?z=t[47]:(z={id:`sharing`,label:R},t[46]=R,t[47]=z);let B;t[48]!==A||t[49]!==M||t[50]!==N||t[51]!==F||t[52]!==L||t[53]!==z?(B=[A,M,...N,F,L,z],t[48]=A,t[49]=M,t[50]=N,t[51]=F,t[52]=L,t[53]=z,t[54]=B):B=t[54];let V;t[55]!==_||t[56]!==O||t[57]!==B?(V={id:`project`,label:O,enabled:_,items:B},t[55]=_,t[56]=O,t[57]=B,t[58]=V):V=t[58];let H;t[59]===a?H=t[60]:(H=a({id:`nbfdhU`}),t[59]=a,t[60]=H);let U;t[61]!==a||t[62]!==f?(U=[],t[61]=a,t[62]=f,t[63]=U):U=t[63];let W;t[64]!==H||t[65]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[64]=H,t[65]=U,t[66]=W):W=t[66];let G;t[67]!==D||t[68]!==V||t[69]!==W?(G=[D,V,W],t[67]=D,t[68]=V,t[69]=W,t[70]=G):G=t[70];let K=G,q;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(wo,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[71]=q):q=t[71];let J;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(Co,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[72]=J):J=t[72];let ee;t[73]!==p||t[74]!==K?(ee=(0,Z.jsx)(zC,{groups:K,activeId:p,onSelect:m}),t[73]=p,t[74]=K,t[75]=ee):ee=t[75];let te;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(HC,{}),t[76]=te):te=t[76];let ne=l?c:null,re;t[77]!==p||t[78]!==u||t[79]!==d||t[80]!==ne?(re=(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)(PC,{children:(0,Z.jsx)(Q.Suspense,{fallback:te,children:(0,Z.jsx)(jC,{activeId:p,userBinding:ne,okignoreBinding:u,okignoreSynced:d})})})}),t[77]=p,t[78]=u,t[79]=d,t[80]=ne,t[81]=re):re=t[81];let Y;t[82]!==ee||t[83]!==re?(Y=(0,Z.jsxs)(To,{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:[q,J,ee,re]}),t[82]=ee,t[83]=re,t[84]=Y):Y=t[84];let ie;return t[85]!==r||t[86]!==n||t[87]!==Y?(ie=(0,Z.jsx)(ko,{open:n,onOpenChange:r,children:Y}),t[85]=r,t[86]=n,t[87]=Y,t[88]=ie):ie=t[88],ie}function zC(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)(VC,{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)(BC,{}),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 BC(){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=LC(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:si(`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)(yo,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function VC(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=si(`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:si(`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 HC(){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)(Oi,{className:`h-5 w-32`}),r=(0,Z.jsx)(Oi,{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)(Oi,{className:`h-9 w-full`}),(0,Z.jsx)(Oi,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function UC(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=si(`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)(_x,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WC(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)(bx,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function GC(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=si(`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)(wx,{"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 KC(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=si(`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 qC=ai(`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 JC(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=si(qC({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:YC,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function YC(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ai(`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 XC(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=si(`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 ZC(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=si(`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)(Mo,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QC(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)(ZC,{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)(ol,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(xo,{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)(Ns,{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)(Is,{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)(gu,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(xo,{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 W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=W):W=t[43];let G;t[44]===U?G=t[45]:(G=(0,Z.jsxs)(Is,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(JC,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=K):K=t[48];let q;t[49]!==K||t[50]!==F?(q=(0,Z.jsxs)(KC,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,K]}),t[49]=K,t[50]=F,t[51]=q):q=t[51];let J;t[52]===E?J=t[53]:(J=(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]=J);let ee;t[54]===S?ee=t[55]:(ee=S({id:`oqB2ez`}),t[54]=S,t[55]=ee);let te=!w,ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(Lt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=ne):ne=t[56];let re;t[57]!==v||t[58]!==ee||t[59]!==te?(re=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:te,onClick:v,children:ne})}),t[57]=v,t[58]=ee,t[59]=te,t[60]=re):re=t[60];let Y;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=Y):Y=t[61];let ie;t[62]===re?ie=t[63]:(ie=(0,Z.jsxs)(Is,{children:[re,Y]}),t[62]=re,t[63]=ie);let ae;t[64]===S?ae=t[65]:(ae=S({id:`SiUUCS`}),t[64]=S,t[65]=ae);let oe=!w,se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(He,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=se):se=t[66];let ce;t[67]!==_||t[68]!==ae||t[69]!==oe?(ce=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ae,disabled:oe,onClick:_,children:se})}),t[67]=_,t[68]=ae,t[69]=oe,t[70]=ce):ce=t[70];let le;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=le):le=t[71];let ue;t[72]===ce?ue=t[73]:(ue=(0,Z.jsxs)(Is,{children:[ce,le]}),t[72]=ce,t[73]=ue);let de=o?`secondary`:`ghost`,fe;t[74]!==S||t[75]!==o?(fe=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=fe):fe=t[76];let pe=o?`ok-replace-input`:void 0,me;t[77]!==m||t[78]!==o?(me=()=>m(!o),t[77]=m,t[78]=o,t[79]=me):me=t[79];let he;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=he):he=t[80];let ge;t[81]!==o||t[82]!==de||t[83]!==fe||t[84]!==pe||t[85]!==me?(ge=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:de,size:`icon-sm`,"aria-label":fe,"aria-expanded":o,"aria-controls":pe,onClick:me,children:he})}),t[81]=o,t[82]=de,t[83]=fe,t[84]=pe,t[85]=me,t[86]=ge):ge=t[86];let _e;t[87]===o?_e=t[88]:(_e=(0,Z.jsx)(Ns,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=_e);let ve;t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsxs)(Is,{children:[ge,_e]}),t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(ye=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)(Mo,{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)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Jl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{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]=ye):ye=t[100];let be;t[101]===S?be=t[102]:(be=S({id:`wJo9oS`}),t[101]=S,t[102]=be);let xe;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(gs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=xe):xe=t[103];let Se;t[104]!==x||t[105]!==be?(Se=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":be,onClick:x,children:xe})}),t[104]=x,t[105]=be,t[106]=Se):Se=t[106];let Ce;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Ce):Ce=t[107];let we;t[108]===Se?we=t[109]:(we=(0,Z.jsxs)(Is,{children:[Se,Ce]}),t[108]=Se,t[109]=we);let Te;return t[110]!==q||t[111]!==J||t[112]!==ie||t[113]!==ue||t[114]!==j||t[115]!==ve||t[116]!==ye||t[117]!==we?(Te=(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,q,J,ie,ue,ve,ye,we]}),t[110]=q,t[111]=J,t[112]=ie,t[113]=ue,t[114]=j,t[115]=ve,t[116]=ye,t[117]=we,t[118]=Te):Te=t[118],Te}var $C={current:0,total:0},ew=120,tw=100;function nw(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?q(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(E,n,rw)}function rw(){return null}function iw(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,`
|
|
25
25
|
`,`
|
|
26
26
|
`).trim();return i.length===0||i.length>ew||i.includes(`
|
|
27
27
|
`)?null:i}function aw(e){let t=Be(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function ow(e,t){return e.current===t.current&&e.total===t.total}function sw(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n($C)}function cw(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=w(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 lw(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=nw(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)($C),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(dw))},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(uw)},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($C);return}if(!u.open||r){i.commands.clearFindMatches(),p($C);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=aw(i);p(t=>ow(t,e)?t:e)},tw);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=Be(i.state),t=aw(i);p(e=>ow(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=iw(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(nc(t,`find`)){t.preventDefault(),u.open?sw(i,d,p):e(!1);return}if(nc(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=nc(t,`find-next`),n=nc(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&cw(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),sw(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=Be(i.state),t=aw(i);p(e=>ow(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(){sw(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()&&cw(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()&&cw(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)&&cw(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)&&cw(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 W,G,K,q,J;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),q=e=>d(t=>({...t,caseSensitive:e})),J=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=J):(W=t[63],G=t[64],K=t[65],q=t[66],J=t[67]);let ee;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?(ee=(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)(QC,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:q,onWholeWordChange:J,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]=ee):ee=t[80],ee}function uw(e){return{...e,open:!1,activeIndex:0}}function dw(e){return{...e,activeIndex:0}}var fw=300;function pw(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Tc),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Tc);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Ac(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,fw)};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 mw(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function hw(e){let t=(0,$.c)(8),{poolEntries:n}=ht(),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=()=>mw(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(mw(i));let t=()=>s(mw(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 gw(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Mc(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Nc,r)}var _w=`ok-doc-panel-width-v1`;function vw(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function yw(e){try{let t=(e??localStorage).getItem(_w);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?vw(n):320}catch{return 320}}function bw(e,t){try{(t??localStorage).setItem(_w,String(vw(e)))}catch{}}function xw(){try{return typeof localStorage>`u`?320:yw()}catch{return 320}}var Sw=1024,Cw=1280,ww={left:Sw,right:Cw};function Tw(e,t,n){return e==null?t>=ww[n]?`above`:`below`:`embedded`}function Ew(e){return e===`above`?`open`:`collapsed`}var Dw=`ok-sidebar-pins-v2`;function Ow(e){return e===`open`||e===`collapsed`}function kw(e){return e===`above`||e===`below`||e===`embedded`}function Aw(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!kw(e)||!Ow(t[e]))return!1;return!0}function jw(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return Aw(n.left)&&(r.left=n.left),Aw(n.right)&&(r.right=n.right),r}function Mw(e){try{let t=(e??localStorage).getItem(Dw);return t==null?{}:jw(t)}catch{return{}}}function Nw(e,t){try{t.setItem(Dw,JSON.stringify(e))}catch{}}function Pw(e,t,n){return n[e]?.[t]??Ew(t)}function Fw(e,t,n,r){let i=r??localStorage,a=Mw(i);return a[e]={...a[e],[t]:n},Nw(a,i),a}function Iw(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`?Lw: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 Lw(e){return e===`synced`?`synced`:`connected`}var Rw=Rr;function zw(e,t={}){let n=Oe(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var Bw=200,Vw=`Outside any block`;function Hw(e){let t=(0,$.c)(5),{editor:n}=e,r=Kt(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?Uw(n,r):o.current?Vw:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},Bw),()=>{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 Uw(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=zw(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=zw(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 Ww(){let[e]=(0,Q.useState)(Lr);return e}function Gw({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:xr(e.display_name),color:Gn(e.id,Pn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Gn(e.id,Pn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function Kw(e,t){return e>t}function qw(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 Jw=3,Yw=6e4;function Xw(e,t){let n=0;for(let r of e)t-r<Yw&&(n+=1);return n<Jw}var Zw=new Map;function Qw(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 $w(e){let t=kt.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function eT(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=kt.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){ue.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=>{Kw(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!Kw(i,a)||l!==null&&$w(l.state))return;o=!0;let e=Date.now();for(let[t,n]of Zw)n.every(t=>e-t>=Yw)&&Zw.delete(t);let t=(Zw.get(n)??[]).filter(t=>e-t<Yw);if(!Xw(t,e)){Zw.set(n,t),ue.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),Zw.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,ue.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==kt&&Qw(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new or({state:{init:()=>null,apply:e=>(qw(e.getMeta(kt))&&(a=i,o&&ue.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!Kw(i,a)||$w(t)?!0:e.getMeta(kt)!==void 0,view:e=>{let r=t.doc;return r==null?(ue.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 tT(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 nT=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&&$n(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(Ms(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Rs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ts(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ls(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(zs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ds(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(As(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ks(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=Un(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof ir){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 Dr){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():tT(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Ps(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()}},rT=e=>new or({key:typeof e.pluginKey==`string`?new Vn(e.pluginKey):e.pluginKey,view:t=>new nT({view:t,...e})});ti.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[rT({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 iT=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 Nr(e,{textSerializers:Mn(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ms(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Rs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ts(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ls(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(zs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ds(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(As(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ks(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=Un(this.view,e.from,e.to);Ps({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()}},aT=e=>new or({key:typeof e.pluginKey==`string`?new Vn(e.pluginKey):e.pluginKey,view:t=>new iT({view:t,...e})});ti.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?[aT({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 oT(e,t){return e??new Vn(t)}var sT=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,cT=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),lT=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(`.`)),uT=new Set([`children`,`className`,`style`]),dT=new Set([`tabIndex`]),fT=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),pT={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function mT(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function hT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function gT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||fT.has(e)}function _T(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function vT(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:pT[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function yT(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 bT(e){return dT.has(e)}function xT(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function ST(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 CT(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||lT.has(e)?String(t):`${t}px`}function wT(e,t){cT.has(t)||e.style.removeProperty(_T(t))}function TT(e,t,n){cT.has(t)||e.style.setProperty(_T(t),CT(t,n))}function ET(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(uT.has(r)||!gT(r)||mT(r,t[r])||mT(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=hT(r);if(a==null||a===!1){bT(r)&&ST(e,r),e.removeAttribute(o);return}if(a===!0){bT(r)&&xT(e,r,!0),e.setAttribute(o,``);return}if(bT(r)){xT(e,r,a);return}e.setAttribute(o,String(a))})}function DT(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function OT(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){wT(e,t);return}TT(e,t,a)}})}function kT(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(!mT(t,n))return;let{eventName:i,options:a}=vT(t),o=t=>{n(yT(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function AT(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);sT(()=>{let i=n.current;return DT(e,i.className,t.className),OT(e,i.style,t.style),ET(e,i,t),r.current=kT(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 jT=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)(oT(e,`bubbleMenu`)).current;AT(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=qt(),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=rT({...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,rl.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)(oT(e,`floatingMenu`)).current;AT(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=qt(),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=aT({...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,rl.createPortal)(s,u.current)});var MT=[{name:`paragraph`,label:`Text`,icon:Wl,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Ee,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:F,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:Et,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:_e,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:he,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:k,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:M,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:tu,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function NT(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:PT},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Le(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)(He,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsxs)(li,{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=MT.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Da,{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)(to,{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)(oo,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function PT(e){let t=Object.fromEntries(MT.map(t=>[t.name,t.isActive(e.editor)]));return{current:MT.find(e=>t[e.name])??MT[0],activeStates:t}}function FT(e){let t=(0,$.c)(17),{installStates:n,onPick:r}=e,{_:a}=i(),[o,c]=(0,Q.useState)(``),l;if(t[0]!==a||t[1]!==n||t[2]!==o||t[3]!==r){let e;t[5]===n?e=t[6]:(e=e=>n[e.id]?.installed===!0,t[5]=n,t[6]=e);let i=gg.filter(e),u=gg.some(e=>n[e.id]?.installed==null),d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`font-mono text-xs uppercase tracking-wide text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EVnzPs`})}),t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>c(e.target.value),t[8]=f):f=t[8];let p;t[9]===a?p=t[10]:(p=a({id:`Rah7yq`}),t[9]=a,t[10]=p);let m;t[11]===a?m=t[12]:(m=a({id:`ZBt4rI`}),t[11]=a,t[12]=m);let h;t[13]!==o||t[14]!==p||t[15]!==m?(h=(0,Z.jsx)(Mo,{value:o,onChange:f,placeholder:p,"aria-label":m,"data-testid":`edit-with-ai-instruction`}),t[13]=o,t[14]=p,t[15]=m,t[16]=h):h=t[16],l=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,h,i.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,"data-testid":`edit-with-ai-send-label`,children:(0,Z.jsx)(s,{id:`C37Zkt`})}),(0,Z.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:i.map(e=>(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,"data-testid":`edit-with-ai-target-${e.id}`,onClick:()=>r(e,o),children:[(0,Z.jsx)(Vx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:e.displayName})]},e.id))})]}):(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`edit-with-ai-empty`,"aria-live":`polite`,children:u?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=a,t[1]=n,t[2]=o,t[3]=r,t[4]=l}else l=t[4];return l}function IT(e){let t=(0,$.c)(27),{open:n,onOpenChange:r,snapshot:a,children:o}=e,{_:s}=i(),{states:c,refresh:l}=D_(),{dispatch:u}=g_(),d;t[0]===l?d=t[1]:(d=()=>{l()},t[0]=l,t[1]=d);let f=(0,Q.useEffectEvent)(d),p;t[2]!==n||t[3]!==f?(p=()=>{n&&f()},t[2]=n,t[3]=f,t[4]=p):p=t[4];let m;t[5]===n?m=t[6]:(m=[n],t[5]=n,t[6]=m),(0,Q.useEffect)(p,m);let h;t[7]!==s||t[8]!==u||t[9]!==r||t[10]!==a?(h=(e,t)=>{if(a!==null){let n=a_({docName:a.docName,workspace:a.workspace,instruction:t,selectionMarkdown:a.selectionMarkdown});n===null?X.error(s({id:`_VRtd7`})):u(e.id,n)}r(!1)},t[7]=s,t[8]=u,t[9]=r,t[10]=a,t[11]=h):h=t[11];let g=h,_;t[12]===o?_=t[13]:(_=(0,Z.jsx)(J,{asChild:!0,children:o}),t[12]=o,t[13]=_);let v;t[14]===s?v=t[15]:(v=s({id:`EVnzPs`}),t[14]=s,t[15]=v);let y;t[16]!==g||t[17]!==c?(y=(0,Z.jsx)(FT,{installStates:c,onPick:g}),t[16]=g,t[17]=c,t[18]=y):y=t[18];let x;t[19]!==v||t[20]!==y?(x=(0,Z.jsx)(b,{align:`start`,"aria-label":v,"data-testid":`edit-with-ai-popover`,children:y}),t[19]=v,t[20]=y,t[21]=x):x=t[21];let S;return t[22]!==r||t[23]!==n||t[24]!==_||t[25]!==x?(S=(0,Z.jsxs)(pe,{open:n,onOpenChange:r,children:[_,x]}),t[22]=r,t[23]=n,t[24]=_,t[25]=x,t[26]=S):S=t[26],S}function LT(e){let t=P(e.state.selection.content(),e.state.schema);return l().serialize(t).trim()}function RT(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function zT(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,a=Xn(),o=pg();if(!a||o)return null;let s;return t[0]!==n||t[1]!==i?(s=(0,Z.jsx)(BT,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=s):s=t[2],s}function BT(e){let t=(0,$.c)(19),{editor:n,shortcutEnabled:r}=e,{_:a}=i(),o=ka(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f;if(t[0]!==a||t[1]!==n||t[2]!==o){let e=()=>{let e;try{e=LT(n)}catch(e){return console.error(`Edit with AI: could not read the selection`,e),X.error(a({id:`-RXIMO`})),null}return{docName:xt(n),workspace:o,selectionMarkdown:e}};f=()=>{let t=e();t!==null&&(d(t),l(!0))},t[0]=a,t[1]=n,t[2]=o,t[3]=f}else f=t[3];let p=f,m;t[4]===p?m=t[5]:(m=e=>{if(e){p();return}l(!1),d(null)},t[4]=p,t[5]=m);let h=m,g;t[6]===p?g=t[7]:(g=()=>{p()},t[6]=p,t[7]=g);let _=(0,Q.useEffectEvent)(g),v;t[8]!==_||t[9]!==r?(v=()=>{let e=e=>{r&&nc(e,`edit-with-ai`)&&(RT(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[8]=_,t[9]=r,t[10]=v):v=t[10];let y;t[11]===r?y=t[12]:(y=[r],t[11]=r,t[12]=y),(0,Q.useEffect)(v,y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(li,{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`,children:[(0,Z.jsx)(bi,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`EVnzPs`})})]}),t[14]=x):x=t[14];let S;return t[15]!==h||t[16]!==c||t[17]!==u?(S=(0,Z.jsxs)(Z.Fragment,{children:[b,(0,Z.jsx)(IT,{open:c,onOpenChange:h,snapshot:u,children:x})]}),t[15]=h,t[16]=c,t[17]=u,t[18]=S):S=t[18],S}function VT(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 HT(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:Ft(typeof n.src==`string`?n.src:``)}function UT(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 WT(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:GT},t[0]=n,t[1]=a),Le(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=VT(n);t&&UT(t,HT(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Ya,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{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)(Ns,{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)(Is,{children:[u,d]})}),t[11]=u,t[12]=f),f}function GT(e){return VT(e.editor)}function KT(e){return VT(e)!==null}function qT(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function JT(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 YT(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function XT(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=i(),a;t[0]===n?a=t[1]:(a={editor:n,selector:ZT},t[0]=n,t[1]=a);let o=Le(a),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!qT(n)||n.state.selection.empty||YT(n)||JT(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=Bn(Hn(n.state.doc)),a=Fr(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)(ne,{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)(js,{asChild:!0,children:(0,Z.jsx)(li,{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)(Ns,{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)(Is,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function ZT(e){let t=e.editor;return!!(!qT(t)||t.state.selection.empty||YT(t)||JT(t))}var QT=`img, .ok-embed, .ok-video`,$T=220,eE=`cubic-bezier(0.23, 1, 0.32, 1)`,tE=`ok-image-align-flip`,nE=.5;function rE(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function iE(){return typeof requestAnimationFrame==`function`}function aE(e){return e?e.querySelector(QT):null}function oE(e,t){if(rE()||!iE()){t();return}let n=aE(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=aE(e);if(!t)return;for(let e of t.getAnimations())e.id===tE&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<nE)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:$T,easing:eE,fill:`none`});i.id=tE})}var sE=[{value:`left`,label:`Align left`,icon:du},{value:`center`,label:`Align center`,icon:lu},{value:`right`,label:`Align right`,icon:uu}];function cE(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!zt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function lE(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:uE},t[0]=n,t[1]=r);let i=Le(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=sE.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{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(!zt.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(ir.create(u.doc,s)),oE(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{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 uE(e){return cE(e.editor)}function dE(e){return cE(e)!==null}var fE=[{name:`bold`,icon:nl,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:kl,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:pu,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:ou,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:bt,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Dl,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function pE(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:mE},t[0]=n,t[1]=r);let i=Le(r),a;t[2]!==i||t[3]!==n?(a=fE.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{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)(Ns,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Yt,{"aria-label":rc(e.shortcutId),children:tc(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 mE(e){return Object.fromEntries(fE.map(t=>[t.name,t.isActive(e.editor)]))}function hE(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:p,pages:m}=is(),h;t[0]===n?h=t[1]:(h=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=h);let g=h,v;t[2]===n?v=t[3]:(v=n.getAttributes(`link`).href??``,t[2]=n,t[3]=v);let y=v,b;t[4]===n?b=t[5]:(b=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=b);let x=b,S,C;t[6]===n?(S=t[7],C=t[8]):(S=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},C=[n],t[6]=n,t[7]=S,t[8]=C),(0,Q.useEffect)(S,C);let w,T;t[9]===a?(w=t[10],T=t[11]):(w=()=>{a&&requestAnimationFrame(()=>u.current?.focus())},T=[a],t[9]=a,t[10]=w,t[11]=T),(0,Q.useEffect)(w,T);let E;t[12]!==n||t[13]!==g||t[14]!==c?(E=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():g&&n.chain().focus().unsetLink().run(),o(!1)},t[12]=n,t[13]=g,t[14]=c,t[15]=E):E=t[15];let D=E,O;t[16]===n?O=t[17]:(O=function(){n.chain().focus().unsetLink().run(),o(!1)},t[16]=n,t[17]=O);let k=O,A;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(st(e.path,null))},t[18]=A):A=t[18];let j=A,M;t[19]!==D||t[20]!==n?(M=function(e){e.key===`Enter`&&(e.preventDefault(),D()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[19]=D,t[20]=n,t[21]=M):M=t[21];let N=M;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]!==N||t[28]!==p||t[29]!==m||t[30]!==e||t[31]!==n||t[32]!==c?(i=(0,Z.jsx)(_,{ref:u,type:`text`,placeholder:e,value:c,pages:m,folderPaths:d,loading:p,onValueChange:l,onSuggestionSelect:j,onKeyDown:N,"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]=N,t[28]=p,t[29]=m,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]===D?o=t[37]:(o=()=>{D()},t[36]=D,t[37]=o);let h;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(pl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=h):h=t[38];let v;t[39]!==a||t[40]!==o?(v=(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:h}),t[39]=a,t[40]=o,t[41]=v):v=t[41];let b;t[42]!==i||t[43]!==v?(b=(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,v]}),t[42]=i,t[43]=v,t[44]=b):b=t[44];let x;t[45]!==r||t[46]!==y||t[47]!==g||t[48]!==k?(x=g&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),f(y)},children:(0,Z.jsx)(yo,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),k()},children:(0,Z.jsx)(K,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[45]=r,t[46]=y,t[47]=g,t[48]=k,t[49]=x):x=t[49];let S;return t[50]!==b||t[51]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[b,x]}),t[50]=b,t[51]=x,t[52]=S):S=t[52],S}let P;t[53]===r?P=t[54]:(P=r({id:`p0Iq25`}),t[53]=r,t[54]=P);let F=g?`bg-accent text-primary`:`text-accent-foreground`,I;t[55]===x?I=t[56]:(I=e=>{e.preventDefault(),l(x()),o(!0)},t[55]=x,t[56]=I);let L;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(jl,{className:`size-3.5`}),t[57]=L):L=t[57];let R;t[58]!==P||t[59]!==F||t[60]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":P,className:F,onMouseDown:I,children:L})}),t[58]=P,t[59]=F,t[60]=I,t[61]=R):R=t[61];let z;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(s,{id:`yzF66j`}),t[62]=z):z=t[62];let B;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(Ns,{side:`bottom`,sideOffset:8,children:[z,(0,Z.jsx)(Yt,{children:tc(`command-palette`)})]}),t[63]=B):B=t[63];let V;return t[64]===R?V=t[65]:(V=(0,Z.jsxs)(Is,{children:[R,B]}),t[64]=R,t[65]=V),V}function gE({editor:e}){if(Be(e.state).query||e.isActive(`codeBlock`))return!1;if(dE(e)||KT(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 _E(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:SE},t[0]=n,t[1]=l);let u=Le(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:xE},t[2]=n,t[3]=d);let f=Le(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Un(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=Os(e,t,()=>{Ps(e,t,{placement:`top`,strategy:`fixed`,middleware:[Ts(8),Ms(),Rs({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(bE)}))},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(yE)},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)(lE,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(WT,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(NT,{editor:n}),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(pE,{editor:n},o),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(hE,{editor:n},`${o}-link`),(0,Z.jsx)(XT,{editor:n},`${o}-footnote`),(0,Z.jsx)(zT,{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 b;return t[19]!==n||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(jT,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:vE,shouldShow:gE,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]=b):b=t[22],b}function vE(){return document.body}function yE(e){return e+1}function bE(){}function xE(e){return KT(e.editor)}function SE(e){return dE(e.editor)}var CE=56,wE=`0 2px 4px rgba(0, 0, 0, 0.08)`,TE=150,EE=globalThis.ScrollTimeline;function DE(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+CE);return{startOffset:o,endOffset:o+a,maxShift:a}}var OE=new WeakMap;function kE(e){let t=OE.get(e);if(t){for(let e of t.animations)e.cancel();OE.delete(e)}}function AE(e){for(let t of Array.from(e.cells))kE(t)}var jE=e=>e.cellIndex===0?`3`:`2`;function ME(e,t){return NE(e,t,e=>({transform:`translateY(${e}px)`}))}function NE(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 PE(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 FE(e,t,n){return PE(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:wE})}function IE(e,t){return PE(e,t,{opacity:`0`},{opacity:`1`})}function LE(e,t,n,r){let i=jE(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=OE.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(ME(n,r),s),l=e.animate(FE(n,r,i),s),u=e.animate(IE(n,r),{...s,pseudoElement:`::before`});OE.set(e,{key:a,animations:[c,l,u]})}function RE(e,t){let n=jE(e),r=`in|${t}|${n}`,i=OE.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:wE}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});OE.set(e,{key:r,animations:[a,o]})}function zE(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=DE(a,i,c.top,c.height,l.height);if(!u){AE(s);continue}if(n){if(o<=0){AE(s);continue}for(let e of Array.from(s.cells))LE(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+CE){AE(s);continue}for(let e of Array.from(s.cells))RE(e,d)}}var BE=ti.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new or({key:new Vn(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||zE(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()},TE);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&EE)try{n=new EE({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`))AE(t)}}}})]}}),VE=`application/x-open-knowledge-sidebar-item+json`,HE={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function UE(e){return JSON.stringify(e)}function WE(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:Wo(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:Yo(e.assetPath)}:{target:ds(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:Ho(e.docName)}}function GE(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(VE);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!KE(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&&!qE(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function KE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qE(e){return typeof e==`string`&&Object.hasOwn(HE,e)}function JE(e,t){return(n,r)=>{let i=r,a=GE(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function YE(e,t){let n=WE(e);t(n.target,{tabBehavior:`append`}),Xo(n.hash)}function XE(e){return[...e?[{label:`Toggle header column`,icon:dl,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:_i,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:no,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:K,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Tl,run:e=>e.chain().focus().deleteTable().run()}]}function ZE(e){return[...e?[{label:`Toggle header row`,icon:su,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:pt,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:$e,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:K,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Tl,run:e=>e.chain().focus().deleteTable().run()}]}function QE(e){if(!e.isEditable||Be(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 $E(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 Os(r,e,()=>{Ps(r,e,{strategy:`absolute`,placement:t,middleware:[Ts(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(eD)})},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`?hl:Ea,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)(ja,{asChild:!0,children:(0,Z.jsx)(li,{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)(ro,{}),(0,Z.jsxs)(Da,{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)(to,{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)(oo,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function eD(){}function tD(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=QE(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=XE(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)($E,{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=ZE(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)($E,{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 nD(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=kt.getState(e.state)?.binding;if(!t){ue.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){ue.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}ue.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return ti.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new or({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var rD=new WeakMap;function iD(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=Kr(e.color),n.textContent=e.name,t.append(n),t}var aD={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},oD=100,sD=100,cD=3,lD=250;function uD(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function dD(e,t){let n=w(e);if(!n||t.contains(n.dom))return!1;if(!uD(e))return console.warn(`[TiptapEditor] TipTap EditorContent binding fields missing; detached editor repair skipped`),!1;let r=e;if(r.contentComponent==null)return!1;try{n.setProps({nodeViews:{}})}catch{}return r.contentComponent=null,r.isEditorContentInitialized=!1,!0}function fD(){let e=new cr({extensions:mr});return{mdManager:e,text:Tt({mdManager:e}),html:L({mdManager:e}),paste:Se({mdManager:e}),drop:Te({mdManager:e})}}function pD(e,t){return t?{collaboration:fe.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[nD({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:fe.configure({document:e.document}),guard:[]}}function mD(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=pD(t,r);return[...St.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),Rw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,ti.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[rt]}}),ti.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[gt(e,{cursorBuilder:iD})]}}),ti.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[eT({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,BE]}function hD(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{rD.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=rD.get(e);if(rD.delete(e),r==null)return;let i=performance.now();ue(`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:JE(n.drop,e.onSidebarDrop)},extensions:Zp(mD(e))}}function gD(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=hD({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}=Pt(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var _D=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(aD),c=Ww(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=ht(),p=n.configuration.name??``,[m]=(0,Q.useState)(fD),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new _r(gD({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;ue(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{YE(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=ot(p)??crypto.randomUUID();_=Q.use,v=ee({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=()=>()=>{de(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)(vD,{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},vD=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,b;t[3]!==c||t[4]!==f?(v=()=>{dD(c,f)&&h(yD)},b=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=b):(v=t[5],b=t[6]),(0,Q.useEffect)(v,b);let x;t[7]!==c||t[8]!==n.configuration.name?(x=()=>(Mt(c,n.configuration.name??null),()=>{Mt(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=x):x=t[9];let S;t[10]!==c||t[11]!==n?(S=[c,n],t[10]=c,t[11]=n,t[12]=S):S=t[12],(0,Q.useEffect)(x,S);let C;t[13]!==c||t[14]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(e)return re(e,c),()=>N(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=C):C=t[15];let T;t[16]!==c||t[17]!==n?(T=[c,n],t[16]=c,t[17]=n,t[18]=T):T=t[18],(0,Q.useEffect)(C,T);let E;t[19]!==c||t[20]!==n.configuration.name?(E=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,kc(e,`wysiwyg`,jc(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),kc(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=E):E=t[21];let D;t[22]!==c||t[23]!==n?(D=[c,n],t[22]=c,t[23]=n,t[24]=D):D=t[24],(0,Q.useEffect)(E,D);let O;t[25]!==c||t[26]!==n.configuration.name?(O=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=O):O=t[27];let k;t[28]!==c||t[29]!==n?(k=[c,n],t[28]=c,t[29]=n,t[30]=k):k=t[30],(0,Q.useEffect)(O,k);let A,j;t[31]===c?(A=t[32],j=t[33]):(A=()=>{let e=bD,t=null,n=()=>{if(t||c.isDestroyed)return;let n=w(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 w(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},j=[c],t[31]=c,t[32]=A,t[33]=j),(0,Q.useEffect)(A,j);let M,P;t[34]!==i||t[35]!==c?(M=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!w(c))return;e=!0;let t=y(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})),ue(`ok/editor/selection-restore-failed`,{docName:i,message:n})}Jt(i)};if(w(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},P=[c,i],t[34]=i,t[35]=c,t[36]=M,t[37]=P):(M=t[36],P=t[37]),(0,Q.useEffect)(M,P);let F,I;t[38]!==u||t[39]!==n.document||t[40]!==l?(F=()=>{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)},Rn)};c(aD);let f=()=>{if(pr(e),!Er(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`?Er(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)}},I=[n.document,u,l],t[38]=u,t[39]=n.document,t[40]=l,t[41]=F,t[42]=I):(F=t[41],I=t[42]),(0,Q.useEffect)(F,I);let L,R;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(L=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<oD){e+=1,t=window.setTimeout(p,sD);return}r=null,o=null,e=0},u=function(e){let t=w(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=cD,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,lD)))};t=window.setTimeout(o,lD)};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=os(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)}},R=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=L,t[48]=R):(L=t[47],R=t[48]),(0,Q.useEffect)(L,R);let z,B;t[49]===c?(z=t[50],B=t[51]):(z=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=w(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(Ec,e),()=>window.removeEventListener(Ec,e)},B=[c],t[49]=c,t[50]=z,t[51]=B),(0,Q.useEffect)(z,B);let V;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(V=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:Gw({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[52]=a,t[53]=i,t[54]=o,t[55]=r,t[56]=s,t[57]=n.awareness,t[58]=V):V=t[58];let H;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(H=[n,i,a,o,s,r],t[59]=a,t[60]=i,t[61]=o,t[62]=r,t[63]=s,t[64]=n,t[65]=H):H=t[65],(0,Q.useEffect)(V,H);let U,W;t[66]!==c||t[67]!==r?(U=()=>(d(c,r),()=>{d(c,!1)}),W=[c,r],t[66]=c,t[67]=r,t[68]=U,t[69]=W):(U=t[68],W=t[69]),(0,Q.useEffect)(U,W);let G;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(G=!r&&(0,Z.jsx)(_E,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=G):G=t[74];let K;t[75]!==c||t[76]!==r?(K=!r&&(0,Z.jsx)(tD,{editor:c}),t[75]=c,t[76]=r,t[77]=K):K=t[77];let q;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=q):q=t[78];let J;t[79]!==c||t[80]!==m?(J=(0,Z.jsx)(je,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=J):J=t[81];let ee;t[82]!==f||t[83]!==J?(ee=(0,rl.createPortal)(J,f),t[82]=f,t[83]=J,t[84]=ee):ee=t[84];let te;t[85]===c?te=t[86]:(te=(0,Z.jsx)(Hw,{editor:c}),t[85]=c,t[86]=te);let ne;t[87]===c?ne=t[88]:(ne=vt(c),t[87]=c,t[88]=ne);let Y;t[89]===ne.store?Y=t[90]:(Y=(0,Z.jsx)(At,{store:ne.store}),t[89]=ne.store,t[90]=Y);let ie;return t[91]!==G||t[92]!==K||t[93]!==ee||t[94]!==te||t[95]!==Y||t[96]!==l?(ie=(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:[G,K,q,ee,te,Y]}),t[91]=G,t[92]=K,t[93]=ee,t[94]=te,t[95]=Y,t[96]=l,t[97]=ie):ie=t[97],ie};function yD(e){return e+1}function bD(){return j()}var xD=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 SD(e,t,n,r,i,a){if(e==r)return[];let o=MD(e,t,n,r,i,a),s=ND(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 xD(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new xD(t,t+o,i,i),new xD(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 xD(t,t,i,i+o),new xD(n,n,i+o+c,a)]}if(c==1||l==1)return[new xD(t,n,i,a)];let u=FD(e,t,n,r,i,a);if(u){let[o,s,c]=u;return SD(e,t,o,r,i,s).concat(SD(e,o+c,n,r,s+c,a))}return ED(e,t,n,r,i,a)}var CD=1e9,wD=0,TD=!1;function ED(e,t,n,r,i,a){let o=n-t,s=a-i;if(CD<1e9&&Math.min(o,s)>CD*16||wD>0&&Date.now()>wD)return Math.min(o,s)>CD*64?[new xD(t,n,i,a)]:ID(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);OD.reset(c),kD.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:kD,f=d?null:OD;for(let p=0;p<c;p++){if(p>CD||wD>0&&!(p&63)&&Date.now()>wD)return ID(e,t,n,r,i,a);let m=OD.advance(p,o,s,c,d,!1,l)||kD.advance(p,o,s,c,f,!0,u);if(m)return AD(e,t,n,t+m[0],r,i,a,i+m[1])}return[new xD(t,n,i,a)]}var DD=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}},OD=new DD,kD=new DD;function AD(e,t,n,r,i,a,o,s){let c=!1;return!ZD(e,r)&&++r==n&&(c=!0),!ZD(i,s)&&++s==o&&(c=!0),c?[new xD(t,n,a,o)]:SD(e,t,r,i,a,s).concat(SD(e,r,n,i,s,o))}function jD(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function MD(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=jD(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-+!ZD(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function ND(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=jD(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-+!ZD(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function PD(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;;){ZD(e,s)||s++;let u=s+o;if(ZD(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=MD(e,u,n,r,i+f+d.length,a),c=ND(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 FD(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=FD(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:PD(e,t,n,r,i,a,Math.floor(o/4),-1)}function ID(e,t,n,r,i,a){TD=!0;let o=n-t,s=a-i,c;if(o<s){let s=PD(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=PD(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new xD(t,n,i,a)];let[l,u,d]=c;return SD(e,t,l,r,i,u).concat(SD(e,l+d,n,r,u+d,a))}function LD(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 xD(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function RD(e,t,n){for(;;){LD(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=MD(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new xD(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=ND(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new xD(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 xD(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 xD(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function zD(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=KD(t,a.fromA,l),f=GD(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 xD(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=GD(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new xD(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=KD(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new xD(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=JD(n,a.fromB,a.toB),r,o=t<0?-1:qD(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=JD(t,a.fromA,a.toA),r,o=n<0?-1:qD(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 LD(e,3),e}var BD;try{BD=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function VD(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function HD(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!VD(n):BD?!YD(n)||t==e.length-1?+!!BD.test(String.fromCharCode(n)):BD.test(e.slice(t,t+2))?2:0:0}function UD(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!VD(n):BD?!XD(n)||t==1?+!!BD.test(String.fromCharCode(n)):BD.test(e.slice(t-2,t))?2:0:0}var WD=8;function GD(e,t,n){if(t==e.length||!UD(e,t))return t;for(let r=t,i=t+n,a=0;a<WD;a++){let t=HD(e,r);if(!t||r+t>i)return r;r+=t}return t}function KD(e,t,n){if(!t||!HD(e,t))return t;for(let r=t,i=t-n,a=0;a<WD;a++){let t=UD(e,r);if(!t||r-t<i)return r;r-=t}return t}function qD(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function JD(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var YD=e=>e>=55296&&e<=56319,XD=e=>e>=56320&&e<=57343;function ZD(e,t){return!t||t==e.length||!YD(e.charCodeAt(t-1))||!XD(e.charCodeAt(t))}function QD(e,t,n){let r=n?.override;return r?r(e,t):(CD=(n?.scanLimit??1e9)>>1,wD=n?.timeout?Date.now()+n.timeout:0,TD=!1,RD(e,t,SD(e,0,e.length,t,0,t.length)))}function $D(){return!TD}function eO(e,t,n){return zD(QD(e,t,n),e,t)}var tO=pc.define({combine:e=>e[0]}),nO=mc.define(),rO=pc.define(),iO=cc.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(nO)&&(e=n.value);for(let n of t.state.facet(rO))e=n(e,t);return e}});function aO(e){let t=e.field(iO,!1);if(!t)return null;let n=e.facet(tO);return{chunks:t,side:n?n.side:null}}var oO=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 lO(eO(e.toString(),t.toString(),n),e,t,0,0,$D())}static updateA(e,t,n,r,i){return pO(fO(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return pO(fO(e,r,!1,t.length),e,t,n,i)}};function sO(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 cO(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 lO(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=sO(c.fromA+r,c.fromB+i,t,n),[d,f]=cO(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]=sO(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]=cO(a.toA+r,a.toB+i,t,n),s++}o.push(new oO(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var uO=1e3;function dO(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 fO(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>uO&&([l,d]=dO(e,a-uO,n,!0)),o<t.length-uO&&([u,f]=dO(e,o+uO,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 pO(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=eO(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of lO(h,n,r,d,f,$D()))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 mO={scanLimit:500},hO=hc.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=TO(e))}update(e){(e.docChanged||e.viewportChanged||_O(e.startState,e.state)||vO(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=TO(e.view))}},{decorations:e=>e.deco}),gO=ac.low(yc({class:`cm-changeGutter`,markers:e=>e.plugin(hO)?.gutter||xc.empty}));function _O(e,t){return e.field(iO,!1)!=t.field(iO,!1)}function vO(e,t){return e.facet(tO)!=t.facet(tO)}var yO=dc.line({class:`cm-changedLine`}),bO=dc.mark({class:`cm-changedText`}),xO=dc.mark({tagName:`ins`,class:`cm-insertedLine`}),SO=dc.mark({tagName:`del`,class:`cm-deletedLine`}),CO=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function wO(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,yO),i.add(o,s,n?SO:xO),a&&a.add(o,o,CO);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,yO),a&&a.add(u,u,CO);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,bO),s<t)c++;else break}u=t}}}function TO(e){let t=e.state.field(iO),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(tO),o=n==`a`,s=new fc,c=i?new fc: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))&&wO(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var EO=class extends ic{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}},DO=mc.define({map:(e,t)=>e.map(t)}),OO=cc.define({create:()=>dc.none,update:(e,t)=>{for(let e of t.effects)if(e.is(DO))return e.value;return e.map(t.changes)},provide:e=>_c.decorations.from(e)}),kO=.01;function AO(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 jO(e,t,n){let r=new fc,i=new fc,a=e.state.field(OO).iter(),o=t.state.field(OO).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<-kO?(l-=n,r.add(s,s,dc.widget({widget:new EO(-n),block:!0,side:-1}))):n>kO&&(u+=n,i.add(c,c,dc.widget({widget:new EO(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<kO?r.add(e.state.doc.length,e.state.doc.length,dc.widget({widget:new EO(-p),block:!0,side:1})):p>kO&&i.add(t.state.doc.length,t.state.doc.length,dc.widget({widget:new EO(p),block:!0,side:1}));let m=r.finish(),h=i.finish();AO(m,e.state.field(OO))||e.dispatch({effects:DO.of(m)}),AO(h,t.state.field(OO))||t.dispatch({effects:DO.of(h)})}var MO=mc.define({map:(e,t)=>t.mapPos(e)}),NO=class extends ic{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:MO.of(n)});let{side:r,sibling:i}=e.state.facet(tO);i&&i().dispatch({effects:MO.of(PO(n,e.state.field(iO),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function PO(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 FO=cc.define({create(e){return dc.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(MO)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>_c.decorations.from(e)});function IO({margin:e=3,minSize:t=4}){return FO.init(n=>LO(n,e,t))}function LO(e,t,n){let r=new fc,i=e.facet(tO).side==`a`,a=e.field(iO),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,dc.replace({widget:new NO(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var RO=_c.styleModule.of(new bc({".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`}})),zO=_c.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`}}),BO=new gc,VO=new gc,HO=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||mO;let t=[ac.low(hO),zO,RO,OO,_c.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(DO)))&&this.measure()})],n=[tO.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(gO);let r=sc.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],_c.editorAttributes.of({class:`cm-merge-a`}),VO.of(n),t]}),i=[tO.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(gO);let a=sc.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],_c.editorAttributes.of({class:`cm-merge-b`}),VO.of(i),t]});this.chunks=oO.build(r.doc,a.doc,this.diffConf);let o=[iO.init(()=>this.chunks),BO.of(e.collapseUnchanged?IO(e.collapseUnchanged):[])];r=r.update({effects:mc.appendConfig.of(o)}).state,a=a.update({effects:mc.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 _c({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new _c({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),oc.empty(e[0].startState.doc.length));this.chunks=t==this.a?oO.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):oO.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:nO.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:nO.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(tO),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(VO.reconfigure([tO.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?gO:[]])),a.push(VO.reconfigure([tO.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?gO:[]]))}if(r){let t=BO.reconfigure(e.collapseUnchanged?IO(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(){jO(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=UO(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=UO(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 UO(e){let t=e.nextSibling;return e.remove(),t}var WO=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},GO=ac.low(yc({class:`cm-changeGutter`,markers:e=>e.plugin(hO)?.gutter||xc.empty,widgetMarker:(e,t)=>t instanceof XO?WO:null}));function KO(e){let t=typeof e.original==`string`?uc.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||mO;return[ac.low(hO),tk,zO,_c.editorAttributes.of({class:`cm-merge-b`}),rO.of((e,t)=>{let r=t.effects.find(e=>e.is(qO));return r&&(e=oO.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=oO.updateB(e,t.state.field(JO),t.newDoc,t.changes,n)),e}),tO.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?sk:void 0,side:`b`}),JO.init(()=>t),e.gutter===!1?[]:GO,e.collapseUnchanged?IO(e.collapseUnchanged):[],iO.init(e=>oO.build(t,e.doc,n))]}var qO=mc.define(),JO=cc.define({create:()=>uc.empty,update(e,t){for(let n of t.effects)n.is(qO)&&(e=n.value.doc);return e}}),YO=new WeakMap,XO=class extends ic{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 ZO(e,t,n){let r=YO.get(t.changes);if(r)return r;let i=dc.widget({block:!0,side:-1,widget:new XO(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(tO),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(),QO(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),$O(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(JO).sliceString(t.fromA,t.endA),u=a&&e.facet(Sc),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)==`
|
|
28
28
|
`){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
|
|
29
|
-
`,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;lc(t,{style:t=>Cc(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 YO.set(t.changes,i),i}function QO(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(iO).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(JO);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=oc.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:qO.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function $O(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(iO).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(JO).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 ek(e){let t=new fc;for(let n of e.field(iO)){let r=e.facet(tO).overrideChunk&&rk(e,n);t.add(n.fromB,n.fromB,ZO(e,n,!!r))}return t.finish()}var tk=cc.define({create:e=>ek(e),update(e,t){return t.state.field(iO,!1)==t.startState.field(iO,!1)?e:ek(t.state)},provide:e=>_c.decorations.from(e)}),nk=new WeakMap;function rk(e,t){let n=nk.get(t);if(n!==void 0)return n;n=null;let r=e.field(JO),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(dc.widget({widget:new ik(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(bO.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return nk.set(t,n),n}var ik=class extends ic{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}},ak=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},ok=dc.line({class:`cm-inlineChangedLine`});function sk(e,t,n,r){let i=rk(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,ak),n.add(o.from,o.from,ok);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 ck=te({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),lk=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),uk=_c.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 dk({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 fk(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:_}=Pr(),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`?ck:lk,u=[_c.editable.of(!1),sc.readOnly.of(!0)],d=[Fc,wc(),...u,l,_c.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new _c({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=dk({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 _c({doc:p,extensions:[Fc,wc(),_c.editable.of(!1),l,uk,_c.lineWrapping,KO({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),_c.updateListener.of(e=>{let t=aO(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=aO(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new HO({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new _c({doc:p,extensions:[...d,KO({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 _c)||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 _c)||ye(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`}):hs._({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,rl.createPortal)((0,Z.jsx)(li,{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)(li,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(li,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(li,{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 R;return t[29]!==L||t[30]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=R):R=t[31],R}async function pk(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 mk(e,t){return pk(e,`content`,t)}async function hk(e){return pk(e,`mine`)}async function gk(e){return pk(e,`theirs`)}async function _k(e){return pk(e,`delete`)}async function vk(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 yk(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=Fi(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>qo(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),vk(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 mk(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)(fk,{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(_k),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)(li,{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(gk),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)(li,{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)(fk,{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(hk),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)(li,{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(_k),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)(li,{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)(fk,{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 bk(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(It(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 xk=`__back-nav__`;function Sk(e){return e instanceof Re||e instanceof yt||e instanceof Ne||e instanceof tt||e instanceof jt||e instanceof me?e.docName:null}function Ck(e){if(e instanceof Re){let t=e.docName;return{title:hs._({id:`Jejur6`}),summary:hs._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof yt){let t=e.docName;return{title:hs._({id:`V7QxyT`}),summary:hs._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Ne){let t=e.docName;return{title:hs._({id:`1di5fu`}),summary:hs._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof tt){let t=e.docName;return{title:hs._({id:`wvbc1r`}),summary:hs._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:hs._({id:`Gfr4fu`}),summary:hs._({id:`j6LB7S`})};if(e instanceof me){let t=e.docName;return{title:hs._({id:`vv7kpg`}),summary:hs._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:hs._({id:`W5A0Ly`});return{title:hs._({id:`29VNqC`}),summary:t}}function wk(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=Ck(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)(TS,{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)(li,{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)(li,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(ut(Sk(n)??i),o(a),r(xk))},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 Tk(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)(wk,{...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]===xk){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}: ${Ck(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)(le,{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 Ek(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Cr(t);return{map:n,keys:kn(t),parseError:r}}function Dk(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>Ek(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=Nn(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=Qe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ft(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)(Ok,{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)(kk,{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 Ok(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 kk(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 Ak(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Cr(t);return{map:n,keys:kn(t),parseError:r}}function jk(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=()=>Ak(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=Nn(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=br(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 H=B,U;t[20]!==r||t[21]!==a?(U=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=br(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]=U):U=t[22];let W=U,G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e,t){return`${e} ${t}`},t[23]=G):G=t[23];let K=G,q;t[24]!==a||t[25]!==m?(q=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)=>K(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]=q):q=t[26];let J=q,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={activationConstraint:{distance:4}},t[27]=ee):ee=t[27];let te;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(te={coordinateGetter:_a},t[28]=te):te=t[28];let ne=Ti(aa(ya,ee),aa(xa,te)),re;t[29]!==z||t[30]!==p?(re=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=sa(n,t);(!Object.hasOwn(p,e)||!wr(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=re):re=t[31];let Y=re,ie;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=ie):ie=t[32];let ae=ie,{addPropertySignal:oe,clearAddProperty:se}=kC(),ce;t[33]!==oe||t[34]!==j?(ce=oe.get(j)??0,t[33]=oe,t[34]=j,t[35]=ce):ce=t[35];let le=ce,ue,de;t[36]===le?(ue=t[37],de=t[38]):(ue=()=>{le>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},de=[le],t[36]=le,t[37]=ue,t[38]=de),(0,Q.useEffect)(ue,de);let fe,pe;t[39]!==se||t[40]!==j?(fe=()=>()=>se(j),pe=[j,se],t[39]=se,t[40]=j,t[41]=fe,t[42]=pe):(fe=t[41],pe=t[42]),(0,Q.useEffect)(fe,pe);let me;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Yi[e];return{...t,type:e,value:n,error:null}})},t[43]=me):me=t[43];let he=me,ge;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e){S(t=>t&&{...t,value:e})},t[44]=ge):ge=t[44];let _e=ge,ve;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=ve):ve=t[45];let ye=ve,be;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(be=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]=be):be=t[50];let xe=be,Se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){S(null)},t[51]=Se):Se=t[51];let Ce=Se,we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){w({key:e,draft:e,error:null})},t[52]=we):we=t[52];let Te=we,Ee;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Ee):Ee=t[53];let De=Ee,Oe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){w(null)},t[54]=Oe):Oe=t[54];let ke=Oe,Ae;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(Ae=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=W(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]=W,t[58]=C,t[59]=Ae):Ae=t[59];let je=Ae,Me;t[60]!==p||t[61]!==m?(Me=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=Me):Me=t[62];let Ne=Me,Pe;if(t[63]!==Ne){Pe=new Map;for(let e of Ne)Pe.set(e,(Pe.get(e)??0)+1);t[63]=Ne,t[64]=Pe}else Pe=t[64];if(Ne.length===0&&!x&&!h)return null;let Fe=!g,Ie;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>_(!e),t[65]=Ie):Ie=t[65];let Le=!g,Re;t[66]===Le?Re=t[67]:(Re=(0,Z.jsx)(Po,{"data-expanded":Le,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Le,t[67]=Re);let ze;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=ze):ze=t[68];let Be;t[69]===Re?Be=t[70]:(Be=(0,Z.jsx)(Fo,{asChild:!0,children:(0,Z.jsxs)(li,{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:[Re,ze]})}),t[69]=Re,t[70]=Be);let Ve;t[71]===h?Ve=t[72]:(Ve=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)(Ro,{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]=Ve);let He;if(t[73]!==Ne){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],He=Ne.map(e),t[73]=Ne,t[74]=He}else He=t[74];let Ue;if(t[76]!==z||t[77]!==je||t[78]!==Pe||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Ne||t[85]!==k||t[86]!==Y){let e;t[88]!==z||t[89]!==je||t[90]!==Pe||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==Y?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??jn(n),i=C?.key===e?C:null,a=(Pe.get(e)??0)>1;return(0,Z.jsx)(Li,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Te(e),onChangeDraft:De,onCommit:je,onCancel:ke},onCommit:t=>z(e,t),onChangeType:t=>Y(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=z,t[89]=je,t[90]=Pe,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=Y,t[98]=e):e=t[98],Ue=Ne.map(e),t[76]=z,t[77]=je,t[78]=Pe,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Ne,t[85]=k,t[86]=Y,t[87]=Ue}else Ue=t[87];let We;t[99]!==He||t[100]!==Ue?(We=(0,Z.jsx)(ha,{items:He,strategy:qi,children:Ue}),t[99]=He,t[100]=Ue,t[101]=We):We=t[101];let Ge;t[102]!==J||t[103]!==ne||t[104]!==We?(Ge=(0,Z.jsx)(Qa,{sensors:ne,collisionDetection:Ca,onDragEnd:J,children:We}),t[102]=J,t[103]=ne,t[104]=We,t[105]=Ge):Ge=t[105];let Ke;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(Ke=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(Li,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:Mk},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=Ke):Ke=t[110];let qe;t[111]!==r||t[112]!==x||t[113]!==xe?(qe=x?(0,Z.jsx)(ra,{draft:x,onChangeName:ye,onChangeType:he,onChangeValue:_e,onCommit:xe,onCancel:Ce}):(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)(li,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ae,"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)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=xe,t[114]=qe):qe=t[114];let Je;t[115]!==Ve||t[116]!==Ge||t[117]!==Ke||t[118]!==qe?(Je=(0,Z.jsxs)(No,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Ve,Ge,Ke,qe]}),t[115]=Ve,t[116]=Ge,t[117]=Ke,t[118]=qe,t[119]=Je):Je=t[119];let Ye;t[120]!==Fe||t[121]!==Be||t[122]!==Je?(Ye=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(Io,{open:Fe,onOpenChange:Ie,children:[Be,Je]})}),t[120]=Fe,t[121]=Be,t[122]=Je,t[123]=Ye):Ye=t[123];let Xe;return t[124]!==a||t[125]!==Ye?(Xe=(0,Z.jsx)(ki,{binding:a,children:Ye}),t[124]=a,t[125]=Ye,t[126]=Xe):Xe=t[126],Xe}function Mk(){}var Nk=v(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Pk(e){let t=e.threshold??Nk;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Fk(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var Ik=v(`ACTIVITY_MOUNT_LIMIT`,3);function Lk(){return n(()=>import(`./SourceEditor-jEv8YtjM.js`),__vite__mapDeps([55,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,56,26,54]),import.meta.url)}var Rk=(0,Q.lazy)(async()=>({default:(await Lk()).SourceEditor}));function zk(e,t,n){if(n<=0)return[];let r=e.filter(e=>!qe(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 Bk(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:hs._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?hs._({id:`Sc1bKE`,values:{docName:e}}):hs._({id:`ovIGrT`,values:{docName:e}}),actionLabel:hs._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:hs._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?hs._({id:`bmC18N`,values:{docName:e}}):hs._({id:`pAgkuZ`,values:{docName:e}})}:null}function Vk(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Gt,{name:`activity-pool`,children:(0,Z.jsx)(Hk,{...e})}),t[0]=e,t[1]=n),n}function Hk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ht(),{pages:u,loading:d}=is(),f=zk(c,n,Ik),p=(0,Q.useRef)(``),h=f.map(Uk).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)m(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;W(e,t&&t.length>0?t:crypto.randomUUID())}ue(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,Wt(t)},[h,n]);let y;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?(y=e=>(0,Z.jsx)(Yk,{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]=y):y=t[12];let b=f.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function Uk(e){return e.docName}function Wk(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&&ue(`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&&(ue(`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&&ue(`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 Gk(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)(Ix,{}),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)(Rk,{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 Kk(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)(Ka,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(h,{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)(li,{type:`button`,onClick:qk,children:[(0,Z.jsx)(Ka,{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 qk(){return window.location.reload()}function Jk(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 Yk(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=Bk(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=hw(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{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]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==b?(S=()=>{i&&!_?v(!0):!i&&!b&&x(!0)},C=[i,_,b],t[5]=i,t[6]=_,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=Pk({ytextLength:g,isSourceMode:i,visitedSource:_,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]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&ue(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,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]=g,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=()=>y(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]!==g?(P=()=>{Fk({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(ue(`ok/cold/first-toggle`,{docName:n.docName,mountId:ot(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,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]=g,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]!==h||t[41]!==s||t[42]!==f||t[43]!==j?(z=f?(0,Z.jsx)(Kk,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Tk,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(Jk,{html:j}):(0,Z.jsx)(Ix,{}),children:(0,Z.jsx)(bk,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(yk,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Dk,{provider:n.provider}),!i&&(0,Z.jsx)(jk,{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)(Gk,{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)(_D,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${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]=h,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)(Wk,{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 Xk(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function Zk(e){let{value:t,unit:n}=Xk(e);return n===`rem`?t*16:t}function Qk(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var $k=3600*24*7;function eA(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?tA:m,O=g===void 0?$k:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=Zk(b),J;t[6]===x?J=t[7]:(J=Zk(x),t[6]=x,t[7]=J);let ee=J,te;t[8]!==E||t[9]!==k?(te=function(e){E&&(P.current=!0,j.current=H.current?0:Zk(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]=te):te=t[10];let ne=te,re,Y;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{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}=Xk(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=Qk(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(ee,u)),f=Qk(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)}},Y=[i,a,D,q,ee,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]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=Y):(re=t[24],Y=t[25]),(0,Q.useEffect)(re,Y);let ie;return t[26]===ne?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ie),ie}function tA(){}var nA=3600*24*7,rA=`18rem`,iA=`3rem`,aA=`app-file-sidebar`,oA=`14.625rem`,sA=`32rem`,cA=`sidebar_width`,lA=/^\d+(?:\.\d+)?(?:rem|px)$/,uA=Q.createContext(null);function dA(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${cA}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return lA.test(n)?n:e}function fA(){let e=Q.use(uA);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function pA(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?rA:c,[u]=Q.useState(hA),d;t[8]===u?d=t[9]:(d=()=>Tw(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>dA(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=Mw();return Pw(`left`,Tw(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),Fw(`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(mA)},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: ${Sw}px)`),t=()=>{let e=Tw(u,window.innerWidth,`left`);p(e),C(Pw(`left`,e,Mw())===`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(aA)?.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=>{nc(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":iA,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=si(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(uA.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function mA(e){return!e}function hA(){return kr()}function gA(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}=fA();if(d===`none`){let e;t[7]===r?e=t[8]:(e=si(`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]:(_=si(`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=si(`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:aA,"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 _A(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}=fA(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=rc(`toggle-files-sidebar`);l=li,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=aA,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]:(_=si(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)(Xt,{}):(0,Z.jsx)(Bl,{}),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 vA(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}=fA(),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:oA,maxResizeWidth:sA,setIsDraggingRail:h,widthCookieName:cA,widthCookieMaxAge:nA},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}=eA(_),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=si(`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 yA(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}=fA(),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=si(`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 bA(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=si(`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 xA(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=si(`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 SA(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=si(`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 CA(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=si(`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 wA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`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 TA=ai(`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 EA(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?ci:`button`,{state:m}=fA(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=si(TA({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)(js,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ns,{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)(Is,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function DA(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 OA(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=zr.safeParse(t);return n.success?n.data.currentBranch??null:null}var kA=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:DA({fetchBranch:OA,subscribeToEvent:rs}),AA=kA.subscribe,jA=kA.getSnapshot;function MA(){return(0,Q.useSyncExternalStore)(AA,jA,jA)}function NA(){let e=(0,$.c)(6),t=MA(),n=ka(),{state:r}=fA(),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&&da(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 PA(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=NA();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)(FA,{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 FA(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)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ns,{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)(ke,{"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 IA(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=si(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 LA(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=si(`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 RA(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=si(`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 zA(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=si(`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 BA(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=si(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Po,{}),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 VA=1,HA=2,UA=4;function WA(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}=Me(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>UA?[...u.slice(0,VA).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(VA,-HA)},...u.slice(-HA).map((e,t)=>d(e,u.length-HA+t))]:u.map((e,t)=>d(e,t));a=IA,t[8]===r?c=t[9]:(c=si(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=LA,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(GA)}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 GA(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(BA,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(RA,{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)(hl,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(RA,{className:`min-w-0`,children:(0,Z.jsx)(zA,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var KA={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`},qA=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`,...KA,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},JA=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)(qA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},YA=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)(qA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function XA(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=tc(`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=rc(`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)(WA,{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)(js,{children:(0,Z.jsx)(YA,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(bo,{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)(Ns,{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)(Is,{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)(JA,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(bo,{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)(Ns,{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)(Is,{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)(So,{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)(Is,{children:[(0,Z.jsx)(li,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(Nl,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=Is,h=li,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)(js,{children:u?(0,Z.jsx)(Hl,{}):(0,Z.jsx)(Vl,{})}),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)(Ns,{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 ZA(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function QA(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=si(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(Vd,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var $A=ai(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function ej(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=si($A({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(Hd,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function tj(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=si(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ud,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Wd,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var rj=`ok-terminal-height-v1`,ij=.5;function aj(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*ij))}function oj(e,t){let n=aj(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function sj(){return typeof window>`u`?0:window.innerHeight}function cj(e,t){try{let n=e??localStorage,r=t??sj(),i=n.getItem(rj);if(i==null)return oj(240,r);let a=Number.parseInt(i,10);return oj(Number.isFinite(a)?a:240,r)}catch{return 240}}function lj(e,t,n){try{let r=t??localStorage,i=n??sj();r.setItem(rj,String(oj(e,i)))}catch{}}function uj(){try{return typeof localStorage>`u`?240:cj()}catch{return 240}}var dj=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-BmOjKfef.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([57,1,22,6,3,23,9,11,58,59]),import.meta.url));function fj(e){let t=(0,$.c)(11),{bridge:n,onClose:r,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=ji(),l=uo(),{_:u}=i(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){X.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||X.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let i;return t[4]!==n||t[5]!==o||t[6]!==r?(i=(0,Z.jsx)(le,{fallbackRender:mj,onError:pj,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(dj,{bridge:n,className:`h-full`,onClose:r,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i):i=t[7],i}let m;return t[8]!==p||t[9]!==d?(m=d?(0,Z.jsx)(_j,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[8]=p,t[9]=d,t[10]=m):m=t[10],m}function pj(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function mj(e){return(0,Z.jsx)(hj,{...e})}function hj(e){let t=(0,$.c)(15),{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:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(li,{onClick:gj,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function gj(){return window.location.reload()}function _j(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=i(),a;t[0]===r?a=t[1]:(a=r({id:`_XWY2J`}),t[0]=r,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(li,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let f;return t[15]!==a||t[16]!==s||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{"aria-label":a,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=a,t[16]=s,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function vj(e){let t=(0,$.c)(33),{sessions:n,activeSessionId:r,onSelect:a,onTabActivate:o,onNew:s,onClose:c,children:l,className:u}=e,{_:d}=i(),f;t[0]===u?f=t[1]:(f=si(`flex min-h-0 min-w-0 flex-1 flex-col`,u),t[0]=u,t[1]=f);let p;t[2]===d?p=t[3]:(p=d({id:`1MGRQl`}),t[2]=d,t[3]=p);let m;if(t[4]!==d||t[5]!==r||t[6]!==c||t[7]!==o||t[8]!==n){let e;t[10]!==d||t[11]!==r||t[12]!==c||t[13]!==o?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:si(`flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(tj,{value:e.id,onClick:()=>o?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":d({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:`text-muted-foreground hover:text-foreground`,onClick:t=>{t.stopPropagation(),c(e.id)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`})})]},e.id)},t[10]=d,t[11]=r,t[12]=c,t[13]=o,t[14]=e):e=t[14],m=n.map(e),t[4]=d,t[5]=r,t[6]=c,t[7]=o,t[8]=n,t[9]=m}else m=t[9];let h;t[15]!==p||t[16]!==m?(h=(0,Z.jsx)(ej,{variant:`line`,"aria-label":p,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none]`,children:m}),t[15]=p,t[16]=m,t[17]=h):h=t[17];let g;t[18]===d?g=t[19]:(g=d({id:`ZBxvV3`}),t[18]=d,t[19]=g);let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(V,{"aria-hidden":`true`}),t[20]=_):_=t[20];let v;t[21]!==s||t[22]!==g?(v=(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":g,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:s,children:_}),t[21]=s,t[22]=g,t[23]=v):v=t[23];let y;t[24]!==h||t[25]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[h,v]}),t[24]=h,t[25]=v,t[26]=y):y=t[26];let b;return t[27]!==r||t[28]!==l||t[29]!==a||t[30]!==f||t[31]!==y?(b=(0,Z.jsxs)(QA,{value:r,onValueChange:a,className:f,children:[y,l]}),t[27]=r,t[28]=l,t[29]=a,t[30]=f,t[31]=y,t[32]=b):b=t[32],b}var yj=`terminal-dock-panel`;function bj(e){return`terminal-session-${e}`}function xj(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function Sj(e){let t=(0,$.c)(77),{bridge:n,children:r,visible:a,onVisibleChange:o,launch:s}=e,c=s===void 0?null:s,{_:l}=i(),{resolvedTheme:u}=Pr(),d=Sx(),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!a),h;t[0]!==c||t[1]!==a?(h=()=>a?[{id:bj(1),launch:c}]:[],t[0]=c,t[1]=a,t[2]=h):h=t[2];let[g,_]=(0,Q.useState)(h),v;t[3]===a?v=t[4]:(v=()=>a?bj(1):``,t[3]=a,t[4]=v);let[y,b]=(0,Q.useState)(v),x=(0,Q.useRef)(y),S=(0,Q.useRef)(g),C=(0,Q.useRef)(+!!a),w=(0,Q.useRef)(a&&c?c.nonce:null),T=(0,Q.useRef)(a),E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C.current+=1;let t=bj(C.current);_(n=>[...n,{id:t,launch:e}]),b(t)},t[5]=E):E=t[5];let D=E,O=(0,Q.useRef)(D),k;t[6]!==y||t[7]!==o?(k=function(e){let t=S.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>xj(e))}_(r),r.length===0&&(o(!1),f.current?.focus())},t[6]=y,t[7]=o,t[8]=k):k=t[8];let A=k,j=(0,Q.useRef)(Tj),M;t[9]!==y||t[10]!==A||t[11]!==g?(M=()=>{O.current=D,x.current=y,S.current=g,j.current=()=>{y!==``&&A(y)}},t[9]=y,t[10]=A,t[11]=g,t[12]=M):M=t[12],(0,Q.useEffect)(M);let[N]=(0,Q.useState)(wj),P=(0,Q.useRef)(N),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){R.current!=null&&clearTimeout(R.current),R.current=setTimeout(()=>{lj(e),R.current=null},100)},t[13]=z):z=t[13];let B=z,V=(0,Q.useRef)(null),H,U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>()=>{R.current!=null&&clearTimeout(R.current),V.current!=null&&(window.removeEventListener(`pointerup`,V.current),V.current=null)},U=[],t[14]=H,t[15]=U):(H=t[14],U=t[15]),(0,Q.useEffect)(H,U);let W,G;t[16]!==c||t[17]!==g.length||t[18]!==a?(W=()=>{let e=T.current;if(T.current=a,c!=null&&c.nonce!==w.current){w.current=c.nonce,O.current(c);return}a&&!e&&g.length===0&&O.current(null)},G=[a,c,g.length],t[16]=c,t[17]=g.length,t[18]=a,t[19]=W,t[20]=G):(W=t[19],G=t[20]),(0,Q.useEffect)(W,G);let K,q;t[21]===n?(K=t[22],q=t[23]):(K=()=>n.onMenuAction(e=>{e===`new-terminal`?O.current(null):e===`kill-terminal`&&j.current()}),q=[n],t[21]=n,t[22]=K,t[23]=q),(0,Q.useEffect)(K,q);let J,ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(yj)?.contains(document.activeElement))return;let t=S.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>xj(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[24]=J,t[25]=ee):(J=t[24],ee=t[25]),(0,Q.useEffect)(J,ee);let te;t[26]!==n.editor||t[27]!==g.length?(te=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[26]=n.editor,t[27]=g.length,t[28]=te):te=t[28];let ne;t[29]!==n||t[30]!==g.length?(ne=[n,g.length],t[29]=n,t[30]=g.length,t[31]=ne):ne=t[31],(0,Q.useEffect)(te,ne);let re,Y;t[32]!==d||t[33]!==a?(re=()=>{let e=d.current;e!=null&&(a?e.resize(`${P.current}px`):e.collapse())},Y=[a,d],t[32]=d,t[33]=a,t[34]=re,t[35]=Y):(re=t[34],Y=t[35]),(0,Q.useEffect)(re,Y);let ie,ae;t[36]===p?(ie=t[37],ae=t[38]):(ie=()=>{p&&document.getElementById(yj)?.contains(document.activeElement)&&f.current?.focus()},ae=[p],t[36]=p,t[37]=ie,t[38]=ae),(0,Q.useLayoutEffect)(ie,ae);let oe,se;t[39]===p?(oe=t[40],se=t[41]):(oe=()=>{p||xj(x.current)},se=[p],t[39]=p,t[40]=oe,t[41]=se),(0,Q.useEffect)(oe,se);let ce;if(t[42]!==l||t[43]!==g){let e;t[45]===l?e=t[46]:(e=(e,t)=>({id:e.id,label:l({id:`OVjNeX`,values:{0:t+1}})}),t[45]=l,t[46]=e),ce=g.map(e),t[42]=l,t[43]=g,t[44]=ce}else ce=t[44];let le=ce,ue=F||void 0,de;t[47]===r?de=t[48]:(de=(0,Z.jsx)(WC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:f,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[47]=r,t[48]=de);let fe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(GC,{withHandle:!0,onPointerDown:()=>{I(!0),L.current=!0;let e=()=>{I(!1),L.current=!1,window.removeEventListener(`pointerup`,e),V.current=null};V.current=e,window.addEventListener(`pointerup`,e)}}),t[49]=fe):fe=t[49];let pe;t[50]===u?pe=t[51]:(pe=Lc(u),t[50]=u,t[51]=pe);let me;t[52]===pe.background?me=t[53]:(me={backgroundColor:pe.background},t[52]=pe.background,t[53]=me);let he=a?`${N}px`:0,ge;t[54]!==o||t[55]!==a?(ge=e=>{let t=e.asPercentage===0;m(t),L.current&&(t&&a?o(!1):!t&&!a&&o(!0),e.inPixels>0&&(P.current=e.inPixels,B(e.inPixels)))},t[54]=o,t[55]=a,t[56]=ge):ge=t[56];let _e=!F&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ve;t[57]===_e?ve=t[58]:(ve=si(`flex flex-col`,_e),t[57]=_e,t[58]=ve);let ye;t[59]!==y||t[60]!==n||t[61]!==A||t[62]!==g||t[63]!==le?(ye=g.length>0?(0,Z.jsx)(vj,{sessions:le,activeSessionId:y,onSelect:b,onTabActivate:Cj,onNew:()=>D(null),onClose:A,className:`h-full`,children:g.map(e=>(0,Z.jsx)(nj,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(fj,{bridge:n,launch:e.launch,onClose:()=>A(e.id)})},e.id))}):null,t[59]=y,t[60]=n,t[61]=A,t[62]=g,t[63]=le,t[64]=ye):ye=t[64];let be;t[65]!==p||t[66]!==d||t[67]!==me||t[68]!==he||t[69]!==ge||t[70]!==ve||t[71]!==ye?(be=(0,Z.jsx)(WC,{id:yj,style:me,panelRef:d,defaultSize:he,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:ge,inert:p,className:ve,children:ye}),t[65]=p,t[66]=d,t[67]=me,t[68]=he,t[69]=ge,t[70]=ve,t[71]=ye,t[72]=be):be=t[72];let xe;return t[73]!==ue||t[74]!==de||t[75]!==be?(xe=(0,Z.jsxs)(UC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":ue,children:[de,fe,be]}),t[73]=ue,t[74]=de,t[75]=be,t[76]=xe):xe=t[76],xe}function Cj(e){return queueMicrotask(()=>xj(e))}function wj(){return uj()}function Tj(){}var Ej=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BYzNZP-E.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent}));function Dj(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(kj,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Oj,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Gt,{name:`editor-area`,children:(0,Z.jsxs)(DC,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Oj(){let e=(0,$.c)(5),t=Eg(),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)(RC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function kj(e){let t=(0,$.c)(148),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,terminalBridge:c,terminalVisible:l,onTerminalVisibleChange:u,terminalLaunch:d}=e,f=l===void 0?!1:l,p=d===void 0?null:d,{_:m}=i(),{activeDocName:h,activeProvider:g,activeTarget:_,recycleDocument:v,docPanelMode:y,docPanelAgentId:b,docPanelExpandSignal:S}=ht(),{openDocumentTransition:C}=Ot(),{requestAddProperty:w}=kC(),T=pw(g,h),E=gw(h,n===`source`?`source`:`wysiwyg`),D=Iw(g),O=D===`connected`||D===`synced`,k=hw(h)===`conflict`,A=(0,Q.useDeferredValue)(h),j=_?.kind===`missing`,M=!!h&&_?.kind!==`folder`,N;t[0]!==m||t[1]!==j?(N=j?m({id:`K-a33w`}):void 0,t[0]=m,t[1]=j,t[2]=N):N=t[2];let P=N,[F]=(0,Q.useState)(Mj),I=F!==null,L;t[3]===F?L=t[4]:(L=()=>Tw(F,window.innerWidth,`right`),t[3]=F,t[4]=L);let[R,z]=(0,Q.useState)(L),B=(0,Q.useRef)(R),V,H;t[5]===R?(V=t[6],H=t[7]):(V=()=>{B.current=R},H=[R],t[5]=R,t[6]=V,t[7]=H),(0,Q.useEffect)(V,H);let U=Sx(),W;t[8]===R?W=t[9]:(W=()=>Pw(`right`,R,Mw())===`collapsed`,t[8]=R,t[9]=W);let[G]=(0,Q.useState)(W),[K,q]=(0,Q.useState)(G),J=(0,Q.useRef)(K),ee,te;t[10]===K?(ee=t[11],te=t[12]):(ee=()=>{J.current=K},te=[K],t[10]=K,t[11]=ee,t[12]=te),(0,Q.useEffect)(ee,te);let[ne,re]=(0,Q.useState)(!1),Y=(0,Q.useRef)(!1),[ie]=(0,Q.useState)(jj),ae=(0,Q.useRef)(ie),oe=(0,Q.useRef)(null),se;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(se=function(e){oe.current!=null&&clearTimeout(oe.current),oe.current=setTimeout(()=>{bw(e),oe.current=null},100)},t[13]=se):se=t[13];let ce=se,le,ue;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>()=>{oe.current!=null&&clearTimeout(oe.current)},ue=[],t[14]=le,t[15]=ue):(le=t[14],ue=t[15]),(0,Q.useEffect)(le,ue);let[de,fe]=(0,Q.useState)(null),pe;t[16]!==K||t[17]!==U?(pe=function(){if(U.current==null)return;let e=B.current;K?(Fw(`right`,e,`open`),U.current?.expand()):(Fw(`right`,e,`collapsed`),U.current?.collapse())},t[16]=K,t[17]=U,t[18]=pe):pe=t[18];let me=pe,he,ge;t[19]!==F||t[20]!==U?(he=()=>{let e=window.matchMedia(`(min-width: ${Cw}px)`),t=()=>{let e=Tw(F,window.innerWidth,`right`);z(e);let t=Pw(`right`,e,Mw())===`collapsed`;q(t),t?U.current?.collapse():U.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ge=[F,U],t[19]=F,t[20]=U,t[21]=he,t[22]=ge):(he=t[21],ge=t[22]),(0,Q.useEffect)(he,ge);let _e,ve;t[23]!==de||t[24]!==I||t[25]!==U?(_e=()=>{if(de==null||I)return;let e=new ResizeObserver(()=>{J.current||Y.current||U.current?.resize(`${ae.current}px`)});return e.observe(de),()=>e.disconnect()},ve=[de,I,U],t[23]=de,t[24]=I,t[25]=U,t[26]=_e,t[27]=ve):(_e=t[26],ve=t[27]),(0,Q.useEffect)(_e,ve);let ye,be;t[28]!==o||t[29]!==U?(ye=()=>{let e=e=>{o(e),U.current?.expand()},t=Eh();return t&&e(t),Oh(t=>{Eh(),e(t)})},be=[o,U],t[28]=o,t[29]=U,t[30]=ye,t[31]=be):(ye=t[30],be=t[31]),(0,Q.useEffect)(ye,be);let xe,Se;t[32]!==S||t[33]!==U?(xe=()=>{S!==0&&U.current?.expand()},Se=[S,U],t[32]=S,t[33]=U,t[34]=xe,t[35]=Se):(xe=t[34],Se=t[35]),(0,Q.useEffect)(xe,Se);let Ce,we;t[36]===K?(Ce=t[37],we=t[38]):(Ce=()=>{if(!K||!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()},we=[K],t[36]=K,t[37]=Ce,t[38]=we),(0,Q.useLayoutEffect)(Ce,we);let Te,Ee;t[39]===K?(Te=t[40],Ee=t[41]):(Te=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!K})},Ee=[K],t[39]=K,t[40]=Te,t[41]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[42]===me?(De=t[43],Oe=t[44]):(De=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&me()})},Oe=[me],t[42]=me,t[43]=De,t[44]=Oe),(0,Q.useEffect)(De,Oe);let ke,Ae;t[45]===me?(ke=t[46],Ae=t[47]):(ke=()=>{if(window.okDesktop!=null)return;let e=e=>{nc(e,`toggle-document-panel`)&&(e.preventDefault(),me())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ae=[me],t[45]=me,t[46]=ke,t[47]=Ae),(0,Q.useEffect)(ke,Ae);let je=(0,Q.useRef)(null),[Me,Ne]=(0,Q.useState)(null),Pe=_?.kind===`large-file`?_.docName:h,Fe,Ie;t[48]===Pe?(Fe=t[49],Ie=t[50]):(Fe=()=>{if(Pe&&Pe!==je.current){let e=je.current;je.current=Pe,Ne(e)}},Ie=[Pe],t[48]=Pe,t[49]=Fe,t[50]=Ie),(0,Q.useEffect)(Fe,Ie);let Le;t[51]===C?Le=t[52]:(Le=function(e){let t=Ho(e);window.location.hash===t?C(e):window.location.hash=t},t[51]=C,t[52]=Le);let Re=Le,ze,Be=null;if(_?.kind===`large-file`){let e;t[53]!==Re||t[54]!==Me?(e=Me?{previousDocName:Me,onNavigateBack:Re}:void 0,t[53]=Re,t[54]=Me,t[55]=e):e=t[55];let n;t[56]!==_.docName||t[57]!==_.limit||t[58]!==_.size||t[59]!==e?(n=(0,Z.jsx)(CC,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[56]=_.docName,t[57]=_.limit,t[58]=_.size,t[59]=e,t[60]=n):n=t[60],ze=n}else if(_?.kind===`folder`){let e;if(t[61]===_.folderPath?e=t[62]:(e=(0,Z.jsx)(yC,{folderPath:_.folderPath}),t[61]=_.folderPath,t[62]=e),ze=e,y===`agent`&&b!==null){let e;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(GC,{withHandle:!0}),t[63]=e):e=t[63];let n;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(WC,{id:`agent-panel`,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)(Ej,{showBackButton:!1})})})]}),t[64]=n):n=t[64],Be=n}}else if(_?.kind===`asset`){let e;t[65]!==_.assetPath||t[66]!==_.mediaKind?(e=(0,Z.jsx)(Fx,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[65]=_.assetPath,t[66]=_.mediaKind,t[67]=e):e=t[67],ze=e}else if(!g||!h){if((typeof window<`u`?as(window.location.hash):null)!==null){let e;return t[68]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ix,{}),t[68]=e):e=t[68],e}let e;t[69]===f?e=t[70]:(e=(0,Z.jsx)(zS,{terminalVisible:f}),t[69]=f,t[70]=e),ze=e}else{let e=n===`source`,i=!O,s=K,c;t[71]!==h||t[72]!==w?(c=function(){h&&w(h)},t[71]=h,t[72]=w,t[73]=c):c=t[73];let l=c,u=A??h,d=Me??void 0,f;t[74]!==P||t[75]!==e||t[76]!==Re||t[77]!==v||t[78]!==u||t[79]!==d?(f=(0,Z.jsx)(Vk,{activeDocName:u,isSourceMode:e,editorPlaceholder:P,previousDocName:d,onNavigateBack:Re,onRecycle:v}),t[74]=P,t[75]=e,t[76]=Re,t[77]=v,t[78]=u,t[79]=d,t[80]=f):f=t[80];let p;t[81]!==h||t[82]!==e?(p=(0,Z.jsx)(lw,{activeDocName:h,isSourceMode:e}),t[81]=h,t[82]=e,t[83]=p):p=t[83];let m;t[84]!==h||t[85]!==A?(m=ZA({activeDocName:h,deferredActiveDocName:A,mountResolved:h!==null&&x(h),syncResolved:h!==null&&Ve(h)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Ix,{}),h===null?null:(0,Z.jsx)(wC,{docName:h})]}):null,t[84]=h,t[85]=A,t[86]=m):m=t[86];let g;t[87]!==f||t[88]!==p||t[89]!==m?(g=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[f,p,m]}),t[87]=f,t[88]=p,t[89]=m,t[90]=g):g=t[90];let _;t[91]!==h||t[92]!==k||t[93]!==s||t[94]!==e||t[95]!==r||t[96]!==l||t[97]!==i||t[98]!==me?(_=!k&&(0,Z.jsx)(XA,{activeDocName:h,isSourceMode:e,sourceDisabled:i,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:me}),t[91]=h,t[92]=k,t[93]=s,t[94]=e,t[95]=r,t[96]=l,t[97]=i,t[98]=me,t[99]=_):_=t[99];let b;t[100]!==g||t[101]!==_?(b=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[g,_]}),t[100]=g,t[101]=_,t[102]=b):b=t[102];let S;t[103]!==E||t[104]!==M||t[105]!==T?(S=(0,Z.jsx)(PA,{stats:T,selectionStats:E,showStats:M}),t[103]=E,t[104]=M,t[105]=T,t[106]=S):S=t[106];let C;t[107]!==b||t[108]!==S?(C=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[b,S]}),t[107]=b,t[108]=S,t[109]=C):C=t[109],ze=C;let D=I&&K,j;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{re(!0),Y.current=!0;let e=()=>{re(!1),Y.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[110]=j):j=t[110];let N;t[111]===D?N=t[112]:(N=(0,Z.jsx)(GC,{withHandle:!0,disabled:D,onPointerDown:j}),t[111]=D,t[112]=N);let F=G?0:`${ie}px`,L;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{q(e.asPercentage===0),e.inPixels>0&&Y.current&&(ae.current=e.inPixels,ce(e.inPixels))},t[113]=L):L=t[113];let R=!ne&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,z;t[114]===R?z=t[115]:(z=si(`flex flex-col bg-muted/20`,R),t[114]=R,t[115]=z);let B;t[116]!==h||t[117]!==a||t[118]!==y||t[119]!==e||t[120]!==o?(B=(0,Z.jsx)(Oy,{docName:h,isSourceMode:e,activeTab:a,onActiveTabChange:o,mode:y}),t[116]=h,t[117]=a,t[118]=y,t[119]=e,t[120]=o,t[121]=B):B=t[121];let V;t[122]!==K||t[123]!==U||t[124]!==F||t[125]!==z||t[126]!==B?(V=(0,Z.jsx)(WC,{id:`doc-panel`,panelRef:U,defaultSize:F,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:L,inert:K,className:z,children:B}),t[122]=K,t[123]=U,t[124]=F,t[125]=z,t[126]=B,t[127]=V):V=t[127];let H;t[128]!==N||t[129]!==V?(H=(0,Z.jsxs)(Z.Fragment,{children:[N,V]}),t[128]=N,t[129]=V,t[130]=H):H=t[130],Be=H}let He;t[131]!==u||t[132]!==c||t[133]!==p||t[134]!==f||t[135]!==ze?(He=c==null?ze:(0,Z.jsx)(Sj,{bridge:c,visible:f,onVisibleChange:u??Aj,launch:p,children:ze}),t[131]=u,t[132]=c,t[133]=p,t[134]=f,t[135]=ze,t[136]=He):He=t[136];let Ue=He,We=ne||void 0,Ge;t[137]!==G||t[138]!==Be?(Ge=Be!=null&&!G?{}:{defaultSize:`100%`},t[137]=G,t[138]=Be,t[139]=Ge):Ge=t[139];let Ke=ne?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,qe;t[140]!==Ue||t[141]!==Ge||t[142]!==Ke?(qe=(0,Z.jsx)(WC,{minSize:`30%`,...Ge,className:Ke,children:Ue}),t[140]=Ue,t[141]=Ge,t[142]=Ke,t[143]=qe):qe=t[143];let Je;return t[144]!==Be||t[145]!==We||t[146]!==qe?(Je=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:fe,children:(0,Z.jsxs)(UC,{orientation:`horizontal`,"data-dragging":We,children:[qe,Be]})}),t[144]=Be,t[145]=We,t[146]=qe,t[147]=Je):Je=t[147],Je}function Aj(){}function jj(){return xw()}function Mj(){return kr()}function Nj(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 Pj(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 Fj=1e3,Ij=!1;function Lj(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Rj(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:Ci(i)?a=i:(a=void 0,Ij||(Ij=!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`&&(Lj({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=Pj(i),{current:c,crossDoc:l}=a?vi(a,n,Date.now()):{current:[],crossDoc:[]},u=zj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Nj(e.current,p)&&Nj(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,Fj);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 zj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Bj=`sync-status`;function Vj(e,t){let n=(0,$.c)(6),{_:r}=i(),a=cm(),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(t),l,u;n[0]!==r||n[1]!==t||n[2]!==a||n[3]!==e?(l=()=>{if(c.current!==t&&(c.current=t,o.current=!1,s.current=!1),t)if(e===`synced`&&(o.current=!0),e===`disconnected`&&o.current){if(a){X.dismiss(Bj);return}s.current=!0,X.warning(r({id:`HGNCsl`}),{id:Bj,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,X.success(r({id:`GhjUB_`}),{id:Bj,duration:3e3}))},u=[e,t,r,a],n[0]=r,n[1]=t,n[2]=a,n[3]=e,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,Q.useEffect)(l,u)}var Hj=4,Uj=3,Wj={Bird:tl,Cat:sl,Dog:ml,Fish:bl,Mouse:ql,Rabbit:Kl,Shrimp:$l,Snail:eu,Squirrel:iu,Turtle:fu};Object.freeze(Object.keys(Wj));function Gj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Wj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var Kj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function qj(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=Gj(n),c=s.kind===`animal`?Wj[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=tr(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Kr(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)(js,{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)(Ns,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Is,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function Jj(e){let t=Kj[e.icon];return e.displayName||t||hs._({id:`iEQQyu`})}function Yj(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 Xj(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=ht(),{presence:u,agentId:d}=n,f=Jj(u),p=Yj(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)(xi,{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)(xi,{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)(js,{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)(Ns,{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)(Is,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function Zj(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?hs._({id:`9euN0m`,values:{count:n}}):hs._({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)(J,{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)(qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(Xj,{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)(b,{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)(pe,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function Qj(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(Xj,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function $j(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ht(),{current:s,crossDoc:c}=Rj(t,r,n);if(Vj(Iw(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,Hj),n;e[6]===s?n=e[7]:(n=s.slice(Hj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Uj),d;e[8]===c?d=e[9]:(d=c.slice(Uj),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=>Qj(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)(Zj,{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=>Qj(e,p,!0,m)),f.length>0?(0,Z.jsx)(Zj,{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 eM=new Set([`.md`,`.mdx`]);function tM(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function nM(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 rM(e){return eM.has(tM(e).toLowerCase())}function iM(e,t,n){if(n)return{kind:`allow`,destinationPath:t};let r=tM(e);return r===``?{kind:`allow`,destinationPath:t}:{kind:`allow`,destinationPath:tM(t)?t:nM(t,r)}}var aM=`.md`,oM=/\.(md|mdx)$/i;function sM(e,t=aM){return`${e}${t}`}function cM(e){return FM(e).replace(oM,``)}function lM(e){return Qo(e)?fM(e.path):zo(e)?e.path:sM(e.docName,e.docExt)}function uM(e){let t=FM(e).match(oM);return t?`.${t[1].toLowerCase()}`:void 0}function dM(e){return FM(e)}function fM(e){let t=FM(e.trim());return t?`${t}/`:``}function pM(e){return e.endsWith(`/`)?dM(e):cM(e)}function mM(e){return e.map(lM)}function hM(e){return[...e].sort().join(`\0`)}function gM(e){return hM(mM(e))}function _M(e){let t=new Set;for(let n of e){if(Qo(n)){let e=fM(n.path);e&&t.add(e)}let e=(Qo(n)||zo(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Qo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function vM(e){if(!e)return[];let t=FM(e.replace(oM,``)).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 yM(e,t,n){let r=uM(e);if(r)return r;let i=n.find(e=>ps(e)&&e.docName===t);return i?i.docExt??aM:PM(e).includes(`.`)?void 0:aM}function bM(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(!zo(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 xM(e,t,n){if(uM(e))return null;let r=n.find(e=>zo(e)&&e.path===t);return r?r.path:PM(e).includes(`.`)?t:bM(t,n)}function SM(e,t){let n=e.kind===`directory`,r=n?dM(e.path):cM(e.path);if(n)return{kind:`folder`,name:FM(PM(e.path)).replace(oM,``),path:r,treePath:wM(e.path,!0)};let i=xM(e.path,r,t);if(i)return{kind:`asset`,name:FM(PM(i)),path:i,treePath:i};let a=yM(e.path,r,t);return{kind:`file`,name:FM(PM(e.path)).replace(oM,``),path:r,treePath:wM(e.path,!1),docExt:a}}function CM(e){return e.kind===`directory`?dM(e.path):e.path}function wM(e,t){return t?fM(e):oM.test(e)?e:`${e}${aM}`}function TM(e,t,n){let r=fM(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}${aM}`;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 EM(e,t){return e===`file`?wM(t,!1):`${dM(t)}/index${aM}`}function DM(e,t){return t.kind===`root`||t.directoryPath==null?PM(e):`${t.directoryPath}${PM(e)}`}function OM(e,t){if(t)return dM(fM(e));let n=cM(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function kM(e,t){let n=dM(fM(e));return n?`${n}/${t}`:t}function AM(e,t){return(t.path??kM(e,t.src)).replace(/^\/+/,``)}function jM(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function MM(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function NM(e,t){let n=tM(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:cM(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:rr(i),modified:r,size:t.size}}function PM(e){let t=FM(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function FM(e){return e.endsWith(`/`)?e.slice(0,-1):e}function IM(e,t){return t.trim()}function LM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function RM(e,t){let n=IM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function zM(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(ps(e)){let t=s.get(sM(e.docName,e.docExt));if(t){let n=Vo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:rr(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Qo(e))return{...e,path:KM(e.path,n)};if(zo(e)){let t=s.get(e.path);return t&&rM(t)?{kind:`document`,docName:cM(t),docExt:tM(t),size:e.size,modified:e.modified}:{...e,path:t??KM(e.path,n)}}return e})}function BM(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=>ps(e)?!i.has(e.docName)&&!XM(e.docName,n):Qo(e)?!XM(e.path,n):zo(e)?!a.has(e.path)&&!XM(e.path,n):!0)}function VM(e,t){if(e.kind!==`asset`||t.some(t=>zo(t)&&t.path===e.path))return e;let n=bM(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function HM(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>qM(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ps(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=>Qo(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(ps(i)){let e=YM(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Qo(i)){let e=JM(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function UM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function WM(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function GM(e,t){let n=e.kind===`file`?sM(e.path,e.docExt):e.path;return Zg(t.contentDir,n,t.pathSeparator)}function KM(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 qM(e,t){return ps(e)&&ps(t)?e.docName===t.docName:Qo(e)&&Qo(t)||zo(e)&&zo(t)?e.path===t.path:!1}function JM(e,t,n){return e===t?n:YM(e,t,n)}function YM(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function XM(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function ZM(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)(pd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function QM(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=si(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(md,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $M(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)(_d,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function eN(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)(Cd,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function tN(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=si(`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)(hd,{children:(0,Z.jsx)(gd,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nN(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=si(`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)(yd,{"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 rN(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=si(`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)(Po,{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)(wd,{"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 iN(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=si(`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)(Td,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aN(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=si(`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)(xd,{children:(0,Z.jsx)(Ao,{})})}),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)(bd,{"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 oN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=si(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(vd,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function sN(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=si(`-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)(Sd,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var cN=`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`,lN=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,uN={start:[Gi.Space],cancel:[Gi.Esc],end:[Gi.Space,Gi.Enter]};function dN(e){return si(cN,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function fN(e){return e?void 0:-1}function pN({className:e,isDragging:t}){return si(e,t&&lN)}function mN(e){return e.code===Gi.Enter&&e.target===e.currentTarget}function hN({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&mN(e)?`activate-tab`:`delegate-sortable`}function gN({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Na.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 _N(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 vN(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 yN=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 Ca(e)},bN=[`.md`,`.mdx`],xN=`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`,SN=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,CN=si(SN,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),wN=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function TN(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function EN(e){let t=Ho(e);window.location.hash!==t&&(window.location.hash=t)}function DN(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function ON(e,t){let n=[t,...bN].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 kN(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:_}=zi(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=gN({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=hN({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=pN({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 AN(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=Ye(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=Ye(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)(QM,{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)(nN,{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)(nN,{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)(nN,{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)(sN,{}),(0,Z.jsx)(nN,{"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)(tN,{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)(ZM,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function jN(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)(Gl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(li,{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=dN(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=fN(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)(gs,{"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)(li,{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 MN(e){let t=(0,$.c)(1),{docName:n}=e;if(hw(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Ro,{"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 NN(){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:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=ht(),{_:T}=i(),{pageMeta:E}=is(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?Ze(a):t?Ue(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=G):G=e[3];let K=G,q;e[4]!==r||e[5]!==K||e[6]!==h||e[7]!==g||e[8]!==v?(q=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:K?`${K}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=K,e[6]=h,e[7]=g,e[8]=v,e[9]=q):q=e[9];let J=q,ee,te;e[10]===t?(ee=e[11],te=e[12]):(ee=()=>{W.current=t},te=[t],e[10]=t,e[11]=ee,e[12]=te),(0,Q.useEffect)(ee,te);let ne,re;e[13]===J?(ne=e[14],re=e[15]):(ne=()=>{J&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},re=[J],e[13]=J,e[14]=ne,e[15]=re),(0,Q.useEffect)(ne,re);let Y,ie;e[16]===j?(Y=e[17],ie=e[18]):(Y=()=>{j&&(z.current?.focus(),z.current?.select())},ie=[j],e[16]=j,e[17]=Y,e[18]=ie),(0,Q.useEffect)(Y,ie);let ae,oe;e[19]!==v||e[20]!==j?(ae=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),R(!1))},oe=[v,j],e[19]=v,e[20]=j,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=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)},ce=function(){H.current=!0,U.current=null,M(null),P(``),I(null),R(!1)},le=async function(){if(H.current){H.current=!1;return}if(B.current)return;let e=j?.docName;if(!e){ce();return}let t=IM(`file`,ON(N,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===U.current){z.current?.focus();return}if(!LM(t)){I(T({id:`P8yDjG`})),z.current?.focus();return}let i=RM({kind:`file`,path:e,name:r},t);B.current=!0,R(!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){R(!1),B.current=!1;return}let r=await ve(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),B.current=!1,U.current=t,z.current?.focus();return}let a=A(Qr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=UM(o,a);Vt(a);let c=!0;try{let e=WM(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),cs([`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(T({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),R(!1),B.current=!1,U.current=null,c&&s&&s!==o&&EN(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(T({id:`HIb0vl`})),R(!1),B.current=!1,U.current=t,z.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===g?de=e[24]:(de=new Set(g),e[23]=g,e[24]=de);let fe=de,pe;e[25]===O?pe=e[26]:(pe=vN(O),e[25]=O,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==u||e[30]!==f||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.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]=fe,e[32]=ge):ge=e[32];let _e=ge,ye;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ye={activationConstraint:{distance:8}},e[33]=ye):ye=e[33];let be;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(be={coordinateGetter:_a,keyboardCodes:uN},e[34]=be):be=e[34];let xe=Ti(aa(ya,ye),aa(xa,be)),Se;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){k(_N(D.current))},e[35]=Se):Se=e[35];let Ce=Se,we;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(){k(null)},e[36]=we):we=e[36];let Te=we,Ee;e[37]!==Te||e[38]!==S||e[39]!==w?(Ee=function(e){Te();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Vi([...w],r,i),t)},e[37]=Te,e[38]=S,e[39]=w,e[40]=Ee):Ee=e[40];let De=Ee,Oe=ue?``:void 0,ke;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(ke=si(`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]`,ue&&`[-webkit-app-region:drag]`),e[41]=ke):ke=e[41];let Ae=DN,je;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(je=si(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=je):je=e[42];let Ne=Qa,Pe=yN,Fe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={container:typeof document<`u`?document.body:void 0},e[43]=Fe):Fe=e[43];let Ie=ha,Le;e[44]===w?Le=e[45]:(Le=[...w],e[44]=w,e[45]=Le);let Re=pa,ze=w.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(AN,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(kN,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:si(xN,t?SN:CN),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":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:wN,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":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:dN(t),tabIndex:fN(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=mt(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Me(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(AN,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(kN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(xN,n?SN:CN),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:wN,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:si(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:si(`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)(jN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Me(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(AN,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(kN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(xN,n?SN:CN),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:wN,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:si(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:si(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(jN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=Me(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,x=`editor-tab-rename-error-${TN(a)}`;return(0,Z.jsx)(AN,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(kN,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(xN,n?SN:CN,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)(KC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(ZC,{ref:z,value:N,disabled:L,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?x:void 0,"aria-busy":L||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(ON(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(JC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(XC,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:x,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:wN,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,a)},tabIndex:-1,children:[(0,Z.jsx)(MN,{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)(jN,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),Be;e[46]!==Ie||e[47]!==Le||e[48]!==Re||e[49]!==ze?(Be=(0,Z.jsx)(Ie,{items:Le,strategy:Re,children:ze}),e[46]=Ie,e[47]=Le,e[48]=Re,e[49]=ze,e[50]=Be):Be=e[50];let Ve;e[51]!==Ne||e[52]!==Te||e[53]!==De||e[54]!==Ce||e[55]!==xe||e[56]!==!1||e[57]!==Pe||e[58]!==Fe||e[59]!==Be||e[60]!==he?(Ve=(0,Z.jsx)(Ne,{sensors:xe,autoScroll:!1,collisionDetection:Pe,modifiers:he,onDragStart:Ce,onDragEnd:De,onDragCancel:Te,accessibility:Fe,children:Be}),e[51]=Ne,e[52]=Te,e[53]=De,e[54]=Ce,e[55]=xe,e[56]=!1,e[57]=Pe,e[58]=Fe,e[59]=Be,e[60]=he,e[61]=Ve):Ve=e[61];let He;e[62]===T?He=e[63]:(He=T({id:`3YvS-c`}),e[62]=T,e[63]=He);let We;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(V,{"aria-hidden":`true`}),e[64]=We):We=e[64];let Ge;e[65]!==_||e[66]!==He?(Ge=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":He,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:We})}),e[65]=_,e[66]=He,e[67]=Ge):Ge=e[67];let Ke;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=Ke):Ke=e[68];let qe;e[69]===Ge?qe=e[70]:(qe=(0,Z.jsxs)(Is,{children:[Ge,Ke]}),e[69]=Ge,e[70]=qe);let Je;e[71]!==je||e[72]!==Ve||e[73]!==qe?(Je=(0,Z.jsxs)(`div`,{className:je,children:[Ve,qe]}),e[71]=je,e[72]=Ve,e[73]=qe,e[74]=Je):Je=e[74];let Ye;return e[75]!==Oe||e[76]!==ke||e[77]!==Ae||e[78]!==Je?(Ye=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":Oe,className:ke,onWheel:Ae,children:Je}),e[75]=Oe,e[76]=ke,e[77]=Ae,e[78]=Je,e[79]=Ye):Ye=e[79],Ye}function PN(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 FN(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 IN=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Ct},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:wf},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:$o},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:PN},{label:`Twitter`,href:`https://x.com/inkeep`,icon:FN}],LN=()=>{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)(ze,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(li,{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)(Is,{children:[o,(0,Z.jsx)(Ns,{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=IN.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=>wa(e,r),onAuxClick:e=>wa(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)(b,{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)(pe,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function RN(e){let t=(0,$.c)(19),{installStates:n,terminalLaunch:r,disabled:a,onPick:o,onLaunchTerminal:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(``),f;if(t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let i=gg.filter(e),p=gg.some(e=>n[e.id]?.installed==null),m=i.length>0,h=r!==null,g=m||h,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>d(e.target.value),t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=l({id:`Rah7yq`}),t[11]=l,t[12]=v);let y;t[13]===l?y=t[14]:(y=l({id:`ZBt4rI`}),t[13]=l,t[14]=y);let b;t[15]!==u||t[16]!==v||t[17]!==y?(b=(0,Z.jsx)(Mo,{value:u,onChange:_,placeholder:v,"aria-label":y,"data-testid":`open-in-agent-instruction`}),t[15]=u,t[16]=v,t[17]=y,t[18]=b):b=t[18],f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[b,g?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(e=>{let{displayName:t}=e;return(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,disabled:a,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":l({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>o(e,u),children:[(0,Z.jsx)(Vx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t})]},e.id)})]}):null,h?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(Pi,{className:`my-1`}):null,(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,disabled:a,"data-testid":`open-in-agent-terminal`,"aria-label":l({id:`AcK_r0`}),onClick:()=>c(u),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`fcgvCA`})})]})]})]}):null]}):(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:p?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=l,t[1]=a,t[2]=n,t[3]=u,t[4]=c,t[5]=o,t[6]=r,t[7]=f}else f=t[7];return f}function zN(e){let t=(0,$.c)(44),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=D_(),{dispatch:u}=g_(),d=Wx(),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),h=pg(),g=r??f,_;t[0]===l?_=t[1]:(_=()=>{l()},t[0]=l,t[1]=_);let v=(0,Q.useEffectEvent)(_),y;t[2]!==g||t[3]!==v?(y=()=>{g&&v()},t[2]=g,t[3]=v,t[4]=y):y=t[4];let x;if(t[5]===g?x=t[6]:(x=[g],t[5]=g,t[6]=x),(0,Q.useEffect)(y,x),h)return null;let S=typeof window<`u`&&window.okDesktop!=null,C;t[7]!==a||t[8]!==r?(C=e=>{r===void 0&&p(e),a?.(e)},t[7]=a,t[8]=r,t[9]=C):C=t[9];let w=C,T=n===null,E;t[10]===n?E=t[11]:(E=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=E);let D=E,O;t[12]!==u||t[13]!==w||t[14]!==D?(O=(e,t)=>{let n=D(t);n!==null&&(u(e.id,n),w(!1))},t[12]=u,t[13]=w,t[14]=D,t[15]=O):O=t[15];let k=O,A;t[16]!==w||t[17]!==D||t[18]!==d?(A=e=>{let t=D(e);t===null||d===null||(d.launchInTerminal(t),w(!1))},t[16]=w,t[17]=D,t[18]=d,t[19]=A):A=t[19];let j=A,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=S?()=>{m.current=!0}:void 0,t[20]=M):M=t[20];let N;t[21]===w?N=t[22]:(N=S?()=>{if(m.current){m.current=!1;return}w(!0)}:void 0,t[21]=w,t[22]=N);let P,F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(bi,{className:`size-3.5`,"aria-hidden":`true`}),F=(0,Z.jsx)(s,{id:`O7_W_a`}),t[23]=P,t[24]=F):(P=t[23],F=t[24]);let I;t[25]!==N||t[26]!==T?(I=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,disabled:T,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:M,onClick:N,children:[P,F]})}),t[25]=N,t[26]=T,t[27]=I):I=t[27];let L;t[28]===o?L=t[29]:(L=o({id:`O7_W_a`}),t[28]=o,t[29]=L);let R=n===null,z;t[30]!==j||t[31]!==k||t[32]!==c||t[33]!==R||t[34]!==d?(z=(0,Z.jsx)(RN,{installStates:c,terminalLaunch:d,disabled:R,onPick:k,onLaunchTerminal:j}),t[30]=j,t[31]=k,t[32]=c,t[33]=R,t[34]=d,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==z?(B=(0,Z.jsx)(b,{align:`end`,"aria-label":L,"data-testid":`open-in-agent-menu`,children:z}),t[36]=L,t[37]=z,t[38]=B):B=t[38];let V;return t[39]!==w||t[40]!==g||t[41]!==I||t[42]!==B?(V=(0,Z.jsxs)(pe,{open:g,onOpenChange:w,children:[I,B]}),t[39]=w,t[40]=g,t[41]=I,t[42]=B,t[43]=V):V=t[43],V}var BN=50,VN=()=>{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,jC.preload()},BN))},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=Sg)},u=(0,Z.jsx)(Zl,{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)(js,{asChild:!0,children:(0,Z.jsxs)(li,{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)(Is,{children:[d,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function HN(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=go(),[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 la({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:Pa,toastSuccess:JN,toastError:qN,logEvent:KN});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,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[9]=x):x=t[9];let C;t[10]!==a||t[11]!==n?.kind?(C=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=C):C=t[12];let w=c||g,T,E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ql,{className:`size-3.5`,"aria-hidden":!0}),E=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=T,t[14]=E):(T=t[13],E=t[14]);let D;t[15]!==v||t[16]!==C||t[17]!==w?(D=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,"aria-label":C,onClick:v,disabled:w,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[T,E]})}),t[15]=v,t[16]=C,t[17]=w,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[20]=k):k=t[20];let A=u??``,j;t[21]===a?j=t[22]:(j=a({id:`5-FeN2`}),t[21]=a,t[22]=j);let M;t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(b,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[O,k,(0,Z.jsx)(Mo,{ref:f,readOnly:!0,value:A,onFocus:GN,onClick:WN,onContextMenu:UN,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":j})]}),t[23]=A,t[24]=j,t[25]=M):M=t[25];let N;return t[26]!==D||t[27]!==M||t[28]!==y?(N=(0,Z.jsxs)(pe,{open:y,onOpenChange:x,children:[D,M]}),t[26]=D,t[27]=M,t[28]=y,t[29]=N):N=t[29],N}function UN(e){return e.currentTarget.select()}function WN(e){return e.currentTarget.select()}function GN(e){return e.currentTarget.select()}function KN(e){return console.log(e)}function qN(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function JN(e){return X.success(e)}function YN(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=ht(),{state:p,isDraggingRail:m}=fA(),h=xg(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=tc(`toggle-files-sidebar`),t[0]=g):g=t[0];let _=g,v=tc(`command-palette`),y=ka(),[b,x]=(0,Q.useState)(!1),S;bb0:{if(f===null){let e;t[1]===y?e=t[2]:(e=e_({workspace:y}),t[1]=y,t[2]=e),S=e;break bb0}if(f.kind===`folder`){if(!y){S=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==y?(e=r_({folderRelativePath:f.folderPath,workspace:y}),t[3]=f.folderPath,t[4]=y,t[5]=e):e=t[5],S=e;break bb0}let e;t[6]!==d||t[7]!==y?(e=$g({docName:d,workspace:y}),t[6]=d,t[7]=y,t[8]=e):e=t[8],S=e}let C=c??S,w;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=po(f.folderPath),t[9]=f.folderPath,t[10]=e),w=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Oa(d),t[11]=d,t[12]=e),w=e;break bb1}w=null}let E=w,D=typeof window<`u`&&window.okDesktop!=null,O=p===`collapsed`,k=D?``:void 0,A=D&&O&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,j=D&&!m&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,M;t[13]!==A||t[14]!==j?(M=si(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,D&&`[-webkit-app-region:drag]`,A,j),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(_A,{className:si(`-ml-1 shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ns,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:_}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:_}})})]}),O&&a&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:si(`shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(T,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:v}})})]}),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(NN,{})]}),P;t[16]===N?P=t[17]:(P=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:N}),t[16]=N,t[17]=P);let F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=si(`flex shrink-0 items-center justify-end gap-2 px-3`,D&&`[&>*]:[-webkit-app-region:no-drag]`),t[18]=F):F=t[18];let I;t[19]!==C||t[20]!==l||t[21]!==o||t[22]!==b||t[23]!==x||t[24]!==E||t[25]!==h?(I=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(zN,{input:C,open:o,onOpenChange:l}),(0,Z.jsx)(HN,{input:E,onClickWhenNoRemote:()=>x(!0)}),(0,Z.jsx)(ho,{open:b,onOpenChange:x})]}),t[19]=C,t[20]=l,t[21]=o,t[22]=b,t[23]=x,t[24]=E,t[25]=h,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==n?(L=(0,Z.jsx)(Wa,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=L):L=t[29];let R,z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)($j,{}),z=(0,Z.jsx)(Pi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),B=(0,Z.jsx)(qd,{}),t[30]=R,t[31]=z,t[32]=B):(R=t[30],z=t[31],B=t[32]);let V;t[33]===h?V=t[34]:(V=!h&&(0,Z.jsx)(VN,{}),t[33]=h,t[34]=V);let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(LN,{}),t[35]=H):H=t[35];let U;t[36]!==I||t[37]!==L||t[38]!==V?(U=(0,Z.jsxs)(`div`,{className:F,children:[I,L,R,z,B,V,H]}),t[36]=I,t[37]=L,t[38]=V,t[39]=U):U=t[39];let W;return t[40]!==P||t[41]!==U||t[42]!==k||t[43]!==M?(W=(0,Z.jsxs)(`header`,{"data-electron-drag":k,className:M,children:[P,U]}),t[40]=P,t[41]=U,t[42]=k,t[43]=M,t[44]=W):W=t[44],W}var XN=`open-knowledge:terminal-launch`;function ZN(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(XN,{detail:{prompt:e}}))}function QN(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.prompt:void 0;typeof n==`string`&&e(n)};return t.addEventListener(XN,n),()=>t.removeEventListener(XN,n)}function $N(e){let t=(0,$.c)(61),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]=ov(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Cy[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=typeof window<`u`?window.okDesktop??null:null,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),D=(0,Q.useRef)(0),O=lo(),{projectLocalConfig:k,projectLocalSynced:A}=oe(),j=ka(),{activeDocName:M}=ht(),N=O?.hasRemote,P=O?.pushPermission?.checkStatus,F;t[2]!==g||t[3]!==k||t[4]!==A||t[5]!==N||t[6]!==P?(F=uv({autoSyncOnboardingDismissed:g,hasRemote:N,projectLocalSynced:A,projectLocalConfig:k,pushPermissionCheckStatus:P}),t[2]=g,t[3]=k,t[4]=A,t[5]=N,t[6]=P,t[7]=F):F=t[7];let I=F,L,R;t[8]===M?(L=t[9],R=t[10]):(L=()=>{let e=function(e){let t=e.detail;t&&M&&Oc(M,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(Q_,e),()=>window.removeEventListener(Q_,e)},R=[M],t[8]=M,t[9]=L,t[10]=R),(0,Q.useEffect)(L,R);let z,B;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?w(tP):e===`new-terminal`&&w(!0)})},B=[],t[11]=z,t[12]=B):(z=t[11],B=t[12]),(0,Q.useEffect)(z,B);let V,H;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{if(window.okDesktop!=null)return;let e=function(e){nc(e,`toggle-terminal-panel`)&&(e.preventDefault(),w(eP))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},V=[],t[13]=V,t[14]=H):(V=t[13],H=t[14]),(0,Q.useEffect)(H,V);let U,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>QN(e=>{w(!0),D.current+=1,E({prompt:e,nonce:D.current})}),W=[],t[15]=U,t[16]=W):(U=t[15],W=t[16]),(0,Q.useEffect)(U,W);let G,K;t[17]===C?(G=t[18],K=t[19]):(G=()=>{C||E(null)},K=[C],t[17]=C,t[18]=G,t[19]=K),(0,Q.useEffect)(G,K);let q,J;t[20]===C?(q=t[21],J=t[22]):(q=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C})},J=[C],t[20]=C,t[21]=q,t[22]=J),(0,Q.useEffect)(q,J);let ee,te;t[23]===C?(ee=t[24],te=t[25]):(ee=()=>{window.okDesktop!=null&&C&&Ta()},te=[C],t[23]=C,t[24]=ee,t[25]=te),(0,Q.useEffect)(ee,te),sv(O?.pausedReason);let ne;t[26]===s?ne=t[27]:(ne=function(e){l(e),s(e)},t[26]=s,t[27]=ne);let re=ne,Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y=function(e){y(e),e||x(null)},t[28]=Y):Y=t[28];let ie=Y,ae;t[29]!==a||t[30]!==M||t[31]!==j?(ae={openSelection(e){let t=a_({docName:e.docName??M,workspace:j,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown});return t===null?(X.error(a({id:`_VRtd7`})),!1):(x(t),y(!0),!0)}},t[29]=a,t[30]=M,t[31]=j,t[32]=ae):ae=t[32];let se,ce;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{p(`auth`),d(!0)},ce=()=>{p(`identity`),d(!0)},t[33]=se,t[34]=ce):(se=t[33],ce=t[34]);let le;t[35]!==r||t[36]!==b||t[37]!==v?(le=(0,Z.jsx)(YN,{onSignIn:se,onSetIdentity:ce,onOpenSearch:r,openInAgentMenuOpen:v,openInAgentMenuInput:b,onOpenInAgentMenuOpenChange:ie}),t[35]=r,t[36]=b,t[37]=v,t[38]=le):le=t[38];let ue;t[39]!==m||t[40]!==c||t[41]!==re||t[42]!==T||t[43]!==C?(ue=(0,Z.jsx)(Dj,{editorMode:c,onModeChange:re,activeTab:m,onActiveTabChange:h,terminalBridge:S,terminalVisible:C,onTerminalVisibleChange:w,terminalLaunch:T}),t[39]=m,t[40]=c,t[41]=re,t[42]=T,t[43]=C,t[44]=ue):ue=t[44];let de;t[45]!==ae||t[46]!==le||t[47]!==ue?(de=(0,Z.jsxs)(Pc,{value:ae,children:[le,ue]}),t[45]=ae,t[46]=le,t[47]=ue,t[48]=de):de=t[48];let fe=f===`identity`,pe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>{d(!1)},t[49]=pe):pe=t[49];let me;t[50]!==u||t[51]!==fe?(me=(0,Z.jsx)(ea,{open:u,onOpenChange:d,identityPrompt:fe,onSuccess:pe}),t[50]=u,t[51]=fe,t[52]=me):me=t[52];let he;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>_(!0),t[53]=he):he=t[53];let ge;t[54]===I?ge=t[55]:(ge=(0,Z.jsx)(cv,{open:I,onResolved:he}),t[54]=I,t[55]=ge);let _e;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(Y_,{}),t[56]=_e):_e=t[56];let ve;return t[57]!==de||t[58]!==me||t[59]!==ge?(ve=(0,Z.jsxs)(Z.Fragment,{children:[de,me,ge,_e]}),t[57]=de,t[58]=me,t[59]=ge,t[60]=ve):ve=t[60],ve}function eP(e){return!e}function tP(e){return!e}function nP(e){let t=Ho(qo(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function rP(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Fi();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)(Ro,{"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)(Ro,{"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(iP),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 iP(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(li,{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:()=>nP(e.file),children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var aP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
29
|
+
`,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;lc(t,{style:t=>Cc(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 YO.set(t.changes,i),i}function QO(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(iO).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(JO);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=oc.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:qO.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function $O(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(iO).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(JO).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 ek(e){let t=new fc;for(let n of e.field(iO)){let r=e.facet(tO).overrideChunk&&rk(e,n);t.add(n.fromB,n.fromB,ZO(e,n,!!r))}return t.finish()}var tk=cc.define({create:e=>ek(e),update(e,t){return t.state.field(iO,!1)==t.startState.field(iO,!1)?e:ek(t.state)},provide:e=>_c.decorations.from(e)}),nk=new WeakMap;function rk(e,t){let n=nk.get(t);if(n!==void 0)return n;n=null;let r=e.field(JO),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(dc.widget({widget:new ik(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(bO.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return nk.set(t,n),n}var ik=class extends ic{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}},ak=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},ok=dc.line({class:`cm-inlineChangedLine`});function sk(e,t,n,r){let i=rk(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,ak),n.add(o.from,o.from,ok);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 ck=te({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),lk=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),uk=_c.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 dk({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 fk(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:_}=Pr(),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`?ck:lk,u=[_c.editable.of(!1),sc.readOnly.of(!0)],d=[Fc,wc(),...u,l,_c.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new _c({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=dk({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 _c({doc:p,extensions:[Fc,wc(),_c.editable.of(!1),l,uk,_c.lineWrapping,KO({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),_c.updateListener.of(e=>{let t=aO(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=aO(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new HO({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new _c({doc:p,extensions:[...d,KO({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 _c)||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 _c)||ye(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`}):hs._({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,rl.createPortal)((0,Z.jsx)(li,{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)(li,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(li,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(li,{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 R;return t[29]!==L||t[30]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=R):R=t[31],R}async function pk(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 mk(e,t){return pk(e,`content`,t)}async function hk(e){return pk(e,`mine`)}async function gk(e){return pk(e,`theirs`)}async function _k(e){return pk(e,`delete`)}async function vk(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 yk(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=Fi(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>qo(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),vk(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 mk(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)(fk,{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(_k),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)(li,{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(gk),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)(li,{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)(fk,{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(hk),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)(li,{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(_k),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)(li,{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)(fk,{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 bk(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(It(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 xk=`__back-nav__`;function Sk(e){return e instanceof Re||e instanceof yt||e instanceof Ne||e instanceof tt||e instanceof jt||e instanceof me?e.docName:null}function Ck(e){if(e instanceof Re){let t=e.docName;return{title:hs._({id:`Jejur6`}),summary:hs._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof yt){let t=e.docName;return{title:hs._({id:`V7QxyT`}),summary:hs._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Ne){let t=e.docName;return{title:hs._({id:`1di5fu`}),summary:hs._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof tt){let t=e.docName;return{title:hs._({id:`wvbc1r`}),summary:hs._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:hs._({id:`Gfr4fu`}),summary:hs._({id:`j6LB7S`})};if(e instanceof me){let t=e.docName;return{title:hs._({id:`vv7kpg`}),summary:hs._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:hs._({id:`W5A0Ly`});return{title:hs._({id:`29VNqC`}),summary:t}}function wk(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=Ck(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)(TS,{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)(li,{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)(li,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(ut(Sk(n)??i),o(a),r(xk))},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 Tk(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)(wk,{...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]===xk){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}: ${Ck(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)(le,{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 Ek(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Cr(t);return{map:n,keys:kn(t),parseError:r}}function Dk(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>Ek(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=Nn(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=Qe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ft(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)(Ok,{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)(kk,{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 Ok(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 kk(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 Ak(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Cr(t);return{map:n,keys:kn(t),parseError:r}}function jk(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=()=>Ak(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=Nn(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=br(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 H=B,U;t[20]!==r||t[21]!==a?(U=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=br(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]=U):U=t[22];let W=U,G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e,t){return`${e} ${t}`},t[23]=G):G=t[23];let K=G,q;t[24]!==a||t[25]!==m?(q=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)=>K(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]=q):q=t[26];let J=q,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={activationConstraint:{distance:4}},t[27]=ee):ee=t[27];let te;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(te={coordinateGetter:_a},t[28]=te):te=t[28];let ne=Ti(aa(ya,ee),aa(xa,te)),re;t[29]!==z||t[30]!==p?(re=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=sa(n,t);(!Object.hasOwn(p,e)||!wr(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=re):re=t[31];let Y=re,ie;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=ie):ie=t[32];let ae=ie,{addPropertySignal:oe,clearAddProperty:se}=kC(),ce;t[33]!==oe||t[34]!==j?(ce=oe.get(j)??0,t[33]=oe,t[34]=j,t[35]=ce):ce=t[35];let le=ce,ue,de;t[36]===le?(ue=t[37],de=t[38]):(ue=()=>{le>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},de=[le],t[36]=le,t[37]=ue,t[38]=de),(0,Q.useEffect)(ue,de);let fe,pe;t[39]!==se||t[40]!==j?(fe=()=>()=>se(j),pe=[j,se],t[39]=se,t[40]=j,t[41]=fe,t[42]=pe):(fe=t[41],pe=t[42]),(0,Q.useEffect)(fe,pe);let me;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Yi[e];return{...t,type:e,value:n,error:null}})},t[43]=me):me=t[43];let he=me,ge;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e){S(t=>t&&{...t,value:e})},t[44]=ge):ge=t[44];let _e=ge,ve;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=ve):ve=t[45];let ye=ve,be;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(be=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]=be):be=t[50];let xe=be,Se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){S(null)},t[51]=Se):Se=t[51];let Ce=Se,we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){w({key:e,draft:e,error:null})},t[52]=we):we=t[52];let Te=we,Ee;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Ee):Ee=t[53];let De=Ee,Oe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){w(null)},t[54]=Oe):Oe=t[54];let ke=Oe,Ae;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(Ae=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=W(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]=W,t[58]=C,t[59]=Ae):Ae=t[59];let je=Ae,Me;t[60]!==p||t[61]!==m?(Me=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=Me):Me=t[62];let Ne=Me,Pe;if(t[63]!==Ne){Pe=new Map;for(let e of Ne)Pe.set(e,(Pe.get(e)??0)+1);t[63]=Ne,t[64]=Pe}else Pe=t[64];if(Ne.length===0&&!x&&!h)return null;let Fe=!g,Ie;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>_(!e),t[65]=Ie):Ie=t[65];let Le=!g,Re;t[66]===Le?Re=t[67]:(Re=(0,Z.jsx)(Po,{"data-expanded":Le,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Le,t[67]=Re);let ze;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=ze):ze=t[68];let Be;t[69]===Re?Be=t[70]:(Be=(0,Z.jsx)(Fo,{asChild:!0,children:(0,Z.jsxs)(li,{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:[Re,ze]})}),t[69]=Re,t[70]=Be);let Ve;t[71]===h?Ve=t[72]:(Ve=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)(Ro,{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]=Ve);let He;if(t[73]!==Ne){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],He=Ne.map(e),t[73]=Ne,t[74]=He}else He=t[74];let Ue;if(t[76]!==z||t[77]!==je||t[78]!==Pe||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Ne||t[85]!==k||t[86]!==Y){let e;t[88]!==z||t[89]!==je||t[90]!==Pe||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==Y?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??jn(n),i=C?.key===e?C:null,a=(Pe.get(e)??0)>1;return(0,Z.jsx)(Li,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Te(e),onChangeDraft:De,onCommit:je,onCancel:ke},onCommit:t=>z(e,t),onChangeType:t=>Y(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=z,t[89]=je,t[90]=Pe,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=Y,t[98]=e):e=t[98],Ue=Ne.map(e),t[76]=z,t[77]=je,t[78]=Pe,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Ne,t[85]=k,t[86]=Y,t[87]=Ue}else Ue=t[87];let We;t[99]!==He||t[100]!==Ue?(We=(0,Z.jsx)(ha,{items:He,strategy:qi,children:Ue}),t[99]=He,t[100]=Ue,t[101]=We):We=t[101];let Ge;t[102]!==J||t[103]!==ne||t[104]!==We?(Ge=(0,Z.jsx)(Qa,{sensors:ne,collisionDetection:Ca,onDragEnd:J,children:We}),t[102]=J,t[103]=ne,t[104]=We,t[105]=Ge):Ge=t[105];let Ke;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(Ke=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(Li,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:Mk},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=Ke):Ke=t[110];let qe;t[111]!==r||t[112]!==x||t[113]!==xe?(qe=x?(0,Z.jsx)(ra,{draft:x,onChangeName:ye,onChangeType:he,onChangeValue:_e,onCommit:xe,onCancel:Ce}):(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)(li,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ae,"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)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=xe,t[114]=qe):qe=t[114];let Je;t[115]!==Ve||t[116]!==Ge||t[117]!==Ke||t[118]!==qe?(Je=(0,Z.jsxs)(No,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Ve,Ge,Ke,qe]}),t[115]=Ve,t[116]=Ge,t[117]=Ke,t[118]=qe,t[119]=Je):Je=t[119];let Ye;t[120]!==Fe||t[121]!==Be||t[122]!==Je?(Ye=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(Io,{open:Fe,onOpenChange:Ie,children:[Be,Je]})}),t[120]=Fe,t[121]=Be,t[122]=Je,t[123]=Ye):Ye=t[123];let Xe;return t[124]!==a||t[125]!==Ye?(Xe=(0,Z.jsx)(ki,{binding:a,children:Ye}),t[124]=a,t[125]=Ye,t[126]=Xe):Xe=t[126],Xe}function Mk(){}var Nk=v(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Pk(e){let t=e.threshold??Nk;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Fk(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var Ik=v(`ACTIVITY_MOUNT_LIMIT`,3);function Lk(){return n(()=>import(`./SourceEditor-jEv8YtjM.js`),__vite__mapDeps([55,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,56,26,54]),import.meta.url)}var Rk=(0,Q.lazy)(async()=>({default:(await Lk()).SourceEditor}));function zk(e,t,n){if(n<=0)return[];let r=e.filter(e=>!qe(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 Bk(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:hs._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?hs._({id:`Sc1bKE`,values:{docName:e}}):hs._({id:`ovIGrT`,values:{docName:e}}),actionLabel:hs._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:hs._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?hs._({id:`bmC18N`,values:{docName:e}}):hs._({id:`pAgkuZ`,values:{docName:e}})}:null}function Vk(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Gt,{name:`activity-pool`,children:(0,Z.jsx)(Hk,{...e})}),t[0]=e,t[1]=n),n}function Hk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ht(),{pages:u,loading:d}=is(),f=zk(c,n,Ik),p=(0,Q.useRef)(``),h=f.map(Uk).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)m(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;W(e,t&&t.length>0?t:crypto.randomUUID())}ue(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,Wt(t)},[h,n]);let y;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?(y=e=>(0,Z.jsx)(Yk,{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]=y):y=t[12];let b=f.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function Uk(e){return e.docName}function Wk(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&&ue(`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&&(ue(`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&&ue(`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 Gk(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)(Ix,{}),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)(Rk,{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 Kk(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)(Ka,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(h,{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)(li,{type:`button`,onClick:qk,children:[(0,Z.jsx)(Ka,{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 qk(){return window.location.reload()}function Jk(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 Yk(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=Bk(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=hw(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{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]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==b?(S=()=>{i&&!_?v(!0):!i&&!b&&x(!0)},C=[i,_,b],t[5]=i,t[6]=_,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=Pk({ytextLength:g,isSourceMode:i,visitedSource:_,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]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&ue(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,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]=g,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=()=>y(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]!==g?(P=()=>{Fk({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(ue(`ok/cold/first-toggle`,{docName:n.docName,mountId:ot(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,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]=g,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]!==h||t[41]!==s||t[42]!==f||t[43]!==j?(z=f?(0,Z.jsx)(Kk,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Tk,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(Jk,{html:j}):(0,Z.jsx)(Ix,{}),children:(0,Z.jsx)(bk,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(yk,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Dk,{provider:n.provider}),!i&&(0,Z.jsx)(jk,{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)(Gk,{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)(_D,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${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]=h,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)(Wk,{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 Xk(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function Zk(e){let{value:t,unit:n}=Xk(e);return n===`rem`?t*16:t}function Qk(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var $k=3600*24*7;function eA(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?tA:m,O=g===void 0?$k:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=Zk(b),J;t[6]===x?J=t[7]:(J=Zk(x),t[6]=x,t[7]=J);let ee=J,te;t[8]!==E||t[9]!==k?(te=function(e){E&&(P.current=!0,j.current=H.current?0:Zk(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]=te):te=t[10];let ne=te,re,Y;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{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}=Xk(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=Qk(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(ee,u)),f=Qk(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)}},Y=[i,a,D,q,ee,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]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=Y):(re=t[24],Y=t[25]),(0,Q.useEffect)(re,Y);let ie;return t[26]===ne?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ie),ie}function tA(){}var nA=3600*24*7,rA=`18rem`,iA=`3rem`,aA=`app-file-sidebar`,oA=`14.625rem`,sA=`32rem`,cA=`sidebar_width`,lA=/^\d+(?:\.\d+)?(?:rem|px)$/,uA=Q.createContext(null);function dA(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${cA}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return lA.test(n)?n:e}function fA(){let e=Q.use(uA);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function pA(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?rA:c,[u]=Q.useState(hA),d;t[8]===u?d=t[9]:(d=()=>Tw(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>dA(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=Mw();return Pw(`left`,Tw(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),Fw(`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(mA)},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: ${Sw}px)`),t=()=>{let e=Tw(u,window.innerWidth,`left`);p(e),C(Pw(`left`,e,Mw())===`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(aA)?.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=>{nc(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":iA,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=si(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(uA.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function mA(e){return!e}function hA(){return kr()}function gA(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}=fA();if(d===`none`){let e;t[7]===r?e=t[8]:(e=si(`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]:(_=si(`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=si(`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:aA,"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 _A(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}=fA(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=rc(`toggle-files-sidebar`);l=li,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=aA,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]:(_=si(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)(Xt,{}):(0,Z.jsx)(Bl,{}),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 vA(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}=fA(),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:oA,maxResizeWidth:sA,setIsDraggingRail:h,widthCookieName:cA,widthCookieMaxAge:nA},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}=eA(_),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=si(`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 yA(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}=fA(),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=si(`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 bA(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=si(`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 xA(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=si(`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 SA(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=si(`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 CA(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=si(`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 wA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`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 TA=ai(`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 EA(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?ci:`button`,{state:m}=fA(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=si(TA({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)(js,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ns,{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)(Is,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function DA(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 OA(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=zr.safeParse(t);return n.success?n.data.currentBranch??null:null}var kA=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:DA({fetchBranch:OA,subscribeToEvent:rs}),AA=kA.subscribe,jA=kA.getSnapshot;function MA(){return(0,Q.useSyncExternalStore)(AA,jA,jA)}function NA(){let e=(0,$.c)(6),t=MA(),n=ka(),{state:r}=fA(),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&&da(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 PA(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=NA();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)(FA,{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 FA(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)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ns,{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)(ke,{"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 IA(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=si(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 LA(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=si(`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 RA(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=si(`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 zA(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=si(`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 BA(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=si(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Po,{}),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 VA=1,HA=2,UA=4;function WA(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}=Me(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>UA?[...u.slice(0,VA).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(VA,-HA)},...u.slice(-HA).map((e,t)=>d(e,u.length-HA+t))]:u.map((e,t)=>d(e,t));a=IA,t[8]===r?c=t[9]:(c=si(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=LA,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(GA)}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 GA(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(BA,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(RA,{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)(hl,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(RA,{className:`min-w-0`,children:(0,Z.jsx)(zA,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var KA={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`},qA=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`,...KA,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},JA=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)(qA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},YA=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)(qA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function XA(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=tc(`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=rc(`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)(WA,{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)(js,{children:(0,Z.jsx)(YA,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(bo,{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)(Ns,{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)(Is,{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)(JA,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(bo,{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)(Ns,{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)(Is,{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)(So,{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)(Is,{children:[(0,Z.jsx)(li,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(Nl,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=Is,h=li,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)(js,{children:u?(0,Z.jsx)(Hl,{}):(0,Z.jsx)(Vl,{})}),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)(Ns,{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 ZA(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function QA(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=si(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(Vd,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var $A=ai(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function ej(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=si($A({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(Hd,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function tj(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=si(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ud,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Wd,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var rj=`ok-terminal-height-v1`,ij=.5;function aj(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*ij))}function oj(e,t){let n=aj(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function sj(){return typeof window>`u`?0:window.innerHeight}function cj(e,t){try{let n=e??localStorage,r=t??sj(),i=n.getItem(rj);if(i==null)return oj(240,r);let a=Number.parseInt(i,10);return oj(Number.isFinite(a)?a:240,r)}catch{return 240}}function lj(e,t,n){try{let r=t??localStorage,i=n??sj();r.setItem(rj,String(oj(e,i)))}catch{}}function uj(){try{return typeof localStorage>`u`?240:cj()}catch{return 240}}var dj=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-BmOjKfef.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([57,1,22,6,3,23,9,11,58,59]),import.meta.url));function fj(e){let t=(0,$.c)(11),{bridge:n,onClose:r,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=ji(),l=uo(),{_:u}=i(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){X.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||X.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let i;return t[4]!==n||t[5]!==o||t[6]!==r?(i=(0,Z.jsx)(le,{fallbackRender:mj,onError:pj,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(dj,{bridge:n,className:`h-full`,onClose:r,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i):i=t[7],i}let m;return t[8]!==p||t[9]!==d?(m=d?(0,Z.jsx)(_j,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[8]=p,t[9]=d,t[10]=m):m=t[10],m}function pj(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function mj(e){return(0,Z.jsx)(hj,{...e})}function hj(e){let t=(0,$.c)(15),{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:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(li,{onClick:gj,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function gj(){return window.location.reload()}function _j(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=i(),a;t[0]===r?a=t[1]:(a=r({id:`_XWY2J`}),t[0]=r,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(li,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let f;return t[15]!==a||t[16]!==s||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{"aria-label":a,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=a,t[16]=s,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function vj(e){let t=(0,$.c)(33),{sessions:n,activeSessionId:r,onSelect:a,onTabActivate:o,onNew:s,onClose:c,children:l,className:u}=e,{_:d}=i(),f;t[0]===u?f=t[1]:(f=si(`flex min-h-0 min-w-0 flex-1 flex-col`,u),t[0]=u,t[1]=f);let p;t[2]===d?p=t[3]:(p=d({id:`1MGRQl`}),t[2]=d,t[3]=p);let m;if(t[4]!==d||t[5]!==r||t[6]!==c||t[7]!==o||t[8]!==n){let e;t[10]!==d||t[11]!==r||t[12]!==c||t[13]!==o?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:si(`flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(tj,{value:e.id,onClick:()=>o?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":d({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:`text-muted-foreground hover:text-foreground`,onClick:t=>{t.stopPropagation(),c(e.id)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`})})]},e.id)},t[10]=d,t[11]=r,t[12]=c,t[13]=o,t[14]=e):e=t[14],m=n.map(e),t[4]=d,t[5]=r,t[6]=c,t[7]=o,t[8]=n,t[9]=m}else m=t[9];let h;t[15]!==p||t[16]!==m?(h=(0,Z.jsx)(ej,{variant:`line`,"aria-label":p,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none]`,children:m}),t[15]=p,t[16]=m,t[17]=h):h=t[17];let g;t[18]===d?g=t[19]:(g=d({id:`ZBxvV3`}),t[18]=d,t[19]=g);let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(V,{"aria-hidden":`true`}),t[20]=_):_=t[20];let v;t[21]!==s||t[22]!==g?(v=(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":g,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:s,children:_}),t[21]=s,t[22]=g,t[23]=v):v=t[23];let y;t[24]!==h||t[25]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[h,v]}),t[24]=h,t[25]=v,t[26]=y):y=t[26];let b;return t[27]!==r||t[28]!==l||t[29]!==a||t[30]!==f||t[31]!==y?(b=(0,Z.jsxs)(QA,{value:r,onValueChange:a,className:f,children:[y,l]}),t[27]=r,t[28]=l,t[29]=a,t[30]=f,t[31]=y,t[32]=b):b=t[32],b}var yj=`terminal-dock-panel`;function bj(e){return`terminal-session-${e}`}function xj(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function Sj(e){let t=(0,$.c)(77),{bridge:n,children:r,visible:a,onVisibleChange:o,launch:s}=e,c=s===void 0?null:s,{_:l}=i(),{resolvedTheme:u}=Pr(),d=Sx(),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!a),h;t[0]!==c||t[1]!==a?(h=()=>a?[{id:bj(1),launch:c}]:[],t[0]=c,t[1]=a,t[2]=h):h=t[2];let[g,_]=(0,Q.useState)(h),v;t[3]===a?v=t[4]:(v=()=>a?bj(1):``,t[3]=a,t[4]=v);let[y,b]=(0,Q.useState)(v),x=(0,Q.useRef)(y),S=(0,Q.useRef)(g),C=(0,Q.useRef)(+!!a),w=(0,Q.useRef)(a&&c?c.nonce:null),T=(0,Q.useRef)(a),E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C.current+=1;let t=bj(C.current);_(n=>[...n,{id:t,launch:e}]),b(t)},t[5]=E):E=t[5];let D=E,O=(0,Q.useRef)(D),k;t[6]!==y||t[7]!==o?(k=function(e){let t=S.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>xj(e))}_(r),r.length===0&&(o(!1),f.current?.focus())},t[6]=y,t[7]=o,t[8]=k):k=t[8];let A=k,j=(0,Q.useRef)(Tj),M;t[9]!==y||t[10]!==A||t[11]!==g?(M=()=>{O.current=D,x.current=y,S.current=g,j.current=()=>{y!==``&&A(y)}},t[9]=y,t[10]=A,t[11]=g,t[12]=M):M=t[12],(0,Q.useEffect)(M);let[N]=(0,Q.useState)(wj),P=(0,Q.useRef)(N),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){R.current!=null&&clearTimeout(R.current),R.current=setTimeout(()=>{lj(e),R.current=null},100)},t[13]=z):z=t[13];let B=z,V=(0,Q.useRef)(null),H,U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>()=>{R.current!=null&&clearTimeout(R.current),V.current!=null&&(window.removeEventListener(`pointerup`,V.current),V.current=null)},U=[],t[14]=H,t[15]=U):(H=t[14],U=t[15]),(0,Q.useEffect)(H,U);let W,G;t[16]!==c||t[17]!==g.length||t[18]!==a?(W=()=>{let e=T.current;if(T.current=a,c!=null&&c.nonce!==w.current){w.current=c.nonce,O.current(c);return}a&&!e&&g.length===0&&O.current(null)},G=[a,c,g.length],t[16]=c,t[17]=g.length,t[18]=a,t[19]=W,t[20]=G):(W=t[19],G=t[20]),(0,Q.useEffect)(W,G);let K,q;t[21]===n?(K=t[22],q=t[23]):(K=()=>n.onMenuAction(e=>{e===`new-terminal`?O.current(null):e===`kill-terminal`&&j.current()}),q=[n],t[21]=n,t[22]=K,t[23]=q),(0,Q.useEffect)(K,q);let J,ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(yj)?.contains(document.activeElement))return;let t=S.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>xj(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[24]=J,t[25]=ee):(J=t[24],ee=t[25]),(0,Q.useEffect)(J,ee);let te;t[26]!==n.editor||t[27]!==g.length?(te=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[26]=n.editor,t[27]=g.length,t[28]=te):te=t[28];let ne;t[29]!==n||t[30]!==g.length?(ne=[n,g.length],t[29]=n,t[30]=g.length,t[31]=ne):ne=t[31],(0,Q.useEffect)(te,ne);let re,Y;t[32]!==d||t[33]!==a?(re=()=>{let e=d.current;e!=null&&(a?e.resize(`${P.current}px`):e.collapse())},Y=[a,d],t[32]=d,t[33]=a,t[34]=re,t[35]=Y):(re=t[34],Y=t[35]),(0,Q.useEffect)(re,Y);let ie,ae;t[36]===p?(ie=t[37],ae=t[38]):(ie=()=>{p&&document.getElementById(yj)?.contains(document.activeElement)&&f.current?.focus()},ae=[p],t[36]=p,t[37]=ie,t[38]=ae),(0,Q.useLayoutEffect)(ie,ae);let oe,se;t[39]===p?(oe=t[40],se=t[41]):(oe=()=>{p||xj(x.current)},se=[p],t[39]=p,t[40]=oe,t[41]=se),(0,Q.useEffect)(oe,se);let ce;if(t[42]!==l||t[43]!==g){let e;t[45]===l?e=t[46]:(e=(e,t)=>({id:e.id,label:l({id:`OVjNeX`,values:{0:t+1}})}),t[45]=l,t[46]=e),ce=g.map(e),t[42]=l,t[43]=g,t[44]=ce}else ce=t[44];let le=ce,ue=F||void 0,de;t[47]===r?de=t[48]:(de=(0,Z.jsx)(WC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:f,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[47]=r,t[48]=de);let fe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(GC,{withHandle:!0,onPointerDown:()=>{I(!0),L.current=!0;let e=()=>{I(!1),L.current=!1,window.removeEventListener(`pointerup`,e),V.current=null};V.current=e,window.addEventListener(`pointerup`,e)}}),t[49]=fe):fe=t[49];let pe;t[50]===u?pe=t[51]:(pe=Lc(u),t[50]=u,t[51]=pe);let me;t[52]===pe.background?me=t[53]:(me={backgroundColor:pe.background},t[52]=pe.background,t[53]=me);let he=a?`${N}px`:0,ge;t[54]!==o||t[55]!==a?(ge=e=>{let t=e.asPercentage===0;m(t),L.current&&(t&&a?o(!1):!t&&!a&&o(!0),e.inPixels>0&&(P.current=e.inPixels,B(e.inPixels)))},t[54]=o,t[55]=a,t[56]=ge):ge=t[56];let _e=!F&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ve;t[57]===_e?ve=t[58]:(ve=si(`flex flex-col`,_e),t[57]=_e,t[58]=ve);let ye;t[59]!==y||t[60]!==n||t[61]!==A||t[62]!==g||t[63]!==le?(ye=g.length>0?(0,Z.jsx)(vj,{sessions:le,activeSessionId:y,onSelect:b,onTabActivate:Cj,onNew:()=>D(null),onClose:A,className:`h-full`,children:g.map(e=>(0,Z.jsx)(nj,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(fj,{bridge:n,launch:e.launch,onClose:()=>A(e.id)})},e.id))}):null,t[59]=y,t[60]=n,t[61]=A,t[62]=g,t[63]=le,t[64]=ye):ye=t[64];let be;t[65]!==p||t[66]!==d||t[67]!==me||t[68]!==he||t[69]!==ge||t[70]!==ve||t[71]!==ye?(be=(0,Z.jsx)(WC,{id:yj,style:me,panelRef:d,defaultSize:he,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:ge,inert:p,className:ve,children:ye}),t[65]=p,t[66]=d,t[67]=me,t[68]=he,t[69]=ge,t[70]=ve,t[71]=ye,t[72]=be):be=t[72];let xe;return t[73]!==ue||t[74]!==de||t[75]!==be?(xe=(0,Z.jsxs)(UC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":ue,children:[de,fe,be]}),t[73]=ue,t[74]=de,t[75]=be,t[76]=xe):xe=t[76],xe}function Cj(e){return queueMicrotask(()=>xj(e))}function wj(){return uj()}function Tj(){}var Ej=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BYzNZP-E.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent}));function Dj(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(kj,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Oj,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Gt,{name:`editor-area`,children:(0,Z.jsxs)(DC,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Oj(){let e=(0,$.c)(5),t=Eg(),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)(RC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function kj(e){let t=(0,$.c)(148),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,terminalBridge:c,terminalVisible:l,onTerminalVisibleChange:u,terminalLaunch:d}=e,f=l===void 0?!1:l,p=d===void 0?null:d,{_:m}=i(),{activeDocName:h,activeProvider:g,activeTarget:_,recycleDocument:v,docPanelMode:y,docPanelAgentId:b,docPanelExpandSignal:S}=ht(),{openDocumentTransition:C}=Ot(),{requestAddProperty:w}=kC(),T=pw(g,h),E=gw(h,n===`source`?`source`:`wysiwyg`),D=Iw(g),O=D===`connected`||D===`synced`,k=hw(h)===`conflict`,A=(0,Q.useDeferredValue)(h),j=_?.kind===`missing`,M=!!h&&_?.kind!==`folder`,N;t[0]!==m||t[1]!==j?(N=j?m({id:`K-a33w`}):void 0,t[0]=m,t[1]=j,t[2]=N):N=t[2];let P=N,[F]=(0,Q.useState)(Mj),I=F!==null,L;t[3]===F?L=t[4]:(L=()=>Tw(F,window.innerWidth,`right`),t[3]=F,t[4]=L);let[R,z]=(0,Q.useState)(L),B=(0,Q.useRef)(R),V,H;t[5]===R?(V=t[6],H=t[7]):(V=()=>{B.current=R},H=[R],t[5]=R,t[6]=V,t[7]=H),(0,Q.useEffect)(V,H);let U=Sx(),W;t[8]===R?W=t[9]:(W=()=>Pw(`right`,R,Mw())===`collapsed`,t[8]=R,t[9]=W);let[G]=(0,Q.useState)(W),[K,q]=(0,Q.useState)(G),J=(0,Q.useRef)(K),ee,te;t[10]===K?(ee=t[11],te=t[12]):(ee=()=>{J.current=K},te=[K],t[10]=K,t[11]=ee,t[12]=te),(0,Q.useEffect)(ee,te);let[ne,re]=(0,Q.useState)(!1),Y=(0,Q.useRef)(!1),[ie]=(0,Q.useState)(jj),ae=(0,Q.useRef)(ie),oe=(0,Q.useRef)(null),se;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(se=function(e){oe.current!=null&&clearTimeout(oe.current),oe.current=setTimeout(()=>{bw(e),oe.current=null},100)},t[13]=se):se=t[13];let ce=se,le,ue;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>()=>{oe.current!=null&&clearTimeout(oe.current)},ue=[],t[14]=le,t[15]=ue):(le=t[14],ue=t[15]),(0,Q.useEffect)(le,ue);let[de,fe]=(0,Q.useState)(null),pe;t[16]!==K||t[17]!==U?(pe=function(){if(U.current==null)return;let e=B.current;K?(Fw(`right`,e,`open`),U.current?.expand()):(Fw(`right`,e,`collapsed`),U.current?.collapse())},t[16]=K,t[17]=U,t[18]=pe):pe=t[18];let me=pe,he,ge;t[19]!==F||t[20]!==U?(he=()=>{let e=window.matchMedia(`(min-width: ${Cw}px)`),t=()=>{let e=Tw(F,window.innerWidth,`right`);z(e);let t=Pw(`right`,e,Mw())===`collapsed`;q(t),t?U.current?.collapse():U.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ge=[F,U],t[19]=F,t[20]=U,t[21]=he,t[22]=ge):(he=t[21],ge=t[22]),(0,Q.useEffect)(he,ge);let _e,ve;t[23]!==de||t[24]!==I||t[25]!==U?(_e=()=>{if(de==null||I)return;let e=new ResizeObserver(()=>{J.current||Y.current||U.current?.resize(`${ae.current}px`)});return e.observe(de),()=>e.disconnect()},ve=[de,I,U],t[23]=de,t[24]=I,t[25]=U,t[26]=_e,t[27]=ve):(_e=t[26],ve=t[27]),(0,Q.useEffect)(_e,ve);let ye,be;t[28]!==o||t[29]!==U?(ye=()=>{let e=e=>{o(e),U.current?.expand()},t=Eh();return t&&e(t),Oh(t=>{Eh(),e(t)})},be=[o,U],t[28]=o,t[29]=U,t[30]=ye,t[31]=be):(ye=t[30],be=t[31]),(0,Q.useEffect)(ye,be);let xe,Se;t[32]!==S||t[33]!==U?(xe=()=>{S!==0&&U.current?.expand()},Se=[S,U],t[32]=S,t[33]=U,t[34]=xe,t[35]=Se):(xe=t[34],Se=t[35]),(0,Q.useEffect)(xe,Se);let Ce,we;t[36]===K?(Ce=t[37],we=t[38]):(Ce=()=>{if(!K||!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()},we=[K],t[36]=K,t[37]=Ce,t[38]=we),(0,Q.useLayoutEffect)(Ce,we);let Te,Ee;t[39]===K?(Te=t[40],Ee=t[41]):(Te=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!K})},Ee=[K],t[39]=K,t[40]=Te,t[41]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[42]===me?(De=t[43],Oe=t[44]):(De=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&me()})},Oe=[me],t[42]=me,t[43]=De,t[44]=Oe),(0,Q.useEffect)(De,Oe);let ke,Ae;t[45]===me?(ke=t[46],Ae=t[47]):(ke=()=>{if(window.okDesktop!=null)return;let e=e=>{nc(e,`toggle-document-panel`)&&(e.preventDefault(),me())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ae=[me],t[45]=me,t[46]=ke,t[47]=Ae),(0,Q.useEffect)(ke,Ae);let je=(0,Q.useRef)(null),[Me,Ne]=(0,Q.useState)(null),Pe=_?.kind===`large-file`?_.docName:h,Fe,Ie;t[48]===Pe?(Fe=t[49],Ie=t[50]):(Fe=()=>{if(Pe&&Pe!==je.current){let e=je.current;je.current=Pe,Ne(e)}},Ie=[Pe],t[48]=Pe,t[49]=Fe,t[50]=Ie),(0,Q.useEffect)(Fe,Ie);let Le;t[51]===C?Le=t[52]:(Le=function(e){let t=Ho(e);window.location.hash===t?C(e):window.location.hash=t},t[51]=C,t[52]=Le);let Re=Le,ze,Be=null;if(_?.kind===`large-file`){let e;t[53]!==Re||t[54]!==Me?(e=Me?{previousDocName:Me,onNavigateBack:Re}:void 0,t[53]=Re,t[54]=Me,t[55]=e):e=t[55];let n;t[56]!==_.docName||t[57]!==_.limit||t[58]!==_.size||t[59]!==e?(n=(0,Z.jsx)(CC,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[56]=_.docName,t[57]=_.limit,t[58]=_.size,t[59]=e,t[60]=n):n=t[60],ze=n}else if(_?.kind===`folder`){let e;if(t[61]===_.folderPath?e=t[62]:(e=(0,Z.jsx)(yC,{folderPath:_.folderPath}),t[61]=_.folderPath,t[62]=e),ze=e,y===`agent`&&b!==null){let e;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(GC,{withHandle:!0}),t[63]=e):e=t[63];let n;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(WC,{id:`agent-panel`,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)(Ej,{showBackButton:!1})})})]}),t[64]=n):n=t[64],Be=n}}else if(_?.kind===`asset`){let e;t[65]!==_.assetPath||t[66]!==_.mediaKind?(e=(0,Z.jsx)(Fx,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[65]=_.assetPath,t[66]=_.mediaKind,t[67]=e):e=t[67],ze=e}else if(!g||!h){if((typeof window<`u`?as(window.location.hash):null)!==null){let e;return t[68]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ix,{}),t[68]=e):e=t[68],e}let e;t[69]===f?e=t[70]:(e=(0,Z.jsx)(zS,{terminalVisible:f}),t[69]=f,t[70]=e),ze=e}else{let e=n===`source`,i=!O,s=K,c;t[71]!==h||t[72]!==w?(c=function(){h&&w(h)},t[71]=h,t[72]=w,t[73]=c):c=t[73];let l=c,u=A??h,d=Me??void 0,f;t[74]!==P||t[75]!==e||t[76]!==Re||t[77]!==v||t[78]!==u||t[79]!==d?(f=(0,Z.jsx)(Vk,{activeDocName:u,isSourceMode:e,editorPlaceholder:P,previousDocName:d,onNavigateBack:Re,onRecycle:v}),t[74]=P,t[75]=e,t[76]=Re,t[77]=v,t[78]=u,t[79]=d,t[80]=f):f=t[80];let p;t[81]!==h||t[82]!==e?(p=(0,Z.jsx)(lw,{activeDocName:h,isSourceMode:e}),t[81]=h,t[82]=e,t[83]=p):p=t[83];let m;t[84]!==h||t[85]!==A?(m=ZA({activeDocName:h,deferredActiveDocName:A,mountResolved:h!==null&&x(h),syncResolved:h!==null&&Ve(h)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Ix,{}),h===null?null:(0,Z.jsx)(wC,{docName:h})]}):null,t[84]=h,t[85]=A,t[86]=m):m=t[86];let g;t[87]!==f||t[88]!==p||t[89]!==m?(g=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[f,p,m]}),t[87]=f,t[88]=p,t[89]=m,t[90]=g):g=t[90];let _;t[91]!==h||t[92]!==k||t[93]!==s||t[94]!==e||t[95]!==r||t[96]!==l||t[97]!==i||t[98]!==me?(_=!k&&(0,Z.jsx)(XA,{activeDocName:h,isSourceMode:e,sourceDisabled:i,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:me}),t[91]=h,t[92]=k,t[93]=s,t[94]=e,t[95]=r,t[96]=l,t[97]=i,t[98]=me,t[99]=_):_=t[99];let b;t[100]!==g||t[101]!==_?(b=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[g,_]}),t[100]=g,t[101]=_,t[102]=b):b=t[102];let S;t[103]!==E||t[104]!==M||t[105]!==T?(S=(0,Z.jsx)(PA,{stats:T,selectionStats:E,showStats:M}),t[103]=E,t[104]=M,t[105]=T,t[106]=S):S=t[106];let C;t[107]!==b||t[108]!==S?(C=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[b,S]}),t[107]=b,t[108]=S,t[109]=C):C=t[109],ze=C;let D=I&&K,j;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{re(!0),Y.current=!0;let e=()=>{re(!1),Y.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[110]=j):j=t[110];let N;t[111]===D?N=t[112]:(N=(0,Z.jsx)(GC,{withHandle:!0,disabled:D,onPointerDown:j}),t[111]=D,t[112]=N);let F=G?0:`${ie}px`,L;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{q(e.asPercentage===0),e.inPixels>0&&Y.current&&(ae.current=e.inPixels,ce(e.inPixels))},t[113]=L):L=t[113];let R=!ne&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,z;t[114]===R?z=t[115]:(z=si(`flex flex-col bg-muted/20`,R),t[114]=R,t[115]=z);let B;t[116]!==h||t[117]!==a||t[118]!==y||t[119]!==e||t[120]!==o?(B=(0,Z.jsx)(Oy,{docName:h,isSourceMode:e,activeTab:a,onActiveTabChange:o,mode:y}),t[116]=h,t[117]=a,t[118]=y,t[119]=e,t[120]=o,t[121]=B):B=t[121];let V;t[122]!==K||t[123]!==U||t[124]!==F||t[125]!==z||t[126]!==B?(V=(0,Z.jsx)(WC,{id:`doc-panel`,panelRef:U,defaultSize:F,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:L,inert:K,className:z,children:B}),t[122]=K,t[123]=U,t[124]=F,t[125]=z,t[126]=B,t[127]=V):V=t[127];let H;t[128]!==N||t[129]!==V?(H=(0,Z.jsxs)(Z.Fragment,{children:[N,V]}),t[128]=N,t[129]=V,t[130]=H):H=t[130],Be=H}let He;t[131]!==u||t[132]!==c||t[133]!==p||t[134]!==f||t[135]!==ze?(He=c==null?ze:(0,Z.jsx)(Sj,{bridge:c,visible:f,onVisibleChange:u??Aj,launch:p,children:ze}),t[131]=u,t[132]=c,t[133]=p,t[134]=f,t[135]=ze,t[136]=He):He=t[136];let Ue=He,We=ne||void 0,Ge;t[137]!==G||t[138]!==Be?(Ge=Be!=null&&!G?{}:{defaultSize:`100%`},t[137]=G,t[138]=Be,t[139]=Ge):Ge=t[139];let Ke=ne?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,qe;t[140]!==Ue||t[141]!==Ge||t[142]!==Ke?(qe=(0,Z.jsx)(WC,{minSize:`30%`,...Ge,className:Ke,children:Ue}),t[140]=Ue,t[141]=Ge,t[142]=Ke,t[143]=qe):qe=t[143];let Je;return t[144]!==Be||t[145]!==We||t[146]!==qe?(Je=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:fe,children:(0,Z.jsxs)(UC,{orientation:`horizontal`,"data-dragging":We,children:[qe,Be]})}),t[144]=Be,t[145]=We,t[146]=qe,t[147]=Je):Je=t[147],Je}function Aj(){}function jj(){return xw()}function Mj(){return kr()}function Nj(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 Pj(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 Fj=1e3,Ij=!1;function Lj(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Rj(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:Ci(i)?a=i:(a=void 0,Ij||(Ij=!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`&&(Lj({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=Pj(i),{current:c,crossDoc:l}=a?vi(a,n,Date.now()):{current:[],crossDoc:[]},u=zj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Nj(e.current,p)&&Nj(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,Fj);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 zj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Bj=`sync-status`;function Vj(e,t){let n=(0,$.c)(6),{_:r}=i(),a=cm(),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(t),l,u;n[0]!==r||n[1]!==t||n[2]!==a||n[3]!==e?(l=()=>{if(c.current!==t&&(c.current=t,o.current=!1,s.current=!1),t)if(e===`synced`&&(o.current=!0),e===`disconnected`&&o.current){if(a){X.dismiss(Bj);return}s.current=!0,X.warning(r({id:`HGNCsl`}),{id:Bj,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,X.success(r({id:`GhjUB_`}),{id:Bj,duration:3e3}))},u=[e,t,r,a],n[0]=r,n[1]=t,n[2]=a,n[3]=e,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,Q.useEffect)(l,u)}var Hj=4,Uj=3,Wj={Bird:tl,Cat:sl,Dog:ml,Fish:bl,Mouse:ql,Rabbit:Kl,Shrimp:$l,Snail:eu,Squirrel:iu,Turtle:fu};Object.freeze(Object.keys(Wj));function Gj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Wj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var Kj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function qj(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=Gj(n),c=s.kind===`animal`?Wj[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=tr(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Kr(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)(js,{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)(Ns,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Is,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function Jj(e){let t=Kj[e.icon];return e.displayName||t||hs._({id:`iEQQyu`})}function Yj(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 Xj(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=ht(),{presence:u,agentId:d}=n,f=Jj(u),p=Yj(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)(xi,{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)(xi,{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)(js,{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)(Ns,{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)(Is,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function Zj(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?hs._({id:`9euN0m`,values:{count:n}}):hs._({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)(J,{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)(qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(Xj,{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)(b,{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)(pe,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function Qj(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(Xj,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function $j(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ht(),{current:s,crossDoc:c}=Rj(t,r,n);if(Vj(Iw(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,Hj),n;e[6]===s?n=e[7]:(n=s.slice(Hj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Uj),d;e[8]===c?d=e[9]:(d=c.slice(Uj),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=>Qj(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)(Zj,{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=>Qj(e,p,!0,m)),f.length>0?(0,Z.jsx)(Zj,{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 eM=new Set([`.md`,`.mdx`]);function tM(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function nM(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 rM(e){return eM.has(tM(e).toLowerCase())}function iM(e,t,n){if(n)return{kind:`allow`,destinationPath:t};let r=tM(e);return r===``?{kind:`allow`,destinationPath:t}:{kind:`allow`,destinationPath:tM(t)?t:nM(t,r)}}var aM=`.md`,oM=/\.(md|mdx)$/i;function sM(e,t=aM){return`${e}${t}`}function cM(e){return FM(e).replace(oM,``)}function lM(e){return Qo(e)?fM(e.path):zo(e)?e.path:sM(e.docName,e.docExt)}function uM(e){let t=FM(e).match(oM);return t?`.${t[1].toLowerCase()}`:void 0}function dM(e){return FM(e)}function fM(e){let t=FM(e.trim());return t?`${t}/`:``}function pM(e){return e.endsWith(`/`)?dM(e):cM(e)}function mM(e){return e.map(lM)}function hM(e){return[...e].sort().join(`\0`)}function gM(e){return hM(mM(e))}function _M(e){let t=new Set;for(let n of e){if(Qo(n)){let e=fM(n.path);e&&t.add(e)}let e=(Qo(n)||zo(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Qo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function vM(e){if(!e)return[];let t=FM(e.replace(oM,``)).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 yM(e,t,n){let r=uM(e);if(r)return r;let i=n.find(e=>ps(e)&&e.docName===t);return i?i.docExt??aM:PM(e).includes(`.`)?void 0:aM}function bM(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(!zo(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 xM(e,t,n){if(uM(e))return null;let r=n.find(e=>zo(e)&&e.path===t);return r?r.path:PM(e).includes(`.`)?t:bM(t,n)}function SM(e,t){let n=e.kind===`directory`,r=n?dM(e.path):cM(e.path);if(n)return{kind:`folder`,name:FM(PM(e.path)).replace(oM,``),path:r,treePath:wM(e.path,!0)};let i=xM(e.path,r,t);if(i)return{kind:`asset`,name:FM(PM(i)),path:i,treePath:i};let a=yM(e.path,r,t);return{kind:`file`,name:FM(PM(e.path)).replace(oM,``),path:r,treePath:wM(e.path,!1),docExt:a}}function CM(e){return e.kind===`directory`?dM(e.path):e.path}function wM(e,t){return t?fM(e):oM.test(e)?e:`${e}${aM}`}function TM(e,t,n){let r=fM(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}${aM}`;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 EM(e,t){return e===`file`?wM(t,!1):`${dM(t)}/index${aM}`}function DM(e,t){return t.kind===`root`||t.directoryPath==null?PM(e):`${t.directoryPath}${PM(e)}`}function OM(e,t){if(t)return dM(fM(e));let n=cM(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function kM(e,t){let n=dM(fM(e));return n?`${n}/${t}`:t}function AM(e,t){return(t.path??kM(e,t.src)).replace(/^\/+/,``)}function jM(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function MM(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function NM(e,t){let n=tM(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:cM(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:rr(i),modified:r,size:t.size}}function PM(e){let t=FM(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function FM(e){return e.endsWith(`/`)?e.slice(0,-1):e}function IM(e,t){return t.trim()}function LM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function RM(e,t){let n=IM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function zM(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(ps(e)){let t=s.get(sM(e.docName,e.docExt));if(t){let n=Vo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:rr(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Qo(e))return{...e,path:KM(e.path,n)};if(zo(e)){let t=s.get(e.path);return t&&rM(t)?{kind:`document`,docName:cM(t),docExt:tM(t),size:e.size,modified:e.modified}:{...e,path:t??KM(e.path,n)}}return e})}function BM(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=>ps(e)?!i.has(e.docName)&&!XM(e.docName,n):Qo(e)?!XM(e.path,n):zo(e)?!a.has(e.path)&&!XM(e.path,n):!0)}function VM(e,t){if(e.kind!==`asset`||t.some(t=>zo(t)&&t.path===e.path))return e;let n=bM(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function HM(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>qM(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ps(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=>Qo(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(ps(i)){let e=YM(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Qo(i)){let e=JM(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function UM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function WM(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function GM(e,t){let n=e.kind===`file`?sM(e.path,e.docExt):e.path;return Zg(t.contentDir,n,t.pathSeparator)}function KM(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 qM(e,t){return ps(e)&&ps(t)?e.docName===t.docName:Qo(e)&&Qo(t)||zo(e)&&zo(t)?e.path===t.path:!1}function JM(e,t,n){return e===t?n:YM(e,t,n)}function YM(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function XM(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function ZM(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)(pd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function QM(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=si(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(md,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $M(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)(_d,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function eN(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)(Cd,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function tN(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=si(`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)(hd,{children:(0,Z.jsx)(gd,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nN(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=si(`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)(yd,{"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 rN(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=si(`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)(Po,{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)(wd,{"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 iN(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=si(`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)(Td,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aN(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=si(`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)(xd,{children:(0,Z.jsx)(Ao,{})})}),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)(bd,{"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 oN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=si(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(vd,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function sN(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=si(`-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)(Sd,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var cN=`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`,lN=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,uN={start:[Gi.Space],cancel:[Gi.Esc],end:[Gi.Space,Gi.Enter]};function dN(e){return si(cN,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function fN(e){return e?void 0:-1}function pN({className:e,isDragging:t}){return si(e,t&&lN)}function mN(e){return e.code===Gi.Enter&&e.target===e.currentTarget}function hN({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&mN(e)?`activate-tab`:`delegate-sortable`}function gN({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Na.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 _N(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 vN(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 yN=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 Ca(e)},bN=[`.md`,`.mdx`],xN=`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`,SN=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,CN=si(SN,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),wN=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function TN(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function EN(e){let t=Ho(e);window.location.hash!==t&&(window.location.hash=t)}function DN(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function ON(e,t){let n=[t,...bN].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 kN(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:_}=zi(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=gN({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=hN({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=pN({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 AN(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=Ye(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=Ye(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)(QM,{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)(nN,{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)(nN,{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)(nN,{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)(sN,{}),(0,Z.jsx)(nN,{"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)(tN,{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)(ZM,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function jN(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)(Gl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(li,{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=dN(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=fN(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)(gs,{"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)(li,{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 MN(e){let t=(0,$.c)(1),{docName:n}=e;if(hw(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Ro,{"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 NN(){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:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=ht(),{_:T}=i(),{pageMeta:E}=is(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?Ze(a):t?Ue(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=G):G=e[3];let K=G,q;e[4]!==r||e[5]!==K||e[6]!==h||e[7]!==g||e[8]!==v?(q=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:K?`${K}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=K,e[6]=h,e[7]=g,e[8]=v,e[9]=q):q=e[9];let J=q,ee,te;e[10]===t?(ee=e[11],te=e[12]):(ee=()=>{W.current=t},te=[t],e[10]=t,e[11]=ee,e[12]=te),(0,Q.useEffect)(ee,te);let ne,re;e[13]===J?(ne=e[14],re=e[15]):(ne=()=>{J&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},re=[J],e[13]=J,e[14]=ne,e[15]=re),(0,Q.useEffect)(ne,re);let Y,ie;e[16]===j?(Y=e[17],ie=e[18]):(Y=()=>{j&&(z.current?.focus(),z.current?.select())},ie=[j],e[16]=j,e[17]=Y,e[18]=ie),(0,Q.useEffect)(Y,ie);let ae,oe;e[19]!==v||e[20]!==j?(ae=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),R(!1))},oe=[v,j],e[19]=v,e[20]=j,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=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)},ce=function(){H.current=!0,U.current=null,M(null),P(``),I(null),R(!1)},le=async function(){if(H.current){H.current=!1;return}if(B.current)return;let e=j?.docName;if(!e){ce();return}let t=IM(`file`,ON(N,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===U.current){z.current?.focus();return}if(!LM(t)){I(T({id:`P8yDjG`})),z.current?.focus();return}let i=RM({kind:`file`,path:e,name:r},t);B.current=!0,R(!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){R(!1),B.current=!1;return}let r=await ve(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),B.current=!1,U.current=t,z.current?.focus();return}let a=A(Qr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=UM(o,a);Vt(a);let c=!0;try{let e=WM(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),cs([`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(T({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),R(!1),B.current=!1,U.current=null,c&&s&&s!==o&&EN(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(T({id:`HIb0vl`})),R(!1),B.current=!1,U.current=t,z.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===g?de=e[24]:(de=new Set(g),e[23]=g,e[24]=de);let fe=de,pe;e[25]===O?pe=e[26]:(pe=vN(O),e[25]=O,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==u||e[30]!==f||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.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]=fe,e[32]=ge):ge=e[32];let _e=ge,ye;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ye={activationConstraint:{distance:8}},e[33]=ye):ye=e[33];let be;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(be={coordinateGetter:_a,keyboardCodes:uN},e[34]=be):be=e[34];let xe=Ti(aa(ya,ye),aa(xa,be)),Se;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){k(_N(D.current))},e[35]=Se):Se=e[35];let Ce=Se,we;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(){k(null)},e[36]=we):we=e[36];let Te=we,Ee;e[37]!==Te||e[38]!==S||e[39]!==w?(Ee=function(e){Te();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Vi([...w],r,i),t)},e[37]=Te,e[38]=S,e[39]=w,e[40]=Ee):Ee=e[40];let De=Ee,Oe=ue?``:void 0,ke;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(ke=si(`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]`,ue&&`[-webkit-app-region:drag]`),e[41]=ke):ke=e[41];let Ae=DN,je;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(je=si(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=je):je=e[42];let Ne=Qa,Pe=yN,Fe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={container:typeof document<`u`?document.body:void 0},e[43]=Fe):Fe=e[43];let Ie=ha,Le;e[44]===w?Le=e[45]:(Le=[...w],e[44]=w,e[45]=Le);let Re=pa,ze=w.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(AN,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(kN,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:si(xN,t?SN:CN),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":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:wN,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":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:dN(t),tabIndex:fN(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=mt(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Me(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(AN,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(kN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(xN,n?SN:CN),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:wN,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:si(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:si(`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)(jN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Me(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(AN,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(kN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(xN,n?SN:CN),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:wN,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:si(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:si(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(jN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=Me(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,x=`editor-tab-rename-error-${TN(a)}`;return(0,Z.jsx)(AN,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(kN,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(xN,n?SN:CN,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)(KC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(ZC,{ref:z,value:N,disabled:L,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?x:void 0,"aria-busy":L||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(ON(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(JC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(XC,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:x,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:wN,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,a)},tabIndex:-1,children:[(0,Z.jsx)(MN,{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)(jN,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),Be;e[46]!==Ie||e[47]!==Le||e[48]!==Re||e[49]!==ze?(Be=(0,Z.jsx)(Ie,{items:Le,strategy:Re,children:ze}),e[46]=Ie,e[47]=Le,e[48]=Re,e[49]=ze,e[50]=Be):Be=e[50];let Ve;e[51]!==Ne||e[52]!==Te||e[53]!==De||e[54]!==Ce||e[55]!==xe||e[56]!==!1||e[57]!==Pe||e[58]!==Fe||e[59]!==Be||e[60]!==he?(Ve=(0,Z.jsx)(Ne,{sensors:xe,autoScroll:!1,collisionDetection:Pe,modifiers:he,onDragStart:Ce,onDragEnd:De,onDragCancel:Te,accessibility:Fe,children:Be}),e[51]=Ne,e[52]=Te,e[53]=De,e[54]=Ce,e[55]=xe,e[56]=!1,e[57]=Pe,e[58]=Fe,e[59]=Be,e[60]=he,e[61]=Ve):Ve=e[61];let He;e[62]===T?He=e[63]:(He=T({id:`3YvS-c`}),e[62]=T,e[63]=He);let We;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(V,{"aria-hidden":`true`}),e[64]=We):We=e[64];let Ge;e[65]!==_||e[66]!==He?(Ge=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":He,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:We})}),e[65]=_,e[66]=He,e[67]=Ge):Ge=e[67];let Ke;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=Ke):Ke=e[68];let qe;e[69]===Ge?qe=e[70]:(qe=(0,Z.jsxs)(Is,{children:[Ge,Ke]}),e[69]=Ge,e[70]=qe);let Je;e[71]!==je||e[72]!==Ve||e[73]!==qe?(Je=(0,Z.jsxs)(`div`,{className:je,children:[Ve,qe]}),e[71]=je,e[72]=Ve,e[73]=qe,e[74]=Je):Je=e[74];let Ye;return e[75]!==Oe||e[76]!==ke||e[77]!==Ae||e[78]!==Je?(Ye=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":Oe,className:ke,onWheel:Ae,children:Je}),e[75]=Oe,e[76]=ke,e[77]=Ae,e[78]=Je,e[79]=Ye):Ye=e[79],Ye}function PN(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 FN(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 IN=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Ct},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:wf},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:$o},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:PN},{label:`Twitter`,href:`https://x.com/inkeep`,icon:FN}],LN=()=>{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)(ze,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(li,{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)(Is,{children:[o,(0,Z.jsx)(Ns,{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=IN.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=>wa(e,r),onAuxClick:e=>wa(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)(b,{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)(pe,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function RN(e){let t=(0,$.c)(19),{installStates:n,terminalLaunch:r,disabled:a,onPick:o,onLaunchTerminal:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(``),f;if(t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let i=gg.filter(e),p=gg.some(e=>n[e.id]?.installed==null),m=i.length>0,h=r!==null,g=m||h,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>d(e.target.value),t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=l({id:`Rah7yq`}),t[11]=l,t[12]=v);let y;t[13]===l?y=t[14]:(y=l({id:`ZBt4rI`}),t[13]=l,t[14]=y);let b;t[15]!==u||t[16]!==v||t[17]!==y?(b=(0,Z.jsx)(`div`,{className:`px-2 pt-2 pb-1.5`,children:(0,Z.jsx)(Mo,{value:u,onChange:_,placeholder:v,"aria-label":y,"data-testid":`open-in-agent-instruction`})}),t[15]=u,t[16]=v,t[17]=y,t[18]=b):b=t[18],f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[b,g?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(e=>{let{displayName:t}=e;return(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:a,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":l({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>o(e,u),children:[(0,Z.jsx)(Vx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t})]},e.id)})]}):null,h?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(Pi,{className:`my-1`}):null,(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:a,"data-testid":`open-in-agent-terminal`,"aria-label":l({id:`AcK_r0`}),onClick:()=>c(u),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`fcgvCA`})})]})]})]}):null]}):(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:p?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=l,t[1]=a,t[2]=n,t[3]=u,t[4]=c,t[5]=o,t[6]=r,t[7]=f}else f=t[7];return f}function zN(e){let t=(0,$.c)(44),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=D_(),{dispatch:u}=g_(),d=Wx(),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),h=pg(),g=r??f,_;t[0]===l?_=t[1]:(_=()=>{l()},t[0]=l,t[1]=_);let v=(0,Q.useEffectEvent)(_),y;t[2]!==g||t[3]!==v?(y=()=>{g&&v()},t[2]=g,t[3]=v,t[4]=y):y=t[4];let x;if(t[5]===g?x=t[6]:(x=[g],t[5]=g,t[6]=x),(0,Q.useEffect)(y,x),h)return null;let S=typeof window<`u`&&window.okDesktop!=null,C;t[7]!==a||t[8]!==r?(C=e=>{r===void 0&&p(e),a?.(e)},t[7]=a,t[8]=r,t[9]=C):C=t[9];let w=C,T=n===null,E;t[10]===n?E=t[11]:(E=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=E);let D=E,O;t[12]!==u||t[13]!==w||t[14]!==D?(O=(e,t)=>{let n=D(t);n!==null&&(u(e.id,n),w(!1))},t[12]=u,t[13]=w,t[14]=D,t[15]=O):O=t[15];let k=O,A;t[16]!==w||t[17]!==D||t[18]!==d?(A=e=>{let t=D(e);t===null||d===null||(d.launchInTerminal(t),w(!1))},t[16]=w,t[17]=D,t[18]=d,t[19]=A):A=t[19];let j=A,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=S?()=>{m.current=!0}:void 0,t[20]=M):M=t[20];let N;t[21]===w?N=t[22]:(N=S?()=>{if(m.current){m.current=!1;return}w(!0)}:void 0,t[21]=w,t[22]=N);let P,F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(bi,{className:`size-3.5`,"aria-hidden":`true`}),F=(0,Z.jsx)(s,{id:`O7_W_a`}),t[23]=P,t[24]=F):(P=t[23],F=t[24]);let I;t[25]!==N||t[26]!==T?(I=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,disabled:T,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:M,onClick:N,children:[P,F]})}),t[25]=N,t[26]=T,t[27]=I):I=t[27];let L;t[28]===o?L=t[29]:(L=o({id:`O7_W_a`}),t[28]=o,t[29]=L);let R=n===null,z;t[30]!==j||t[31]!==k||t[32]!==c||t[33]!==R||t[34]!==d?(z=(0,Z.jsx)(RN,{installStates:c,terminalLaunch:d,disabled:R,onPick:k,onLaunchTerminal:j}),t[30]=j,t[31]=k,t[32]=c,t[33]=R,t[34]=d,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==z?(B=(0,Z.jsx)(b,{align:`end`,className:`p-1`,"aria-label":L,"data-testid":`open-in-agent-menu`,children:z}),t[36]=L,t[37]=z,t[38]=B):B=t[38];let V;return t[39]!==w||t[40]!==g||t[41]!==I||t[42]!==B?(V=(0,Z.jsxs)(pe,{open:g,onOpenChange:w,children:[I,B]}),t[39]=w,t[40]=g,t[41]=I,t[42]=B,t[43]=V):V=t[43],V}var BN=50,VN=()=>{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,jC.preload()},BN))},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=Sg)},u=(0,Z.jsx)(Zl,{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)(js,{asChild:!0,children:(0,Z.jsxs)(li,{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)(Is,{children:[d,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function HN(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=go(),[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 la({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:Pa,toastSuccess:JN,toastError:qN,logEvent:KN});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,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[9]=x):x=t[9];let C;t[10]!==a||t[11]!==n?.kind?(C=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=C):C=t[12];let w=c||g,T,E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ql,{className:`size-3.5`,"aria-hidden":!0}),E=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=T,t[14]=E):(T=t[13],E=t[14]);let D;t[15]!==v||t[16]!==C||t[17]!==w?(D=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,"aria-label":C,onClick:v,disabled:w,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[T,E]})}),t[15]=v,t[16]=C,t[17]=w,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[20]=k):k=t[20];let A=u??``,j;t[21]===a?j=t[22]:(j=a({id:`5-FeN2`}),t[21]=a,t[22]=j);let M;t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(b,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[O,k,(0,Z.jsx)(Mo,{ref:f,readOnly:!0,value:A,onFocus:GN,onClick:WN,onContextMenu:UN,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":j})]}),t[23]=A,t[24]=j,t[25]=M):M=t[25];let N;return t[26]!==D||t[27]!==M||t[28]!==y?(N=(0,Z.jsxs)(pe,{open:y,onOpenChange:x,children:[D,M]}),t[26]=D,t[27]=M,t[28]=y,t[29]=N):N=t[29],N}function UN(e){return e.currentTarget.select()}function WN(e){return e.currentTarget.select()}function GN(e){return e.currentTarget.select()}function KN(e){return console.log(e)}function qN(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function JN(e){return X.success(e)}function YN(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=ht(),{state:p,isDraggingRail:m}=fA(),h=xg(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=tc(`toggle-files-sidebar`),t[0]=g):g=t[0];let _=g,v=tc(`command-palette`),y=ka(),[b,x]=(0,Q.useState)(!1),S;bb0:{if(f===null){let e;t[1]===y?e=t[2]:(e=e_({workspace:y}),t[1]=y,t[2]=e),S=e;break bb0}if(f.kind===`folder`){if(!y){S=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==y?(e=r_({folderRelativePath:f.folderPath,workspace:y}),t[3]=f.folderPath,t[4]=y,t[5]=e):e=t[5],S=e;break bb0}let e;t[6]!==d||t[7]!==y?(e=$g({docName:d,workspace:y}),t[6]=d,t[7]=y,t[8]=e):e=t[8],S=e}let C=c??S,w;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=po(f.folderPath),t[9]=f.folderPath,t[10]=e),w=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Oa(d),t[11]=d,t[12]=e),w=e;break bb1}w=null}let E=w,D=typeof window<`u`&&window.okDesktop!=null,O=p===`collapsed`,k=D?``:void 0,A=D&&O&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,j=D&&!m&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,M;t[13]!==A||t[14]!==j?(M=si(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,D&&`[-webkit-app-region:drag]`,A,j),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(_A,{className:si(`-ml-1 shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ns,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:_}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:_}})})]}),O&&a&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:si(`shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(T,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:v}})})]}),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(NN,{})]}),P;t[16]===N?P=t[17]:(P=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:N}),t[16]=N,t[17]=P);let F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=si(`flex shrink-0 items-center justify-end gap-2 px-3`,D&&`[&>*]:[-webkit-app-region:no-drag]`),t[18]=F):F=t[18];let I;t[19]!==C||t[20]!==l||t[21]!==o||t[22]!==b||t[23]!==x||t[24]!==E||t[25]!==h?(I=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(zN,{input:C,open:o,onOpenChange:l}),(0,Z.jsx)(HN,{input:E,onClickWhenNoRemote:()=>x(!0)}),(0,Z.jsx)(ho,{open:b,onOpenChange:x})]}),t[19]=C,t[20]=l,t[21]=o,t[22]=b,t[23]=x,t[24]=E,t[25]=h,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==n?(L=(0,Z.jsx)(Wa,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=L):L=t[29];let R,z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)($j,{}),z=(0,Z.jsx)(Pi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),B=(0,Z.jsx)(qd,{}),t[30]=R,t[31]=z,t[32]=B):(R=t[30],z=t[31],B=t[32]);let V;t[33]===h?V=t[34]:(V=!h&&(0,Z.jsx)(VN,{}),t[33]=h,t[34]=V);let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(LN,{}),t[35]=H):H=t[35];let U;t[36]!==I||t[37]!==L||t[38]!==V?(U=(0,Z.jsxs)(`div`,{className:F,children:[I,L,R,z,B,V,H]}),t[36]=I,t[37]=L,t[38]=V,t[39]=U):U=t[39];let W;return t[40]!==P||t[41]!==U||t[42]!==k||t[43]!==M?(W=(0,Z.jsxs)(`header`,{"data-electron-drag":k,className:M,children:[P,U]}),t[40]=P,t[41]=U,t[42]=k,t[43]=M,t[44]=W):W=t[44],W}var XN=`open-knowledge:terminal-launch`;function ZN(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(XN,{detail:{prompt:e}}))}function QN(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.prompt:void 0;typeof n==`string`&&e(n)};return t.addEventListener(XN,n),()=>t.removeEventListener(XN,n)}function $N(e){let t=(0,$.c)(61),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]=ov(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Cy[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=typeof window<`u`?window.okDesktop??null:null,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),D=(0,Q.useRef)(0),O=lo(),{projectLocalConfig:k,projectLocalSynced:A}=oe(),j=ka(),{activeDocName:M}=ht(),N=O?.hasRemote,P=O?.pushPermission?.checkStatus,F;t[2]!==g||t[3]!==k||t[4]!==A||t[5]!==N||t[6]!==P?(F=uv({autoSyncOnboardingDismissed:g,hasRemote:N,projectLocalSynced:A,projectLocalConfig:k,pushPermissionCheckStatus:P}),t[2]=g,t[3]=k,t[4]=A,t[5]=N,t[6]=P,t[7]=F):F=t[7];let I=F,L,R;t[8]===M?(L=t[9],R=t[10]):(L=()=>{let e=function(e){let t=e.detail;t&&M&&Oc(M,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(Q_,e),()=>window.removeEventListener(Q_,e)},R=[M],t[8]=M,t[9]=L,t[10]=R),(0,Q.useEffect)(L,R);let z,B;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?w(tP):e===`new-terminal`&&w(!0)})},B=[],t[11]=z,t[12]=B):(z=t[11],B=t[12]),(0,Q.useEffect)(z,B);let V,H;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{if(window.okDesktop!=null)return;let e=function(e){nc(e,`toggle-terminal-panel`)&&(e.preventDefault(),w(eP))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},V=[],t[13]=V,t[14]=H):(V=t[13],H=t[14]),(0,Q.useEffect)(H,V);let U,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>QN(e=>{w(!0),D.current+=1,E({prompt:e,nonce:D.current})}),W=[],t[15]=U,t[16]=W):(U=t[15],W=t[16]),(0,Q.useEffect)(U,W);let G,K;t[17]===C?(G=t[18],K=t[19]):(G=()=>{C||E(null)},K=[C],t[17]=C,t[18]=G,t[19]=K),(0,Q.useEffect)(G,K);let q,J;t[20]===C?(q=t[21],J=t[22]):(q=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C})},J=[C],t[20]=C,t[21]=q,t[22]=J),(0,Q.useEffect)(q,J);let ee,te;t[23]===C?(ee=t[24],te=t[25]):(ee=()=>{window.okDesktop!=null&&C&&Ta()},te=[C],t[23]=C,t[24]=ee,t[25]=te),(0,Q.useEffect)(ee,te),sv(O?.pausedReason);let ne;t[26]===s?ne=t[27]:(ne=function(e){l(e),s(e)},t[26]=s,t[27]=ne);let re=ne,Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y=function(e){y(e),e||x(null)},t[28]=Y):Y=t[28];let ie=Y,ae;t[29]!==a||t[30]!==M||t[31]!==j?(ae={openSelection(e){let t=a_({docName:e.docName??M,workspace:j,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown});return t===null?(X.error(a({id:`_VRtd7`})),!1):(x(t),y(!0),!0)}},t[29]=a,t[30]=M,t[31]=j,t[32]=ae):ae=t[32];let se,ce;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{p(`auth`),d(!0)},ce=()=>{p(`identity`),d(!0)},t[33]=se,t[34]=ce):(se=t[33],ce=t[34]);let le;t[35]!==r||t[36]!==b||t[37]!==v?(le=(0,Z.jsx)(YN,{onSignIn:se,onSetIdentity:ce,onOpenSearch:r,openInAgentMenuOpen:v,openInAgentMenuInput:b,onOpenInAgentMenuOpenChange:ie}),t[35]=r,t[36]=b,t[37]=v,t[38]=le):le=t[38];let ue;t[39]!==m||t[40]!==c||t[41]!==re||t[42]!==T||t[43]!==C?(ue=(0,Z.jsx)(Dj,{editorMode:c,onModeChange:re,activeTab:m,onActiveTabChange:h,terminalBridge:S,terminalVisible:C,onTerminalVisibleChange:w,terminalLaunch:T}),t[39]=m,t[40]=c,t[41]=re,t[42]=T,t[43]=C,t[44]=ue):ue=t[44];let de;t[45]!==ae||t[46]!==le||t[47]!==ue?(de=(0,Z.jsxs)(Pc,{value:ae,children:[le,ue]}),t[45]=ae,t[46]=le,t[47]=ue,t[48]=de):de=t[48];let fe=f===`identity`,pe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>{d(!1)},t[49]=pe):pe=t[49];let me;t[50]!==u||t[51]!==fe?(me=(0,Z.jsx)(ea,{open:u,onOpenChange:d,identityPrompt:fe,onSuccess:pe}),t[50]=u,t[51]=fe,t[52]=me):me=t[52];let he;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>_(!0),t[53]=he):he=t[53];let ge;t[54]===I?ge=t[55]:(ge=(0,Z.jsx)(cv,{open:I,onResolved:he}),t[54]=I,t[55]=ge);let _e;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(Y_,{}),t[56]=_e):_e=t[56];let ve;return t[57]!==de||t[58]!==me||t[59]!==ge?(ve=(0,Z.jsxs)(Z.Fragment,{children:[de,me,ge,_e]}),t[57]=de,t[58]=me,t[59]=ge,t[60]=ve):ve=t[60],ve}function eP(e){return!e}function tP(e){return!e}function nP(e){let t=Ho(qo(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function rP(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Fi();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)(Ro,{"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)(Ro,{"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(iP),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 iP(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(li,{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:()=>nP(e.file),children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var aP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
30
30
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
31
31
|
<path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
|
|
32
32
|
</symbol>
|
|
@@ -1863,7 +1863,7 @@ Error generating stack: `+e.message+`
|
|
|
1863
1863
|
}`}function Ez(e){return`${wz}
|
|
1864
1864
|
@layer unsafe {
|
|
1865
1865
|
${e}
|
|
1866
|
-
}`}var Dz=new WeakMap;function Oz(e){let t=Dz.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(xF,`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(),Dz.set(e,i),i}function kz(e,t){if(!e.isConnected)return;let n=Oz(t);if(n==null)return;let r=t.querySelector(`style[${SF}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(SF,``),t.appendChild(i)),i.textContent=`:host { ${CF}: ${n}px; }`}var Az;function jz(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Az??(Az=new CSSStyleSheet,Az.replaceSync(Tz(Cz)));let t=!1;try{e.adoptedStyleSheets=[Az],t=!0}catch{}if(t){e.querySelector(`style[${yF}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(yF,``),t.textContent=Tz(Cz),e.prepend(t)}}function Mz(e,t){Nz(e,t),jz(t),kz(e,t)}function Nz(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`});Mz(this,e)}}if(customElements.define(vF,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(vF)))e instanceof HTMLElement&&Mz(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Pz=e=>e.startsWith(`f::`)?e.slice(3):e;function Fz(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Iz(e,t){return e===``?t:`${e}/${t}`}function Lz({files:e,path:t,isFolder:n,nextBasename:r}){let i=Pz(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}=Fz(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Iz(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 Rz(e){return e.endsWith(`/`)}function zz(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 Bz(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 Vz(e,t){return t.includes(e)?Bz(t):[e]}function Hz(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 Uz(e,t){return{draggedPaths:e,target:t}}function Wz(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Rz(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Gz(e,t){return t.kind===`root`||t.directoryPath==null?zz(e):t.directoryPath}function Kz(e,t){let n=e.map(e=>{let n=Gz(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}}}function qz(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 Jz(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(!qz(vz.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 Yz(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function Xz(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 Zz(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Qz(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 Zz(e,t.path)?n?e:null:e;case`move`:return Xz(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Qz(r,e,n),r==null)return null;return r}}}function $z(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function eB(e){switch(e.operation){case`add`:return{...$z(e),operation:`add`,path:e.path};case`remove`:return{...$z(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...$z(e),from:e.from,operation:`move`,to:e.to}}}function tB(e){return{...$z(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>eB(e)),operation:`batch`}}function nB(e){switch(e.operation){case`add`:case`remove`:case`move`:return eB(e);case`batch`:return tB(e);default:return null}}function rB(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function iB(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 aB(e){return iB(e).at(-1)??null}function oB(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function sB(e){return e.endsWith(`/`)}var cB=e=>e.toLowerCase();function lB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function uB(e){return e.endsWith(`/`)?e.slice(0,-1):e}function dB(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var fB=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},pB=Symbol(`FILE_TREE_RENAME_VIEW`),mB=512,hB=512;function gB(e){return e===`top`||e===`center`?e:`nearest`}function _B(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=iB(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 vB(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:_B(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var yB=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=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Jz({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.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=aB(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:gB(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=hB){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(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.#H.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.#Se(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.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.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.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(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.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=Vz(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=Uz(t.draggedPaths,n);(Wz(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Hz(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}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.#De(),!1;let n=Uz(e.draggedPaths,t);if(Wz(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=Kz(e.draggedPaths,t);if(r==null)return this.#De(),!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.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),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.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.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.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=sB(r),a=uB(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of iB(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=lB(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[pB](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){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,sB(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){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,sB(e)?{recursive:!0}:void 0);return}let t=sB(e),n=Lz({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:uB(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(dB(n.sourcePath,t),dB(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=Jz({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!rB(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=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.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=aB(e),n=oB(e,t),r=null,i=null;for(let e of this.#be()){if(aB(e)!==t)continue;let a=oB(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=iB(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(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.#B.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}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!rB(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new vz({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of iB(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(cB),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(cB),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of iB(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;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.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(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)}#Te(e,t){let n=e==null?null:fB(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),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.#pe(),s=this.#me();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 iB(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of iB(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;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.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=vB(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,mB)),e,t?e=>this.#H.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.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=Qz(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Qz(this.#c,e,!0),r=[...this.#B].map(t=>Qz(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Qz(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return rB(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&Yz(e)&&(this.#i=null);let t=Yz(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=nB(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},bB=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 xB(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 SB(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 CB(e,t){return t?`${e}/`:e}function wB(e,t=null){let n=bB(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=xB(t.path);if(e==null)continue;let n=CB(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 SB(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var TB,EB,DB,OB,kB,AB,jB,MB,NB,PB,FB={},IB=[],LB=Array.isArray,RB=IB.slice,zB=Object.assign;function BB(e){e&&e.parentNode&&e.remove()}function VB(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?RB.call(arguments,2):n),HB(e,o,r,i,null)}function HB(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??++EB,__i:-1,__u:0};return i==null&&TB.vnode!=null&&TB.vnode(a),a}function UB(e){return e.children}function WB(e,t){this.props=e,this.context=t,this.__g=0}function GB(e,t){if(t==null)return e.__?GB(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`?GB(e):null}function KB(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 KB(e)}}function qB(e){(8&e.__g||!(e.__g|=8)||!DB.push(e)||kB++)&&OB==TB.debounceRendering||((OB=TB.debounceRendering)||queueMicrotask)(JB)}function JB(){for(var e,t,n,r,i,a,o,s,c=1;DB.length;)DB.length>c&&DB.sort(AB),e=DB.shift(),c=DB.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=zB({},r)).__v=r.__v+1,TB.vnode&&TB.vnode(n),nV(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??GB(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,iV(a,n,o),n.__e!=i&&KB(n)));kB=0}function YB(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||IB,b=t.length;for(c=XB(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?FB:y[m.__i]||FB,m.__i=f,_=nV(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&sV(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=ZB(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function XB(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?HB(null,o,null,null,null):LB(o)?HB(UB,{children:o},null,null,null):o.constructor==null&&o.__b>0?HB(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=QB(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=GB(s)),cV(s,s));return r}function ZB(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=ZB(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=GB(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function QB(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 $B(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function eV(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||$B(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||$B(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(jB,`$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=MB,e.addEventListener(t,a?PB:NB,a)):e.removeEventListener(t,a?PB:NB,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 tV(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=MB++;else if(t.u<n.l)return;return n(TB.event?TB.event(t):t)}}}function nV(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=TB.__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 WB(v,x),f.constructor=M,f.render=lV),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=zB({},f.__s)),zB(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=TB.__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=zB({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===UB&&d.key==null&&(E=aV(d.props.children)),s=YB(e,LB(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--;)BB(a[j]);rV(t)}else t.__e=n.__e,t.__k=n.__k,e.then||rV(t);TB.__e(e,t,n)}else s=t.__e=oV(n.__e,t,n,r,i,a,o,c,l,u);return(d=TB.diffed)&&d(t),128&t.__u?void 0:s}function rV(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(rV)}function iV(e,t,n){for(var r=0;r<n.length;r++)sV(n[r],n[++r],n[++r]);TB.__c&&TB.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){TB.__e(e,t.__v)}})}function aV(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:LB(e)?e.map(aV):zB({},e)}function oV(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&&=(TB.__m&&TB.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=RB.call(e.childNodes),v=n.props||FB,!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;eV(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&&!_||eV(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=``),YB(b==`template`?e.content:e,LB(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&GB(n,0),s,c,l),a!=null)for(u=a.length;u--;)BB(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||eV(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&eV(e,u,g,v[u],i))}return e}function sV(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){TB.__e(e,n)}}function cV(e,t,n){var r,i;if(TB.unmount&&TB.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||sV(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){TB.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&cV(r[i],t,n||typeof e.type!=`function`);n||BB(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function lV(e,t,n){return this.constructor(e,n)}function uV(e,t){var n,r,i,a;t==document&&(t=document.documentElement),TB.__&&TB.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=VB(UB,null,[e]),i=[],a=[],nV(t,e,r||FB,FB,t.namespaceURI,r?null:t.firstChild?RB.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),iV(i,e,a)}function dV(e,t){e.__u|=32,uV(e,t)}TB={__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 kB=0,e}},EB=0,WB.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zB({},this.state);typeof e==`function`&&(e=e(zB({},n),this.props)),e&&zB(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),qB(this))},WB.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),qB(this))},WB.prototype.render=UB,DB=[],kB=0,AB=function(e,t){return e.__v.__b-t.__v.__b},jB=/(PointerCapture)$|Capture$/i,MB=0,NB=tV(!1),PB=tV(!0);var fV=0;Array.isArray;function pV(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:--fV,__i:-1,__u:0,__source:i,__self:a};return TB.vnode&&TB.vnode(l),l}var mV=16,hV=16,gV={};function _V({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}=gV[e]??{width:mV,height:hV},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return pV(`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:pV(`use`,{href:c})})}var vV=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},yV=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)]},bV=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)]},xV=(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)]},SV=(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)]},CV=(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 wV({children:e,marker:t,variant:n=`default`}){"use no memo";return pV(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:pV(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?pV(`span`,{"data-truncate-fade":!0}):t})})}function TV(e){"use no memo";let{mode:t,children:n}=e;return pV(`div`,{children:[pV(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?pV(`span`,{children:n}):n}),pV(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?pV(`span`,{children:n}):n})]})}function EV({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=pV(TV,{mode:t,children:e},`content`),o=pV(wV,{marker:n,mode:t,variant:r},`marker`),s=pV(`div`,{"data-truncate-fill":!0},`fill`);return pV(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:pV(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function DV({children:e,...t}){"use no memo";return pV(EV,{mode:`truncate`,...t,children:e})}function OV({children:e,...t}){"use no memo";return pV(EV,{mode:`fruncate`,...t,children:e})}function kV({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=pV(DV,{...s,children:t[0]}),l=pV(OV,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return pV(`div`,{className:a,style:o});if(e.length<i)return pV(n===`end`?OV:DV,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=vV:r===`extension`?t=yV:r===`leaf-path`&&(t=bV);else if(typeof r==`number`)t=xV,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=SV:e===`first`&&(t=CV)}else typeof r==`function`&&(t=r);t??=vV;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=pV(DV,{...s,..._,children:f}),l=pV(OV,{...s,...v,children:p})}return pV(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[pV(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),pV(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var AV={endIndex:-1,startIndex:-1};function jV(e,t,n){return Math.min(Math.max(e,t),n)}function MV(e,t){return e<0||t<e?AV:{endIndex:t,startIndex:e}}function NV(e){return e.startIndex<0||e.endIndex<e.startIndex}function PV(e,t){return NV(e)?0:(e.endIndex-e.startIndex+1)*t}function FV(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function IV(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function LV(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 RV(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 zV(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 BV(e,t,n){if(e.length===0||t<=0)return[];let r=zV(e),i=LV(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=RV(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 VV(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=jV(t.scrollTop,0,o),c=t.stickyRows??BV(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=FV(s,n,t.itemHeight),m=FV(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?AV:MV(m,IV(u+d,n,t.itemHeight)),y=g+1,b=NV(v)?AV:MV(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=PV(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:NV(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var HV={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},UV={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},WV=`Contains git status items`;function GV(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 KV(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return GV({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function qV(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}function JV(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 YV(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 XV(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ZV(e,t){return e!=null&&e>0?e:t}function QV(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 $V(e,t,n,r,i=0){let a=GV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function eH(e,t,n,r,i,a,o=0){let s=KV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function tH(e,t,n,r,i,a){let o=qV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function nH(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function rH(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function iH({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return pV(`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 aH(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 oH(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}}var sH,cH,lH,uH,dH=Object.is,fH=0,pH=[],mH=TB,hH=mH.__b,gH=mH.__r,_H=mH.diffed,vH=mH.__c,yH=mH.unmount,bH=mH.__;function xH(e,t){mH.__h&&mH.__h(cH,e,fH||t),fH=0;var n=cH.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function SH(e){return fH=1,CH(FH,e)}function CH(e,t,n){var r=xH(sH++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):FH(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);dH(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=cH,!cH.__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,dH(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};cH.__f=!0;var a=cH.shouldComponentUpdate,o=cH.componentWillUpdate;cH.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)},cH.shouldComponentUpdate=i}return r.__N||r.__}function wH(e,t){var n=xH(sH++,3);!mH.__s&&PH(n.__H,t)&&(n.__=e,n.u=t,cH.__H.__h.push(n))}function TH(e,t){var n=xH(sH++,4);!mH.__s&&PH(n.__H,t)&&(n.__=e,n.u=t,cH.__h.push(n))}function EH(e){return fH=5,DH(function(){return{current:e}},[])}function DH(e,t){var n=xH(sH++,7);return PH(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function OH(e,t){return fH=8,DH(function(){return e},t)}function kH(){for(var e;e=pH.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(MH),e.__H.__h.forEach(NH),e.__H.__h=[]}catch(t){e.__H.__h=[],mH.__e(t,e.__v)}}mH.__b=function(e){cH=null,hH&&hH(e)},mH.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),bH&&bH(e,t)},mH.__r=function(e){gH&&gH(e),sH=0;var t=(cH=e.__c).__H;t&&(lH===cH?(t.__h=[],cH.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(MH),t.__h.forEach(NH),t.__h=[],sH=0)),lH=cH},mH.diffed=function(e){_H&&_H(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(pH.push(t)!==1&&uH===mH.requestAnimationFrame||((uH=mH.requestAnimationFrame)||jH)(kH)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),lH=cH=null},mH.__c=function(e,t){t.some(function(e){try{e.__h.forEach(MH),e.__h=e.__h.filter(function(e){return!e.__||NH(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],mH.__e(n,e.__v)}}),vH&&vH(e,t)},mH.unmount=function(e){yH&&yH(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{MH(e)}catch(e){t=e}}),n.__H=void 0,t&&mH.__e(t,n.__v))};var AH=typeof requestAnimationFrame==`function`;function jH(e){var t,n=function(){clearTimeout(r),AH&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);AH&&(t=requestAnimationFrame(n))}function MH(e){var t=cH,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),cH=t}function NH(e){var t=cH;e.__c=e.__(),cH=t}function PH(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!dH(t,e[n])})}function FH(e,t){return typeof t==`function`?t(e):t}function IH(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:pV(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return pV(UB,{children:[pV(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:pV(DV,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function LH(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function RH(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function zH(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 BH({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=VV(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:zH(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?zH(u,1,t,o):i&&r<=0&&c.length>0?BV(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 VH=400,HH=10,UH=40,WH=18;function GH(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))?KH(e,t,n):a instanceof HTMLElement?a:null}function KH(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 qH(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return e?.closest?.(`[data-file-tree-virtualized-scroll]`)instanceof HTMLElement?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:null,kind:`root`}: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 JH(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 YH(){return navigator.vendor!==`Apple Computer, Inc.`}function XH(e,t){let n=e-t.top;if(n<UH)return-Math.ceil((UH-Math.max(0,n))/UH*WH);let r=t.bottom-e;return r<UH?Math.ceil((UH-Math.max(0,r))/UH*WH):0}function ZH(e,t){if(e!=null){let t=HV[e];return t==null?null:{text:t,title:UV[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:WV}:null}function QH(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 $H(e){return e!=null&&`toggle`in e}function eU(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function tU(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function nU(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function rU(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function iU(e,t){return t&&rU(e)||(e.ctrlKey||e.metaKey)&&eU(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var aU=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function oU(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 sU(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 cU(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function lU(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function uU(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function dU(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 fU(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 pU(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 mU(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=pU(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 hU(e,t){return{kind:e.kind,name:RH(e),path:t}}function gU(e){return e==null?void 0:`${e}__tree`}function _U(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function vU(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function yU(e,t){if(e==null)return null;if(`text`in e)return pV(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?vU(e.icon)?t(e.icon):{name:e.icon}:vU(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return pV(`span`,{title:e.title,children:pV(_V,{...n})})}function bU(e){e!=null&&JV(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function xU(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=LH(e);return pV(UB,{children:[e.depth>0?pV(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>pV(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,pV(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?pV(_V,{...t(`file-tree-icon-chevron`)}):pV(_V,{...t(`file-tree-icon-file`,u)})}),pV(`div`,{"data-item-section":`content`,children:e.isFlattened?IH(e,c,a):c??pV(kV,{minimumLength:5,split:`extension`,children:e.name})}),i?pV(`div`,{"data-item-section":`decoration`,children:r==null?null:yU(r,t)}):null,s?pV(`div`,{"data-item-section":`git`,children:yU(o,t)}):null,n?pV(`div`,{"data-item-section":`action`,children:l?pV(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:pV(_V,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function SU(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=LH(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??QH(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=ZH(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,q=K?a.getValue():``,J=R||!K?null:pV(iH,{ref:D,ariaLabel:`Rename ${RH(t)}`,isFlattened:t.isFlattened,value:q,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ee=xU(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:J,showDecorativeActionAffordance:G}),te={...aH({ariaLabel:RH(t),domId:t.isFocused?_U(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.focusMountedPathFromInput(P),j(t,P,{anchorRect:cU(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&K?pV(`div`,{...te,children:ee}):pV(`button`,{...te,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:ee})}function CU(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(LH(e))).map((n,r)=>SU(e,n,t.start+r))}function wU({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Sz,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 _=EH(null),v=EH(null),y=EH(!1),b=EH(null),x=EH(null),S=EH(null),C=EH(null),w=EH(null),T=EH(new Map),E=EH(new Map),D=EH(()=>{}),O=EH(null),k=EH(0),A=EH(!1),j=EH(null);j.current!==t&&(A.current=!1,j.current=t);let M=EH(!1),N=EH(null),P=EH(null),F=EH(!1),I=EH(null),L=EH(null),R=EH(null),z=EH(null),B=EH(null),V=EH(null),H=EH(null),U=EH(null),W=EH(!1),G=EH(null),K=EH(null),q=EH(null),J=EH(null),ee=DH(()=>new Map,[]),[,te]=SH(0),[ne,re]=SH(null),[Y,ie]=SH(null),[ae,oe]=SH(null),[se,ce]=SH(null),[le,ue]=SH(0),[de,fe]=SH(null),pe=EH(de);pe.current=de;let me=EH(null),he=EH(null),ge=EH(null),_e=EH(null),ve=EH(null),ye=EH(!1),be=()=>{he.current=null,ge.current=null,_e.current=null},xe=(e,t)=>{he.current=e,ge.current=null,_e.current=t==null?null:{path:e,scrollTop:t}},Se=(e,t)=>{he.current=null,ge.current={path:e,viewportOffset:t},_e.current=null},Ce=EH(d===`retain`&&t.isSearchOpen()),[we,Te]=SH(p);wH(()=>{p||Te(!1)},[p]);let Ee=EH(!1),De=OH(()=>{Ee.current=!0,Te(e=>e&&!1)},[]),[Oe,ke]=SH(()=>BH({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ae,je]=SH(!1);wH(()=>{je(!0)},[]);let Me=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ne=e?.contextMenu?.triggerMode??(Me?`right-click`:`both`),Pe=Ne===`both`||Ne===`button`,Fe=e?.contextMenu?.buttonVisibility??`when-needed`,Ie=Ne===`both`||Ne===`right-click`;TH(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ve.current=t,ie(t),ce(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(ye.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 Le=OH((e,t)=>{uU(T.current,e,t)},[]),Re=OH((e,t)=>{uU(E.current,e,t)},[]),ze=OH(e=>{x.current=e},[]),Be=OH(e=>dU(e,E.current,T.current),[]),Ve=n!=null||r!=null||i!=null,{resolveIcon:He}=DH(()=>NF(a),[a]),Ue=t[pB](),We=Ue.getPath(),Ge=We!=null,Ke=t.isSearchOpen(),qe=t.getSearchValue(),Je=t.getFocusedPath(),Ye=t.getFocusedIndex(),Xe=t.getScrollRequest(),Ze=t.isDragAndDropEnabled(),Qe=t.getDragSession(),$e=DH(()=>Qe==null?null:new Set(Qe.draggedPaths),[Qe]),et=Qe?.target??null,tt=Qe?.primaryPath??null,nt=gU(o),{overlayHeight:rt,overlayRows:it,snapshot:at,visibleRows:ot}=Oe,st=at.physical.viewportHeight,ct=DH(()=>({end:at.window.endIndex,start:at.window.startIndex}),[at.window.endIndex,at.window.startIndex]),lt=it,ut=at.sticky.rows,dt=at.physical.totalHeight,ft=at.sticky.height,pt=DH(()=>new Set(ut.map(e=>LH(e.row))),[ut]),mt=Ye>=0&&Ye>=ct.start&&Ye<=ct.end,ht=OH((e,t)=>u?.({item:hU(e,t),row:e})??null,[u]),gt=OH(e=>JV(e==null?null:T.current.get(e)??null)?!0:JV(S.current),[]),_t=OH(e=>{gt(t.focusNearestPath(e))},[t,gt]),vt=EH(_t);vt.current=_t;let yt=EH(!0),bt=EH(()=>{}),xt=OH((t=!0)=>{let n=pe.current;n!=null&&(yt.current=yt.current&&t,fe(null),e?.contextMenu?.onClose?.(),yt.current&&_t(n.path))},[e?.contextMenu,_t]);bt.current=xt;let St=OH(e=>{let t=e==null?null:lU(S.current,e);oe(e=>e===t?e:t)},[]),Ct=OH((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Be(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;xe(n,e?.scrollTop??null),M.current=!0,re(e=>e===n?e:n)}i.focus(),St(a),yt.current=!0,fe({anchorRect:r?.anchorRect??null,item:hU(e,n),path:n,source:r?.source??`keyboard`})},[t,Be,St]),wt=OH(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=XV(e,st);I.current=Ye<0||e==null?null:Math.max(0,Math.min(Ye*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(ce(`focus`),te(e=>e+1))}},[t,Ye,s,l,st]),Tt=OH((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=XV(i,st),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:BH({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,tH(i,a,s,l,u,d),D.current(),me.current=n?e:null,!0},[t,s,c,st,h]),Et=()=>y.current===!0||J.current!=null||W.current===!0,Dt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Ot=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},kt=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},At=()=>{V.current?.remove(),V.current=null},jt=()=>{Ot(L.current),L.current=null,B.current=null},Mt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Nt=()=>{U.current?.(),U.current=null,J.current!=null&&(clearTimeout(J.current),J.current=null),W.current=!1,G.current=null,q.current=null,K.current!=null&&(K.current.setAttribute(`draggable`,`true`),K.current.style.removeProperty(`touch-action`),K.current=null),At(),kt(),jt(),H.current=null},Pt=(e,n)=>{let r=S.current?.getRootNode(),i=qH(GH(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Ft=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){kt();return}let r=t.getItem(e.directoryPath),i=$H(r)?r:null;if(i==null||i.isExpanded()){kt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(kt(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},It=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=XH(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()),Ft(Pt(e.clientX,e.clientY)),L.current=Dt(It)},Lt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Dt(It)},Rt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Nt(),At(),kt(),jt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),YH())){let t=JH(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Mt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},zt=()=>{At(),kt(),jt(),H.current=null,t.cancelDrag()},Bt=(e,n,r)=>{if(J.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;q.current={clientX:i.clientX,clientY:i.clientY},K.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;J.current!=null&&(clearTimeout(J.current),J.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null)},s=e=>{let t=e.touches[0],n=q.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=HH*HH||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,J.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null;return}W.current=!0,K.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=JH(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`}),Mt(s),V.current=s,G.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=G.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Ft(Pt(t.clientX,t.clientY)),Lt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Pt(n.clientX,n.clientY),t.completeDrag(),Nt()},u=()=>{t.cancelDrag(),Nt()};U.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)},VH)},Vt=e=>{if(de!=null){if(e.key===`Escape`){xt(),e.preventDefault(),e.stopPropagation();return}aU.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ue.isActive()){if(e.key===`Escape`)Ue.cancel();else if(e.key===`Enter`)Ue.commit();else return;ce(`focus`),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){wt(Je??void 0),e.preventDefault(),e.stopPropagation();return}if(Ke){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=XV(n,st);I.current=Ye<0||n==null?null:Math.max(0,Math.min(Ye*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;ce(`focus`),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&tU(e)){t.openSearch(e.key),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Me&&rU(e),r=iU(e,Me),i=r&&S.current!=null?YV(S.current):null,a=r?new Set(fU(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Je&&a.has(o)){let e=C.current;xe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=$H(p)?p:null,h=u!=null&&(pt.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=dU(u,E.current,T.current);e==null||n==null?y=!1:Ct(e,u)}else if((e.ctrlKey||e.metaKey)&&eU(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;ce(`focus`);let b=t.getFocusedPath(),x=b!=null&&(pt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))xe(b,v?.scrollTop??null),M.current=!0,re(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Se(b,mU(S.current,v,i,u,s,ft,st)),M.current=!0,re(e=>e===b?e:b)):be()}te(e=>e+1),e.preventDefault(),e.stopPropagation()};TH(()=>{if(!(!f||!Ke)){if(Ce.current){Ce.current=!1;return}JV(w.current)}},[Ke,f]),TH(()=>{let e=x.current;switch(rH({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:We})){case`reset`:P.current=null;return;case`reveal-canonical`:We!=null&&Tt(We,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(me.current=null,P.current=We,JV(e),e.select());return}},[ct.end,ct.start,We,Tt,pt]),TH(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=YV(e)?.dataset.itemPath??null;re(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,YV(e)!=null){r();return}M.current=!1,re(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,re(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;re(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),TH(()=>{let e=S.current;e!=null&&(at.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[at.physical.scrollTop]),TH(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=XV(n,g);let a=()=>{let e=t.getVisibleCount(),r=ZV(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),ke(BH({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=ZV(O.current,g),i=t.getVisibleRows(e,e)[0]??null;$V(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?te(e=>e+1):o=!0,a()}),u=()=>{ye.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,ue(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||ye.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),pe.current!=null&&y.current&&bt.current(),ye.current===!0){y.current=!1;return}ie(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:QV(e[0]))??XV(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]),TH(()=>{Me||de==null||xt(!1)},[xt,Me,de]);let Ht=DH(()=>de==null?null:`${de.path}::${de.source}`,[de]);TH(()=>{if(Ht==null){m?.clearSlotContent(TF);return}let t=pe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??sU(n.getBoundingClientRect()),close:e=>{bt.current(e?.restoreFocus??!0)},restoreFocus:()=>{yt.current&&vt.current(pe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(TF,i),e?.contextMenu?.onOpen?.(t.item,r),bU(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&bU(i)}),()=>{m?.clearSlotContent(TF)}},[Ht,e?.contextMenu,m]),TH(()=>{de!=null&&t.getItem(de.path)==null&&xt()},[xt,de,t]),TH(()=>{if(de==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(oU(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&xt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),xt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[xt,de]),TH(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Je;return}let r=Je==null?null:T.current.get(Je)??null,i=YV(n),a=i?.dataset.itemPath??null,o=Ge&&x.current===i,c=f&&w.current===i,l=F.current&&!Ke,u=I.current??0,d=me.current,p=he.current,m=ge.current,g=_e.current,_=i!=null,v=M.current||_,y=N.current!==Je,b=p!=null&&p===Je&&Je!=null,E=!1,O=!1;if(Xe!=null&&Xe.id!==k.current){k.current=Xe.id;let n=Xe.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,st-s))):ft;E=!0,O=eH(e,n,s,st,dt,Xe.offset,t)}t.clearScrollRequest(Xe.id)}let A=!E&&l&&tH(e,Ye,s,st,dt,u),j=!E&&d!=null&&d===Je&&tH(e,Ye,s,st,dt,ft),P=!E&&m!=null&&m.path===Je&&tH(e,Ye,s,st,dt,m.viewportOffset),L=!E&&g!=null&&g.path===Je&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Je&&!b&&$V(e,Ye,s,st,ft))&&D.current(),E){N.current=Je;return}if(!v){N.current=Je;return}if(o){N.current=Je;return}if(c&&!l){N.current=Je;return}if(r==null){l&&Ye>=0&&(tH(e,Ye,s,st,dt,u),D.current()),N.current=Je;return}(y||l||d===Je||p===Je||m?.path===Je||g?.path===Je||a==null||a!==Je)&&(JV(r),d===Je&&(me.current=null),p===Je&&(he.current=null),m?.path===Je&&(ge.current=null),g?.path===Je&&(_e.current=null),F.current=!1,I.current=null),N.current=Je},[t,Ye,Je,mt,s,Ge,Ke,ct,st,f,Xe,h,ft,dt,ot]);let Ut=Ye>=0&&Ye>=at.visible.startIndex&&Ye<=at.visible.endIndex,Wt=Je!=null&<.some(e=>LH(e.row)===Je),Gt=Ut||Wt,Kt=Pe&&M.current===!0&&Gt?Je:null,qt=se===`pointer`?Y:null,Jt=de?.path??ve.current??qt??Kt??Y,Yt=de?.source===`right-click`;TH(()=>{y.current&&de==null||St(Be(Jt))},[de,Be,ct,st,le,lt,Jt,St,ot]);let Xt=OH(e=>{if(y.current||oU(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&&ce(e=>e===`pointer`?e:`pointer`),ie(e=>e===i?e:i)},[]),Zt=OH(()=>{ie(null)},[]);TH(()=>{if(!Ze)return;let e=()=>{Nt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Nt(),t.cancelDrag()}},[t,Ze]);let Qt=e=>{if(!Ze||t.getDragSession()==null||W.current)return;let n=qH(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Ft(t.getDragSession()?.target??null),Lt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},$t=e=>{if(!Ze||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(kt(),jt(),t.setDragTarget(null))},en=e=>{!Ze||t.getDragSession()==null||W.current||(e.preventDefault(),Pt(e.clientX,e.clientY),t.completeDrag(),At(),kt(),jt(),H.current=null)},tn=at.window.height,nn=at.window.offsetTop,rn=Math.min(0,st-tn),an=Math.min(0,st-tn-ft),on=ne===Je||F.current,sn=Je!=null&&on&&!mt&&Ye>=0?ot[Ye]??t.getVisibleRows(Ye,Ye)[0]??null:null,cn=sn==null?null:nH(Ye,s,ct,tn),ln=H.current,un=tt!=null&&ln!=null&&ln.path===tt&&ln.index>=ct.start&&ln.index<=ct.end,dn=tt!=null&&ln!=null&&ln.path===tt&&!un&&ln.path!==sn?.path?ln:null,fn=dn==null?null:nH(dn.index,s,ct,tn),pn=nU((Ye>=0?ot[Ye]??t.getVisibleRows(Ye,Ye)[0]??null:null)?.ancestorPaths.at(-1)??null),mn=Ke&&Je!=null?_U(o,Je,!mt):void 0,hn=de?.path??(Ke?Je:ne),gn=de?.path??Y,_n=Be(Jt),vn=Me&&Pe&&!Yt&&!Ge&&_n!=null&&ae!=null&&Jt!=null,yn=Me&&(vn||de!=null),bn=de?.anchorRect,xn=bn==null&&_n!=null&&ae!=null&&(de!=null||vn)?ae:null,Sn=bn==null?xn==null?void 0:{top:`${xn}px`}:{left:`${bn.left}px`,position:`fixed`,right:`auto`,top:`${bn.top}px`},Cn=Yt?{opacity:`0`}:void 0,wn=OH((e,n,r,i)=>{let a=oH({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Ke,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=at.visible.startIndex&&n.index<=at.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,re(e=>e===c?e:c),ce(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Tt(c,{targetOffset:`sticky-parents`})},[t,Ke,at.visible.endIndex,at.visible.startIndex,Tt]),Tn=()=>{if(y.current||!Pe||Jt==null||_n==null)return;let e=t.getItem(Jt);e!=null&&(St(_n),yt.current=!0,fe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:_n.getAttribute(`aria-label`)??Jt,path:e.getPath()},path:e.getPath(),source:`button`}))},En={contextHoverPath:gn,contextMenuButtonTriggerEnabled:Pe,contextMenuButtonVisibility:Fe,contextMenuEnabled:Me,contextMenuRightClickEnabled:Ie,contextMenuTriggerMode:Ne,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Ze,draggedPathSet:$e,dragTarget:et,gitLaneActive:Ve,gitStatusByPath:n,handleRowDragEnd:zt,handleRowDragStart:Rt,handleRowTouchStart:Bt,ignoredGitDirectories:r,ignoredInheritanceCache:ee,instanceId:o,itemHeight:s,onKeyDown:Vt,onRowClick:wn,openContextMenuForRow:Ct,registerButton:Le,registerRenameInput:ze,renameView:Ue,renderDecorationForRow:ht,resolveIcon:He,shouldSuppressContextMenu:Et,visualFocusPath:hn},Dn={...En,registerButton:Re};return pV(`div`,{ref:S,id:nt,"data-file-tree-context-menu-button-visibility":Me&&Pe?Fe:void 0,"data-file-tree-context-menu-trigger-mode":Me?Ne:void 0,"data-file-tree-has-context-menu-action-lane":Me&&Pe?`true`:void 0,"data-file-tree-has-git-lane":Ve?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":et?.kind===`root`?`true`:void 0,onDragLeave:Ze?$t:void 0,onDragOver:Ze?Qt:void 0,onDrop:Ze?en:void 0,onKeyDown:Vt,onPointerLeave:Me?Zt:void 0,onPointerOver:Me?Xt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[pV(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:pn}}),pV(`slot`,{name:wF,"data-type":`header-slot`}),f?pV(`div`,{"data-file-tree-search-container":!0,"data-open":Ke?`true`:`false`,children:pV(`input`,{ref:w,"aria-activedescendant":mn,"aria-controls":nt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":we?`true`:void 0,value:qe,onBlur:()=>{d===`retain`&&!Ee.current||t.closeSearch()},onFocus:De,onPointerDown:De,onInput:e=>{De();let n=e.currentTarget;t.setSearch(n.value)}})}):null,pV(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ae&<.length>0?pV(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:pV(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${rt}px`},children:lt.map((e,t)=>SU(Dn,e.row,`sticky:${LH(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${lt.length-t}`}}))})}):null,pV(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${dt}px`},children:[pV(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${nn}px`}}),pV(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${tn}px`,top:`${rn}px`,bottom:`${an}px`},children:[CU(En,ct,pt),sn!=null&&cn!=null?SU(En,sn,`parked:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:tt===sn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${cn}px`}}):null,dn!=null&&fn!=null?SU(En,dn,`parked-drag:${dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${fn}px`}}):null]})]})]}),Me?pV(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":yn?`true`:`false`,style:Sn,children:[pV(`button`,{ref:v,type:`button`,"data-type":EF,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":de==null?`false`:`true`,"data-visible":vn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),de!=null){xt();return}Tn()},tabIndex:-1,style:Cn,children:pV(_V,{...He(`file-tree-icon-ellipsis`)})}),de==null?null:pV(`slot`,{name:TF})]}):null,de==null?null:pV(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),xt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),xt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var TU={hydrateRoot:(e,t)=>{dV(VB(wU,t),e)},renderRoot:(e,t)=>{uV(VB(wU,t),e)},unmountRoot:e=>{uV(null,e)}};function EU(e,t){TU.renderRoot(e,t)}function DU(e,t){TU.hydrateRoot(e,t)}function OU(e){TU.unmountRoot(e)}var kU=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)}}},AU=`__c`,jU=`__k`,MU=`__d`,NU=`__s`,PU=/[\s\n\\/='"\0<>]/,FU=/^(xlink|xmlns|xml)([A-Z])/,IU=/^(?: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])/,LU=/^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/,RU=new Set([`draggable`,`spellcheck`]);function zU(e){e.__g===void 0?e[MU]=!0:e.__g|=8}function BU(e){e.__g===void 0?e[MU]=!1:e.__g&=-9}function VU(e){return e.__g===void 0?!0===e[MU]:!!(8&e.__g)}var HU=/["&<]/;function UU(e){if(e.length===0||!1===HU.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var WU={},GU=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(`.`)),KU=/[A-Z]/g;function qU(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:WU[n]||(WU[n]=n.replace(KU,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||GU.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function JU(){this.__d=!0}function YU(e,t){return{__v:e,context:t,props:e.props,setState:JU,forceUpdate:JU,__d:!0,__h:[]}}function XU(e,t,n){if(!e.s){if(n instanceof ZU){if(!n.s)return void(n.o=XU.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(XU.bind(null,e,t),XU.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var ZU=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{XU(r,1,a(this.v))}catch(e){XU(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?XU(r,1,t?t(i):i):n?XU(r,1,n(i)):XU(r,2,i)}catch(e){XU(r,2,e)}},r},e}(),QU,$U,eW,tW,nW={},rW=Array.isArray,iW=Object.assign,aW=``,oW=`<!--$s-->`,sW=`<!--/$s-->`;function cW(e,t){var n,r=e.type,i=!0;return e[AU]?(i=!1,(n=e[AU]).state=n[NU]):n=new r(e.props,t),e[AU]=n,n.__v=e,n.props=e.props,n.context=t,zU(n),n.state??=nW,n[NU]??(n[NU]=n.state),r.getDerivedStateFromProps?n.state=iW({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[NU]===n.state?n.state:n[NU]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),eW&&eW(e),n.render(n.props,n.state,t)}function lW(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===aW)return aW;var s=typeof e;if(s!=`object`)return s==`function`?aW:s==`string`?UU(e):e+aW;if(rW(e)){var c,l=aW;i[jU]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=lW(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=aW,rW(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return aW;e.__=i,QU&&QU(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===UB){if(`tpl`in g){for(var x=aW,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&&!rW(C)?x+=C:x+=lW(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+UU(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=cW(e,b),y=e[AU];else{e[AU]=y=YU(e,b);for(var E=0;VU(y)&&E++<25;){BU(y),eW&&eW(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}zU(y)}if(y.getChildContext!=null&&(t=iW({},t,y.getChildContext())),T&&TB.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===UB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return lW(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[NU]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,nW),VU(y)?(v=cW(e,t),(y=e[AU]).getChildContext!=null&&(t=iW({},t,y.getChildContext())),lW(v=v!=null&&v.type===UB&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):aW}finally{$U&&$U(e),tW&&tW(e)}}}v=v!=null&&v.type===UB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=lW(v,t,n,r,e,a,o);return $U&&$U(e),TB.unmount&&TB.unmount(e),e._suspended?typeof D==`string`?oW+D+sW:rW(D)?(D.unshift(oW),D.push(sW),D):D.then(function(e){return oW+e+sW}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return lW(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=TB.__e;return k&&k(i,e),aW}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=lW(v,t,n,r,e,a,o);return e._suspended?oW+s+sW:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=aW;for(var N in g){var P=g[N];if(typeof(P=dW(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=qU(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(FU.test(N))N=N.replace(FU,`$1:$2`).toLowerCase();else{if(PU.test(N))continue;N[4]!==`-`&&!RU.has(N)||P==null?n?LU.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):IU.test(N)&&(N=N.toLowerCase()):P+=aW}}P!=null&&!1!==P&&(j=!0===P||P===aW?j+` `+N:j+` `+N+`="`+(typeof P==`string`?UU(P):P+aW)+`"`)}}if(PU.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=UU(A):A!=null&&!1!==A&&!0!==A&&(M=lW(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),$U&&$U(e),tW&&tW(e),!M&&uW.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return rW(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var uW=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function dW(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var fW=0;function pW(e){return e!=null&&e.length>0?e:(fW+=1,`pst_ft_${fW}`)}function mW({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Sz)}function hW(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 gW(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 _W(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var vW=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new kU;#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=pW(a),this.#p=wB(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=xz(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new yB({...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&&(OU(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}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(),EU(t.wrapper,this.#w()))}setGitStatus(e){this.#p=wB(e,this.#p);let t=this.#T();t!=null&&EU(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),EU(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),DU(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),EU(r,this.#w())}#C(){return{initialViewportHeight:mW({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(wF,e());return}this.#l.setSlotHtml(wF,this.#e?.header?.html??null)}#k(e){let t=_W(e).find(e=>gW(e)),n=hW(mF(OF(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=_W(e),n=t.find(e=>gW(e)),r=t.filter(e=>e!==n),i=OF(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=hW(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=OF(this.#m);t.colored&&gF(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${bF}]`);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(bF,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Ez(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 Mz(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)}},yW=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function bW(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:wF,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:TF,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function xW(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 SW(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 CW(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 wW({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)(()=>CW(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),yW(()=>{n.setComposition(g)},[g,n]),yW(()=>{if(c!=null)return r!=null&&SW(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=xW(bW(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)(vF,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function TW(e){let[t]=(0,Q.useState)(()=>new vW(e)),n=(0,Q.useRef)({timeout:null,model:t});return(0,Q.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}var EW={density:`compact`,flattenEmptyDirectories:!1},DW={"--trees-level-gap-override":`3px`,"--trees-item-row-gap-override":`2px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`24px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},OW=`
|
|
1866
|
+
}`}var Dz=new WeakMap;function Oz(e){let t=Dz.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(xF,`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(),Dz.set(e,i),i}function kz(e,t){if(!e.isConnected)return;let n=Oz(t);if(n==null)return;let r=t.querySelector(`style[${SF}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(SF,``),t.appendChild(i)),i.textContent=`:host { ${CF}: ${n}px; }`}var Az;function jz(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Az??(Az=new CSSStyleSheet,Az.replaceSync(Tz(Cz)));let t=!1;try{e.adoptedStyleSheets=[Az],t=!0}catch{}if(t){e.querySelector(`style[${yF}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(yF,``),t.textContent=Tz(Cz),e.prepend(t)}}function Mz(e,t){Nz(e,t),jz(t),kz(e,t)}function Nz(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`});Mz(this,e)}}if(customElements.define(vF,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(vF)))e instanceof HTMLElement&&Mz(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Pz=e=>e.startsWith(`f::`)?e.slice(3):e;function Fz(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Iz(e,t){return e===``?t:`${e}/${t}`}function Lz({files:e,path:t,isFolder:n,nextBasename:r}){let i=Pz(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}=Fz(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Iz(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 Rz(e){return e.endsWith(`/`)}function zz(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 Bz(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 Vz(e,t){return t.includes(e)?Bz(t):[e]}function Hz(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 Uz(e,t){return{draggedPaths:e,target:t}}function Wz(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Rz(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Gz(e,t){return t.kind===`root`||t.directoryPath==null?zz(e):t.directoryPath}function Kz(e,t){let n=e.map(e=>{let n=Gz(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}}}function qz(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 Jz(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(!qz(vz.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 Yz(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function Xz(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 Zz(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Qz(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 Zz(e,t.path)?n?e:null:e;case`move`:return Xz(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Qz(r,e,n),r==null)return null;return r}}}function $z(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function eB(e){switch(e.operation){case`add`:return{...$z(e),operation:`add`,path:e.path};case`remove`:return{...$z(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...$z(e),from:e.from,operation:`move`,to:e.to}}}function tB(e){return{...$z(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>eB(e)),operation:`batch`}}function nB(e){switch(e.operation){case`add`:case`remove`:case`move`:return eB(e);case`batch`:return tB(e);default:return null}}function rB(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function iB(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 aB(e){return iB(e).at(-1)??null}function oB(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function sB(e){return e.endsWith(`/`)}var cB=e=>e.toLowerCase();function lB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function uB(e){return e.endsWith(`/`)?e.slice(0,-1):e}function dB(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var fB=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},pB=Symbol(`FILE_TREE_RENAME_VIEW`),mB=512,hB=512;function gB(e){return e===`top`||e===`center`?e:`nearest`}function _B(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=iB(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 vB(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:_B(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var yB=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=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Jz({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.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=aB(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:gB(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=hB){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(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.#H.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.#Se(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.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.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.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(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.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=Vz(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=Uz(t.draggedPaths,n);(Wz(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Hz(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}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.#De(),!1;let n=Uz(e.draggedPaths,t);if(Wz(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=Kz(e.draggedPaths,t);if(r==null)return this.#De(),!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.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),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.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.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.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=sB(r),a=uB(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of iB(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=lB(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[pB](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){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,sB(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){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,sB(e)?{recursive:!0}:void 0);return}let t=sB(e),n=Lz({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:uB(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(dB(n.sourcePath,t),dB(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=Jz({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!rB(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=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.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=aB(e),n=oB(e,t),r=null,i=null;for(let e of this.#be()){if(aB(e)!==t)continue;let a=oB(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=iB(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(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.#B.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}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!rB(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new vz({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of iB(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(cB),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(cB),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of iB(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;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.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(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)}#Te(e,t){let n=e==null?null:fB(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),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.#pe(),s=this.#me();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 iB(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of iB(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;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.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=vB(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,mB)),e,t?e=>this.#H.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.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=Qz(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Qz(this.#c,e,!0),r=[...this.#B].map(t=>Qz(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Qz(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return rB(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&Yz(e)&&(this.#i=null);let t=Yz(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=nB(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},bB=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 xB(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 SB(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 CB(e,t){return t?`${e}/`:e}function wB(e,t=null){let n=bB(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=xB(t.path);if(e==null)continue;let n=CB(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 SB(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var TB,EB,DB,OB,kB,AB,jB,MB,NB,PB,FB={},IB=[],LB=Array.isArray,RB=IB.slice,zB=Object.assign;function BB(e){e&&e.parentNode&&e.remove()}function VB(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?RB.call(arguments,2):n),HB(e,o,r,i,null)}function HB(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??++EB,__i:-1,__u:0};return i==null&&TB.vnode!=null&&TB.vnode(a),a}function UB(e){return e.children}function WB(e,t){this.props=e,this.context=t,this.__g=0}function GB(e,t){if(t==null)return e.__?GB(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`?GB(e):null}function KB(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 KB(e)}}function qB(e){(8&e.__g||!(e.__g|=8)||!DB.push(e)||kB++)&&OB==TB.debounceRendering||((OB=TB.debounceRendering)||queueMicrotask)(JB)}function JB(){for(var e,t,n,r,i,a,o,s,c=1;DB.length;)DB.length>c&&DB.sort(AB),e=DB.shift(),c=DB.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=zB({},r)).__v=r.__v+1,TB.vnode&&TB.vnode(n),nV(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??GB(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,iV(a,n,o),n.__e!=i&&KB(n)));kB=0}function YB(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||IB,b=t.length;for(c=XB(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?FB:y[m.__i]||FB,m.__i=f,_=nV(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&sV(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=ZB(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function XB(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?HB(null,o,null,null,null):LB(o)?HB(UB,{children:o},null,null,null):o.constructor==null&&o.__b>0?HB(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=QB(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=GB(s)),cV(s,s));return r}function ZB(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=ZB(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=GB(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function QB(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 $B(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function eV(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||$B(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||$B(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(jB,`$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=MB,e.addEventListener(t,a?PB:NB,a)):e.removeEventListener(t,a?PB:NB,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 tV(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=MB++;else if(t.u<n.l)return;return n(TB.event?TB.event(t):t)}}}function nV(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=TB.__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 WB(v,x),f.constructor=M,f.render=lV),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=zB({},f.__s)),zB(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=TB.__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=zB({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===UB&&d.key==null&&(E=aV(d.props.children)),s=YB(e,LB(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--;)BB(a[j]);rV(t)}else t.__e=n.__e,t.__k=n.__k,e.then||rV(t);TB.__e(e,t,n)}else s=t.__e=oV(n.__e,t,n,r,i,a,o,c,l,u);return(d=TB.diffed)&&d(t),128&t.__u?void 0:s}function rV(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(rV)}function iV(e,t,n){for(var r=0;r<n.length;r++)sV(n[r],n[++r],n[++r]);TB.__c&&TB.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){TB.__e(e,t.__v)}})}function aV(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:LB(e)?e.map(aV):zB({},e)}function oV(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&&=(TB.__m&&TB.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=RB.call(e.childNodes),v=n.props||FB,!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;eV(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&&!_||eV(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=``),YB(b==`template`?e.content:e,LB(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&GB(n,0),s,c,l),a!=null)for(u=a.length;u--;)BB(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||eV(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&eV(e,u,g,v[u],i))}return e}function sV(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){TB.__e(e,n)}}function cV(e,t,n){var r,i;if(TB.unmount&&TB.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||sV(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){TB.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&cV(r[i],t,n||typeof e.type!=`function`);n||BB(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function lV(e,t,n){return this.constructor(e,n)}function uV(e,t){var n,r,i,a;t==document&&(t=document.documentElement),TB.__&&TB.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=VB(UB,null,[e]),i=[],a=[],nV(t,e,r||FB,FB,t.namespaceURI,r?null:t.firstChild?RB.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),iV(i,e,a)}function dV(e,t){e.__u|=32,uV(e,t)}TB={__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 kB=0,e}},EB=0,WB.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zB({},this.state);typeof e==`function`&&(e=e(zB({},n),this.props)),e&&zB(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),qB(this))},WB.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),qB(this))},WB.prototype.render=UB,DB=[],kB=0,AB=function(e,t){return e.__v.__b-t.__v.__b},jB=/(PointerCapture)$|Capture$/i,MB=0,NB=tV(!1),PB=tV(!0);var fV=0;Array.isArray;function pV(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:--fV,__i:-1,__u:0,__source:i,__self:a};return TB.vnode&&TB.vnode(l),l}var mV=16,hV=16,gV={};function _V({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}=gV[e]??{width:mV,height:hV},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return pV(`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:pV(`use`,{href:c})})}var vV=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},yV=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)]},bV=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)]},xV=(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)]},SV=(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)]},CV=(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 wV({children:e,marker:t,variant:n=`default`}){"use no memo";return pV(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:pV(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?pV(`span`,{"data-truncate-fade":!0}):t})})}function TV(e){"use no memo";let{mode:t,children:n}=e;return pV(`div`,{children:[pV(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?pV(`span`,{children:n}):n}),pV(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?pV(`span`,{children:n}):n})]})}function EV({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=pV(TV,{mode:t,children:e},`content`),o=pV(wV,{marker:n,mode:t,variant:r},`marker`),s=pV(`div`,{"data-truncate-fill":!0},`fill`);return pV(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:pV(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function DV({children:e,...t}){"use no memo";return pV(EV,{mode:`truncate`,...t,children:e})}function OV({children:e,...t}){"use no memo";return pV(EV,{mode:`fruncate`,...t,children:e})}function kV({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=pV(DV,{...s,children:t[0]}),l=pV(OV,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return pV(`div`,{className:a,style:o});if(e.length<i)return pV(n===`end`?OV:DV,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=vV:r===`extension`?t=yV:r===`leaf-path`&&(t=bV);else if(typeof r==`number`)t=xV,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=SV:e===`first`&&(t=CV)}else typeof r==`function`&&(t=r);t??=vV;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=pV(DV,{...s,..._,children:f}),l=pV(OV,{...s,...v,children:p})}return pV(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[pV(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),pV(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var AV={endIndex:-1,startIndex:-1};function jV(e,t,n){return Math.min(Math.max(e,t),n)}function MV(e,t){return e<0||t<e?AV:{endIndex:t,startIndex:e}}function NV(e){return e.startIndex<0||e.endIndex<e.startIndex}function PV(e,t){return NV(e)?0:(e.endIndex-e.startIndex+1)*t}function FV(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function IV(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function LV(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 RV(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 zV(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 BV(e,t,n){if(e.length===0||t<=0)return[];let r=zV(e),i=LV(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=RV(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 VV(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=jV(t.scrollTop,0,o),c=t.stickyRows??BV(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=FV(s,n,t.itemHeight),m=FV(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?AV:MV(m,IV(u+d,n,t.itemHeight)),y=g+1,b=NV(v)?AV:MV(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=PV(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:NV(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var HV={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},UV={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},WV=`Contains git status items`;function GV(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 KV(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return GV({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function qV(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}function JV(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 YV(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 XV(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ZV(e,t){return e!=null&&e>0?e:t}function QV(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 $V(e,t,n,r,i=0){let a=GV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function eH(e,t,n,r,i,a,o=0){let s=KV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function tH(e,t,n,r,i,a){let o=qV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function nH(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function rH(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function iH({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return pV(`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 aH(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 oH(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}}var sH,cH,lH,uH,dH=Object.is,fH=0,pH=[],mH=TB,hH=mH.__b,gH=mH.__r,_H=mH.diffed,vH=mH.__c,yH=mH.unmount,bH=mH.__;function xH(e,t){mH.__h&&mH.__h(cH,e,fH||t),fH=0;var n=cH.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function SH(e){return fH=1,CH(FH,e)}function CH(e,t,n){var r=xH(sH++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):FH(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);dH(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=cH,!cH.__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,dH(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};cH.__f=!0;var a=cH.shouldComponentUpdate,o=cH.componentWillUpdate;cH.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)},cH.shouldComponentUpdate=i}return r.__N||r.__}function wH(e,t){var n=xH(sH++,3);!mH.__s&&PH(n.__H,t)&&(n.__=e,n.u=t,cH.__H.__h.push(n))}function TH(e,t){var n=xH(sH++,4);!mH.__s&&PH(n.__H,t)&&(n.__=e,n.u=t,cH.__h.push(n))}function EH(e){return fH=5,DH(function(){return{current:e}},[])}function DH(e,t){var n=xH(sH++,7);return PH(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function OH(e,t){return fH=8,DH(function(){return e},t)}function kH(){for(var e;e=pH.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(MH),e.__H.__h.forEach(NH),e.__H.__h=[]}catch(t){e.__H.__h=[],mH.__e(t,e.__v)}}mH.__b=function(e){cH=null,hH&&hH(e)},mH.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),bH&&bH(e,t)},mH.__r=function(e){gH&&gH(e),sH=0;var t=(cH=e.__c).__H;t&&(lH===cH?(t.__h=[],cH.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(MH),t.__h.forEach(NH),t.__h=[],sH=0)),lH=cH},mH.diffed=function(e){_H&&_H(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(pH.push(t)!==1&&uH===mH.requestAnimationFrame||((uH=mH.requestAnimationFrame)||jH)(kH)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),lH=cH=null},mH.__c=function(e,t){t.some(function(e){try{e.__h.forEach(MH),e.__h=e.__h.filter(function(e){return!e.__||NH(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],mH.__e(n,e.__v)}}),vH&&vH(e,t)},mH.unmount=function(e){yH&&yH(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{MH(e)}catch(e){t=e}}),n.__H=void 0,t&&mH.__e(t,n.__v))};var AH=typeof requestAnimationFrame==`function`;function jH(e){var t,n=function(){clearTimeout(r),AH&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);AH&&(t=requestAnimationFrame(n))}function MH(e){var t=cH,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),cH=t}function NH(e){var t=cH;e.__c=e.__(),cH=t}function PH(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!dH(t,e[n])})}function FH(e,t){return typeof t==`function`?t(e):t}function IH(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:pV(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return pV(UB,{children:[pV(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:pV(DV,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function LH(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function RH(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function zH(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 BH({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=VV(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:zH(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?zH(u,1,t,o):i&&r<=0&&c.length>0?BV(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 VH=400,HH=10,UH=40,WH=18;function GH(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))?KH(e,t,n):a instanceof HTMLElement?a:null}function KH(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 qH(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return e?.closest?.(`[data-file-tree-virtualized-scroll]`)instanceof HTMLElement?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:null,kind:`root`}: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 JH(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 YH(){return navigator.vendor!==`Apple Computer, Inc.`}function XH(e,t){let n=e-t.top;if(n<UH)return-Math.ceil((UH-Math.max(0,n))/UH*WH);let r=t.bottom-e;return r<UH?Math.ceil((UH-Math.max(0,r))/UH*WH):0}function ZH(e,t){if(e!=null){let t=HV[e];return t==null?null:{text:t,title:UV[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:WV}:null}function QH(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 $H(e){return e!=null&&`toggle`in e}function eU(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function tU(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function nU(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function rU(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function iU(e,t){return t&&rU(e)||(e.ctrlKey||e.metaKey)&&eU(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var aU=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function oU(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 sU(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 cU(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function lU(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function uU(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function dU(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 fU(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 pU(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 mU(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=pU(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 hU(e,t){return{kind:e.kind,name:RH(e),path:t}}function gU(e){return e==null?void 0:`${e}__tree`}function _U(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function vU(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function yU(e,t){if(e==null)return null;if(`text`in e)return pV(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?vU(e.icon)?t(e.icon):{name:e.icon}:vU(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return pV(`span`,{title:e.title,children:pV(_V,{...n})})}function bU(e){e!=null&&JV(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function xU(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=LH(e);return pV(UB,{children:[e.depth>0?pV(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>pV(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,pV(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?pV(_V,{...t(`file-tree-icon-chevron`)}):pV(_V,{...t(`file-tree-icon-file`,u)})}),pV(`div`,{"data-item-section":`content`,children:e.isFlattened?IH(e,c,a):c??pV(kV,{minimumLength:5,split:`extension`,children:e.name})}),i?pV(`div`,{"data-item-section":`decoration`,children:r==null?null:yU(r,t)}):null,s?pV(`div`,{"data-item-section":`git`,children:yU(o,t)}):null,n?pV(`div`,{"data-item-section":`action`,children:l?pV(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:pV(_V,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function SU(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=LH(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??QH(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=ZH(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,q=K?a.getValue():``,J=R||!K?null:pV(iH,{ref:D,ariaLabel:`Rename ${RH(t)}`,isFlattened:t.isFlattened,value:q,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ee=xU(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:J,showDecorativeActionAffordance:G}),te={...aH({ariaLabel:RH(t),domId:t.isFocused?_U(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.focusMountedPathFromInput(P),j(t,P,{anchorRect:cU(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&K?pV(`div`,{...te,children:ee}):pV(`button`,{...te,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:ee})}function CU(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(LH(e))).map((n,r)=>SU(e,n,t.start+r))}function wU({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Sz,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 _=EH(null),v=EH(null),y=EH(!1),b=EH(null),x=EH(null),S=EH(null),C=EH(null),w=EH(null),T=EH(new Map),E=EH(new Map),D=EH(()=>{}),O=EH(null),k=EH(0),A=EH(!1),j=EH(null);j.current!==t&&(A.current=!1,j.current=t);let M=EH(!1),N=EH(null),P=EH(null),F=EH(!1),I=EH(null),L=EH(null),R=EH(null),z=EH(null),B=EH(null),V=EH(null),H=EH(null),U=EH(null),W=EH(!1),G=EH(null),K=EH(null),q=EH(null),J=EH(null),ee=DH(()=>new Map,[]),[,te]=SH(0),[ne,re]=SH(null),[Y,ie]=SH(null),[ae,oe]=SH(null),[se,ce]=SH(null),[le,ue]=SH(0),[de,fe]=SH(null),pe=EH(de);pe.current=de;let me=EH(null),he=EH(null),ge=EH(null),_e=EH(null),ve=EH(null),ye=EH(!1),be=()=>{he.current=null,ge.current=null,_e.current=null},xe=(e,t)=>{he.current=e,ge.current=null,_e.current=t==null?null:{path:e,scrollTop:t}},Se=(e,t)=>{he.current=null,ge.current={path:e,viewportOffset:t},_e.current=null},Ce=EH(d===`retain`&&t.isSearchOpen()),[we,Te]=SH(p);wH(()=>{p||Te(!1)},[p]);let Ee=EH(!1),De=OH(()=>{Ee.current=!0,Te(e=>e&&!1)},[]),[Oe,ke]=SH(()=>BH({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ae,je]=SH(!1);wH(()=>{je(!0)},[]);let Me=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ne=e?.contextMenu?.triggerMode??(Me?`right-click`:`both`),Pe=Ne===`both`||Ne===`button`,Fe=e?.contextMenu?.buttonVisibility??`when-needed`,Ie=Ne===`both`||Ne===`right-click`;TH(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ve.current=t,ie(t),ce(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(ye.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 Le=OH((e,t)=>{uU(T.current,e,t)},[]),Re=OH((e,t)=>{uU(E.current,e,t)},[]),ze=OH(e=>{x.current=e},[]),Be=OH(e=>dU(e,E.current,T.current),[]),Ve=n!=null||r!=null||i!=null,{resolveIcon:He}=DH(()=>NF(a),[a]),Ue=t[pB](),We=Ue.getPath(),Ge=We!=null,Ke=t.isSearchOpen(),qe=t.getSearchValue(),Je=t.getFocusedPath(),Ye=t.getFocusedIndex(),Xe=t.getScrollRequest(),Ze=t.isDragAndDropEnabled(),Qe=t.getDragSession(),$e=DH(()=>Qe==null?null:new Set(Qe.draggedPaths),[Qe]),et=Qe?.target??null,tt=Qe?.primaryPath??null,nt=gU(o),{overlayHeight:rt,overlayRows:it,snapshot:at,visibleRows:ot}=Oe,st=at.physical.viewportHeight,ct=DH(()=>({end:at.window.endIndex,start:at.window.startIndex}),[at.window.endIndex,at.window.startIndex]),lt=it,ut=at.sticky.rows,dt=at.physical.totalHeight,ft=at.sticky.height,pt=DH(()=>new Set(ut.map(e=>LH(e.row))),[ut]),mt=Ye>=0&&Ye>=ct.start&&Ye<=ct.end,ht=OH((e,t)=>u?.({item:hU(e,t),row:e})??null,[u]),gt=OH(e=>JV(e==null?null:T.current.get(e)??null)?!0:JV(S.current),[]),_t=OH(e=>{gt(t.focusNearestPath(e))},[t,gt]),vt=EH(_t);vt.current=_t;let yt=EH(!0),bt=EH(()=>{}),xt=OH((t=!0)=>{let n=pe.current;n!=null&&(yt.current=yt.current&&t,fe(null),e?.contextMenu?.onClose?.(),yt.current&&_t(n.path))},[e?.contextMenu,_t]);bt.current=xt;let St=OH(e=>{let t=e==null?null:lU(S.current,e);oe(e=>e===t?e:t)},[]),Ct=OH((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Be(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;xe(n,e?.scrollTop??null),M.current=!0,re(e=>e===n?e:n)}i.focus(),St(a),yt.current=!0,fe({anchorRect:r?.anchorRect??null,item:hU(e,n),path:n,source:r?.source??`keyboard`})},[t,Be,St]),wt=OH(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=XV(e,st);I.current=Ye<0||e==null?null:Math.max(0,Math.min(Ye*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(ce(`focus`),te(e=>e+1))}},[t,Ye,s,l,st]),Tt=OH((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=XV(i,st),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:BH({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,tH(i,a,s,l,u,d),D.current(),me.current=n?e:null,!0},[t,s,c,st,h]),Et=()=>y.current===!0||J.current!=null||W.current===!0,Dt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Ot=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},kt=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},At=()=>{V.current?.remove(),V.current=null},jt=()=>{Ot(L.current),L.current=null,B.current=null},Mt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Nt=()=>{U.current?.(),U.current=null,J.current!=null&&(clearTimeout(J.current),J.current=null),W.current=!1,G.current=null,q.current=null,K.current!=null&&(K.current.setAttribute(`draggable`,`true`),K.current.style.removeProperty(`touch-action`),K.current=null),At(),kt(),jt(),H.current=null},Pt=(e,n)=>{let r=S.current?.getRootNode(),i=qH(GH(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Ft=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){kt();return}let r=t.getItem(e.directoryPath),i=$H(r)?r:null;if(i==null||i.isExpanded()){kt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(kt(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},It=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=XH(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()),Ft(Pt(e.clientX,e.clientY)),L.current=Dt(It)},Lt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Dt(It)},Rt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Nt(),At(),kt(),jt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),YH())){let t=JH(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Mt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},zt=()=>{At(),kt(),jt(),H.current=null,t.cancelDrag()},Bt=(e,n,r)=>{if(J.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;q.current={clientX:i.clientX,clientY:i.clientY},K.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;J.current!=null&&(clearTimeout(J.current),J.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null)},s=e=>{let t=e.touches[0],n=q.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=HH*HH||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,J.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null;return}W.current=!0,K.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=JH(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`}),Mt(s),V.current=s,G.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=G.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Ft(Pt(t.clientX,t.clientY)),Lt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Pt(n.clientX,n.clientY),t.completeDrag(),Nt()},u=()=>{t.cancelDrag(),Nt()};U.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)},VH)},Vt=e=>{if(de!=null){if(e.key===`Escape`){xt(),e.preventDefault(),e.stopPropagation();return}aU.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ue.isActive()){if(e.key===`Escape`)Ue.cancel();else if(e.key===`Enter`)Ue.commit();else return;ce(`focus`),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){wt(Je??void 0),e.preventDefault(),e.stopPropagation();return}if(Ke){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=XV(n,st);I.current=Ye<0||n==null?null:Math.max(0,Math.min(Ye*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;ce(`focus`),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&tU(e)){t.openSearch(e.key),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Me&&rU(e),r=iU(e,Me),i=r&&S.current!=null?YV(S.current):null,a=r?new Set(fU(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Je&&a.has(o)){let e=C.current;xe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=$H(p)?p:null,h=u!=null&&(pt.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=dU(u,E.current,T.current);e==null||n==null?y=!1:Ct(e,u)}else if((e.ctrlKey||e.metaKey)&&eU(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;ce(`focus`);let b=t.getFocusedPath(),x=b!=null&&(pt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))xe(b,v?.scrollTop??null),M.current=!0,re(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Se(b,mU(S.current,v,i,u,s,ft,st)),M.current=!0,re(e=>e===b?e:b)):be()}te(e=>e+1),e.preventDefault(),e.stopPropagation()};TH(()=>{if(!(!f||!Ke)){if(Ce.current){Ce.current=!1;return}JV(w.current)}},[Ke,f]),TH(()=>{let e=x.current;switch(rH({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:We})){case`reset`:P.current=null;return;case`reveal-canonical`:We!=null&&Tt(We,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(me.current=null,P.current=We,JV(e),e.select());return}},[ct.end,ct.start,We,Tt,pt]),TH(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=YV(e)?.dataset.itemPath??null;re(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,YV(e)!=null){r();return}M.current=!1,re(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,re(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;re(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),TH(()=>{let e=S.current;e!=null&&(at.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[at.physical.scrollTop]),TH(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=XV(n,g);let a=()=>{let e=t.getVisibleCount(),r=ZV(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),ke(BH({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=ZV(O.current,g),i=t.getVisibleRows(e,e)[0]??null;$V(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?te(e=>e+1):o=!0,a()}),u=()=>{ye.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,ue(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||ye.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),pe.current!=null&&y.current&&bt.current(),ye.current===!0){y.current=!1;return}ie(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:QV(e[0]))??XV(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]),TH(()=>{Me||de==null||xt(!1)},[xt,Me,de]);let Ht=DH(()=>de==null?null:`${de.path}::${de.source}`,[de]);TH(()=>{if(Ht==null){m?.clearSlotContent(TF);return}let t=pe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??sU(n.getBoundingClientRect()),close:e=>{bt.current(e?.restoreFocus??!0)},restoreFocus:()=>{yt.current&&vt.current(pe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(TF,i),e?.contextMenu?.onOpen?.(t.item,r),bU(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&bU(i)}),()=>{m?.clearSlotContent(TF)}},[Ht,e?.contextMenu,m]),TH(()=>{de!=null&&t.getItem(de.path)==null&&xt()},[xt,de,t]),TH(()=>{if(de==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(oU(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&xt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),xt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[xt,de]),TH(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Je;return}let r=Je==null?null:T.current.get(Je)??null,i=YV(n),a=i?.dataset.itemPath??null,o=Ge&&x.current===i,c=f&&w.current===i,l=F.current&&!Ke,u=I.current??0,d=me.current,p=he.current,m=ge.current,g=_e.current,_=i!=null,v=M.current||_,y=N.current!==Je,b=p!=null&&p===Je&&Je!=null,E=!1,O=!1;if(Xe!=null&&Xe.id!==k.current){k.current=Xe.id;let n=Xe.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,st-s))):ft;E=!0,O=eH(e,n,s,st,dt,Xe.offset,t)}t.clearScrollRequest(Xe.id)}let A=!E&&l&&tH(e,Ye,s,st,dt,u),j=!E&&d!=null&&d===Je&&tH(e,Ye,s,st,dt,ft),P=!E&&m!=null&&m.path===Je&&tH(e,Ye,s,st,dt,m.viewportOffset),L=!E&&g!=null&&g.path===Je&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Je&&!b&&$V(e,Ye,s,st,ft))&&D.current(),E){N.current=Je;return}if(!v){N.current=Je;return}if(o){N.current=Je;return}if(c&&!l){N.current=Je;return}if(r==null){l&&Ye>=0&&(tH(e,Ye,s,st,dt,u),D.current()),N.current=Je;return}(y||l||d===Je||p===Je||m?.path===Je||g?.path===Je||a==null||a!==Je)&&(JV(r),d===Je&&(me.current=null),p===Je&&(he.current=null),m?.path===Je&&(ge.current=null),g?.path===Je&&(_e.current=null),F.current=!1,I.current=null),N.current=Je},[t,Ye,Je,mt,s,Ge,Ke,ct,st,f,Xe,h,ft,dt,ot]);let Ut=Ye>=0&&Ye>=at.visible.startIndex&&Ye<=at.visible.endIndex,Wt=Je!=null&<.some(e=>LH(e.row)===Je),Gt=Ut||Wt,Kt=Pe&&M.current===!0&&Gt?Je:null,qt=se===`pointer`?Y:null,Jt=de?.path??ve.current??qt??Kt??Y,Yt=de?.source===`right-click`;TH(()=>{y.current&&de==null||St(Be(Jt))},[de,Be,ct,st,le,lt,Jt,St,ot]);let Xt=OH(e=>{if(y.current||oU(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&&ce(e=>e===`pointer`?e:`pointer`),ie(e=>e===i?e:i)},[]),Zt=OH(()=>{ie(null)},[]);TH(()=>{if(!Ze)return;let e=()=>{Nt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Nt(),t.cancelDrag()}},[t,Ze]);let Qt=e=>{if(!Ze||t.getDragSession()==null||W.current)return;let n=qH(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Ft(t.getDragSession()?.target??null),Lt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},$t=e=>{if(!Ze||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(kt(),jt(),t.setDragTarget(null))},en=e=>{!Ze||t.getDragSession()==null||W.current||(e.preventDefault(),Pt(e.clientX,e.clientY),t.completeDrag(),At(),kt(),jt(),H.current=null)},tn=at.window.height,nn=at.window.offsetTop,rn=Math.min(0,st-tn),an=Math.min(0,st-tn-ft),on=ne===Je||F.current,sn=Je!=null&&on&&!mt&&Ye>=0?ot[Ye]??t.getVisibleRows(Ye,Ye)[0]??null:null,cn=sn==null?null:nH(Ye,s,ct,tn),ln=H.current,un=tt!=null&&ln!=null&&ln.path===tt&&ln.index>=ct.start&&ln.index<=ct.end,dn=tt!=null&&ln!=null&&ln.path===tt&&!un&&ln.path!==sn?.path?ln:null,fn=dn==null?null:nH(dn.index,s,ct,tn),pn=nU((Ye>=0?ot[Ye]??t.getVisibleRows(Ye,Ye)[0]??null:null)?.ancestorPaths.at(-1)??null),mn=Ke&&Je!=null?_U(o,Je,!mt):void 0,hn=de?.path??(Ke?Je:ne),gn=de?.path??Y,_n=Be(Jt),vn=Me&&Pe&&!Yt&&!Ge&&_n!=null&&ae!=null&&Jt!=null,yn=Me&&(vn||de!=null),bn=de?.anchorRect,xn=bn==null&&_n!=null&&ae!=null&&(de!=null||vn)?ae:null,Sn=bn==null?xn==null?void 0:{top:`${xn}px`}:{left:`${bn.left}px`,position:`fixed`,right:`auto`,top:`${bn.top}px`},Cn=Yt?{opacity:`0`}:void 0,wn=OH((e,n,r,i)=>{let a=oH({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Ke,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=at.visible.startIndex&&n.index<=at.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,re(e=>e===c?e:c),ce(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Tt(c,{targetOffset:`sticky-parents`})},[t,Ke,at.visible.endIndex,at.visible.startIndex,Tt]),Tn=()=>{if(y.current||!Pe||Jt==null||_n==null)return;let e=t.getItem(Jt);e!=null&&(St(_n),yt.current=!0,fe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:_n.getAttribute(`aria-label`)??Jt,path:e.getPath()},path:e.getPath(),source:`button`}))},En={contextHoverPath:gn,contextMenuButtonTriggerEnabled:Pe,contextMenuButtonVisibility:Fe,contextMenuEnabled:Me,contextMenuRightClickEnabled:Ie,contextMenuTriggerMode:Ne,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Ze,draggedPathSet:$e,dragTarget:et,gitLaneActive:Ve,gitStatusByPath:n,handleRowDragEnd:zt,handleRowDragStart:Rt,handleRowTouchStart:Bt,ignoredGitDirectories:r,ignoredInheritanceCache:ee,instanceId:o,itemHeight:s,onKeyDown:Vt,onRowClick:wn,openContextMenuForRow:Ct,registerButton:Le,registerRenameInput:ze,renameView:Ue,renderDecorationForRow:ht,resolveIcon:He,shouldSuppressContextMenu:Et,visualFocusPath:hn},Dn={...En,registerButton:Re};return pV(`div`,{ref:S,id:nt,"data-file-tree-context-menu-button-visibility":Me&&Pe?Fe:void 0,"data-file-tree-context-menu-trigger-mode":Me?Ne:void 0,"data-file-tree-has-context-menu-action-lane":Me&&Pe?`true`:void 0,"data-file-tree-has-git-lane":Ve?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":et?.kind===`root`?`true`:void 0,onDragLeave:Ze?$t:void 0,onDragOver:Ze?Qt:void 0,onDrop:Ze?en:void 0,onKeyDown:Vt,onPointerLeave:Me?Zt:void 0,onPointerOver:Me?Xt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[pV(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:pn}}),pV(`slot`,{name:wF,"data-type":`header-slot`}),f?pV(`div`,{"data-file-tree-search-container":!0,"data-open":Ke?`true`:`false`,children:pV(`input`,{ref:w,"aria-activedescendant":mn,"aria-controls":nt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":we?`true`:void 0,value:qe,onBlur:()=>{d===`retain`&&!Ee.current||t.closeSearch()},onFocus:De,onPointerDown:De,onInput:e=>{De();let n=e.currentTarget;t.setSearch(n.value)}})}):null,pV(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ae&<.length>0?pV(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:pV(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${rt}px`},children:lt.map((e,t)=>SU(Dn,e.row,`sticky:${LH(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${lt.length-t}`}}))})}):null,pV(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${dt}px`},children:[pV(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${nn}px`}}),pV(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${tn}px`,top:`${rn}px`,bottom:`${an}px`},children:[CU(En,ct,pt),sn!=null&&cn!=null?SU(En,sn,`parked:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:tt===sn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${cn}px`}}):null,dn!=null&&fn!=null?SU(En,dn,`parked-drag:${dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${fn}px`}}):null]})]})]}),Me?pV(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":yn?`true`:`false`,style:Sn,children:[pV(`button`,{ref:v,type:`button`,"data-type":EF,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":de==null?`false`:`true`,"data-visible":vn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),de!=null){xt();return}Tn()},tabIndex:-1,style:Cn,children:pV(_V,{...He(`file-tree-icon-ellipsis`)})}),de==null?null:pV(`slot`,{name:TF})]}):null,de==null?null:pV(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),xt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),xt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var TU={hydrateRoot:(e,t)=>{dV(VB(wU,t),e)},renderRoot:(e,t)=>{uV(VB(wU,t),e)},unmountRoot:e=>{uV(null,e)}};function EU(e,t){TU.renderRoot(e,t)}function DU(e,t){TU.hydrateRoot(e,t)}function OU(e){TU.unmountRoot(e)}var kU=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)}}},AU=`__c`,jU=`__k`,MU=`__d`,NU=`__s`,PU=/[\s\n\\/='"\0<>]/,FU=/^(xlink|xmlns|xml)([A-Z])/,IU=/^(?: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])/,LU=/^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/,RU=new Set([`draggable`,`spellcheck`]);function zU(e){e.__g===void 0?e[MU]=!0:e.__g|=8}function BU(e){e.__g===void 0?e[MU]=!1:e.__g&=-9}function VU(e){return e.__g===void 0?!0===e[MU]:!!(8&e.__g)}var HU=/["&<]/;function UU(e){if(e.length===0||!1===HU.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var WU={},GU=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(`.`)),KU=/[A-Z]/g;function qU(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:WU[n]||(WU[n]=n.replace(KU,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||GU.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function JU(){this.__d=!0}function YU(e,t){return{__v:e,context:t,props:e.props,setState:JU,forceUpdate:JU,__d:!0,__h:[]}}function XU(e,t,n){if(!e.s){if(n instanceof ZU){if(!n.s)return void(n.o=XU.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(XU.bind(null,e,t),XU.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var ZU=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{XU(r,1,a(this.v))}catch(e){XU(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?XU(r,1,t?t(i):i):n?XU(r,1,n(i)):XU(r,2,i)}catch(e){XU(r,2,e)}},r},e}(),QU,$U,eW,tW,nW={},rW=Array.isArray,iW=Object.assign,aW=``,oW=`<!--$s-->`,sW=`<!--/$s-->`;function cW(e,t){var n,r=e.type,i=!0;return e[AU]?(i=!1,(n=e[AU]).state=n[NU]):n=new r(e.props,t),e[AU]=n,n.__v=e,n.props=e.props,n.context=t,zU(n),n.state??=nW,n[NU]??(n[NU]=n.state),r.getDerivedStateFromProps?n.state=iW({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[NU]===n.state?n.state:n[NU]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),eW&&eW(e),n.render(n.props,n.state,t)}function lW(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===aW)return aW;var s=typeof e;if(s!=`object`)return s==`function`?aW:s==`string`?UU(e):e+aW;if(rW(e)){var c,l=aW;i[jU]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=lW(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=aW,rW(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return aW;e.__=i,QU&&QU(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===UB){if(`tpl`in g){for(var x=aW,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&&!rW(C)?x+=C:x+=lW(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+UU(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=cW(e,b),y=e[AU];else{e[AU]=y=YU(e,b);for(var E=0;VU(y)&&E++<25;){BU(y),eW&&eW(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}zU(y)}if(y.getChildContext!=null&&(t=iW({},t,y.getChildContext())),T&&TB.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===UB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return lW(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[NU]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,nW),VU(y)?(v=cW(e,t),(y=e[AU]).getChildContext!=null&&(t=iW({},t,y.getChildContext())),lW(v=v!=null&&v.type===UB&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):aW}finally{$U&&$U(e),tW&&tW(e)}}}v=v!=null&&v.type===UB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=lW(v,t,n,r,e,a,o);return $U&&$U(e),TB.unmount&&TB.unmount(e),e._suspended?typeof D==`string`?oW+D+sW:rW(D)?(D.unshift(oW),D.push(sW),D):D.then(function(e){return oW+e+sW}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return lW(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=TB.__e;return k&&k(i,e),aW}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=lW(v,t,n,r,e,a,o);return e._suspended?oW+s+sW:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=aW;for(var N in g){var P=g[N];if(typeof(P=dW(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=qU(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(FU.test(N))N=N.replace(FU,`$1:$2`).toLowerCase();else{if(PU.test(N))continue;N[4]!==`-`&&!RU.has(N)||P==null?n?LU.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):IU.test(N)&&(N=N.toLowerCase()):P+=aW}}P!=null&&!1!==P&&(j=!0===P||P===aW?j+` `+N:j+` `+N+`="`+(typeof P==`string`?UU(P):P+aW)+`"`)}}if(PU.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=UU(A):A!=null&&!1!==A&&!0!==A&&(M=lW(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),$U&&$U(e),tW&&tW(e),!M&&uW.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return rW(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var uW=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function dW(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var fW=0;function pW(e){return e!=null&&e.length>0?e:(fW+=1,`pst_ft_${fW}`)}function mW({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Sz)}function hW(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 gW(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 _W(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var vW=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new kU;#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=pW(a),this.#p=wB(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=xz(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new yB({...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&&(OU(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}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(),EU(t.wrapper,this.#w()))}setGitStatus(e){this.#p=wB(e,this.#p);let t=this.#T();t!=null&&EU(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),EU(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),DU(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),EU(r,this.#w())}#C(){return{initialViewportHeight:mW({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(wF,e());return}this.#l.setSlotHtml(wF,this.#e?.header?.html??null)}#k(e){let t=_W(e).find(e=>gW(e)),n=hW(mF(OF(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=_W(e),n=t.find(e=>gW(e)),r=t.filter(e=>e!==n),i=OF(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=hW(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=OF(this.#m);t.colored&&gF(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${bF}]`);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(bF,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Ez(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 Mz(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)}},yW=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function bW(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:wF,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:TF,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function xW(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 SW(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 CW(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 wW({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)(()=>CW(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),yW(()=>{n.setComposition(g)},[g,n]),yW(()=>{if(c!=null)return r!=null&&SW(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=xW(bW(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)(vF,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function TW(e){let[t]=(0,Q.useState)(()=>new vW(e)),n=(0,Q.useRef)({timeout:null,model:t});return(0,Q.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}var EW={density:`compact`,flattenEmptyDirectories:!1},DW={"--trees-level-gap-override":`4px`,"--trees-item-row-gap-override":`4px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`26px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},OW=`
|
|
1867
1867
|
[data-item-section='spacing-item'] {
|
|
1868
1868
|
opacity: 0.5;
|
|
1869
1869
|
}
|