@inkeep/open-knowledge 0.25.0-beta.5 → 0.25.0-beta.7
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-BqDmPSy7.mjs +2 -0
- package/dist/{dist-CMJUtzX1.mjs → dist-7R982DBB.mjs} +1 -1
- package/dist/{dist-CWHBXHzy.mjs → dist-B1-OZ0zK.mjs} +4 -4
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/init-GRaEliNl.mjs +1 -0
- package/dist/{init-DtokbzyT.mjs → init-c3JG_h2l.mjs} +5 -5
- package/dist/{loader-BVo2aawg.mjs → loader-407aLHS3.mjs} +2 -2
- package/dist/loader-BopMp2v5.mjs +1 -0
- package/dist/{preview-C1HxEg0k.mjs → preview-BFKr7oX6.mjs} +2 -2
- package/dist/preview-Db2Mp1k4.mjs +1 -0
- package/dist/public/assets/{index-C5C53Kpg.js → index-BCPjnywU.js} +87 -87
- package/dist/public/assets/index-CG7gf_6X.css +1 -0
- package/dist/public/index.html +2 -2
- package/dist/{repair-launch-json-CBT8wHOA.mjs → repair-launch-json-BiWBKEuw.mjs} +2 -2
- package/dist/repair-mcp-configs-Dvl04XS8.mjs +2 -0
- package/dist/repair-skills-BvhYVWdw.mjs +3 -0
- package/dist/repair-skills-qkZ_LTHD.mjs +1 -0
- package/dist/{src-fQ6x4gIw.mjs → src-Ag0-SexD.mjs} +2 -2
- package/dist/{start-tk-cc-AP.mjs → start-CPpIE_XZ.mjs} +2 -2
- package/dist/start-jAOWwcum.mjs +1 -0
- package/dist/write-project-skill-CAgr6zKv.mjs +36 -0
- package/package.json +1 -1
- package/dist/constants-Dy6ROZPZ.mjs +0 -2
- package/dist/init-DGcKNDQp.mjs +0 -1
- package/dist/loader-B_lu8fYu.mjs +0 -1
- package/dist/preview-yLVYKisA.mjs +0 -1
- package/dist/public/assets/index-5ybhwuEB.css +0 -1
- package/dist/repair-mcp-configs-D9JnyEcT.mjs +0 -2
- package/dist/repair-skills-BFe09bLm.mjs +0 -1
- package/dist/repair-skills-xrYOvyVd.mjs +0 -3
- package/dist/start-B1p3dI9B.mjs +0 -1
- package/dist/write-project-skill-CRxX-42S.mjs +0 -12
|
@@ -26,9 +26,9 @@ Error generating stack: `+e.message+`
|
|
|
26
26
|
`).trim(),mentions:t}}function jw(e){let{instruction:t,mentions:n}=Aw(e);return t===``&&n.length===0}function Mw(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function Nw(e){let t=(0,$.c)(29),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,className:c,placeholder:l,initialDoc:u}=e,d=(0,Q.useRef)(i),f=(0,Q.useRef)(a),p=(0,Q.useRef)(o),m=(0,Q.useRef)(s),h;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(h=()=>{d.current=i,f.current=a,p.current=o,m.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=h):h=t[4],(0,Q.useEffect)(h);let g;t[5]===l?g=t[6]:(g=Dw({placeholder:l}),t[5]=l,t[6]=g);let _=u??void 0,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=wi(`composer-prosemirror py-1 outline-none`),t[7]=v):v=t[7];let y;t[8]===r?y=t[9]:(y={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:v},t[8]=r,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>t.key===`Escape`?yw.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?yw.getState(e.state)?.active?!1:(m.current(),!0):!1,t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x={attributes:y,handleKeyDown:b},t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let{editor:t}=e;d.current(jw(t)),f.current?.(t.getJSON()),p.current?.(Aw(t).mentions)},t[13]=S):S=t[13];let C;t[14]!==g||t[15]!==_||t[16]!==x?(C={extensions:g,content:_,immediatelyRender:!0,editorProps:x,onUpdate:S},t[14]=g,t[15]=_,t[16]=x,t[17]=C):C=t[17];let w=D(C),T;t[18]!==w||t[19]!==u?(T=()=>{w&&(jw(w)&&Mw(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),fw()),d.current(jw(w)),p.current?.(Aw(w).mentions))},t[18]=w,t[19]=u,t[20]=T):T=t[20];let E;t[21]===w?E=t[22]:(E=[w],t[21]=w,t[22]=E),(0,Q.useEffect)(T,E);let O,k;t[23]===w?(O=t[24],k=t[25]):(O=()=>({focus:()=>w?.commands.focus(),blur:()=>w?.commands.blur(),clear:()=>w?.commands.clearContent(!0),setText:e=>{w&&(w.commands.setContent(e),f.current?.(w.getJSON()),p.current?.(Aw(w).mentions))},getContent:()=>w?Aw(w):{instruction:``,mentions:[]}}),k=[w],t[23]=w,t[24]=O,t[25]=k),(0,Q.useImperativeHandle)(n,O,k);let A;return t[26]!==c||t[27]!==w?(A=(0,Z.jsx)(ee,{editor:w,className:c}),t[26]=c,t[27]=w,t[28]=A):A=t[28],A}function Pw(e,t,n){return e.trim().length>0||t.length>0||n}var Fw=new Set(lo.map(e=>e.id));function Iw(e){return typeof e==`string`&&Fw.has(e)}function Lw(e){try{let t=ab(e);return Iw(t)?t:null}catch{return null}}function Rw(e,t){ob(e,t)}function zw(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:lo.find(e=>n[e.id]?.installed===!0)?.id??null}function Bw(e){let t=(0,$.c)(28),{scenario:n,className:r}=e,{_:i}=an(),{states:a,refresh:o}=So(),{dispatch:s}=Ao(),c=so(),l=Oo(),[u,d]=(0,Q.useState)(Uw),f=(0,Q.useRef)(!1),[p,m]=(0,Q.useState)(null),h=p!==null&&l!==null,g=(0,Q.useRef)(null),[_]=(0,Q.useState)(Hw),[v,y]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(e),e||x(!1)},t[0]=S):S=t[0];let C=S,w=ZC(n),T;t[1]===a?T=t[2]:(T=e=>a[e.id]?.installed===!0,t[1]=a,t[2]=T);let E=lo.filter(T),D;t[3]===a?D=t[4]:(D=lo.every(e=>a[e.id]?.installed!=null),t[3]=a,t[4]=D);let O=D,k=O&&E.length===0,A,j;t[5]!==O||t[6]!==a?(A=()=>{if(!O||f.current)return;let e=zw({lastUsed:Lw(),states:a});d(t=>e===t?t:e)},j=[O,a],t[5]=O,t[6]=a,t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,Q.useEffect)(A,j);let M=function(e){f.current=!0,m(null),d(e),Rw(e)},N=function(e){f.current=!0,m(e)},P=function(){if(l===null||p===null)return;let{instruction:e,mentions:t}=g.current?.getContent()??{instruction:``,mentions:[]};if(!Pw(e,t,!1)){x(!0);return}let r=_o({workspace:c,description:e,scenario:n,mentions:t});r!==null&&(l.launchInTerminal(r,p),g.current?.clear(),fw())},F=function(e){let{instruction:t,mentions:r}=g.current?.getContent()??{instruction:``,mentions:[]};if(!Pw(t,r,!1)){x(!0);return}Rw(e);let i=_o({workspace:c,description:t,scenario:n,mentions:r});i!==null&&(s(e,i),g.current?.clear(),fw())},I=function(){h?P():u!==null&&F(u)},L=function(e){g.current?.setText(e),g.current?.focus()};if(k){let e;t[9]===r?e=t[10]:(e=wi(`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[9]=r,t[10]=e);let n;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(us,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[11]=n):n=t[11];let i;t[12]===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)(Y,{id:`3IseAk`})})]}),t[12]=i):i=t[12];let a;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:lo.map(Vw)}),t[13]=a):a=t[13];let o;return t[14]===e?o=t[15]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[14]=e,t[15]=o),o}let R=E.length>0,z=l!==null,B;t[16]===r?B=t[17]:(B=wi(`flex w-full flex-col gap-3`,r),t[16]=r,t[17]=B);let V;t[18]===i?V=t[19]:(V=i({id:`7hctf2`}),t[18]=i,t[19]=V);let H;t[20]===i?H=t[21]:(H=i({id:`0jD-Gn`}),t[20]=i,t[21]=H);let U;t[22]!==v||t[23]!==b?(U=b&&v?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(Y,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[22]=v,t[23]=b,t[24]=U):U=t[24];let W=u===null?(0,Z.jsx)(X,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(Y,{id:`hYgDIe`})}):(0,Z.jsxs)(mw,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>h?P():F(u),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:h&&p!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(go,{id:ho(p),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`4rjwLG`,values:{0:Vn[p].displayName}})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(go,{id:u,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`9dw5bW`,values:{0:uo(u)}})]})}),(0,Z.jsxs)(jc,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(Xa,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Tc,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(wc,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),Do.map(e=>{let{displayName:t}=Vn[e];return(0,Z.jsxs)(Cc,{onSelect:()=>N(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(go,{id:ho(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),p===e?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,R?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(Ic,{}):null,(0,Z.jsxs)(wc,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),E.map(e=>(0,Z.jsxs)(Cc,{onSelect:()=>M(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(go,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!h&&e.id===u?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]})]})]}),G;return t[25]!==W||t[26]!==U?(G=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[U,W]}),t[25]=W,t[26]=U,t[27]=G):G=t[27],(0,Z.jsxs)(`div`,{className:B,children:[(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:[(0,Z.jsx)(Nw,{ref:g,ariaLabel:V,placeholder:H,onEmptyChange:C,onContentChange:dw,onSubmit:I,initialDoc:_,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),G]}),n!==`existing-repo`&&w.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:w.map(e=>{let t=e.icon;return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>L(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)})}):null]})}function Vw(e){return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void oo(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(go,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(Oa,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function Hw(){return uw().doc??void 0}function Uw(){return Lw()}var Ww=3100,Gw=3;function Kw(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Gw;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var qw={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}},Jw=[`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 Yw(e,t={}){let n=t.rng??Math.random,r=t.colors??Jw,i=qw[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 Xw=1.8,Zw=90,Qw=16,$w=380,eT=.025,tT=.1,nT=.18,rT=400,iT=9.2736,aT=18.1799,oT=14.5244,sT={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function cT(e,t){let{halfWidth:n,apexLift:r}=sT[t];return`M${e-n} ${oT+.3} Q${e} ${oT-r}, ${e+n} ${oT+.3}`}function lT(e){let t=1.5,n=.3;return`M${e-t} ${oT-n} Q${e} ${oT+1.4}, ${e+t} ${oT-n}`}var uT=15,dT=15;function fT(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 pT(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=Kw(g,t);_(n),y(_T),S(Yw(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Ww)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(gT),S(Yw(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Ww))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/$w)),C=-Math.max(-1,Math.min(1,b/$w))*Qw,w=S*Qw,T=0,E=0;if(x>=1){let e=Math.min(x/Zw,1)*Xw;T=y/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!m&&D)return;l(),r+=(C-r)*tT,i+=(w-i)*tT,u.style.transform=`perspective(${rT}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*nT,o+=(E-o)*nT;let O=i*eT,k=-r*eT,A=a+O,j=o+k;h.current.x=A,h.current.y=j,p.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=wi(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=wi(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=wi(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:iT,cy:oT,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let ee=(F||T)&&`ok-blob-eye-hidden`,te;t[26]===ee?te=t[27]:(te=wi(`ok-blob-eye ok-blob-eye-right`,ee),t[26]=ee,t[27]=te);let q;t[28]===te?q=t[29]:(q=(0,Z.jsx)(`ellipse`,{cx:aT,cy:oT,rx:1.2722,ry:1.9083,className:te}),t[28]=te,t[29]=q);let J;t[30]===I?J=t[31]:(J=cT(iT,I),t[30]=I,t[31]=J);let ne=(!F||T)&&`ok-blob-eye-hidden`,re;t[32]===ne?re=t[33]:(re=wi(`ok-blob-happy-eye`,ne),t[32]=ne,t[33]=re);let ie;t[34]!==J||t[35]!==re?(ie=(0,Z.jsx)(`path`,{d:J,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:re}),t[34]=J,t[35]=re,t[36]=ie):ie=t[36];let ae;t[37]===I?ae=t[38]:(ae=cT(aT,I),t[37]=I,t[38]=ae);let oe=(!F||T)&&`ok-blob-eye-hidden`,se;t[39]===oe?se=t[40]:(se=wi(`ok-blob-happy-eye`,oe),t[39]=oe,t[40]=se);let ce;t[41]!==ae||t[42]!==se?(ce=(0,Z.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:se}),t[41]=ae,t[42]=se,t[43]=ce):ce=t[43];let le;t[44]===T?le=t[45]:(le=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:lT(iT),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:lT(aT),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=le);let ue;t[46]!==K||t[47]!==q||t[48]!==ie||t[49]!==ce||t[50]!==le?(ue=(0,Z.jsxs)(`g`,{ref:p,children:[K,q,ie,ce,le]}),t[46]=K,t[47]=q,t[48]=ie,t[49]=ce,t[50]=le,t[51]=ue):ue=t[51];let de;t[52]!==B||t[53]!==H||t[54]!==ue?(de=(0,Z.jsxs)(`g`,{className:H,children:[U,ue]},B),t[52]=B,t[53]=H,t[54]=ue,t[55]=de):de=t[55];let fe;t[56]===T?fe=t[57]:(fe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=fe);let pe;t[58]!==v||t[59]!==x?(pe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(mT)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=pe):pe=t[60];let me;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==de||t[65]!==fe||t[66]!==pe?(me=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:hT,children:[de,fe,pe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=de,t[65]=fe,t[66]=pe,t[67]=me):me=t[67];let he;return t[68]!==R||t[69]!==me?(he=(0,Z.jsx)(`span`,{ref:d,className:R,children:me}),t[68]=R,t[69]=me,t[70]=he):he=t[70],he}function mT(e){return(0,Z.jsx)(`circle`,{cx:uT+e.originDx,cy:dT+e.originDy,r:e.size,className:`ok-blob-firework`,style:fT(e)},e.id)}function hT(e){return e.preventDefault()}function gT(e){return e+1}function _T(e){return e+1}function vT(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(pT,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function yT({isOnboarding:e,isEmbedded:t}){return e?{title:{id:`6h4zVU`},subtitle:t?{id:`vGeNNQ`}:{id:`qpQwGC`}}:{title:{id:`FOGD7m`},subtitle:t?{id:`3DTatP`}:{id:`MqQoV-`}}}var bT=`open-knowledge:create-top-level-file`;function xT(e={}){window.dispatchEvent(new CustomEvent(bT,{detail:e}))}function ST(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(bT,t),()=>window.removeEventListener(bT,t)}function CT(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=an(),a=bo(),{title:o,subtitle:s}=yT({isOnboarding:!1,isEmbedded:a}),c=pa(),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=vT,m=i(o),h=i(s),_;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(_=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=_):_=t[7];let v;t[8]===a?v=t[9]:(v=a?(0,Z.jsx)(QC,{scenario:`existing-repo`}):(0,Z.jsx)(Bw,{scenario:`existing-repo`}),t[8]=a,t[9]=v);let y;t[10]!==u||t[11]!==f||t[12]!==d?(y=d||f||u.length>0?(0,Z.jsx)(ET,{templates:u,loading:d,error:f,onSelect:TT}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=y):y=t[13];let b,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`size-3`}),x=(0,Z.jsx)(Y,{id:`IajAbS`}),t[14]=b,t[15]=x):(b=t[14],x=t[15]);let S;t[16]===r?S=t[17]:(S=(0,Z.jsxs)(X,{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:[b,x]}),t[16]=r,t[17]=S);let C;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(X,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:wT,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(g,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=C):C=t[18];let w;t[19]===S?w=t[20]:(w=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[S,C]}),t[19]=S,t[20]=w);let T;t[21]!==w||t[22]!==y?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[y,w]}),t[21]=w,t[22]=y,t[23]=T):T=t[23];let E;return t[24]!==T||t[25]!==_||t[26]!==v?(E=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[_,v,T]}),t[24]=T,t[25]=_,t[26]=v,t[27]=E):E=t[27],E}function wT(){return xT({initialDir:``})}function TT(e,t){return xT({template:{folder:e,name:t}})}function ET(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=an(),s;t[0]===o?s=t[1]:(s=o({id:`_8quCH`}),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`_8quCH`})}),t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(l=r||i?null:(0,Z.jsx)(ge,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=l):l=t[7];let u;t[8]===l?u=t[9]:(u=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,l]}),t[8]=l,t[9]=u);let d;t[10]===o?d=t[11]:(d=o({id:`irFGwu`}),t[10]=o,t[11]=d);let f;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(f=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(DT,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==d||t[19]!==f?(p=(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":d,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:f})}),t[17]=r,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==u||t[23]!==p?(m=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex w-full flex-col gap-3`,children:[u,p]}),t[21]=s,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function DT(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=an(),o;t[0]!==n.name||t[1]!==n.title?(o=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=o):o=t[2];let s=o,c=`${n.name}.md`,l=n.source_folder===``,u;t[3]!==a||t[4]!==s||t[5]!==c||t[6]!==l||t[7]!==r?(u=a(l?{id:`89TtiD`,values:{displayTitle:s,fileName:c}}:{id:`0_J12R`,values:{displayTitle:s,fileName:c,targetLabel:r}}),t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=r,t[8]=u):u=t[8];let d=u,f;t[9]===s?f=t[10]:(f=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:s}),t[9]=s,t[10]=f);let p;t[11]===c?p=t[12]:(p=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:c}),t[11]=c,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h=`shrink-0 font-mono text-1sm ${l?`text-muted-foreground/70`:`text-muted-foreground`}`,g;t[16]!==h||t[17]!==r?(g=(0,Z.jsx)(`span`,{className:h,children:r}),t[16]=h,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==d||t[20]!==i||t[21]!==m||t[22]!==g?(_=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,onClick:i,"aria-label":d,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:[m,g]}),t[19]=d,t[20]=i,t[21]=m,t[22]=g,t[23]=_):_=t[23],_}function OT(e){let t=(0,$.c)(20),{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{ok:t,body:n}=await $a();if(e)return;let r=t?Hn.safeParse(n):null;r?.success?(l(jT(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=ks(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(AT),500),$a().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=Hn.safeParse(n);r.success&&l(jT(r.data.documents))}).catch(kT)},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;t[4]!==u||t[5]!==y||t[6]!==v?(e=v?(0,Z.jsx)(MT,{isOnboarding:y,celebrateSignal:u}):null,t[4]=u,t[5]=y,t[6]=v,t[7]=e):e=t[7];let n;return t[8]===e?n=t[9]:(n=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 sm:px-12 md:px-16 pb-8 pt-10`,children:e}),t[8]=e,t[9]=n),n}let S;t[10]!==u||t[11]!==y||t[12]!==v?(S=v?y?(0,Z.jsx)(NT,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(CT,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[10]=u,t[11]=y,t[12]=v,t[13]=S):S=t[13];let C;t[14]!==o||t[15]!==i?(C=(0,Z.jsx)(Jv,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[14]=o,t[15]=i,t[16]=C):C=t[16];let w;return t[17]!==S||t[18]!==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[17]=S,t[18]=C,t[19]=w):w=t[19],w}function kT(){}function AT(e){return e+1}function jT(e){return rl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function MT(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=an(),a=bo(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=yT({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=vT,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function NT(e){let t=(0,$.c)(28),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=an(),a=bo(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=yT({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=vT,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(QC,{scenario:`new-project`}):(0,Z.jsx)(Bw,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(FT,{label:f}),t[16]=f,t[17]=p);let m;t[18]===r?m=t[19]:(m=(0,Z.jsx)(Vv,{onPackSelect:r,onCreateBlankFile:PT}),t[18]=r,t[19]=m);let h;t[20]!==p||t[21]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[p,m]}),t[20]=p,t[21]=m,t[22]=h):h=t[22];let g;return t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==h?(g=(0,Z.jsxs)(`div`,{className:l,children:[u,d,h]}),t[23]=l,t[24]=u,t[25]=d,t[26]=h,t[27]=g):g=t[27],g}function PT(){return xT()}function FT(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 IT(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function LT(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=an(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(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)(zT,{}),(0,Z.jsx)(Qi,{className:`h-7 w-full`}),(0,Z.jsx)(Qi,{className:`h-7 w-full`}),(0,Z.jsx)(Qi,{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)(Y,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.frontmatterLocal?f=t[4]:(f=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=f);let p=f,m;t[5]===r.data.folder.path?m=t[6]:(m=IT(r.data.folder.path),t[5]=r.data.folder.path,t[6]=m);let h=m,g;t[7]===p?g=t[8]:(g=Object.keys(p),t[7]=p,t[8]=g);let _=g,v;t[9]!==a||t[10]!==n||t[11]!==i?(v=async function(e,t){let r=await Xo(n,{[e]:t});if(!r.ok){let{error:e}=r;Ss.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},t[9]=a,t[10]=n,t[11]=i,t[12]=v):v=t[12];let y=v,b;t[13]!==a||t[14]!==n||t[15]!==i?(b=async function(e){let t=await Xo(n,{[e]:null});if(!t.ok){let{error:e}=t;Ss.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},t[13]=a,t[14]=n,t[15]=i,t[16]=b):b=t[16];let x=b,S;t[17]!==y||t[18]!==p?(S=function(e,t){let n=p[e];y(e,Va(n,t))},t[17]=y,t[18]=p,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){l({name:``,type:`text`,value:``,error:null}),s(!1)},t[20]=w):w=t[20];let T=w,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Ia[e];return{...t,type:e,value:n,error:null}})},t[21]=E):E=t[21];let D=E,O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(t=>t&&{...t,value:e})},t[22]=O):O=t[22];let k=O,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(t=>t&&{...t,name:e,error:null})},t[23]=A):A=t[23];let j=A,M;t[24]!==a||t[25]!==c||t[26]!==n||t[27]!==i||t[28]!==p?(M=async function(e){if(!c)return;let t=e??c.value,r=c.name.trim();if(!r){l({...c,value:t,error:a({id:`8_brI5`})});return}if(_r(t)){l({...c,value:t,error:a({id:`hXUWyd`})});return}if(Object.hasOwn(p,r)){l({...c,value:t,error:a({id:`CTJLpz`,values:{trimmed:r}})});return}let o=await Xo(n,{[r]:t});if(!o.ok){l({...c,value:t,error:o.error});return}l(null),i()},t[24]=a,t[25]=c,t[26]=n,t[27]=i,t[28]=p,t[29]=M):M=t[29];let N=M,P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d({key:e,draft:e,error:null})},t[30]=P):P=t[30];let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){d(t=>t&&{...t,draft:e,error:null})},t[31]=I):I=t[31];let L=I,R;t[32]!==a||t[33]!==n||t[34]!==i||t[35]!==p||t[36]!==u?(R=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:a({id:`8_brI5`})});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:a({id:`CTJLpz`,values:{trimmed:e}})});return}let t=p[u.key],r=await Xo(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`size-3 transition-transform ${o?``:`rotate-90`}`,G;t[40]===W?G=t[41]:(G=(0,Z.jsx)(Qa,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=G);let K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`vQIVHc`})}),t[42]=K):K=t[42];let ee;t[43]===G?ee=t[44]:(ee=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[G,K]}),t[43]=G,t[44]=ee);let te;t[45]===h?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:RT,children:h}),t[45]=h,t[46]=te);let q;t[47]!==ee||t[48]!==te?(q=(0,Z.jsxs)(cs,{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:[ee,te]}),t[47]=ee,t[48]=te,t[49]=q):q=t[49];let J;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hSBIG-`})}),t[50]=J):J=t[50];let ne;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ne=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(za,{keyName:e,value:t,declared:Pa(t,ur(t)),rename:{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:L,onCommit:z,onCancel:V},badge:null,onCommit:t=>void y(e,t),onChangeType:t=>C(e,t),onRemove:()=>void x(e)},e)}),t[51]=c,t[52]=y,t[53]=z,t[54]=_,t[55]=p,t[56]=x,t[57]=u,t[58]=C,t[59]=ne):ne=t[59];let re;t[60]!==c||t[61]!==N?(re=c?(0,Z.jsx)(La,{draft:c,onChangeName:j,onChangeType:D,onChangeValue:k,onCommit:e=>void N(e),onCancel:()=>l(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>T(),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)(Lt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=re):re=t[62];let ie;t[63]!==ne||t[64]!==re?(ie=(0,Z.jsx)(ss,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[J,ne,re]})}),t[63]=ne,t[64]=re,t[65]=ie):ie=t[65];let ae;return t[66]!==H||t[67]!==q||t[68]!==ie?(ae=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(ls,{open:H,onOpenChange:U,children:[q,ie]})}),t[66]=H,t[67]=q,t[68]=ie,t[69]=ae):ae=t[69],ae}function RT(e){return e.stopPropagation()}function zT(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(kd,{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)(Y,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function BT(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Ms._({id:`xOTzt5`}):t<3600?Ms._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Ms._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Ms._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function VT(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function HT(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:ia,label:Ms._({id:`QR5SP1`}),detail:VT(i)};case`template-edit`:return{Icon:Wo,label:Ms._({id:`-LHLx7`}),detail:VT(i)};case`template-delete`:return{Icon:Ro,label:Ms._({id:`_gkGSK`}),detail:VT(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:id,label:Ms._({id:`KPW5WC`}),detail:`${VT(e??``)} → ${VT(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:kd,label:Ms._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:kd,label:Ms._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:kd,label:Ms._({id:`ZQLDTl`}),detail:``};default:return{Icon:Id,label:r.replace(/-/g,` `),detail:VT(i)}}}function UT(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Ms._({id:`B2DrPb`}):e.author||Ms._({id:`Ef7StM`})}function WT(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,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),u,d;if(t[1]===n?(u=t[2],d=t[3]):(u=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){l(!0),s(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),l(!1),s(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),l(!0),s(!1))}};s(!0),t();let r=Es(t);return()=>{e=!0,r()}},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,Q.useEffect)(u,d),c||!o&&i.length===0)return null;let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(ge,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=p);let m;t[7]===p?m=t[8]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[f,p]}),t[7]=p,t[8]=m);let h;t[9]!==i||t[10]!==o?(h=(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)(Qi,{className:`h-8 w-full`}),(0,Z.jsx)(Qi,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(GT)})}),t[9]=i,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function GT(e){let{Icon:t,label:n,detail:r}=HT(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)(Af,{className:`size-3`,"aria-hidden":!0}),UT(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:BT(e.timestamp)})]},e.sha)}function KT(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function qT(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=KT(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function JT(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function YT(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:qT(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:JT(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:qT(e,t.pageTitles),children:a}}function XT(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(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)(Y,{id:`-QCLWk`})})}),(0,Z.jsx)(Qi,{className:`h-12 w-full`}),(0,Z.jsx)(Qi,{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)(Y,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.folder.templates_available?f=t[4]:(f=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-QCLWk`})}),t[5]=m):m=t[5];let h;t[6]===p.length?h=t[7]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,Z.jsx)(ge,{className:`text-xs`,variant:`secondary`,children:p.length})]}),t[6]=p.length,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(X,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(Lt,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`G1Gw0v`})]}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[h,g]}),t[9]=h,t[10]=_);let v;t[11]===p?v=t[12]:(v=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(Da,{template:e,onCreate:()=>l(e.name),onEdit:()=>ns(V(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(Na,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=v);let y;t[13]!==_||t[14]!==v?(y=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||s(null)},t[16]=b):b=t[16];let x;t[17]!==o||t[18]!==i?(x=(0,Z.jsx)(Oi,{template:o,onOpenChange:b,onDeleted:i}),t[17]=o,t[18]=i,t[19]=x):x=t[19];let S;t[20]===p?S=t[21]:(S=new Set(p.map(ZT)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),ns(V(n,e))},t[22]=n,t[23]=i,t[24]=C):C=t[24];let w;t[25]!==n||t[26]!==u||t[27]!==S||t[28]!==C?(w=(0,Z.jsx)(Ui,{folderPath:n,existingNames:S,open:u,onOpenChange:d,onCreated:C}),t[25]=n,t[26]=u,t[27]=S,t[28]=C,t[29]=w):w=t[29];let T=c!==null,E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||l(null)},t[30]=E):E=t[30];let D=c??void 0,O;t[31]!==a||t[32]!==n||t[33]!==T||t[34]!==D?(O=(0,Z.jsx)(wv,{open:T,onOpenChange:E,kind:`file`,initialDir:n,initialTemplate:D,folderConfig:a}),t[31]=a,t[32]=n,t[33]=T,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==w||t[37]!==O||t[38]!==y||t[39]!==x?(k=(0,Z.jsxs)(Z.Fragment,{children:[y,x,w,O]}),t[36]=w,t[37]=O,t[38]=y,t[39]=x,t[40]=k):k=t[40],k}function ZT(e){return e.name}function QT(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=wi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=wi(`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 $T(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=wi(`[&_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 eE(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=wi(`[&_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 tE(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=wi(`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 nE(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=wi(`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 rE(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=wi(`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 iE(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Ms._({id:`xOTzt5`});if(r<60)return Ms._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Ms._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Ms._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function aE(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 oE(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)(y,{className:`ml-1 size-3`}):(0,Z.jsx)(rt,{className:`ml-1 size-3`}):(0,Z.jsx)(ad,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function sE(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=an(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=to(),l=ya(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(a){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)(Qi,{className:`size-5 rounded`}),(0,Z.jsx)(Qi,{className:`h-7 w-48`})]}),(0,Z.jsx)(Qi,{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)(Qi,{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)(Qi,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(uE)]})]}),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 v,y,b,x,S,C,w,T,E,D,O;if(t[7]!==r||t[8]!==u||t[9]!==l||t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==s||t[14]!==o||t[15]!==d||t[16]!==g||t[17]!==m){let e=YT(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=aE(e.children,m,g),f=e.title||(n===``?r({id:`3aeN7X`}):e.title),k;t[29]===m?k=t[30]:(k=function(e){e===m?_(lE):(h(e),_(`asc`))},t[29]=m,t[30]=k);let A=k;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(Io,{className:`size-5 text-muted-foreground`}),t[31]=j):j=t[31];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:f})]}),N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(X,{onClick:()=>p(!0),children:[(0,Z.jsx)(Lt,{className:`size-4`}),(0,Z.jsx)(Y,{id:`isRobC`})]}),t[32]=N):N=t[32],t[33]===M?w=t[34]:(w=(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:[M,N]})}),t[33]=M,t[34]=w),t[35]!==u||t[36]!==n||t[37]!==d?(T=(0,Z.jsx)(LT,{folderPath:n,state:u,onChange:d}),t[35]=u,t[36]=n,t[37]=d,t[38]=T):T=t[38],t[39]!==u||t[40]!==l||t[41]!==n||t[42]!==d?(E=(0,Z.jsx)(XT,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[39]=u,t[40]=l,t[41]=n,t[42]=d,t[43]=E):E=t[43],t[44]===n?D=t[45]:(D=(0,Z.jsx)(WT,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=QT;let P=m===`name`?g===`asc`?`ascending`:`descending`:`none`,F;t[46]===r?F=t[47]:(F=r({id:`6YtxFj`}),t[46]=r,t[47]=F);let I;t[48]!==A||t[49]!==g||t[50]!==m||t[51]!==F?(I=(0,Z.jsx)(oE,{label:F,sortKey:`name`,activeKey:m,activeDir:g,onSort:A}),t[48]=A,t[49]=g,t[50]=m,t[51]=F,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==I?(L=(0,Z.jsx)(nE,{"aria-sort":P,children:I}),t[53]=P,t[54]=I,t[55]=L):L=t[55];let R=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,z;t[56]===r?z=t[57]:(z=r({id:`tgWuMB`}),t[56]=r,t[57]=z);let B;t[58]!==A||t[59]!==g||t[60]!==m||t[61]!==z?(B=(0,Z.jsx)(oE,{label:z,sortKey:`modified`,activeKey:m,activeDir:g,onSort:A}),t[58]=A,t[59]=g,t[60]=m,t[61]=z,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,Z.jsx)(nE,{className:`w-32`,"aria-sort":R,children:B}),t[63]=R,t[64]=B,t[65]=V):V=t[65],t[66]!==L||t[67]!==V?(x=(0,Z.jsx)($T,{children:(0,Z.jsxs)(tE,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=eE,b=a.length?a.map(cE):(0,Z.jsx)(tE,{children:(0,Z.jsx)(rE,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Pkw7J9`})})}),t[7]=r,t[8]=u,t[9]=l,t[10]=n,t[11]=i,t[12]=c,t[13]=s,t[14]=o,t[15]=d,t[16]=g,t[17]=m,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O}else v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28];let k;t[69]!==v||t[70]!==b?(k=(0,Z.jsx)(v,{children:b}),t[69]=v,t[70]=b,t[71]=k):k=t[71];let A;t[72]!==y||t[73]!==k||t[74]!==x?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[72]=y,t[73]=k,t[74]=x,t[75]=A):A=t[75];let j;t[76]!==A||t[77]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[76]=A,t[77]=S,t[78]=j):j=t[78];let M;t[79]!==j||t[80]!==C||t[81]!==w||t[82]!==T||t[83]!==E||t[84]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,j]}),t[79]=j,t[80]=C,t[81]=w,t[82]=T,t[83]=E,t[84]=D,t[85]=M):M=t[85];let N;t[86]!==M||t[87]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[86]=M,t[87]=O,t[88]=N):N=t[88];let P;t[89]!==f||t[90]!==l||t[91]!==n?(P=(0,Z.jsx)(wv,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[89]=f,t[90]=l,t[91]=n,t[92]=P):P=t[92];let F;return t[93]!==N||t[94]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[93]=N,t[94]=P,t[95]=F):F=t[95],F}function cE(e){return(0,Z.jsxs)(tE,{children:[(0,Z.jsx)(rE,{children:(0,Z.jsxs)(`a`,{href:Jc(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)(jd,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(dt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(rE,{className:`text-muted-foreground`,children:e.kind===`file`?iE(e.modified):`—`})]},e.path)}function lE(e){return e===`asc`?`desc`:`asc`}function uE(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)(Qi,{className:`size-4 rounded`}),(0,Z.jsx)(Qi,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Qi,{className:`h-4 w-16`})})]},e)}function dE(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(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)(Ed,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Y,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=Er(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Er(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(B,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(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:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function fE(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(pE),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>f(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){L(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[5]=u):u=t[5];let d;return t[6]===c?d=t[7]:(d=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:u})]}),t[6]=c,t[7]=d),d}function pE(){return new Set}function mE(e){let t=(0,$.c)(24),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=bi(r).body;s=D,i=bt,a=!1,o=Pt().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4 pb-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let d=s(l,u),[f]=(0,Q.useState)(hE),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})})}),t[15]=g):g=t[15];let _;t[16]===d?_=t[17]:(_=(0,Z.jsx)(ee,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[16]=d,t[17]=_);let v;t[18]!==f||t[19]!==_?(v=(0,ld.createPortal)(_,f),t[18]=f,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==n||t[22]!==v?(y=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:[g,v]}),t[21]=n,t[22]=v,t[23]=y):y=t[23],y}function hE(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var gE=`data-skill-markdown`;function _E(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>Ac({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=VC(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)(HC,{fileName:a,dataAttr:gE}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)(UC,{fileName:a,dataAttr:gE,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(mE,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var vE=new Set([`md`,`mdx`]);function yE(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=vE.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(_E,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>Ac({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(KC,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function bE(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var xE=bE(()=>n(()=>import(`./SettingsDialogBody-CU-nEwde.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([68,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,69,8,70,21,18,19,71,33,72,65,24,47,73]),import.meta.url));function SE(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=an(),i;t[0]!==r||t[1]!==n?(i=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]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(Y,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(X,{variant:`default`,onClick:CE,children:(0,Z.jsx)(Y,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(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:[s,c]}),t[7]=s,t[8]=l),l}function CE(){return window.location.reload()}function wE(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(h,{fallbackRender:EE,onError:TE,children:n}),t[0]=n,t[1]=r),r}function TE(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function EE(e){return(0,Z.jsx)(SE,{...e})}function DE(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function OE(e){let t=(0,$.c)(94),{open:n,onOpenChange:r}=e,{_:i}=an(),{collabUrl:a}=pt(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l}=Bo(),{desktopPresent:u}=Hi(),[d,f]=(0,Q.useState)(`preferences`),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&f(`preferences`)},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=a!==null,g=typeof window<`u`&&window.okDesktop!=null,_;t[3]===i?_=t[4]:(_=i({id:`7PzzBU`}),t[3]=i,t[4]=_);let v;t[5]===i?v=t[6]:(v=i({id:`Q6hhn8`}),t[5]=i,t[6]=v);let y;t[7]===v?y=t[8]:(y={id:`preferences`,label:v},t[7]=v,t[8]=y);let b;t[9]===i?b=t[10]:(b=i({id:`4KmEoC`}),t[9]=i,t[10]=b);let x;t[11]===b?x=t[12]:(x={id:`hotkeys`,label:b},t[11]=b,t[12]=x);let S;t[13]===i?S=t[14]:(S=i({id:`AeXO77`}),t[13]=i,t[14]=S);let C;t[15]===S?C=t[16]:(C={id:`account`,label:S},t[15]=S,t[16]=C);let w;t[17]!==y||t[18]!==x||t[19]!==C?(w=[y,x,C],t[17]=y,t[18]=x,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==_?(T={id:`user`,label:_,enabled:!0,items:w},t[21]=w,t[22]=_,t[23]=T):T=t[23];let E;t[24]===i?E=t[25]:(E=i({id:`ZWyHmq`}),t[24]=i,t[25]=E);let D;t[26]===i?D=t[27]:(D=i({id:`Nu4DdT`}),t[26]=i,t[27]=D);let O;t[28]===D?O=t[29]:(O={id:`sync`,label:D},t[28]=D,t[29]=O);let k;t[30]===i?k=t[31]:(k=i({id:`A1taO8`}),t[30]=i,t[31]=k);let A;t[32]===k?A=t[33]:(A={id:`search`,label:k},t[32]=k,t[33]=A);let j;t[34]===i?j=t[35]:(j=g?[{id:`terminal`,label:i({id:`ALhMYW`})}]:[],t[34]=i,t[35]=j);let M;t[36]===i?M=t[37]:(M=i({id:`iTylMl`}),t[36]=i,t[37]=M);let N;t[38]===M?N=t[39]:(N={id:`project-templates`,label:M},t[38]=M,t[39]=N);let P;t[40]===i?P=t[41]:(P=i({id:`PCSkw2`}),t[40]=i,t[41]=P);let F;t[42]===P?F=t[43]:(F={id:`skills`,label:P},t[42]=P,t[43]=F);let I;t[44]===i?I=t[45]:(I=i({id:`3zyg_A`}),t[44]=i,t[45]=I);let L;t[46]===I?L=t[47]:(L={id:`okignore`,label:I},t[46]=I,t[47]=L);let R;t[48]===i?R=t[49]:(R=i({id:`cs4mps`}),t[48]=i,t[49]=R);let z;t[50]===R?z=t[51]:(z={id:`sharing`,label:R},t[50]=R,t[51]=z);let B;t[52]!==O||t[53]!==A||t[54]!==j||t[55]!==N||t[56]!==F||t[57]!==L||t[58]!==z?(B=[O,A,...j,N,F,L,z],t[52]=O,t[53]=A,t[54]=j,t[55]=N,t[56]=F,t[57]=L,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==h||t[61]!==E||t[62]!==B?(V={id:`project`,label:E,enabled:h,items:B},t[60]=h,t[61]=E,t[62]=B,t[63]=V):V=t[63];let H;t[64]===i?H=t[65]:(H=i({id:`nbfdhU`}),t[64]=i,t[65]=H);let U;t[66]!==i||t[67]!==u?(U=[],t[66]=i,t[67]=u,t[68]=U):U=t[68];let W;t[69]!==H||t[70]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[69]=H,t[70]=U,t[71]=W):W=t[71];let G;t[72]!==T||t[73]!==V||t[74]!==W?(G=[T,V,W],t[72]=T,t[73]=V,t[74]=W,t[75]=G):G=t[75];let K=G,ee;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Wa,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})}),t[76]=ee):ee=t[76];let te;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ua,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`RDrXh4`})}),t[77]=te):te=t[77];let q;t[78]!==d||t[79]!==K?(q=(0,Z.jsx)(kE,{groups:K,activeId:d,onSelect:f}),t[78]=d,t[79]=K,t[80]=q):q=t[80];let J;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(ME,{}),t[81]=J):J=t[81];let ne=s?o:null,re;t[82]!==d||t[83]!==c||t[84]!==l||t[85]!==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)(wE,{children:(0,Z.jsx)(Q.Suspense,{fallback:J,children:(0,Z.jsx)(xE,{activeId:d,userBinding:ne,okignoreBinding:c,okignoreSynced:l})})})}),t[82]=d,t[83]=c,t[84]=l,t[85]=ne,t[86]=re):re=t[86];let ie;t[87]!==q||t[88]!==re?(ie=(0,Z.jsxs)(Ga,{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:[ee,te,q,re]}),t[87]=q,t[88]=re,t[89]=ie):ie=t[89];let ae;return t[90]!==r||t[91]!==n||t[92]!==ie?(ae=(0,Z.jsx)(Ya,{open:n,onOpenChange:r,children:ie}),t[90]=r,t[91]=n,t[92]=ie,t[93]=ae):ae=t[93],ae}function kE(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:i}=e,{_:a}=an(),o;t[0]===a?o=t[1]:(o=a({id:`y1t8bQ`}),t[0]=a,t[1]=o);let s;if(t[2]!==r||t[3]!==n||t[4]!==i){let e;t[6]!==r||t[7]!==i?(e=e=>(0,Z.jsx)(jE,{group:e,activeId:r,onSelect:i},e.id),t[6]=r,t[7]=i,t[8]=e):e=t[8],s=n.map(e),t[2]=r,t[3]=n,t[4]=i,t[5]=s}else s=t[5];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(AE,{}),t[9]=c):c=t[9];let l;return t[10]!==o||t[11]!==s?(l=(0,Z.jsxs)(`nav`,{"aria-label":o,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:[s,c]}),t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function AE(){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=DE(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 s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(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:wi(`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)(Y,{id:`_PACVa`}),(0,Z.jsx)(Oa,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function jE(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`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=wi(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=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)(Y,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;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:wi(`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],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function ME(){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)(Y,{id:`GsBUCk`})}),n=(0,Z.jsx)(Qi,{className:`h-5 w-32`}),r=(0,Z.jsx)(Qi,{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)(Qi,{className:`h-9 w-full`}),(0,Z.jsx)(Qi,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function NE(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=wi(`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)(OC,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function PE(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)(MC,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function FE(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=wi(`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)(IC,{"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 IE(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=wi(`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 LE=Ci(`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 RE(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=wi(LE({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:zE,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function zE(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Ci(`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 BE(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=wi(`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 VE(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=wi(`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)(Vc,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HE(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=an(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(Y,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(VE,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(fd,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(Aa,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(Ws,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(jf,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(Aa,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(Ws,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(RE,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let G;t[49]!==W||t[50]!==N?(G=(0,Z.jsxs)(IE,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=G):G=t[51];let K;t[52]===w?K=t[53]:(K=(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:w}),t[52]=w,t[53]=K);let ee;t[54]===b?ee=t[55]:(ee=b({id:`oqB2ez`}),t[54]=b,t[55]=ee);let te=!S,q;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Jt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=q):q=t[56];let J;t[57]!==g||t[58]!==ee||t[59]!==te?(J=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:te,onClick:g,children:q})}),t[57]=g,t[58]=ee,t[59]=te,t[60]=J):J=t[60];let ne;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`oqB2ez`})}),t[61]=ne):ne=t[61];let re;t[62]===J?re=t[63]:(re=(0,Z.jsxs)(Ws,{children:[J,ne]}),t[62]=J,t[63]=re);let ie;t[64]===b?ie=t[65]:(ie=b({id:`SiUUCS`}),t[64]=b,t[65]=ie);let ae=!S,oe;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Xa,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=oe):oe=t[66];let se;t[67]!==h||t[68]!==ie||t[69]!==ae?(se=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ie,disabled:ae,onClick:h,children:oe})}),t[67]=h,t[68]=ie,t[69]=ae,t[70]=se):se=t[70];let ce;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`SiUUCS`})}),t[71]=ce):ce=t[71];let le;t[72]===se?le=t[73]:(le=(0,Z.jsxs)(Ws,{children:[se,ce]}),t[72]=se,t[73]=le);let ue=a?`secondary`:`ghost`,de;t[74]!==b||t[75]!==a?(de=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=de):de=t[76];let fe=a?`ok-replace-input`:void 0,pe;t[77]!==f||t[78]!==a?(pe=()=>f(!a),t[77]=f,t[78]=a,t[79]=pe):pe=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(cf,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==a||t[82]!==ue||t[83]!==de||t[84]!==fe||t[85]!==pe?(he=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:ue,size:`icon-sm`,"aria-label":de,"aria-expanded":a,"aria-controls":fe,onClick:pe,children:me})}),t[81]=a,t[82]=ue,t[83]=de,t[84]=fe,t[85]=pe,t[86]=he):he=t[86];let ge;t[87]===a?ge=t[88]:(ge=(0,Z.jsx)(Hs,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`UkQGhd`}):(0,Z.jsx)(Y,{id:`1RluQD`})}),t[87]=a,t[88]=ge);let _e;t[89]!==he||t[90]!==ge?(_e=(0,Z.jsxs)(Ws,{children:[he,ge]}),t[89]=he,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(ve=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(Y,{id:`fqSfXY`})}),(0,Z.jsx)(Vc,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({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)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(cf,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`bS_boY`})})]}),(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(sf,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=ve):ve=t[100];let ye;t[101]===b?ye=t[102]:(ye=b({id:`wJo9oS`}),t[101]=b,t[102]=ye);let be;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(Cs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=be):be=t[103];let xe;t[104]!==y||t[105]!==ye?(xe=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ye,onClick:y,children:be})}),t[104]=y,t[105]=ye,t[106]=xe):xe=t[106];let Se;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`yz7wBu`})}),t[107]=Se):Se=t[107];let Ce;t[108]===xe?Ce=t[109]:(Ce=(0,Z.jsxs)(Ws,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==G||t[111]!==K||t[112]!==re||t[113]!==le||t[114]!==k||t[115]!==_e||t[116]!==ve||t[117]!==Ce?(we=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,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:[A,G,K,re,le,_e,ve,Ce]}),t[110]=G,t[111]=K,t[112]=re,t[113]=le,t[114]=k,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var UE={current:0,total:0},WE=120,GE=100;function KE(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?pe(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(F,n,qE)}function qE(){return null}function JE(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,`
|
|
27
27
|
`,`
|
|
28
28
|
`).trim();return i.length===0||i.length>WE||i.includes(`
|
|
29
|
-
`)?null:i}function YE(e){let t=Ke(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function XE(e,t){return e.current===t.current&&e.total===t.total}function ZE(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(UE)}function QE(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=de(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 $E(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=KE(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)(UE),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(tD))},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(eD)},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(UE);return}if(!u.open||r){i.commands.clearFindMatches(),p(UE);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=YE(i);p(t=>XE(t,e)?t:e)},GE);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=Ke(i.state),t=YE(i);p(e=>XE(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=JE(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(El(t,`find`)){t.preventDefault(),u.open?ZE(i,d,p):e(!1);return}if(El(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=El(t,`find-next`),n=El(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&QE(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),ZE(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=Ke(i.state),t=YE(i);p(e=>XE(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(){ZE(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()&&QE(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()&&QE(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)&&QE(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)&&QE(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,ee,te;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})),ee=e=>d(t=>({...t,caseSensitive:e})),te=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=ee,t[67]=te):(W=t[63],G=t[64],K=t[65],ee=t[66],te=t[67]);let q;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?(q=(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)(HE,{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:ee,onWholeWordChange:te,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]=q):q=t[80],q}function eD(e){return{...e,open:!1,activeIndex:0}}function tD(e){return{...e,activeIndex:0}}var nD=300;function rD(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Yl),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Yl);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i($l(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,nD)};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 iD(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function aD(e){let t=(0,$.c)(8),{poolEntries:n}=pt(),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=()=>iD(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(iD(i));let t=()=>s(iD(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 oD(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>ru(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(iu,r)}var sD=`ok-doc-panel-width-v1`;function cD(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function lD(e){try{let t=(e??localStorage).getItem(sD);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?cD(n):320}catch{return 320}}function uD(e,t){try{(t??localStorage).setItem(sD,String(cD(e)))}catch{}}function dD(){try{return typeof localStorage>`u`?320:lD()}catch{return 320}}var fD=1024,pD=1280,mD={left:fD,right:pD};function hD(e,t,n){return e==null?t>=mD[n]?`above`:`below`:`embedded`}function gD(e){return e===`above`?`open`:`collapsed`}var _D=`ok-sidebar-pins-v2`;function vD(e){return e===`open`||e===`collapsed`}function yD(e){return e===`above`||e===`below`||e===`embedded`}function bD(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!yD(e)||!vD(t[e]))return!1;return!0}function xD(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return bD(n.left)&&(r.left=n.left),bD(n.right)&&(r.right=n.right),r}function SD(e){try{let t=(e??localStorage).getItem(_D);return t==null?{}:xD(t)}catch{return{}}}function CD(e,t){try{t.setItem(_D,JSON.stringify(e))}catch{}}function wD(e,t,n){return n[e]?.[t]??gD(t)}function TD(e,t,n,r){let i=r??localStorage,a=SD(i);return a[e]={...a[e],[t]:n},CD(a,i),a}var ED=`ok-terminal-width-v1`;function DD(e){return Number.isFinite(e)?e<320?320:e>900?900:Math.round(e):480}function OD(e){try{let t=(e??localStorage).getItem(ED);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?DD(n):480}catch{return 480}}function kD(e,t){try{(t??localStorage).setItem(ED,String(DD(e)))}catch{}}function AD(){try{return typeof localStorage>`u`?480:OD()}catch{return 480}}function jD(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`?MD: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 MD(e){return e===`synced`?`synced`:`connected`}function ND(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function PD(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=an(),a,o;t[0]!==i||t[1]!==n?(a=ND(n),o=i({id:`hnq8fP`,values:{label:a}}),t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s=o,c=`composer-context-chip-file-${n}`,l;t[4]===r?l=t[5]:(l=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r())},t[4]=r,t[5]=l);let u;t[6]===n?u=t[7]:(u=(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 inline-flex size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,children:(0,Z.jsx)(Bt,{path:n,className:`size-3`})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Cs,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=d):d=t[8];let f;t[9]!==r||t[10]!==s||t[11]!==l||t[12]!==u?(f=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s,onClick:r,onKeyDown:l,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[u,d]}),t[9]=r,t[10]=s,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===a?p=t[15]:(p=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),t[14]=a,t[15]=p);let m;return t[16]!==n||t[17]!==c||t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`span`,{"data-testid":c,title:n,className:`group/chip inline-flex max-w-[14rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[f,p]}),t[16]=n,t[17]=c,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function FD(e){let t=(0,$.c)(11),{files:n,onRemoveFile:r,className:i,children:a}=e;if(n.length===0&&a==null)return null;let o;t[0]===i?o=t[1]:(o=wi(`flex flex-wrap items-center gap-1`,i),t[0]=i,t[1]=o);let s;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,Z.jsx)(PD,{path:e,onRemove:()=>r(e)},e),t[5]=r,t[6]=e),s=n.map(e),t[2]=n,t[3]=r,t[4]=s}else s=t[4];let c;return t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsxs)(`div`,{className:o,"data-testid":`composer-context-chips`,children:[s,a]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function ID(e){let t=(0,$.c)(35),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets:a,selectedTargetId:o,onSelectTarget:s,terminal:c,terminals:l,menuEmptyState:u,onMenuOpenChange:d,menuAlign:f,triggerAriaLabel:p,testIds:m}=e,h=i===void 0?!1:i,g=f===void 0?`end`:f,{_}=an(),v=a.length>0,y=l&&l.length>0?l:null,b=y!=null||c!=null,x=v||b,S;t[0]===m?S=t[1]:(S=e=>typeof m.terminal==`function`?m.terminal(e):m.terminal,t[0]=m,t[1]=S);let C=S,w;t[2]!==r||t[3]!==n||t[4]!==h||t[5]!==m.primary?(w=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:h,onClick:r,"data-testid":m.primary,children:n}),t[2]=r,t[3]=n,t[4]=h,t[5]=m.primary,t[6]=w):w=t[6];let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Xa,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=T):T=t[7];let E;t[8]!==m.trigger||t[9]!==p?(E=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon`,"aria-label":p,"data-testid":m.trigger,children:T})}),t[8]=m.trigger,t[9]=p,t[10]=E):E=t[10];let D;t[11]!==_||t[12]!==y||t[13]!==x||t[14]!==a||t[15]!==u||t[16]!==s||t[17]!==o||t[18]!==v||t[19]!==b||t[20]!==c||t[21]!==C||t[22]!==m?(D=x?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsxs)(wc,{"aria-label":_({id:`ALhMYW`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),y?y.map(e=>(0,Z.jsxs)(Cc,{onSelect:e.onSelect,"data-testid":C(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(go,{id:ho(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):c?(0,Z.jsxs)(Cc,{onSelect:c.onSelect,"data-testid":C(`claude`),"aria-label":_({id:`AcK_r0`}),children:[(0,Z.jsx)(go,{id:ho(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`fcgvCA`})}),c.selected?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,v?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsx)(Ic,{}):null,(0,Z.jsxs)(wc,{"aria-label":_({id:`BBqGS9`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(Cc,{onSelect:()=>s(e),"data-testid":m.option(e.id),children:[(0,Z.jsx)(go,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),o===e.id?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):u,t[11]=_,t[12]=y,t[13]=x,t[14]=a,t[15]=u,t[16]=s,t[17]=o,t[18]=v,t[19]=b,t[20]=c,t[21]=C,t[22]=m,t[23]=D):D=t[23];let O;t[24]!==g||t[25]!==D||t[26]!==m.menu?(O=(0,Z.jsx)(Tc,{align:g,className:`min-w-[200px]`,"data-testid":m.menu,children:D}),t[24]=g,t[25]=D,t[26]=m.menu,t[27]=O):O=t[27];let k;t[28]!==d||t[29]!==E||t[30]!==O?(k=(0,Z.jsxs)(jc,{onOpenChange:d,children:[E,O]}),t[28]=d,t[29]=E,t[30]=O,t[31]=k):k=t[31];let A;return t[32]!==w||t[33]!==k?(A=(0,Z.jsxs)(mw,{children:[w,k]}),t[32]=w,t[33]=k,t[34]=A):A=t[34],A}function LD(e){return rl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function RD(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=Hn.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return LD(n.data.documents)}async function zD(e=ag){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await RD()>=1&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function BD(e=ag){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var VD=5200,HD=500;function UD(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function WD(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(GD),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`);n(e.matches);let t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function GD(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function KD(e,t){let n=(0,$.c)(9),[r,i]=(0,Q.useState)(0),[a,o]=(0,Q.useState)(!0),s,c;if(n[0]!==t||n[1]!==a?(s=()=>{if(!t)return;if(a){let e=setTimeout(()=>o(!1),VD);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(qD),o(!0)},HD);return()=>clearTimeout(e)},c=[a,t],n[0]=t,n[1]=a,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,Q.useEffect)(s,c),!t){let t=e[0]??``,r;return n[4]===t?r=n[5]:(r={text:t,visible:!0},n[4]=t,n[5]=r),r}let l=e[e.length>0?r%e.length:0]??``,u;return n[6]!==l||n[7]!==a?(u={text:l,visible:a},n[6]=l,n[7]=a,n[8]=u):u=n[8],u}function qD(e){return e+1}function JD(e){let t=(0,$.c)(153),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=an(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=WD(),m=so(),{states:h}=So(),{dispatch:g}=Ao(),_=Oo(),[v]=(0,Q.useState)(aO),[y,b]=(0,Q.useState)(null),x=Jy(),[S,C]=(0,Q.useState)(!0),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),[O]=(0,Q.useState)(iO),k,A;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(k=()=>{if(u||n==null)return;let e=document.documentElement,t=nO,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=pe(n),t=D.current;if(!(!e||e.isDestroyed||!t))try{let n=e.view,r=n.coordsAtPos(e.state.selection.head).bottom-(t.getBoundingClientRect().top-28);if(r<=0)return;let i=n.dom.closest(`.editor-doc-scroll`);i instanceof HTMLElement&&(i.scrollTop+=r)}catch{}})},a=D.current;if(c||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+56}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},A=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=k,t[5]=A):(k=t[4],A=t[5]),(0,Q.useEffect)(k,A);let j=(0,Q.useRef)(c),M=(0,Q.useRef)(s),N;t[6]!==c||t[7]!==s?(N=()=>{j.current=c,M.current=s},t[6]=c,t[7]=s,t[8]=N):N=t[8],(0,Q.useEffect)(N);let P,F;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>eu(()=>{j.current?M.current?.():E.current?.focus()}),F=[],t[9]=P,t[10]=F):(P=t[9],F=t[10]),(0,Q.useEffect)(P,F);let I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=[],t[11]=I):I=t[11],(0,Q.useEffect)(eO,I);let L=(0,Q.useRef)(c),R,z;t[12]===c?(R=t[13],z=t[14]):(R=()=>{let e=L.current;L.current=c,e&&!c&&E.current?.focus()},z=[c],t[12]=c,t[13]=R,t[14]=z),(0,Q.useEffect)(R,z);let B;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(B=[],t[15]=B):B=t[15];let[V,H]=(0,Q.useState)(B),[U,W]=(0,Q.useState)($D),G;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(G=[],t[16]=G):G=t[16];let[K,ee]=(0,Q.useState)(G),te;t[17]!==n||t[18]!==u?(te=u||n==null?``:fo(n),t[17]=n,t[18]=u,t[19]=te):te=t[19];let q=te,J,ne;t[20]!==q||t[21]!==U||t[22]!==u||t[23]!==S?(J=()=>{u||S||H(e=>e.includes(q)||U.has(q)?e:[...e,q])},ne=[u,S,q,U],t[20]=q,t[21]=U,t[22]=u,t[23]=S,t[24]=J,t[25]=ne):(J=t[24],ne=t[25]),(0,Q.useEffect)(J,ne);let re;t[26]!==U||t[27]!==u||t[28]!==i||t[29]!==K||t[30]!==V?(re=u?i&&!U.has(i)&&!K.includes(i)?[i]:[]:V.filter(e=>!U.has(e)&&!K.includes(e)),t[26]=U,t[27]=u,t[28]=i,t[29]=K,t[30]=V,t[31]=re):re=t[31];let ie=re,ae=Ra(d,f),oe=Ra(d,`frontmatter`),[se,ce]=(0,Q.useState)(null),[le,ue]=(0,Q.useState)(!1),de,fe;t[32]===ae?(de=t[33],fe=t[34]):(de=()=>{ae&&ce(ae)},fe=[ae],t[32]=ae,t[33]=de,t[34]=fe),(0,Q.useEffect)(de,fe);let me,he;t[35]===oe?(me=t[36],he=t[37]):(me=()=>{oe&&ce(oe)},he=[oe],t[35]=oe,t[36]=me,t[37]=he),(0,Q.useEffect)(me,he);let ge=y??v,_e;t[38]!==ge||t[39]!==_?(_e=_===null?null:rb(ge),t[38]=ge,t[39]=_,t[40]=_e):_e=t[40];let ve=_e,ye;t[41]!==ge||t[42]!==x||t[43]!==_?(ye=_!==null&&ge===null?cb(null,x):null,t[41]=ge,t[42]=x,t[43]=_,t[44]=ye):ye=t[44];let be=ve??ye,xe=be!==null,Se;t[45]!==ge||t[46]!==xe||t[47]!==h?(Se=xe?null:sb(h,ge),t[45]=ge,t[46]=xe,t[47]=h,t[48]=Se):Se=t[48];let Ce=Se,we=!w&&(!S||se!==null)&&(xe||Ce!==null),Te;t[49]===h?Te=t[50]:(Te=lo.filter(e=>h[e.id]?.installed===!0),t[49]=h,t[50]=Te);let Ee=Te,De;t[51]===h?De=t[52]:(De=lo.some(e=>h[e.id]?.installed==null),t[51]=h,t[52]=De);let Oe=De,ke=_===null?void 0:vi.map(e=>{let{displayName:t}=Vn[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:be===e,onSelect:()=>Re(e)}}),Ae;t[53]===l?Ae=t[54]:(Ae=l({id:`KYSocE`}),t[53]=l,t[54]=Ae);let je;t[55]===l?je=t[56]:(je=l({id:`7Ongq0`}),t[55]=l,t[56]=je);let Me;t[57]===l?Me=t[58]:(Me=l({id:`HPTPGr`}),t[57]=l,t[58]=Me);let Ne;t[59]===l?Ne=t[60]:(Ne=l({id:`qiRoLb`}),t[59]=l,t[60]=Ne);let Pe;t[61]!==Ae||t[62]!==je||t[63]!==Me||t[64]!==Ne?(Pe=[Ae,je,Me,Ne],t[61]=Ae,t[62]=je,t[63]=Me,t[64]=Ne,t[65]=Pe):Pe=t[65];let Fe=KD(Pe,!p&&S&&!c),Ie;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>{b(e.id),ob(e.id)},t[66]=Ie):Ie=t[66];let Le=Ie,Re=e=>{let t=nb(e);b(t),ob(t)},ze;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>{E.current?.clear(),ce(null),ue(!1),H([]),W(new Set),fw()},t[67]=ze):ze=t[67];let Be=ze,Ve;t[68]!==l||t[69]!==g||t[70]!==Ce||t[71]!==be||t[72]!==_?(Ve=e=>{if(e===null){Ss.error(l({id:`y8B54M`}));return}if(be!==null&&_!==null){try{_.launchInTerminal(e,be)}catch{Ss.error(l({id:`jBVUXo`}));return}BD(),Be();return}Ce!==null&&(T(!0),g(Ce.id,e).then(QD).finally(()=>{T(!1),Be()}))},t[68]=l,t[69]=g,t[70]=Ce,t[71]=be,t[72]=_,t[73]=Ve):Ve=t[73];let He=Ve,Ue;t[74]!==q||t[75]!==we||t[76]!==He||t[77]!==n||t[78]!==ie||t[79]!==u||t[80]!==i||t[81]!==se||t[82]!==m?(Ue=()=>{if(!we)return;let{instruction:e,mentions:t}=E.current?.getContent()??{instruction:``,mentions:[]};if(u){He(vo({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...ie,...t])].filter(e=>e!==i)}));return}let r=se?cu(se):void 0,a=se?.docName??null,o=se?a:ie.includes(q)?n??null:null,s=o===null?null:fo(o);He(vo({docName:o,workspace:m,instruction:e,mentions:[...new Set([...ie,...t])].filter(e=>e!==s),selection:r}))},t[74]=q,t[75]=we,t[76]=He,t[77]=n,t[78]=ie,t[79]=u,t[80]=i,t[81]=se,t[82]=m,t[83]=Ue):Ue=t[83];let We=Ue;if(c)return null;let Ge=``,Ke=``;if(se){let e;t[84]===se?e=t[85]:(e=lu(se,fo(se.docName).split(`/`).pop()??``),t[84]=se,t[85]=e),Ge=e;let n;t[86]===se.markdown?n=t[87]:(n=uu(se.markdown),t[86]=se.markdown,t[87]=n),Ke=n}let qe;t[88]!==l||t[89]!==u||t[90]!==o?(qe=u?null:(0,Z.jsx)(X,{type:`button`,variant:`outline`,"aria-label":l({id:`EWX92Z`}),onClick:()=>o?.(),"data-testid":`ask-ai-collapse`,className:`-top-2.5 -translate-x-1/2 absolute left-1/2 z-10 h-5 w-10 rounded-md p-0 text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100`,children:(0,Z.jsx)(Xa,{className:`size-3.5`,"aria-hidden":!0})}),t[88]=l,t[89]=u,t[90]=o,t[91]=qe):qe=t[91];let Je;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Je=e=>W(t=>{let n=new Set(t);return n.add(e),n}),t[92]=Je):Je=t[92];let Ye;t[93]!==l||t[94]!==Ge||t[95]!==Ke||t[96]!==se||t[97]!==le?(Ye=se?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:Ge,className:`group/chip inline-flex max-w-[16rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{ce(null),ue(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Ef,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,"aria-hidden":!0}),(0,Z.jsx)(Cs,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"aria-expanded":le,"aria-label":l(le?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>ue(ZD),"data-testid":`composer-selection-peek`,className:`h-auto min-h-0 min-w-0 shrink justify-start px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:Ge})})]}),le&&Ke!==``?(0,Z.jsx)(`p`,{className:`max-h-24 w-full basis-full overflow-y-auto whitespace-pre-wrap text-2xs text-muted-foreground/80 subtle-scrollbar`,"data-testid":`composer-selection-preview`,children:Ke}):null]}):null,t[93]=l,t[94]=Ge,t[95]=Ke,t[96]=se,t[97]=le,t[98]=Ye):Ye=t[98];let Xe;t[99]!==ie||t[100]!==Ye?(Xe=(0,Z.jsx)(FD,{files:ie,onRemoveFile:Je,children:Ye}),t[99]=ie,t[100]=Ye,t[101]=Xe):Xe=t[101];let Ze;t[102]===l?Ze=t[103]:(Ze=l({id:`xWEvuo`}),t[102]=l,t[103]=Ze);let Qe;t[104]!==O||t[105]!==We||t[106]!==Ze?(Qe=(0,Z.jsx)(Nw,{ref:E,ariaLabel:Ze,onEmptyChange:C,onContentChange:dw,onMentionsChange:ee,onSubmit:We,initialDoc:O,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),t[104]=O,t[105]=We,t[106]=Ze,t[107]=Qe):Qe=t[107];let $e;t[108]!==S||t[109]!==p||t[110]!==Fe?($e=S?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:wi(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!p&&`transition-opacity duration-500 ease-in-out`,Fe.visible?`opacity-100`:`opacity-0`),children:Fe.text}):null,t[108]=S,t[109]=p,t[110]=Fe,t[111]=$e):$e=t[111];let et;t[112]!==Qe||t[113]!==$e?(et=(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[Qe,$e]}),t[112]=Qe,t[113]=$e,t[114]=et):et=t[114];let tt;t[115]!==Ce||t[116]!==be?(tt=be===null?Ce?(0,Z.jsx)(go,{id:Ce.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(go,{id:ho(be),className:`size-4`,"aria-hidden":!0}),t[115]=Ce,t[116]=be,t[117]=tt):tt=t[117];let nt;t[118]!==Ce||t[119]!==be?(nt=(0,Z.jsx)(`span`,{children:be===null?Ce?(0,Z.jsx)(Y,{id:`nUNZL4`,values:{0:Ce.displayName}}):(0,Z.jsx)(Y,{id:`F-vBv0`}):(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:Vn[be].displayName}})}),t[118]=Ce,t[119]=be,t[120]=nt):nt=t[120];let rt;t[121]===w?rt=t[122]:(rt=w?(0,Z.jsx)(Fo,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[121]=w,t[122]=rt);let it;t[123]!==tt||t[124]!==nt||t[125]!==rt?(it=(0,Z.jsxs)(Z.Fragment,{children:[tt,nt,rt]}),t[123]=tt,t[124]=nt,t[125]=rt,t[126]=it):it=t[126];let at=!we,ot=xe?null:Ce?.id??null,st;t[127]===Oe?st=t[128]:(st=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:Oe?(0,Z.jsx)(Y,{id:`EcR0fl`}):(0,Z.jsx)(Y,{id:`l6OXqI`})}),t[127]=Oe,t[128]=st);let ct;t[129]===l?ct=t[130]:(ct=l({id:`nskygk`}),t[129]=l,t[130]=ct);let lt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(lt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:XD,terminal:YD},t[131]=lt):lt=t[131];let ut;t[132]!==ke||t[133]!==Le||t[134]!==Ee||t[135]!==We||t[136]!==it||t[137]!==at||t[138]!==ot||t[139]!==st||t[140]!==ct?(ut=(0,Z.jsx)(ID,{primary:it,onPrimary:We,primaryDisabled:at,installedTargets:Ee,selectedTargetId:ot,onSelectTarget:Le,terminals:ke,menuEmptyState:st,triggerAriaLabel:ct,testIds:lt}),t[132]=ke,t[133]=Le,t[134]=Ee,t[135]=We,t[136]=it,t[137]=at,t[138]=ot,t[139]=st,t[140]=ct,t[141]=ut):ut=t[141];let dt;t[142]!==et||t[143]!==ut?(dt=(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[et,ut]}),t[142]=et,t[143]=ut,t[144]=dt):dt=t[144];let ft;t[145]!==qe||t[146]!==Xe||t[147]!==dt?(ft=(0,Z.jsxs)(`div`,{ref:D,className:`pointer-events-auto group relative flex flex-col gap-1.5 rounded-2xl border border-border/60 bg-card px-3 py-2 shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[qe,Xe,dt]}),t[145]=qe,t[146]=Xe,t[147]=dt,t[148]=ft):ft=t[148];let pt=ft;if(u){let e;return t[149]===pt?e=t[150]:(e=(0,Z.jsx)(`div`,{className:`shrink-0 pt-2 pb-3`,"data-testid":`bottom-composer`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-6`,children:pt})}),t[149]=pt,t[150]=e),e}let mt;return t[151]===pt?mt=t[152]:(mt=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-20 editor-content-aligned bg-gradient-to-t from-background from-65% via-background to-transparent pt-10 pb-2`,"data-testid":`bottom-composer`,children:pt}),t[151]=pt,t[152]=mt),mt}function YD(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function XD(e){return`ask-ai-agent-option-${e}`}function ZD(e){return!e}function QD(e){e.ok&&BD()}function $D(){return new Set}function eO(){let e=tO;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function tO(e){El(e,`open-ask-ai`)&&(UD(e.target)||(e.preventDefault(),au()))}function nO(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(rO);if(e.length===0)return;let t=!1,n=()=>{t=!0};window.addEventListener(`wheel`,n,{passive:!0}),window.addEventListener(`touchstart`,n,{passive:!0});let r=performance.now(),i=()=>{if(t||performance.now()-r>=300){window.removeEventListener(`wheel`,n),window.removeEventListener(`touchstart`,n);return}for(let t of e)t.scrollTop=t.scrollHeight-t.clientHeight;requestAnimationFrame(i)};requestAnimationFrame(i)}function rO(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function iO(){return uw().doc??void 0}function aO(){return ab()}function oO(e){return!e.terminalVisible&&!e.isEmbedded&&e.activeDocName!==null}function sO(e){return!e.terminalVisible&&!e.isEmbedded}function cO(e,t={}){let n=we(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var lO=200,uO=`Outside any block`;function dO(e){let t=(0,$.c)(5),{editor:n}=e,r=Qt(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?fO(n,r):o.current?uO:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},lO),()=>{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 fO(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=cO(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=cO(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 pO(){let[e]=(0,Q.useState)(fr);return e}function mO({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:mi(e.display_name),color:Cr(e.id,Kn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Cr(e.id,Kn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function hO(e,t){return e>t}function gO(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 _O=3,vO=6e4;function yO(e,t){let n=0;for(let r of e)t-r<vO&&(n+=1);return n<_O}var bO=new Map;function xO(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 SO(e){let t=qt.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function CO(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=qt.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){vl.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=>{hO(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!hO(i,a)||l!==null&&SO(l.state))return;o=!0;let e=Date.now();for(let[t,n]of bO)n.every(t=>e-t>=vO)&&bO.delete(t);let t=(bO.get(n)??[]).filter(t=>e-t<vO);if(!yO(t,e)){bO.set(n,t),vl.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),bO.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,vl.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==qt&&xO(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new Rr({state:{init:()=>null,apply:e=>(gO(e.getMeta(qt))&&(a=i,o&&vl.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!hO(i,a)||SO(t)?!0:e.getMeta(qt)!==void 0,view:e=>{let r=t.doc;return r==null?(vl.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 wO(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 TO=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&&ui(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(tc(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Zs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push($s(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Qs(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ys(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ec(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ks(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qs(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=si(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Pr){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 Yn){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():wO(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Xs(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()}},EO=e=>new Rr({key:typeof e.pluginKey==`string`?new ri(e.pluginKey):e.pluginKey,view:t=>new TO({view:t,...e})});vr.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[EO({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 DO=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 Sr(e,{textSerializers:Tr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(tc(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Zs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push($s(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Qs(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ys(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ec(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ks(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qs(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=si(this.view,e.from,e.to);Xs({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()}},OO=e=>new Rr({key:typeof e.pluginKey==`string`?new ri(e.pluginKey):e.pluginKey,view:t=>new DO({view:t,...e})});vr.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?[OO({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 kO(e,t){return e??new ri(t)}var AO=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,jO=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),MO=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(`.`)),NO=new Set([`children`,`className`,`style`]),PO=new Set([`tabIndex`]),FO=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),IO={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function LO(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function RO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function zO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||FO.has(e)}function BO(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function VO(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:IO[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function HO(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 UO(e){return PO.has(e)}function WO(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function GO(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 KO(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||MO.has(e)?String(t):`${t}px`}function qO(e,t){jO.has(t)||e.style.removeProperty(BO(t))}function JO(e,t,n){jO.has(t)||e.style.setProperty(BO(t),KO(t,n))}function YO(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(NO.has(r)||!zO(r)||LO(r,t[r])||LO(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=RO(r);if(a==null||a===!1){UO(r)&&GO(e,r),e.removeAttribute(o);return}if(a===!0){UO(r)&&WO(e,r,!0),e.setAttribute(o,``);return}if(UO(r)){WO(e,r,a);return}e.setAttribute(o,String(a))})}function XO(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function ZO(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){qO(e,t);return}JO(e,t,a)}})}function QO(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(!LO(t,n))return;let{eventName:i,options:a}=VO(t),o=t=>{n(HO(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function $O(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);AO(()=>{let i=n.current;return XO(e,i.className,t.className),ZO(e,i.style,t.style),YO(e,i,t),r.current=QO(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 ek=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)(kO(e,`bubbleMenu`)).current;$O(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=le(),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=EO({...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,ld.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)(kO(e,`floatingMenu`)).current;$O(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=le(),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=OO({...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,ld.createPortal)(s,u.current)});var tk=[{name:`paragraph`,label:`Text`,icon:nf,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Pe,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Vt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:st,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:kt,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:Ce,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:$e,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:Le,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:mf,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function nk(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:rk},t[0]=n,t[1]=r);let{current:i,activeStates:a}=oe(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)(Xa,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=tk.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Cc,{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)(Tc,{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)(jc,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function rk(e){let t=Object.fromEntries(tk.map(t=>[t.name,t.isActive(e.editor)]));return{current:tk.find(e=>t[e.name])??tk[0],activeStates:t}}var ik=`open-knowledge:active-terminal-input`;function ak(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(ik,{detail:e}))}function ok(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;typeof n==`string`&&e(n)};return t.addEventListener(ik,n),()=>t.removeEventListener(ik,n)}function sk(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function ck(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r;if(bo())return null;let a;return t[0]!==n||t[1]!==i?(a=(0,Z.jsx)(lk,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}function lk(e){let t=(0,$.c)(11),{editor:n,shortcutEnabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Lr(),t[0]=i):i=t[0];let a=i,o,s;t[1]===r?(o=t[2],s=t[3]):(o=()=>{if(!a)return;let e=e=>{r&&El(e,`edit-with-ai`)&&(sk(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),au()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},s=[r,a],t[1]=r,t[2]=o,t[3]=s),(0,Q.useEffect)(o,s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[4]=c):c=t[4];let l;t[5]===n?l=t[6]:(l=()=>{let e=ft(n),t=pu(n);requestAnimationFrame(()=>{if(e===null||t.trim()===``){au();return}ak($r({relativePath:fo(e),instruction:``,selectionMarkdown:t,target:`claude-code`}))})},t[5]=n,t[6]=l);let u,d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(us,{className:`size-3.5`,"aria-hidden":`true`}),d=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`xWEvuo`})}),t[7]=u,t[8]=d):(u=t[7],d=t[8]);let f;return t[9]===l?f=t[10]:(f=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:l,children:[u,d]})]}),t[9]=l,t[10]=f),f}function uk(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 dk(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:ct(typeof n.src==`string`?n.src:``)}function fk(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 pk(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=an(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:mk},t[0]=n,t[1]=i),oe(i)===null)return null;let a;t[2]===r?a=t[3]:(a=r({id:`WcWS__`}),t[2]=r,t[3]=a);let o;t[4]===n?o=t[5]:(o=e=>{e.preventDefault();let t=uk(n);t&&fk(t,dk(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(wa,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a,className:`text-accent-foreground`,onMouseDown:o,children:s})}),t[7]=a,t[8]=o,t[9]=c):c=t[9];let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`WcWS__`})}),t[10]=l):l=t[10];let u;return t[11]===c?u=t[12]:(u=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Ws,{children:[c,l]})}),t[11]=c,t[12]=u),u}function mk(e){return uk(e.editor)}function hk(e){return uk(e)!==null}function gk(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function _k(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 vk(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function yk(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=an(),i;t[0]===n?i=t[1]:(i={editor:n,selector:bk},t[0]=n,t[1]=i);let a=oe(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!gk(n)||n.state.selection.empty||vk(n)||_k(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=di(wr(n.state.doc)),o=Vr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(o,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=a,t[3]=n,t[4]=o):o=t[4];let s=o,c;t[5]===r?c=t[6]:(c=r({id:`sIGbBZ`}),t[5]=r,t[6]=c);let l;t[7]===s?l=t[8]:(l=e=>{e.preventDefault(),s()},t[7]=s,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(W,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==c||t[12]!==l?(d=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":c,onMouseDown:l,disabled:a,children:u})}),t[10]=a,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;t[14]===r?f=t[15]:(f=r({id:`sIGbBZ`}),t[14]=r,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:f}),t[16]=f,t[17]=p);let m;return t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(Ws,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function bk(e){let t=e.editor;return!!(!gk(t)||t.state.selection.empty||vk(t)||_k(t))}var xk=`img, .ok-embed, .ok-video`,Sk=220,Ck=`cubic-bezier(0.23, 1, 0.32, 1)`,wk=`ok-image-align-flip`,Tk=.5;function Ek(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Dk(){return typeof requestAnimationFrame==`function`}function Ok(e){return e?e.querySelector(xk):null}function kk(e,t){if(Ek()||!Dk()){t();return}let n=Ok(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=Ok(e);if(!t)return;for(let e of t.getAnimations())e.id===wk&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<Tk)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:Sk,easing:Ck,fill:`none`});i.id=wk})}var Ak=[{value:`left`,label:`Align left`,icon:Tf},{value:`center`,label:`Align center`,icon:Cf},{value:`right`,label:`Align right`,icon:wf}];function jk(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Ut.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function Mk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Nk},t[0]=n,t[1]=r);let i=oe(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=Ak.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(!Ut.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(Pr.create(u.doc,s)),kk(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Hs,{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 Nk(e){return jk(e.editor)}function Pk(e){return jk(e)!==null}var Fk=[{name:`bold`,icon:sd,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:Ld,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Of,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:bf,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:Ee,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Fd,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function Ik(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Lk},t[0]=n,t[1]=r);let i=oe(r),a;t[2]!==i||t[3]!==n?(a=Fk.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(Hs,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(wt,{"aria-label":Dl(e.shortcutId),children:Tl(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 Lk(e){return Object.fromEntries(Fk.map(t=>[t.name,t.isActive(e.editor)]))}function Rk(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=an(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=(0,Q.useRef)(null),{folderPaths:l,loading:u,pages:d}=to(),f;t[0]===n?f=t[1]:(f=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=n.getAttributes(`link`).href??``,t[2]=n,t[3]=m);let h=m,g;t[4]===n?g=t[5]:(g=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=g);let _=g,v,y;t[6]===n?(v=t[7],y=t[8]):(v=()=>{let e=function(){n.state.selection.empty&&a(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},y=[n],t[6]=n,t[7]=v,t[8]=y),(0,Q.useEffect)(v,y);let b,x;t[9]===i?(b=t[10],x=t[11]):(b=()=>{i&&requestAnimationFrame(()=>c.current?.focus())},x=[i],t[9]=i,t[10]=b,t[11]=x),(0,Q.useEffect)(b,x);let S;t[12]!==n||t[13]!==p||t[14]!==o?(S=function(){o.trim()?n.chain().focus().setLink({href:o.trim()}).run():p&&n.chain().focus().unsetLink().run(),a(!1)},t[12]=n,t[13]=p,t[14]=o,t[15]=S):S=t[15];let C=S,w;t[16]===n?w=t[17]:(w=function(){n.chain().focus().unsetLink().run(),a(!1)},t[16]=n,t[17]=w);let T=w,E;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){s(K(e.path,null))},t[18]=E):E=t[18];let D=E,O;t[19]!==C||t[20]!==n?(O=function(e){e.key===`Enter`&&(e.preventDefault(),C()),e.key===`Escape`&&(e.preventDefault(),a(!1),n.chain().focus().run())},t[19]=C,t[20]=n,t[21]=O):O=t[21];let k=O;if(i){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]!==l||t[27]!==k||t[28]!==u||t[29]!==d||t[30]!==e||t[31]!==n||t[32]!==o?(i=(0,Z.jsx)(nt,{ref:c,type:`text`,placeholder:e,value:o,pages:d,folderPaths:l,loading:u,onValueChange:s,onSuggestionSelect:D,onKeyDown:k,"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]=l,t[27]=k,t[28]=u,t[29]=d,t[30]=e,t[31]=n,t[32]=o,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 f;t[36]===C?f=t[37]:(f=()=>{C()},t[36]=C,t[37]=f);let m;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(bd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=m):m=t[38];let g;t[39]!==a||t[40]!==f?(g=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:f,children:m}),t[39]=a,t[40]=f,t[41]=g):g=t[41];let _;t[42]!==i||t[43]!==g?(_=(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,g]}),t[42]=i,t[43]=g,t[44]=_):_=t[44];let v;t[45]!==r||t[46]!==h||t[47]!==p||t[48]!==T?(v=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),tn(h)},children:(0,Z.jsx)(Oa,{className:`size-3.5`})})}),(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),T()},children:(0,Z.jsx)(Ro,{className:`size-3.5`})})}),(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`484LKL`})})]})]}),t[45]=r,t[46]=h,t[47]=p,t[48]=T,t[49]=v):v=t[49];let y;return t[50]!==_||t[51]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[_,v]}),t[50]=_,t[51]=v,t[52]=y):y=t[52],y}let A;t[53]===r?A=t[54]:(A=r({id:`p0Iq25`}),t[53]=r,t[54]=A);let j=p?`bg-accent text-primary`:`text-accent-foreground`,M;t[55]===_?M=t[56]:(M=e=>{e.preventDefault(),s(_()),a(!0)},t[55]=_,t[56]=M);let N;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(zd,{className:`size-3.5`}),t[57]=N):N=t[57];let P;t[58]!==A||t[59]!==j||t[60]!==M?(P=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":A,className:j,onMouseDown:M,children:N})}),t[58]=A,t[59]=j,t[60]=M,t[61]=P):P=t[61];let F;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Y,{id:`yzF66j`}),t[62]=F):F=t[62];let I;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsxs)(Hs,{side:`bottom`,sideOffset:8,children:[F,(0,Z.jsx)(wt,{children:Tl(`command-palette`)})]}),t[63]=I):I=t[63];let L;return t[64]===P?L=t[65]:(L=(0,Z.jsxs)(Ws,{children:[P,I]}),t[64]=P,t[65]=L),L}function zk({editor:e}){if(Ke(e.state).query||e.isActive(`codeBlock`))return!1;if(Pk(e)||hk(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 Bk(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:Gk},t[0]=n,t[1]=l);let u=oe(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:Wk},t[2]=n,t[3]=d);let f=oe(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return si(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=Gs(e,t,()=>{Xs(e,t,{placement:`top`,strategy:`fixed`,middleware:[$s(8),tc(),Zs({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(Uk)}))},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(Hk)},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)(Mk,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(pk,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(nk,{editor:n}),(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Ik,{editor:n},o),(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Rk,{editor:n},`${o}-link`),(0,Z.jsx)(yk,{editor:n},`${o}-footnote`),(0,Z.jsx)(ck,{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)(ek,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:Vk,shouldShow:zk,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 Vk(){return document.body}function Hk(e){return e+1}function Uk(){}function Wk(e){return hk(e.editor)}function Gk(e){return Pk(e.editor)}var Kk=56,qk=`0 2px 4px rgba(0, 0, 0, 0.08)`,Jk=150,Yk=globalThis.ScrollTimeline;function Xk(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+Kk);return{startOffset:o,endOffset:o+a,maxShift:a}}var Zk=new WeakMap;function Qk(e){let t=Zk.get(e);if(t){for(let e of t.animations)e.cancel();Zk.delete(e)}}function $k(e){for(let t of Array.from(e.cells))Qk(t)}var eA=e=>e.cellIndex===0?`3`:`2`;function tA(e,t){return nA(e,t,e=>({transform:`translateY(${e}px)`}))}function nA(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 rA(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 iA(e,t,n){return rA(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:qk})}function aA(e,t){return rA(e,t,{opacity:`0`},{opacity:`1`})}function oA(e,t,n,r){let i=eA(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=Zk.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(tA(n,r),s),l=e.animate(iA(n,r,i),s),u=e.animate(aA(n,r),{...s,pseudoElement:`::before`});Zk.set(e,{key:a,animations:[c,l,u]})}function sA(e,t){let n=eA(e),r=`in|${t}|${n}`,i=Zk.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:qk}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});Zk.set(e,{key:r,animations:[a,o]})}function cA(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=Xk(a,i,c.top,c.height,l.height);if(!u){$k(s);continue}if(n){if(o<=0){$k(s);continue}for(let e of Array.from(s.cells))oA(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+Kk){$k(s);continue}for(let e of Array.from(s.cells))sA(e,d)}}var lA=vr.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new Rr({key:new ri(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||cA(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()},Jk);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&Yk)try{n=new Yk({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`))$k(t)}}}})]}});function uA(e,t){return(n,r)=>{let i=r,a=_u(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function dA(e,t){let n=hu(e);t(n.target,{tabBehavior:`append`}),Yc(n.hash)}function fA(e){return[...e?[{label:`Toggle header column`,icon:vd,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:B,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:g,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:Ro,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Md,run:e=>e.chain().focus().deleteTable().run()}]}function pA(e){return[...e?[{label:`Toggle header row`,icon:xf,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:y,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:rt,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:Ro,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Md,run:e=>e.chain().focus().deleteTable().run()}]}function mA(e){if(!e.isEditable||Ke(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 hA(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 Gs(r,e,()=>{Xs(r,e,{strategy:`absolute`,placement:t,middleware:[$s(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(gA)})},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`?Sd:Yi,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)(xc,{asChild:!0,children:(0,Z.jsx)(X,{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)(Ic,{}),(0,Z.jsxs)(Cc,{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)(Tc,{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)(jc,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function gA(){}function _A(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=mA(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=fA(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)(hA,{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=pA(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)(hA,{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 vA(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=qt.getState(e.state)?.binding;if(!t){vl.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){vl.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}vl.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return vr.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new Rr({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var yA=new WeakMap;function bA(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=fi(e.color),n.textContent=e.name,t.append(n),t}var xA={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},SA=100,CA=100,wA=3,TA=250;function EA(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function DA(e,t){let n=de(e);if(!n||t.contains(n.dom))return!1;if(!EA(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 OA(){let e=new er({extensions:hi});return{mdManager:e,text:Rt({mdManager:e}),html:Re({mdManager:e}),paste:et({mdManager:e}),drop:At({mdManager:e})}}function kA(e,t){return t?{collaboration:tt.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[vA({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:tt.configure({document:e.document}),guard:[]}}function AA(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=kA(t,r);return[...bt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),hw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,vr.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[He]}}),vr.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[p(e,{cursorBuilder:bA})]}}),vr.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[CO({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,lA]}function jA(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{yA.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=yA.get(e);if(yA.delete(e),r==null)return;let i=performance.now();vl(`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:uA(n.drop,e.onSidebarDrop)},extensions:Tg(AA(e))}}function MA(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=jA({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}=q(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var NA=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(xA),c=pO(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=pt(),p=n.configuration.name??``,[m]=(0,Q.useState)(OA),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new zn(MA({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;vl(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{dA(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=O(p)??crypto.randomUUID();_=Q.use,v=rn({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=()=>()=>{R(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)(PA,{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},PA=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:u,flashStateRef:d,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,y;t[3]!==c||t[4]!==f?(v=()=>{DA(c,f)&&h(FA)},y=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=y):(v=t[5],y=t[6]),(0,Q.useEffect)(v,y);let b;t[7]!==c||t[8]!==n.configuration.name?(b=()=>(Xe(c,n.configuration.name??null),()=>{Xe(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=b):b=t[9];let x;t[10]!==c||t[11]!==n?(x=[c,n],t[10]=c,t[11]=n,t[12]=x):x=t[12],(0,Q.useEffect)(b,x);let S;t[13]!==c||t[14]!==n.configuration.name?(S=()=>{let e=n.configuration.name;if(e)return T(e,c),()=>Et(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=S):S=t[15];let C;t[16]!==c||t[17]!==n?(C=[c,n],t[16]=c,t[17]=n,t[18]=C):C=t[18],(0,Q.useEffect)(S,C);let w;t[19]!==c||t[20]!==n.configuration.name?(w=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,Ql(e,`wysiwyg`,tu(c)),du(e,`wysiwyg`,fu(c,e))},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),Ql(e,`wysiwyg`,null),du(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=w):w=t[21];let E;t[22]!==c||t[23]!==n?(E=[c,n],t[22]=c,t[23]=n,t[24]=E):E=t[24],(0,Q.useEffect)(w,E);let D;t[25]!==c||t[26]!==n.configuration.name?(D=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=D):D=t[27];let O;t[28]!==c||t[29]!==n?(O=[c,n],t[28]=c,t[29]=n,t[30]=O):O=t[30],(0,Q.useEffect)(D,O);let k,A;t[31]===c?(k=t[32],A=t[33]):(k=()=>{let e=IA,t=null,n=()=>{if(t||c.isDestroyed)return;let n=de(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 de(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},A=[c],t[31]=c,t[32]=k,t[33]=A),(0,Q.useEffect)(k,A);let j,M;t[34]!==i||t[35]!==c?(j=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!de(c))return;e=!0;let t=H(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})),vl(`ok/editor/selection-restore-failed`,{docName:i,message:n})}l(i)};if(de(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},M=[c,i],t[34]=i,t[35]=c,t[36]=j,t[37]=M):(j=t[36],M=t[37]),(0,Q.useEffect)(j,M);let N,P;t[38]!==d||t[39]!==n.document||t[40]!==u?(N=()=>{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=>{d.current=e;let t=u.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??``))},l=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(d.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)},Ln)};c(xA);let f=()=>{if(zr(e),!_i(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(),l()},e)}return}r=n,l()};e.observe(f);let p=()=>{document.visibilityState===`visible`?_i(e,t)&&(t=Date.now(),r=Date.now(),l()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},P=[n.document,d,u],t[38]=d,t[39]=n.document,t[40]=u,t[41]=N,t[42]=P):(N=t[41],P=t[42]),(0,Q.useEffect)(N,P);let F,I;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(F=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<SA){e+=1,t=window.setTimeout(p,CA);return}r=null,o=null,e=0},u=function(e){let t=de(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=wA,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,TA)))};t=window.setTimeout(o,TA)};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=el(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)}},I=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=F,t[48]=I):(F=t[47],I=t[48]),(0,Q.useEffect)(F,I);let L,R;t[49]===c?(L=t[50],R=t[51]):(L=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=de(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(Xl,e),()=>window.removeEventListener(Xl,e)},R=[c],t[49]=c,t[50]=L,t[51]=R),(0,Q.useEffect)(L,R);let z;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(z=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:mO({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]=z):z=t[58];let B;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(B=[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]=B):B=t[65],(0,Q.useEffect)(z,B);let V,U;t[66]!==c||t[67]!==r?(V=()=>($t(c,r),()=>{$t(c,!1)}),U=[c,r],t[66]=c,t[67]=r,t[68]=V,t[69]=U):(V=t[68],U=t[69]),(0,Q.useEffect)(V,U);let W;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(W=!r&&(0,Z.jsx)(Bk,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=W):W=t[74];let G;t[75]!==c||t[76]!==r?(G=!r&&(0,Z.jsx)(_A,{editor:c}),t[75]=c,t[76]=r,t[77]=G):G=t[77];let K;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=K):K=t[78];let te;t[79]!==c||t[80]!==m?(te=(0,Z.jsx)(ee,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=te):te=t[81];let q;t[82]!==f||t[83]!==te?(q=(0,ld.createPortal)(te,f),t[82]=f,t[83]=te,t[84]=q):q=t[84];let J;t[85]===c?J=t[86]:(J=(0,Z.jsx)(dO,{editor:c}),t[85]=c,t[86]=J);let ne;t[87]===c?ne=t[88]:(ne=Ht(c),t[87]=c,t[88]=ne);let re;t[89]===ne.store?re=t[90]:(re=(0,Z.jsx)(Fe,{store:ne.store}),t[89]=ne.store,t[90]=re);let ie;return t[91]!==W||t[92]!==G||t[93]!==q||t[94]!==J||t[95]!==re||t[96]!==u?(ie=(0,Z.jsxs)(`div`,{ref:u,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:[W,G,K,q,J,re]}),t[91]=W,t[92]=G,t[93]=q,t[94]=J,t[95]=re,t[96]=u,t[97]=ie):ie=t[97],ie};function FA(e){return e+1}function IA(){return C()}var LA=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 RA(e,t,n,r,i,a){if(e==r)return[];let o=JA(e,t,n,r,i,a),s=YA(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 LA(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new LA(t,t+o,i,i),new LA(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 LA(t,t,i,i+o),new LA(n,n,i+o+c,a)]}if(c==1||l==1)return[new LA(t,n,i,a)];let u=ZA(e,t,n,r,i,a);if(u){let[o,s,c]=u;return RA(e,t,o,r,i,s).concat(RA(e,o+c,n,r,s+c,a))}return HA(e,t,n,r,i,a)}var zA=1e9,BA=0,VA=!1;function HA(e,t,n,r,i,a){let o=n-t,s=a-i;if(zA<1e9&&Math.min(o,s)>zA*16||BA>0&&Date.now()>BA)return Math.min(o,s)>zA*64?[new LA(t,n,i,a)]:QA(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);WA.reset(c),GA.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:GA,f=d?null:WA;for(let p=0;p<c;p++){if(p>zA||BA>0&&!(p&63)&&Date.now()>BA)return QA(e,t,n,r,i,a);let m=WA.advance(p,o,s,c,d,!1,l)||GA.advance(p,o,s,c,f,!0,u);if(m)return KA(e,t,n,t+m[0],r,i,a,i+m[1])}return[new LA(t,n,i,a)]}var UA=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}},WA=new UA,GA=new UA;function KA(e,t,n,r,i,a,o,s){let c=!1;return!pj(e,r)&&++r==n&&(c=!0),!pj(i,s)&&++s==o&&(c=!0),c?[new LA(t,n,a,o)]:RA(e,t,r,i,a,s).concat(RA(e,r,n,i,s,o))}function qA(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function JA(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=qA(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-+!pj(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function YA(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=qA(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-+!pj(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function XA(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;;){pj(e,s)||s++;let u=s+o;if(pj(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=JA(e,u,n,r,i+f+d.length,a),c=YA(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 ZA(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=ZA(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:XA(e,t,n,r,i,a,Math.floor(o/4),-1)}function QA(e,t,n,r,i,a){VA=!0;let o=n-t,s=a-i,c;if(o<s){let s=XA(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=XA(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new LA(t,n,i,a)];let[l,u,d]=c;return RA(e,t,l,r,i,u).concat(RA(e,l+d,n,r,u+d,a))}function $A(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 LA(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function ej(e,t,n){for(;;){$A(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=JA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new LA(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=YA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new LA(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 LA(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 LA(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function tj(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=cj(t,a.fromA,l),f=sj(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 LA(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=sj(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new LA(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=cj(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new LA(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=uj(n,a.fromB,a.toB),r,o=t<0?-1:lj(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=uj(t,a.fromA,a.toA),r,o=n<0?-1:lj(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 $A(e,3),e}var nj;try{nj=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function rj(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function ij(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!rj(n):nj?!dj(n)||t==e.length-1?+!!nj.test(String.fromCharCode(n)):nj.test(e.slice(t,t+2))?2:0:0}function aj(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!rj(n):nj?!fj(n)||t==1?+!!nj.test(String.fromCharCode(n)):nj.test(e.slice(t-2,t))?2:0:0}var oj=8;function sj(e,t,n){if(t==e.length||!aj(e,t))return t;for(let r=t,i=t+n,a=0;a<oj;a++){let t=ij(e,r);if(!t||r+t>i)return r;r+=t}return t}function cj(e,t,n){if(!t||!ij(e,t))return t;for(let r=t,i=t-n,a=0;a<oj;a++){let t=aj(e,r);if(!t||r-t<i)return r;r-=t}return t}function lj(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function uj(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var dj=e=>e>=55296&&e<=56319,fj=e=>e>=56320&&e<=57343;function pj(e,t){return!t||t==e.length||!dj(e.charCodeAt(t-1))||!fj(e.charCodeAt(t))}function mj(e,t,n){let r=n?.override;return r?r(e,t):(zA=(n?.scanLimit??1e9)>>1,BA=n?.timeout?Date.now()+n.timeout:0,VA=!1,ej(e,t,RA(e,0,e.length,t,0,t.length)))}function hj(){return!VA}function gj(e,t,n){return tj(mj(e,t,n),e,t)}var _j=Ll.define({combine:e=>e[0]}),vj=Rl.define(),yj=Ll.define(),bj=Ml.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(vj)&&(e=n.value);for(let n of t.state.facet(yj))e=n(e,t);return e}});function xj(e){let t=e.field(bj,!1);if(!t)return null;let n=e.facet(_j);return{chunks:t,side:n?n.side:null}}var Sj=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 Tj(gj(e.toString(),t.toString(),n),e,t,0,0,hj())}static updateA(e,t,n,r,i){return kj(Oj(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return kj(Oj(e,r,!1,t.length),e,t,n,i)}};function Cj(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 wj(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 Tj(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Cj(c.fromA+r,c.fromB+i,t,n),[d,f]=wj(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]=Cj(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]=wj(a.toA+r,a.toB+i,t,n),s++}o.push(new Sj(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Ej=1e3;function Dj(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 Oj(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>Ej&&([l,d]=Dj(e,a-Ej,n,!0)),o<t.length-Ej&&([u,f]=Dj(e,o+Ej,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 kj(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=gj(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Tj(h,n,r,d,f,hj()))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 Aj={scanLimit:500},jj=zl.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Vj(e))}update(e){(e.docChanged||e.viewportChanged||Nj(e.startState,e.state)||Pj(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Vj(e.view))}},{decorations:e=>e.deco}),Mj=kl.low(Ul({class:`cm-changeGutter`,markers:e=>e.plugin(jj)?.gutter||Gl.empty}));function Nj(e,t){return e.field(bj,!1)!=t.field(bj,!1)}function Pj(e,t){return e.facet(_j)!=t.facet(_j)}var Fj=Fl.line({class:`cm-changedLine`}),Ij=Fl.mark({class:`cm-changedText`}),Lj=Fl.mark({tagName:`ins`,class:`cm-insertedLine`}),Rj=Fl.mark({tagName:`del`,class:`cm-deletedLine`}),zj=new class extends Hl{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Bj(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,Fj),i.add(o,s,n?Rj:Lj),a&&a.add(o,o,zj);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,Fj),a&&a.add(u,u,zj);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,Ij),s<t)c++;else break}u=t}}}function Vj(e){let t=e.state.field(bj),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(_j),o=n==`a`,s=new Il,c=i?new Il: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))&&Bj(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var Hj=class extends Ol{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}},Uj=Rl.define({map:(e,t)=>e.map(t)}),Wj=Ml.define({create:()=>Fl.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Uj))return e.value;return e.map(t.changes)},provide:e=>Vl.decorations.from(e)}),Gj=.01;function Kj(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 qj(e,t,n){let r=new Il,i=new Il,a=e.state.field(Wj).iter(),o=t.state.field(Wj).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<-Gj?(l-=n,r.add(s,s,Fl.widget({widget:new Hj(-n),block:!0,side:-1}))):n>Gj&&(u+=n,i.add(c,c,Fl.widget({widget:new Hj(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<Gj?r.add(e.state.doc.length,e.state.doc.length,Fl.widget({widget:new Hj(-p),block:!0,side:1})):p>Gj&&i.add(t.state.doc.length,t.state.doc.length,Fl.widget({widget:new Hj(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Kj(m,e.state.field(Wj))||e.dispatch({effects:Uj.of(m)}),Kj(h,t.state.field(Wj))||t.dispatch({effects:Uj.of(h)})}var Jj=Rl.define({map:(e,t)=>t.mapPos(e)}),Yj=class extends Ol{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:Jj.of(n)});let{side:r,sibling:i}=e.state.facet(_j);i&&i().dispatch({effects:Jj.of(Xj(n,e.state.field(bj),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Xj(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 Zj=Ml.define({create(e){return Fl.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Jj)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Vl.decorations.from(e)});function Qj({margin:e=3,minSize:t=4}){return Zj.init(n=>$j(n,e,t))}function $j(e,t,n){let r=new Il,i=e.facet(_j).side==`a`,a=e.field(bj),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,Fl.replace({widget:new Yj(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var eM=Vl.styleModule.of(new Wl({".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`}})),tM=Vl.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`}}),nM=new Bl,rM=new Bl,iM=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Aj;let t=[kl.low(jj),tM,eM,Wj,Vl.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Uj)))&&this.measure()})],n=[_j.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Mj);let r=jl.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Vl.editorAttributes.of({class:`cm-merge-a`}),rM.of(n),t]}),i=[_j.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Mj);let a=jl.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Vl.editorAttributes.of({class:`cm-merge-b`}),rM.of(i),t]});this.chunks=Sj.build(r.doc,a.doc,this.diffConf);let o=[bj.init(()=>this.chunks),nM.of(e.collapseUnchanged?Qj(e.collapseUnchanged):[])];r=r.update({effects:Rl.appendConfig.of(o)}).state,a=a.update({effects:Rl.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 Vl({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Vl({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),Al.empty(e[0].startState.doc.length));this.chunks=t==this.a?Sj.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Sj.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:vj.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:vj.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(_j),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(rM.reconfigure([_j.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Mj:[]])),a.push(rM.reconfigure([_j.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Mj:[]]))}if(r){let t=nM.reconfigure(e.collapseUnchanged?Qj(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(){qj(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=aM(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=aM(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 aM(e){let t=e.nextSibling;return e.remove(),t}var oM=new class extends Hl{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},sM=kl.low(Ul({class:`cm-changeGutter`,markers:e=>e.plugin(jj)?.gutter||Gl.empty,widgetMarker:(e,t)=>t instanceof fM?oM:null}));function cM(e){let t=typeof e.original==`string`?Pl.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Aj;return[kl.low(jj),_M,tM,Vl.editorAttributes.of({class:`cm-merge-b`}),yj.of((e,t)=>{let r=t.effects.find(e=>e.is(lM));return r&&(e=Sj.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Sj.updateB(e,t.state.field(uM),t.newDoc,t.changes,n)),e}),_j.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?CM:void 0,side:`b`}),uM.init(()=>t),e.gutter===!1?[]:sM,e.collapseUnchanged?Qj(e.collapseUnchanged):[],bj.init(e=>Sj.build(t,e.doc,n))]}var lM=Rl.define(),uM=Ml.define({create:()=>Pl.empty,update(e,t){for(let n of t.effects)n.is(lM)&&(e=n.value.doc);return e}}),dM=new WeakMap,fM=class extends Ol{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 pM(e,t,n){let r=dM.get(t.changes);if(r)return r;let i=Fl.widget({block:!0,side:-1,widget:new fM(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(_j),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(),mM(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),hM(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(uM).sliceString(t.fromA,t.endA),u=a&&e.facet(Kl),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)==`
|
|
29
|
+
`)?null:i}function YE(e){let t=Ke(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function XE(e,t){return e.current===t.current&&e.total===t.total}function ZE(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(UE)}function QE(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=de(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 $E(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=KE(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)(UE),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(tD))},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(eD)},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(UE);return}if(!u.open||r){i.commands.clearFindMatches(),p(UE);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=YE(i);p(t=>XE(t,e)?t:e)},GE);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=Ke(i.state),t=YE(i);p(e=>XE(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=JE(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(El(t,`find`)){t.preventDefault(),u.open?ZE(i,d,p):e(!1);return}if(El(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=El(t,`find-next`),n=El(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&QE(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),ZE(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=Ke(i.state),t=YE(i);p(e=>XE(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(){ZE(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()&&QE(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()&&QE(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)&&QE(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)&&QE(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,ee,te;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})),ee=e=>d(t=>({...t,caseSensitive:e})),te=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=ee,t[67]=te):(W=t[63],G=t[64],K=t[65],ee=t[66],te=t[67]);let q;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?(q=(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)(HE,{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:ee,onWholeWordChange:te,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]=q):q=t[80],q}function eD(e){return{...e,open:!1,activeIndex:0}}function tD(e){return{...e,activeIndex:0}}var nD=300;function rD(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Yl),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Yl);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i($l(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,nD)};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 iD(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function aD(e){let t=(0,$.c)(8),{poolEntries:n}=pt(),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=()=>iD(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(iD(i));let t=()=>s(iD(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 oD(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>ru(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(iu,r)}var sD=`ok-doc-panel-width-v1`;function cD(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function lD(e){try{let t=(e??localStorage).getItem(sD);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?cD(n):320}catch{return 320}}function uD(e,t){try{(t??localStorage).setItem(sD,String(cD(e)))}catch{}}function dD(){try{return typeof localStorage>`u`?320:lD()}catch{return 320}}var fD=1024,pD=1280,mD={left:fD,right:pD};function hD(e,t,n){return e==null?t>=mD[n]?`above`:`below`:`embedded`}function gD(e){return e===`above`?`open`:`collapsed`}var _D=`ok-sidebar-pins-v2`;function vD(e){return e===`open`||e===`collapsed`}function yD(e){return e===`above`||e===`below`||e===`embedded`}function bD(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!yD(e)||!vD(t[e]))return!1;return!0}function xD(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return bD(n.left)&&(r.left=n.left),bD(n.right)&&(r.right=n.right),r}function SD(e){try{let t=(e??localStorage).getItem(_D);return t==null?{}:xD(t)}catch{return{}}}function CD(e,t){try{t.setItem(_D,JSON.stringify(e))}catch{}}function wD(e,t,n){return n[e]?.[t]??gD(t)}function TD(e,t,n,r){let i=r??localStorage,a=SD(i);return a[e]={...a[e],[t]:n},CD(a,i),a}var ED=`ok-terminal-width-v1`;function DD(e){return Number.isFinite(e)?e<320?320:e>900?900:Math.round(e):480}function OD(e){try{let t=(e??localStorage).getItem(ED);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?DD(n):480}catch{return 480}}function kD(e,t){try{(t??localStorage).setItem(ED,String(DD(e)))}catch{}}function AD(){try{return typeof localStorage>`u`?480:OD()}catch{return 480}}function jD(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`?MD: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 MD(e){return e===`synced`?`synced`:`connected`}function ND(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function PD(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=an(),a,o;t[0]!==i||t[1]!==n?(a=ND(n),o=i({id:`hnq8fP`,values:{label:a}}),t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s=o,c=`composer-context-chip-file-${n}`,l;t[4]===r?l=t[5]:(l=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r())},t[4]=r,t[5]=l);let u;t[6]===n?u=t[7]:(u=(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 inline-flex size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,children:(0,Z.jsx)(Bt,{path:n,className:`size-3`})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Cs,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=d):d=t[8];let f;t[9]!==r||t[10]!==s||t[11]!==l||t[12]!==u?(f=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s,onClick:r,onKeyDown:l,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[u,d]}),t[9]=r,t[10]=s,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===a?p=t[15]:(p=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),t[14]=a,t[15]=p);let m;return t[16]!==n||t[17]!==c||t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`span`,{"data-testid":c,title:n,className:`group/chip inline-flex max-w-[14rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[f,p]}),t[16]=n,t[17]=c,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function FD(e){let t=(0,$.c)(11),{files:n,onRemoveFile:r,className:i,children:a}=e;if(n.length===0&&a==null)return null;let o;t[0]===i?o=t[1]:(o=wi(`flex flex-wrap items-center gap-1`,i),t[0]=i,t[1]=o);let s;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,Z.jsx)(PD,{path:e,onRemove:()=>r(e)},e),t[5]=r,t[6]=e),s=n.map(e),t[2]=n,t[3]=r,t[4]=s}else s=t[4];let c;return t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsxs)(`div`,{className:o,"data-testid":`composer-context-chips`,children:[s,a]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function ID(e){let t=(0,$.c)(35),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets:a,selectedTargetId:o,onSelectTarget:s,terminal:c,terminals:l,menuEmptyState:u,onMenuOpenChange:d,menuAlign:f,triggerAriaLabel:p,testIds:m}=e,h=i===void 0?!1:i,g=f===void 0?`end`:f,{_}=an(),v=a.length>0,y=l&&l.length>0?l:null,b=y!=null||c!=null,x=v||b,S;t[0]===m?S=t[1]:(S=e=>typeof m.terminal==`function`?m.terminal(e):m.terminal,t[0]=m,t[1]=S);let C=S,w;t[2]!==r||t[3]!==n||t[4]!==h||t[5]!==m.primary?(w=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:h,onClick:r,"data-testid":m.primary,children:n}),t[2]=r,t[3]=n,t[4]=h,t[5]=m.primary,t[6]=w):w=t[6];let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Xa,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=T):T=t[7];let E;t[8]!==m.trigger||t[9]!==p?(E=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon`,"aria-label":p,"data-testid":m.trigger,children:T})}),t[8]=m.trigger,t[9]=p,t[10]=E):E=t[10];let D;t[11]!==_||t[12]!==y||t[13]!==x||t[14]!==a||t[15]!==u||t[16]!==s||t[17]!==o||t[18]!==v||t[19]!==b||t[20]!==c||t[21]!==C||t[22]!==m?(D=x?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsxs)(wc,{"aria-label":_({id:`ALhMYW`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),y?y.map(e=>(0,Z.jsxs)(Cc,{onSelect:e.onSelect,"data-testid":C(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(go,{id:ho(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):c?(0,Z.jsxs)(Cc,{onSelect:c.onSelect,"data-testid":C(`claude`),"aria-label":_({id:`AcK_r0`}),children:[(0,Z.jsx)(go,{id:ho(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`fcgvCA`})}),c.selected?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,v?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsx)(Ic,{}):null,(0,Z.jsxs)(wc,{"aria-label":_({id:`BBqGS9`}),children:[(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(Cc,{onSelect:()=>s(e),"data-testid":m.option(e.id),children:[(0,Z.jsx)(go,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),o===e.id?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):u,t[11]=_,t[12]=y,t[13]=x,t[14]=a,t[15]=u,t[16]=s,t[17]=o,t[18]=v,t[19]=b,t[20]=c,t[21]=C,t[22]=m,t[23]=D):D=t[23];let O;t[24]!==g||t[25]!==D||t[26]!==m.menu?(O=(0,Z.jsx)(Tc,{align:g,className:`min-w-[200px]`,"data-testid":m.menu,children:D}),t[24]=g,t[25]=D,t[26]=m.menu,t[27]=O):O=t[27];let k;t[28]!==d||t[29]!==E||t[30]!==O?(k=(0,Z.jsxs)(jc,{onOpenChange:d,children:[E,O]}),t[28]=d,t[29]=E,t[30]=O,t[31]=k):k=t[31];let A;return t[32]!==w||t[33]!==k?(A=(0,Z.jsxs)(mw,{children:[w,k]}),t[32]=w,t[33]=k,t[34]=A):A=t[34],A}function LD(e){return rl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function RD(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=Hn.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return LD(n.data.documents)}async function zD(e=ag){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await RD()>=1&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function BD(e=ag){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var VD=5200,HD=500;function UD(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function WD(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(GD),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`);n(e.matches);let t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function GD(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function KD(e,t){let n=(0,$.c)(9),[r,i]=(0,Q.useState)(0),[a,o]=(0,Q.useState)(!0),s,c;if(n[0]!==t||n[1]!==a?(s=()=>{if(!t)return;if(a){let e=setTimeout(()=>o(!1),VD);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(qD),o(!0)},HD);return()=>clearTimeout(e)},c=[a,t],n[0]=t,n[1]=a,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,Q.useEffect)(s,c),!t){let t=e[0]??``,r;return n[4]===t?r=n[5]:(r={text:t,visible:!0},n[4]=t,n[5]=r),r}let l=e[e.length>0?r%e.length:0]??``,u;return n[6]!==l||n[7]!==a?(u={text:l,visible:a},n[6]=l,n[7]=a,n[8]=u):u=n[8],u}function qD(e){return e+1}function JD(e){let t=(0,$.c)(153),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=an(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=WD(),m=so(),{states:h}=So(),{dispatch:g}=Ao(),_=Oo(),[v]=(0,Q.useState)(aO),[y,b]=(0,Q.useState)(null),x=Jy(),[S,C]=(0,Q.useState)(!0),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),[O]=(0,Q.useState)(iO),k,A;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(k=()=>{if(u||n==null)return;let e=document.documentElement,t=nO,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=pe(n),t=D.current;if(!(!e||e.isDestroyed||!t))try{let n=e.view,r=n.coordsAtPos(e.state.selection.head).bottom-(t.getBoundingClientRect().top-28);if(r<=0)return;let i=n.dom.closest(`.editor-doc-scroll`);i instanceof HTMLElement&&(i.scrollTop+=r)}catch{}})},a=D.current;if(c||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+56}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},A=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=k,t[5]=A):(k=t[4],A=t[5]),(0,Q.useEffect)(k,A);let j=(0,Q.useRef)(c),M=(0,Q.useRef)(s),N;t[6]!==c||t[7]!==s?(N=()=>{j.current=c,M.current=s},t[6]=c,t[7]=s,t[8]=N):N=t[8],(0,Q.useEffect)(N);let P,F;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>eu(()=>{j.current?M.current?.():E.current?.focus()}),F=[],t[9]=P,t[10]=F):(P=t[9],F=t[10]),(0,Q.useEffect)(P,F);let I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=[],t[11]=I):I=t[11],(0,Q.useEffect)(eO,I);let L=(0,Q.useRef)(c),R,z;t[12]===c?(R=t[13],z=t[14]):(R=()=>{let e=L.current;L.current=c,e&&!c&&E.current?.focus()},z=[c],t[12]=c,t[13]=R,t[14]=z),(0,Q.useEffect)(R,z);let B;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(B=[],t[15]=B):B=t[15];let[V,H]=(0,Q.useState)(B),[U,W]=(0,Q.useState)($D),G;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(G=[],t[16]=G):G=t[16];let[K,ee]=(0,Q.useState)(G),te;t[17]!==n||t[18]!==u?(te=u||n==null?``:fo(n),t[17]=n,t[18]=u,t[19]=te):te=t[19];let q=te,J,ne;t[20]!==q||t[21]!==U||t[22]!==u||t[23]!==S?(J=()=>{u||S||H(e=>e.includes(q)||U.has(q)?e:[...e,q])},ne=[u,S,q,U],t[20]=q,t[21]=U,t[22]=u,t[23]=S,t[24]=J,t[25]=ne):(J=t[24],ne=t[25]),(0,Q.useEffect)(J,ne);let re;t[26]!==U||t[27]!==u||t[28]!==i||t[29]!==K||t[30]!==V?(re=u?i&&!U.has(i)&&!K.includes(i)?[i]:[]:V.filter(e=>!U.has(e)&&!K.includes(e)),t[26]=U,t[27]=u,t[28]=i,t[29]=K,t[30]=V,t[31]=re):re=t[31];let ie=re,ae=Ra(d,f),oe=Ra(d,`frontmatter`),[se,ce]=(0,Q.useState)(null),[le,ue]=(0,Q.useState)(!1),de,fe;t[32]===ae?(de=t[33],fe=t[34]):(de=()=>{ae&&ce(ae)},fe=[ae],t[32]=ae,t[33]=de,t[34]=fe),(0,Q.useEffect)(de,fe);let me,he;t[35]===oe?(me=t[36],he=t[37]):(me=()=>{oe&&ce(oe)},he=[oe],t[35]=oe,t[36]=me,t[37]=he),(0,Q.useEffect)(me,he);let ge=y??v,_e;t[38]!==ge||t[39]!==_?(_e=_===null?null:rb(ge),t[38]=ge,t[39]=_,t[40]=_e):_e=t[40];let ve=_e,ye;t[41]!==ge||t[42]!==x||t[43]!==_?(ye=_!==null&&ge===null?cb(null,x):null,t[41]=ge,t[42]=x,t[43]=_,t[44]=ye):ye=t[44];let be=ve??ye,xe=be!==null,Se;t[45]!==ge||t[46]!==xe||t[47]!==h?(Se=xe?null:sb(h,ge),t[45]=ge,t[46]=xe,t[47]=h,t[48]=Se):Se=t[48];let Ce=Se,we=!w&&(!S||se!==null)&&(xe||Ce!==null),Te;t[49]===h?Te=t[50]:(Te=lo.filter(e=>h[e.id]?.installed===!0),t[49]=h,t[50]=Te);let Ee=Te,De;t[51]===h?De=t[52]:(De=lo.some(e=>h[e.id]?.installed==null),t[51]=h,t[52]=De);let Oe=De,ke=_===null?void 0:vi.map(e=>{let{displayName:t}=Vn[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:be===e,onSelect:()=>Re(e)}}),Ae;t[53]===l?Ae=t[54]:(Ae=l({id:`KYSocE`}),t[53]=l,t[54]=Ae);let je;t[55]===l?je=t[56]:(je=l({id:`7Ongq0`}),t[55]=l,t[56]=je);let Me;t[57]===l?Me=t[58]:(Me=l({id:`HPTPGr`}),t[57]=l,t[58]=Me);let Ne;t[59]===l?Ne=t[60]:(Ne=l({id:`qiRoLb`}),t[59]=l,t[60]=Ne);let Pe;t[61]!==Ae||t[62]!==je||t[63]!==Me||t[64]!==Ne?(Pe=[Ae,je,Me,Ne],t[61]=Ae,t[62]=je,t[63]=Me,t[64]=Ne,t[65]=Pe):Pe=t[65];let Fe=KD(Pe,!p&&S&&!c),Ie;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>{b(e.id),ob(e.id)},t[66]=Ie):Ie=t[66];let Le=Ie,Re=e=>{let t=nb(e);b(t),ob(t)},ze;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>{E.current?.clear(),ce(null),ue(!1),H([]),W(new Set),fw()},t[67]=ze):ze=t[67];let Be=ze,Ve;t[68]!==l||t[69]!==g||t[70]!==Ce||t[71]!==be||t[72]!==_?(Ve=e=>{if(e===null){Ss.error(l({id:`y8B54M`}));return}if(be!==null&&_!==null){try{_.launchInTerminal(e,be)}catch{Ss.error(l({id:`jBVUXo`}));return}BD(),Be();return}Ce!==null&&(T(!0),g(Ce.id,e).then(QD).finally(()=>{T(!1),Be()}))},t[68]=l,t[69]=g,t[70]=Ce,t[71]=be,t[72]=_,t[73]=Ve):Ve=t[73];let He=Ve,Ue;t[74]!==q||t[75]!==we||t[76]!==He||t[77]!==n||t[78]!==ie||t[79]!==u||t[80]!==i||t[81]!==se||t[82]!==m?(Ue=()=>{if(!we)return;let{instruction:e,mentions:t}=E.current?.getContent()??{instruction:``,mentions:[]};if(u){He(vo({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...ie,...t])].filter(e=>e!==i)}));return}let r=se?cu(se):void 0,a=se?.docName??null,o=se?a:ie.includes(q)?n??null:null,s=o===null?null:fo(o);He(vo({docName:o,workspace:m,instruction:e,mentions:[...new Set([...ie,...t])].filter(e=>e!==s),selection:r}))},t[74]=q,t[75]=we,t[76]=He,t[77]=n,t[78]=ie,t[79]=u,t[80]=i,t[81]=se,t[82]=m,t[83]=Ue):Ue=t[83];let We=Ue;if(c)return null;let Ge=``,Ke=``;if(se){let e;t[84]===se?e=t[85]:(e=lu(se,fo(se.docName).split(`/`).pop()??``),t[84]=se,t[85]=e),Ge=e;let n;t[86]===se.markdown?n=t[87]:(n=uu(se.markdown),t[86]=se.markdown,t[87]=n),Ke=n}let qe;t[88]!==l||t[89]!==u||t[90]!==o?(qe=u?null:(0,Z.jsx)(X,{type:`button`,variant:`outline`,"aria-label":l({id:`EWX92Z`}),onClick:()=>o?.(),"data-testid":`ask-ai-collapse`,className:`-top-2.5 -translate-x-1/2 absolute left-1/2 z-10 h-5 w-10 rounded-md p-0 text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100`,children:(0,Z.jsx)(Xa,{className:`size-3.5`,"aria-hidden":!0})}),t[88]=l,t[89]=u,t[90]=o,t[91]=qe):qe=t[91];let Je;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Je=e=>W(t=>{let n=new Set(t);return n.add(e),n}),t[92]=Je):Je=t[92];let Ye;t[93]!==l||t[94]!==Ge||t[95]!==Ke||t[96]!==se||t[97]!==le?(Ye=se?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:Ge,className:`group/chip inline-flex max-w-[16rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{ce(null),ue(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Ef,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,"aria-hidden":!0}),(0,Z.jsx)(Cs,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"aria-expanded":le,"aria-label":l(le?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>ue(ZD),"data-testid":`composer-selection-peek`,className:`h-auto min-h-0 min-w-0 shrink justify-start px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:Ge})})]}),le&&Ke!==``?(0,Z.jsx)(`p`,{className:`max-h-24 w-full basis-full overflow-y-auto whitespace-pre-wrap text-2xs text-muted-foreground/80 subtle-scrollbar`,"data-testid":`composer-selection-preview`,children:Ke}):null]}):null,t[93]=l,t[94]=Ge,t[95]=Ke,t[96]=se,t[97]=le,t[98]=Ye):Ye=t[98];let Xe;t[99]!==ie||t[100]!==Ye?(Xe=(0,Z.jsx)(FD,{files:ie,onRemoveFile:Je,children:Ye}),t[99]=ie,t[100]=Ye,t[101]=Xe):Xe=t[101];let Ze;t[102]===l?Ze=t[103]:(Ze=l({id:`xWEvuo`}),t[102]=l,t[103]=Ze);let Qe;t[104]!==O||t[105]!==We||t[106]!==Ze?(Qe=(0,Z.jsx)(Nw,{ref:E,ariaLabel:Ze,onEmptyChange:C,onContentChange:dw,onMentionsChange:ee,onSubmit:We,initialDoc:O,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),t[104]=O,t[105]=We,t[106]=Ze,t[107]=Qe):Qe=t[107];let $e;t[108]!==S||t[109]!==p||t[110]!==Fe?($e=S?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:wi(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!p&&`transition-opacity duration-500 ease-in-out`,Fe.visible?`opacity-100`:`opacity-0`),children:Fe.text}):null,t[108]=S,t[109]=p,t[110]=Fe,t[111]=$e):$e=t[111];let et;t[112]!==Qe||t[113]!==$e?(et=(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[Qe,$e]}),t[112]=Qe,t[113]=$e,t[114]=et):et=t[114];let tt;t[115]!==Ce||t[116]!==be?(tt=be===null?Ce?(0,Z.jsx)(go,{id:Ce.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(go,{id:ho(be),className:`size-4`,"aria-hidden":!0}),t[115]=Ce,t[116]=be,t[117]=tt):tt=t[117];let nt;t[118]!==Ce||t[119]!==be?(nt=(0,Z.jsx)(`span`,{children:be===null?Ce?(0,Z.jsx)(Y,{id:`nUNZL4`,values:{0:Ce.displayName}}):(0,Z.jsx)(Y,{id:`F-vBv0`}):(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:Vn[be].displayName}})}),t[118]=Ce,t[119]=be,t[120]=nt):nt=t[120];let rt;t[121]===w?rt=t[122]:(rt=w?(0,Z.jsx)(Fo,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[121]=w,t[122]=rt);let it;t[123]!==tt||t[124]!==nt||t[125]!==rt?(it=(0,Z.jsxs)(Z.Fragment,{children:[tt,nt,rt]}),t[123]=tt,t[124]=nt,t[125]=rt,t[126]=it):it=t[126];let at=!we,ot=xe?null:Ce?.id??null,st;t[127]===Oe?st=t[128]:(st=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:Oe?(0,Z.jsx)(Y,{id:`EcR0fl`}):(0,Z.jsx)(Y,{id:`l6OXqI`})}),t[127]=Oe,t[128]=st);let ct;t[129]===l?ct=t[130]:(ct=l({id:`nskygk`}),t[129]=l,t[130]=ct);let lt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(lt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:XD,terminal:YD},t[131]=lt):lt=t[131];let ut;t[132]!==ke||t[133]!==Le||t[134]!==Ee||t[135]!==We||t[136]!==it||t[137]!==at||t[138]!==ot||t[139]!==st||t[140]!==ct?(ut=(0,Z.jsx)(ID,{primary:it,onPrimary:We,primaryDisabled:at,installedTargets:Ee,selectedTargetId:ot,onSelectTarget:Le,terminals:ke,menuEmptyState:st,triggerAriaLabel:ct,testIds:lt}),t[132]=ke,t[133]=Le,t[134]=Ee,t[135]=We,t[136]=it,t[137]=at,t[138]=ot,t[139]=st,t[140]=ct,t[141]=ut):ut=t[141];let dt;t[142]!==et||t[143]!==ut?(dt=(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[et,ut]}),t[142]=et,t[143]=ut,t[144]=dt):dt=t[144];let ft;t[145]!==qe||t[146]!==Xe||t[147]!==dt?(ft=(0,Z.jsxs)(`div`,{ref:D,className:`pointer-events-auto group relative flex flex-col gap-1.5 rounded-2xl border border-border/60 bg-card px-3 py-2 shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[qe,Xe,dt]}),t[145]=qe,t[146]=Xe,t[147]=dt,t[148]=ft):ft=t[148];let pt=ft;if(u){let e;return t[149]===pt?e=t[150]:(e=(0,Z.jsx)(`div`,{className:`shrink-0 pt-2 pb-3`,"data-testid":`bottom-composer`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-6`,children:pt})}),t[149]=pt,t[150]=e),e}let mt;return t[151]===pt?mt=t[152]:(mt=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-[var(--conflict-footer-height,0px)] z-20 editor-content-aligned bg-gradient-to-t from-background from-65% via-background to-transparent pt-10 pb-2`,"data-testid":`bottom-composer`,children:pt}),t[151]=pt,t[152]=mt),mt}function YD(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function XD(e){return`ask-ai-agent-option-${e}`}function ZD(e){return!e}function QD(e){e.ok&&BD()}function $D(){return new Set}function eO(){let e=tO;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function tO(e){El(e,`open-ask-ai`)&&(UD(e.target)||(e.preventDefault(),au()))}function nO(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(rO);if(e.length===0)return;let t=!1,n=()=>{t=!0};window.addEventListener(`wheel`,n,{passive:!0}),window.addEventListener(`touchstart`,n,{passive:!0});let r=performance.now(),i=()=>{if(t||performance.now()-r>=300){window.removeEventListener(`wheel`,n),window.removeEventListener(`touchstart`,n);return}for(let t of e)t.scrollTop=t.scrollHeight-t.clientHeight;requestAnimationFrame(i)};requestAnimationFrame(i)}function rO(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function iO(){return uw().doc??void 0}function aO(){return ab()}function oO(e){return!e.terminalVisible&&!e.isEmbedded&&e.activeDocName!==null}function sO(e){return!e.terminalVisible&&!e.isEmbedded}function cO(e,t={}){let n=we(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var lO=200,uO=`Outside any block`;function dO(e){let t=(0,$.c)(5),{editor:n}=e,r=Qt(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?fO(n,r):o.current?uO:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},lO),()=>{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 fO(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=cO(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=cO(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 pO(){let[e]=(0,Q.useState)(fr);return e}function mO({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:mi(e.display_name),color:Cr(e.id,Kn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Cr(e.id,Kn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function hO(e,t){return e>t}function gO(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 _O=3,vO=6e4;function yO(e,t){let n=0;for(let r of e)t-r<vO&&(n+=1);return n<_O}var bO=new Map;function xO(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 SO(e){let t=qt.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function CO(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=qt.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){vl.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=>{hO(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!hO(i,a)||l!==null&&SO(l.state))return;o=!0;let e=Date.now();for(let[t,n]of bO)n.every(t=>e-t>=vO)&&bO.delete(t);let t=(bO.get(n)??[]).filter(t=>e-t<vO);if(!yO(t,e)){bO.set(n,t),vl.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),bO.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,vl.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==qt&&xO(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new Rr({state:{init:()=>null,apply:e=>(gO(e.getMeta(qt))&&(a=i,o&&vl.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!hO(i,a)||SO(t)?!0:e.getMeta(qt)!==void 0,view:e=>{let r=t.doc;return r==null?(vl.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 wO(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 TO=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&&ui(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(tc(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Zs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push($s(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Qs(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ys(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ec(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ks(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qs(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=si(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Pr){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 Yn){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():wO(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Xs(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()}},EO=e=>new Rr({key:typeof e.pluginKey==`string`?new ri(e.pluginKey):e.pluginKey,view:t=>new TO({view:t,...e})});vr.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[EO({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 DO=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 Sr(e,{textSerializers:Tr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(tc(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Zs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push($s(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Qs(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Ys(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ec(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ks(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(qs(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=si(this.view,e.from,e.to);Xs({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()}},OO=e=>new Rr({key:typeof e.pluginKey==`string`?new ri(e.pluginKey):e.pluginKey,view:t=>new DO({view:t,...e})});vr.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?[OO({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 kO(e,t){return e??new ri(t)}var AO=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,jO=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),MO=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(`.`)),NO=new Set([`children`,`className`,`style`]),PO=new Set([`tabIndex`]),FO=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),IO={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function LO(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function RO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function zO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||FO.has(e)}function BO(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function VO(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:IO[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function HO(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 UO(e){return PO.has(e)}function WO(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function GO(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 KO(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||MO.has(e)?String(t):`${t}px`}function qO(e,t){jO.has(t)||e.style.removeProperty(BO(t))}function JO(e,t,n){jO.has(t)||e.style.setProperty(BO(t),KO(t,n))}function YO(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(NO.has(r)||!zO(r)||LO(r,t[r])||LO(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=RO(r);if(a==null||a===!1){UO(r)&&GO(e,r),e.removeAttribute(o);return}if(a===!0){UO(r)&&WO(e,r,!0),e.setAttribute(o,``);return}if(UO(r)){WO(e,r,a);return}e.setAttribute(o,String(a))})}function XO(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function ZO(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){qO(e,t);return}JO(e,t,a)}})}function QO(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(!LO(t,n))return;let{eventName:i,options:a}=VO(t),o=t=>{n(HO(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function $O(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);AO(()=>{let i=n.current;return XO(e,i.className,t.className),ZO(e,i.style,t.style),YO(e,i,t),r.current=QO(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 ek=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)(kO(e,`bubbleMenu`)).current;$O(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=le(),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=EO({...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,ld.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)(kO(e,`floatingMenu`)).current;$O(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=le(),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=OO({...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,ld.createPortal)(s,u.current)});var tk=[{name:`paragraph`,label:`Text`,icon:nf,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Pe,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Vt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:st,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:kt,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:Ce,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:$e,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:Le,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:mf,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function nk(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:rk},t[0]=n,t[1]=r);let{current:i,activeStates:a}=oe(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)(Xa,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=tk.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Cc,{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)(Tc,{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)(jc,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function rk(e){let t=Object.fromEntries(tk.map(t=>[t.name,t.isActive(e.editor)]));return{current:tk.find(e=>t[e.name])??tk[0],activeStates:t}}var ik=`open-knowledge:active-terminal-input`;function ak(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(ik,{detail:e}))}function ok(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;typeof n==`string`&&e(n)};return t.addEventListener(ik,n),()=>t.removeEventListener(ik,n)}function sk(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function ck(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r;if(bo())return null;let a;return t[0]!==n||t[1]!==i?(a=(0,Z.jsx)(lk,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}function lk(e){let t=(0,$.c)(11),{editor:n,shortcutEnabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Lr(),t[0]=i):i=t[0];let a=i,o,s;t[1]===r?(o=t[2],s=t[3]):(o=()=>{if(!a)return;let e=e=>{r&&El(e,`edit-with-ai`)&&(sk(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),au()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},s=[r,a],t[1]=r,t[2]=o,t[3]=s),(0,Q.useEffect)(o,s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[4]=c):c=t[4];let l;t[5]===n?l=t[6]:(l=()=>{let e=ft(n),t=pu(n);requestAnimationFrame(()=>{if(e===null||t.trim()===``){au();return}ak($r({relativePath:fo(e),instruction:``,selectionMarkdown:t,target:`claude-code`}))})},t[5]=n,t[6]=l);let u,d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(us,{className:`size-3.5`,"aria-hidden":`true`}),d=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`xWEvuo`})}),t[7]=u,t[8]=d):(u=t[7],d=t[8]);let f;return t[9]===l?f=t[10]:(f=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:l,children:[u,d]})]}),t[9]=l,t[10]=f),f}function uk(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 dk(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:ct(typeof n.src==`string`?n.src:``)}function fk(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 pk(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=an(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:mk},t[0]=n,t[1]=i),oe(i)===null)return null;let a;t[2]===r?a=t[3]:(a=r({id:`WcWS__`}),t[2]=r,t[3]=a);let o;t[4]===n?o=t[5]:(o=e=>{e.preventDefault();let t=uk(n);t&&fk(t,dk(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(wa,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a,className:`text-accent-foreground`,onMouseDown:o,children:s})}),t[7]=a,t[8]=o,t[9]=c):c=t[9];let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`WcWS__`})}),t[10]=l):l=t[10];let u;return t[11]===c?u=t[12]:(u=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Ws,{children:[c,l]})}),t[11]=c,t[12]=u),u}function mk(e){return uk(e.editor)}function hk(e){return uk(e)!==null}function gk(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function _k(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 vk(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function yk(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=an(),i;t[0]===n?i=t[1]:(i={editor:n,selector:bk},t[0]=n,t[1]=i);let a=oe(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!gk(n)||n.state.selection.empty||vk(n)||_k(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=di(wr(n.state.doc)),o=Vr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(o,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=a,t[3]=n,t[4]=o):o=t[4];let s=o,c;t[5]===r?c=t[6]:(c=r({id:`sIGbBZ`}),t[5]=r,t[6]=c);let l;t[7]===s?l=t[8]:(l=e=>{e.preventDefault(),s()},t[7]=s,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(W,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==c||t[12]!==l?(d=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":c,onMouseDown:l,disabled:a,children:u})}),t[10]=a,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;t[14]===r?f=t[15]:(f=r({id:`sIGbBZ`}),t[14]=r,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:f}),t[16]=f,t[17]=p);let m;return t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(Ws,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function bk(e){let t=e.editor;return!!(!gk(t)||t.state.selection.empty||vk(t)||_k(t))}var xk=`img, .ok-embed, .ok-video`,Sk=220,Ck=`cubic-bezier(0.23, 1, 0.32, 1)`,wk=`ok-image-align-flip`,Tk=.5;function Ek(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Dk(){return typeof requestAnimationFrame==`function`}function Ok(e){return e?e.querySelector(xk):null}function kk(e,t){if(Ek()||!Dk()){t();return}let n=Ok(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=Ok(e);if(!t)return;for(let e of t.getAnimations())e.id===wk&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<Tk)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:Sk,easing:Ck,fill:`none`});i.id=wk})}var Ak=[{value:`left`,label:`Align left`,icon:Tf},{value:`center`,label:`Align center`,icon:Cf},{value:`right`,label:`Align right`,icon:wf}];function jk(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Ut.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function Mk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Nk},t[0]=n,t[1]=r);let i=oe(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=Ak.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(!Ut.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(Pr.create(u.doc,s)),kk(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Hs,{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 Nk(e){return jk(e.editor)}function Pk(e){return jk(e)!==null}var Fk=[{name:`bold`,icon:sd,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:Ld,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Of,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:bf,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:Ee,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Fd,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function Ik(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Lk},t[0]=n,t[1]=r);let i=oe(r),a;t[2]!==i||t[3]!==n?(a=Fk.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(Hs,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(wt,{"aria-label":Dl(e.shortcutId),children:Tl(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 Lk(e){return Object.fromEntries(Fk.map(t=>[t.name,t.isActive(e.editor)]))}function Rk(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=an(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=(0,Q.useRef)(null),{folderPaths:l,loading:u,pages:d}=to(),f;t[0]===n?f=t[1]:(f=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=n.getAttributes(`link`).href??``,t[2]=n,t[3]=m);let h=m,g;t[4]===n?g=t[5]:(g=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=g);let _=g,v,y;t[6]===n?(v=t[7],y=t[8]):(v=()=>{let e=function(){n.state.selection.empty&&a(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},y=[n],t[6]=n,t[7]=v,t[8]=y),(0,Q.useEffect)(v,y);let b,x;t[9]===i?(b=t[10],x=t[11]):(b=()=>{i&&requestAnimationFrame(()=>c.current?.focus())},x=[i],t[9]=i,t[10]=b,t[11]=x),(0,Q.useEffect)(b,x);let S;t[12]!==n||t[13]!==p||t[14]!==o?(S=function(){o.trim()?n.chain().focus().setLink({href:o.trim()}).run():p&&n.chain().focus().unsetLink().run(),a(!1)},t[12]=n,t[13]=p,t[14]=o,t[15]=S):S=t[15];let C=S,w;t[16]===n?w=t[17]:(w=function(){n.chain().focus().unsetLink().run(),a(!1)},t[16]=n,t[17]=w);let T=w,E;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){s(K(e.path,null))},t[18]=E):E=t[18];let D=E,O;t[19]!==C||t[20]!==n?(O=function(e){e.key===`Enter`&&(e.preventDefault(),C()),e.key===`Escape`&&(e.preventDefault(),a(!1),n.chain().focus().run())},t[19]=C,t[20]=n,t[21]=O):O=t[21];let k=O;if(i){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]!==l||t[27]!==k||t[28]!==u||t[29]!==d||t[30]!==e||t[31]!==n||t[32]!==o?(i=(0,Z.jsx)(nt,{ref:c,type:`text`,placeholder:e,value:o,pages:d,folderPaths:l,loading:u,onValueChange:s,onSuggestionSelect:D,onKeyDown:k,"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]=l,t[27]=k,t[28]=u,t[29]=d,t[30]=e,t[31]=n,t[32]=o,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 f;t[36]===C?f=t[37]:(f=()=>{C()},t[36]=C,t[37]=f);let m;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(bd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=m):m=t[38];let g;t[39]!==a||t[40]!==f?(g=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:f,children:m}),t[39]=a,t[40]=f,t[41]=g):g=t[41];let _;t[42]!==i||t[43]!==g?(_=(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,g]}),t[42]=i,t[43]=g,t[44]=_):_=t[44];let v;t[45]!==r||t[46]!==h||t[47]!==p||t[48]!==T?(v=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),tn(h)},children:(0,Z.jsx)(Oa,{className:`size-3.5`})})}),(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),T()},children:(0,Z.jsx)(Ro,{className:`size-3.5`})})}),(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`484LKL`})})]})]}),t[45]=r,t[46]=h,t[47]=p,t[48]=T,t[49]=v):v=t[49];let y;return t[50]!==_||t[51]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[_,v]}),t[50]=_,t[51]=v,t[52]=y):y=t[52],y}let A;t[53]===r?A=t[54]:(A=r({id:`p0Iq25`}),t[53]=r,t[54]=A);let j=p?`bg-accent text-primary`:`text-accent-foreground`,M;t[55]===_?M=t[56]:(M=e=>{e.preventDefault(),s(_()),a(!0)},t[55]=_,t[56]=M);let N;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(zd,{className:`size-3.5`}),t[57]=N):N=t[57];let P;t[58]!==A||t[59]!==j||t[60]!==M?(P=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":A,className:j,onMouseDown:M,children:N})}),t[58]=A,t[59]=j,t[60]=M,t[61]=P):P=t[61];let F;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Y,{id:`yzF66j`}),t[62]=F):F=t[62];let I;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsxs)(Hs,{side:`bottom`,sideOffset:8,children:[F,(0,Z.jsx)(wt,{children:Tl(`command-palette`)})]}),t[63]=I):I=t[63];let L;return t[64]===P?L=t[65]:(L=(0,Z.jsxs)(Ws,{children:[P,I]}),t[64]=P,t[65]=L),L}function zk({editor:e}){if(Ke(e.state).query||e.isActive(`codeBlock`))return!1;if(Pk(e)||hk(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 Bk(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:Gk},t[0]=n,t[1]=l);let u=oe(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:Wk},t[2]=n,t[3]=d);let f=oe(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return si(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=Gs(e,t,()=>{Xs(e,t,{placement:`top`,strategy:`fixed`,middleware:[$s(8),tc(),Zs({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(Uk)}))},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(Hk)},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)(Mk,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(pk,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(nk,{editor:n}),(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Ik,{editor:n},o),(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Rk,{editor:n},`${o}-link`),(0,Z.jsx)(yk,{editor:n},`${o}-footnote`),(0,Z.jsx)(ck,{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)(ek,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:Vk,shouldShow:zk,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 Vk(){return document.body}function Hk(e){return e+1}function Uk(){}function Wk(e){return hk(e.editor)}function Gk(e){return Pk(e.editor)}var Kk=56,qk=`0 2px 4px rgba(0, 0, 0, 0.08)`,Jk=150,Yk=globalThis.ScrollTimeline;function Xk(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+Kk);return{startOffset:o,endOffset:o+a,maxShift:a}}var Zk=new WeakMap;function Qk(e){let t=Zk.get(e);if(t){for(let e of t.animations)e.cancel();Zk.delete(e)}}function $k(e){for(let t of Array.from(e.cells))Qk(t)}var eA=e=>e.cellIndex===0?`3`:`2`;function tA(e,t){return nA(e,t,e=>({transform:`translateY(${e}px)`}))}function nA(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 rA(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 iA(e,t,n){return rA(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:qk})}function aA(e,t){return rA(e,t,{opacity:`0`},{opacity:`1`})}function oA(e,t,n,r){let i=eA(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=Zk.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(tA(n,r),s),l=e.animate(iA(n,r,i),s),u=e.animate(aA(n,r),{...s,pseudoElement:`::before`});Zk.set(e,{key:a,animations:[c,l,u]})}function sA(e,t){let n=eA(e),r=`in|${t}|${n}`,i=Zk.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:qk}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});Zk.set(e,{key:r,animations:[a,o]})}function cA(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=Xk(a,i,c.top,c.height,l.height);if(!u){$k(s);continue}if(n){if(o<=0){$k(s);continue}for(let e of Array.from(s.cells))oA(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+Kk){$k(s);continue}for(let e of Array.from(s.cells))sA(e,d)}}var lA=vr.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new Rr({key:new ri(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||cA(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()},Jk);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&Yk)try{n=new Yk({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`))$k(t)}}}})]}});function uA(e,t){return(n,r)=>{let i=r,a=_u(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function dA(e,t){let n=hu(e);t(n.target,{tabBehavior:`append`}),Yc(n.hash)}function fA(e){return[...e?[{label:`Toggle header column`,icon:vd,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:B,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:g,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:Ro,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Md,run:e=>e.chain().focus().deleteTable().run()}]}function pA(e){return[...e?[{label:`Toggle header row`,icon:xf,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:y,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:rt,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:Ro,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Md,run:e=>e.chain().focus().deleteTable().run()}]}function mA(e){if(!e.isEditable||Ke(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 hA(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 Gs(r,e,()=>{Xs(r,e,{strategy:`absolute`,placement:t,middleware:[$s(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(gA)})},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`?Sd:Yi,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)(xc,{asChild:!0,children:(0,Z.jsx)(X,{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)(Ic,{}),(0,Z.jsxs)(Cc,{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)(Tc,{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)(jc,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function gA(){}function _A(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=mA(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=fA(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)(hA,{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=pA(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)(hA,{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 vA(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=qt.getState(e.state)?.binding;if(!t){vl.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){vl.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}vl.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return vr.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new Rr({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var yA=new WeakMap;function bA(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=fi(e.color),n.textContent=e.name,t.append(n),t}var xA={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},SA=100,CA=100,wA=3,TA=250;function EA(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function DA(e,t){let n=de(e);if(!n||t.contains(n.dom))return!1;if(!EA(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 OA(){let e=new er({extensions:hi});return{mdManager:e,text:Rt({mdManager:e}),html:Re({mdManager:e}),paste:et({mdManager:e}),drop:At({mdManager:e})}}function kA(e,t){return t?{collaboration:tt.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[vA({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:tt.configure({document:e.document}),guard:[]}}function AA(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=kA(t,r);return[...bt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),hw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,vr.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[He]}}),vr.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[p(e,{cursorBuilder:bA})]}}),vr.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[CO({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,lA]}function jA(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{yA.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=yA.get(e);if(yA.delete(e),r==null)return;let i=performance.now();vl(`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:uA(n.drop,e.onSidebarDrop)},extensions:Tg(AA(e))}}function MA(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=jA({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}=q(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var NA=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(xA),c=pO(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=pt(),p=n.configuration.name??``,[m]=(0,Q.useState)(OA),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new zn(MA({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;vl(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{dA(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=O(p)??crypto.randomUUID();_=Q.use,v=rn({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=()=>()=>{R(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)(PA,{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},PA=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:u,flashStateRef:d,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,y;t[3]!==c||t[4]!==f?(v=()=>{DA(c,f)&&h(FA)},y=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=y):(v=t[5],y=t[6]),(0,Q.useEffect)(v,y);let b;t[7]!==c||t[8]!==n.configuration.name?(b=()=>(Xe(c,n.configuration.name??null),()=>{Xe(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=b):b=t[9];let x;t[10]!==c||t[11]!==n?(x=[c,n],t[10]=c,t[11]=n,t[12]=x):x=t[12],(0,Q.useEffect)(b,x);let S;t[13]!==c||t[14]!==n.configuration.name?(S=()=>{let e=n.configuration.name;if(e)return T(e,c),()=>Et(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=S):S=t[15];let C;t[16]!==c||t[17]!==n?(C=[c,n],t[16]=c,t[17]=n,t[18]=C):C=t[18],(0,Q.useEffect)(S,C);let w;t[19]!==c||t[20]!==n.configuration.name?(w=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,Ql(e,`wysiwyg`,tu(c)),du(e,`wysiwyg`,fu(c,e))},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),Ql(e,`wysiwyg`,null),du(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=w):w=t[21];let E;t[22]!==c||t[23]!==n?(E=[c,n],t[22]=c,t[23]=n,t[24]=E):E=t[24],(0,Q.useEffect)(w,E);let D;t[25]!==c||t[26]!==n.configuration.name?(D=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=D):D=t[27];let O;t[28]!==c||t[29]!==n?(O=[c,n],t[28]=c,t[29]=n,t[30]=O):O=t[30],(0,Q.useEffect)(D,O);let k,A;t[31]===c?(k=t[32],A=t[33]):(k=()=>{let e=IA,t=null,n=()=>{if(t||c.isDestroyed)return;let n=de(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 de(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},A=[c],t[31]=c,t[32]=k,t[33]=A),(0,Q.useEffect)(k,A);let j,M;t[34]!==i||t[35]!==c?(j=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!de(c))return;e=!0;let t=H(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})),vl(`ok/editor/selection-restore-failed`,{docName:i,message:n})}l(i)};if(de(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},M=[c,i],t[34]=i,t[35]=c,t[36]=j,t[37]=M):(j=t[36],M=t[37]),(0,Q.useEffect)(j,M);let N,P;t[38]!==d||t[39]!==n.document||t[40]!==u?(N=()=>{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=>{d.current=e;let t=u.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??``))},l=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(d.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)},Ln)};c(xA);let f=()=>{if(zr(e),!_i(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(),l()},e)}return}r=n,l()};e.observe(f);let p=()=>{document.visibilityState===`visible`?_i(e,t)&&(t=Date.now(),r=Date.now(),l()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},P=[n.document,d,u],t[38]=d,t[39]=n.document,t[40]=u,t[41]=N,t[42]=P):(N=t[41],P=t[42]),(0,Q.useEffect)(N,P);let F,I;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(F=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<SA){e+=1,t=window.setTimeout(p,CA);return}r=null,o=null,e=0},u=function(e){let t=de(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=wA,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,TA)))};t=window.setTimeout(o,TA)};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=el(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)}},I=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=F,t[48]=I):(F=t[47],I=t[48]),(0,Q.useEffect)(F,I);let L,R;t[49]===c?(L=t[50],R=t[51]):(L=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=de(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(Xl,e),()=>window.removeEventListener(Xl,e)},R=[c],t[49]=c,t[50]=L,t[51]=R),(0,Q.useEffect)(L,R);let z;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(z=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:mO({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]=z):z=t[58];let B;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(B=[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]=B):B=t[65],(0,Q.useEffect)(z,B);let V,U;t[66]!==c||t[67]!==r?(V=()=>($t(c,r),()=>{$t(c,!1)}),U=[c,r],t[66]=c,t[67]=r,t[68]=V,t[69]=U):(V=t[68],U=t[69]),(0,Q.useEffect)(V,U);let W;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(W=!r&&(0,Z.jsx)(Bk,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=W):W=t[74];let G;t[75]!==c||t[76]!==r?(G=!r&&(0,Z.jsx)(_A,{editor:c}),t[75]=c,t[76]=r,t[77]=G):G=t[77];let K;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=K):K=t[78];let te;t[79]!==c||t[80]!==m?(te=(0,Z.jsx)(ee,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=te):te=t[81];let q;t[82]!==f||t[83]!==te?(q=(0,ld.createPortal)(te,f),t[82]=f,t[83]=te,t[84]=q):q=t[84];let J;t[85]===c?J=t[86]:(J=(0,Z.jsx)(dO,{editor:c}),t[85]=c,t[86]=J);let ne;t[87]===c?ne=t[88]:(ne=Ht(c),t[87]=c,t[88]=ne);let re;t[89]===ne.store?re=t[90]:(re=(0,Z.jsx)(Fe,{store:ne.store}),t[89]=ne.store,t[90]=re);let ie;return t[91]!==W||t[92]!==G||t[93]!==q||t[94]!==J||t[95]!==re||t[96]!==u?(ie=(0,Z.jsxs)(`div`,{ref:u,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:[W,G,K,q,J,re]}),t[91]=W,t[92]=G,t[93]=q,t[94]=J,t[95]=re,t[96]=u,t[97]=ie):ie=t[97],ie};function FA(e){return e+1}function IA(){return C()}var LA=null;function RA(e){let t=(0,$.c)(3),n=(0,Q.useRef)(null),r,i;return t[0]===e?(r=t[1],i=t[2]):(r=()=>{if(!e)return;let t=n.current;if(!t)return;let r={};LA=r;let i=document.documentElement,a=null,o=()=>{if(LA!==r)return;let e=`${t.offsetHeight}px`;e!==a&&(a=e,i.style.setProperty(`--conflict-footer-height`,e))};o();let s=new ResizeObserver(o);return s.observe(t),()=>{s.disconnect(),LA===r&&(LA=null,i.style.removeProperty(`--conflict-footer-height`))}},i=[e],t[0]=e,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i),n}var zA=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 BA(e,t,n,r,i,a){if(e==r)return[];let o=XA(e,t,n,r,i,a),s=ZA(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 zA(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new zA(t,t+o,i,i),new zA(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 zA(t,t,i,i+o),new zA(n,n,i+o+c,a)]}if(c==1||l==1)return[new zA(t,n,i,a)];let u=$A(e,t,n,r,i,a);if(u){let[o,s,c]=u;return BA(e,t,o,r,i,s).concat(BA(e,o+c,n,r,s+c,a))}return WA(e,t,n,r,i,a)}var VA=1e9,HA=0,UA=!1;function WA(e,t,n,r,i,a){let o=n-t,s=a-i;if(VA<1e9&&Math.min(o,s)>VA*16||HA>0&&Date.now()>HA)return Math.min(o,s)>VA*64?[new zA(t,n,i,a)]:ej(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);KA.reset(c),qA.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:qA,f=d?null:KA;for(let p=0;p<c;p++){if(p>VA||HA>0&&!(p&63)&&Date.now()>HA)return ej(e,t,n,r,i,a);let m=KA.advance(p,o,s,c,d,!1,l)||qA.advance(p,o,s,c,f,!0,u);if(m)return JA(e,t,n,t+m[0],r,i,a,i+m[1])}return[new zA(t,n,i,a)]}var GA=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}},KA=new GA,qA=new GA;function JA(e,t,n,r,i,a,o,s){let c=!1;return!hj(e,r)&&++r==n&&(c=!0),!hj(i,s)&&++s==o&&(c=!0),c?[new zA(t,n,a,o)]:BA(e,t,r,i,a,s).concat(BA(e,r,n,i,s,o))}function YA(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function XA(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=YA(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-+!hj(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function ZA(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=YA(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-+!hj(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function QA(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;;){hj(e,s)||s++;let u=s+o;if(hj(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=XA(e,u,n,r,i+f+d.length,a),c=ZA(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 $A(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=$A(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:QA(e,t,n,r,i,a,Math.floor(o/4),-1)}function ej(e,t,n,r,i,a){UA=!0;let o=n-t,s=a-i,c;if(o<s){let s=QA(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=QA(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new zA(t,n,i,a)];let[l,u,d]=c;return BA(e,t,l,r,i,u).concat(BA(e,l+d,n,r,u+d,a))}function tj(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 zA(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function nj(e,t,n){for(;;){tj(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=XA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new zA(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=ZA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new zA(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 zA(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 zA(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function rj(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=uj(t,a.fromA,l),f=lj(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 zA(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=lj(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new zA(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=uj(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new zA(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=fj(n,a.fromB,a.toB),r,o=t<0?-1:dj(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=fj(t,a.fromA,a.toA),r,o=n<0?-1:dj(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 tj(e,3),e}var ij;try{ij=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function aj(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function oj(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!aj(n):ij?!pj(n)||t==e.length-1?+!!ij.test(String.fromCharCode(n)):ij.test(e.slice(t,t+2))?2:0:0}function sj(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!aj(n):ij?!mj(n)||t==1?+!!ij.test(String.fromCharCode(n)):ij.test(e.slice(t-2,t))?2:0:0}var cj=8;function lj(e,t,n){if(t==e.length||!sj(e,t))return t;for(let r=t,i=t+n,a=0;a<cj;a++){let t=oj(e,r);if(!t||r+t>i)return r;r+=t}return t}function uj(e,t,n){if(!t||!oj(e,t))return t;for(let r=t,i=t-n,a=0;a<cj;a++){let t=sj(e,r);if(!t||r-t<i)return r;r-=t}return t}function dj(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function fj(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var pj=e=>e>=55296&&e<=56319,mj=e=>e>=56320&&e<=57343;function hj(e,t){return!t||t==e.length||!pj(e.charCodeAt(t-1))||!mj(e.charCodeAt(t))}function gj(e,t,n){let r=n?.override;return r?r(e,t):(VA=(n?.scanLimit??1e9)>>1,HA=n?.timeout?Date.now()+n.timeout:0,UA=!1,nj(e,t,BA(e,0,e.length,t,0,t.length)))}function _j(){return!UA}function vj(e,t,n){return rj(gj(e,t,n),e,t)}var yj=Ll.define({combine:e=>e[0]}),bj=Rl.define(),xj=Ll.define(),Sj=Ml.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(bj)&&(e=n.value);for(let n of t.state.facet(xj))e=n(e,t);return e}});function Cj(e){let t=e.field(Sj,!1);if(!t)return null;let n=e.facet(yj);return{chunks:t,side:n?n.side:null}}var wj=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 Dj(vj(e.toString(),t.toString(),n),e,t,0,0,_j())}static updateA(e,t,n,r,i){return jj(Aj(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return jj(Aj(e,r,!1,t.length),e,t,n,i)}};function Tj(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 Ej(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 Dj(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Tj(c.fromA+r,c.fromB+i,t,n),[d,f]=Ej(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]=Tj(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]=Ej(a.toA+r,a.toB+i,t,n),s++}o.push(new wj(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Oj=1e3;function kj(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 Aj(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>Oj&&([l,d]=kj(e,a-Oj,n,!0)),o<t.length-Oj&&([u,f]=kj(e,o+Oj,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 jj(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=vj(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Dj(h,n,r,d,f,_j()))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 Mj={scanLimit:500},Nj=zl.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Uj(e))}update(e){(e.docChanged||e.viewportChanged||Fj(e.startState,e.state)||Ij(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Uj(e.view))}},{decorations:e=>e.deco}),Pj=kl.low(Ul({class:`cm-changeGutter`,markers:e=>e.plugin(Nj)?.gutter||Gl.empty}));function Fj(e,t){return e.field(Sj,!1)!=t.field(Sj,!1)}function Ij(e,t){return e.facet(yj)!=t.facet(yj)}var Lj=Fl.line({class:`cm-changedLine`}),Rj=Fl.mark({class:`cm-changedText`}),zj=Fl.mark({tagName:`ins`,class:`cm-insertedLine`}),Bj=Fl.mark({tagName:`del`,class:`cm-deletedLine`}),Vj=new class extends Hl{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Hj(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,Lj),i.add(o,s,n?Bj:zj),a&&a.add(o,o,Vj);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,Lj),a&&a.add(u,u,Vj);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,Rj),s<t)c++;else break}u=t}}}function Uj(e){let t=e.state.field(Sj),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(yj),o=n==`a`,s=new Il,c=i?new Il: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))&&Hj(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var Wj=class extends Ol{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}},Gj=Rl.define({map:(e,t)=>e.map(t)}),Kj=Ml.define({create:()=>Fl.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Gj))return e.value;return e.map(t.changes)},provide:e=>Vl.decorations.from(e)}),qj=.01;function Jj(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 Yj(e,t,n){let r=new Il,i=new Il,a=e.state.field(Kj).iter(),o=t.state.field(Kj).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<-qj?(l-=n,r.add(s,s,Fl.widget({widget:new Wj(-n),block:!0,side:-1}))):n>qj&&(u+=n,i.add(c,c,Fl.widget({widget:new Wj(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<qj?r.add(e.state.doc.length,e.state.doc.length,Fl.widget({widget:new Wj(-p),block:!0,side:1})):p>qj&&i.add(t.state.doc.length,t.state.doc.length,Fl.widget({widget:new Wj(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Jj(m,e.state.field(Kj))||e.dispatch({effects:Gj.of(m)}),Jj(h,t.state.field(Kj))||t.dispatch({effects:Gj.of(h)})}var Xj=Rl.define({map:(e,t)=>t.mapPos(e)}),Zj=class extends Ol{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:Xj.of(n)});let{side:r,sibling:i}=e.state.facet(yj);i&&i().dispatch({effects:Xj.of(Qj(n,e.state.field(Sj),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Qj(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 $j=Ml.define({create(e){return Fl.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Xj)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Vl.decorations.from(e)});function eM({margin:e=3,minSize:t=4}){return $j.init(n=>tM(n,e,t))}function tM(e,t,n){let r=new Il,i=e.facet(yj).side==`a`,a=e.field(Sj),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,Fl.replace({widget:new Zj(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var nM=Vl.styleModule.of(new Wl({".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`}})),rM=Vl.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`}}),iM=new Bl,aM=new Bl,oM=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Mj;let t=[kl.low(Nj),rM,nM,Kj,Vl.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Gj)))&&this.measure()})],n=[yj.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Pj);let r=jl.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Vl.editorAttributes.of({class:`cm-merge-a`}),aM.of(n),t]}),i=[yj.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Pj);let a=jl.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Vl.editorAttributes.of({class:`cm-merge-b`}),aM.of(i),t]});this.chunks=wj.build(r.doc,a.doc,this.diffConf);let o=[Sj.init(()=>this.chunks),iM.of(e.collapseUnchanged?eM(e.collapseUnchanged):[])];r=r.update({effects:Rl.appendConfig.of(o)}).state,a=a.update({effects:Rl.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 Vl({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Vl({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),Al.empty(e[0].startState.doc.length));this.chunks=t==this.a?wj.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):wj.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:bj.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:bj.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(yj),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(aM.reconfigure([yj.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Pj:[]])),a.push(aM.reconfigure([yj.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Pj:[]]))}if(r){let t=iM.reconfigure(e.collapseUnchanged?eM(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(){Yj(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=sM(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=sM(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 sM(e){let t=e.nextSibling;return e.remove(),t}var cM=new class extends Hl{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},lM=kl.low(Ul({class:`cm-changeGutter`,markers:e=>e.plugin(Nj)?.gutter||Gl.empty,widgetMarker:(e,t)=>t instanceof mM?cM:null}));function uM(e){let t=typeof e.original==`string`?Pl.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Mj;return[kl.low(Nj),yM,rM,Vl.editorAttributes.of({class:`cm-merge-b`}),xj.of((e,t)=>{let r=t.effects.find(e=>e.is(dM));return r&&(e=wj.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=wj.updateB(e,t.state.field(fM),t.newDoc,t.changes,n)),e}),yj.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?TM:void 0,side:`b`}),fM.init(()=>t),e.gutter===!1?[]:lM,e.collapseUnchanged?eM(e.collapseUnchanged):[],Sj.init(e=>wj.build(t,e.doc,n))]}var dM=Rl.define(),fM=Ml.define({create:()=>Pl.empty,update(e,t){for(let n of t.effects)n.is(dM)&&(e=n.value.doc);return e}}),pM=new WeakMap,mM=class extends Ol{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 hM(e,t,n){let r=pM.get(t.changes);if(r)return r;let i=Fl.widget({block:!0,side:-1,widget:new mM(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(yj),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(),gM(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),_M(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(fM).sliceString(t.fromA,t.endA),u=a&&e.facet(Kl),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)==`
|
|
30
30
|
`){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
|
|
31
|
-
`,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;Nl(t,{style:t=>ql(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 dM.set(t.changes,i),i}function mM(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(bj).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(uM);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Al.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:lM.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function hM(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(bj).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(uM).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 gM(e){let t=new Il;for(let n of e.field(bj)){let r=e.facet(_j).overrideChunk&&yM(e,n);t.add(n.fromB,n.fromB,pM(e,n,!!r))}return t.finish()}var _M=Ml.define({create:e=>gM(e),update(e,t){return t.state.field(bj,!1)==t.startState.field(bj,!1)?e:gM(t.state)},provide:e=>Vl.decorations.from(e)}),vM=new WeakMap;function yM(e,t){let n=vM.get(t);if(n!==void 0)return n;n=null;let r=e.field(uM),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(Fl.widget({widget:new bM(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Ij.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return vM.set(t,n),n}var bM=class extends Ol{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}},xM=new class extends Hl{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},SM=Fl.line({class:`cm-inlineChangedLine`});function CM(e,t,n,r){let i=yM(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,xM),n.add(o.from,o.from,SM);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 wM=ae({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),TM=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),EM=Vl.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 DM({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 OM(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=an(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=tr(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C;t[1]!==l||t[2]!==c?(C=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=C):C=t[3],(0,Q.useEffect)(C);let w,T;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(w=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?wM:TM,u=[Vl.editable.of(!1),jl.readOnly.of(!0)],g=[ou,Jl(),...u,l,Vl.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Vl({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=DM({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Vl({doc:d,extensions:[ou,Jl(),Vl.editable.of(!1),l,EM,Vl.lineWrapping,cM({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Vl.updateListener.of(e=>{let t=xj(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=xj(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new iM({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Vl({doc:d,extensions:[...g,cM({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},T=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=w,t[11]=T):(w=t[10],T=t[11]),(0,Q.useEffect)(w,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=p.current;!e||!(e instanceof Vl)||g.current?.(e.state.doc.toString())},t[12]=E):E=t[12];let D=E,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=p.current;!e||!(e instanceof Vl)||U(e)},t[13]=O):O=t[13];let k=O,A=v===0,j;t[14]!==u||t[15]!==v?(j=v===null?``:v===0?u({id:`lPzyrU`}):Ms._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=j):j=t[16];let M=j,N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=N):N=t[17];let P;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,ld.createPortal)((0,Z.jsx)(X,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),P=x.map(e),t[18]=u,t[19]=x,t[20]=P}else P=t[20];let F;t[23]!==A||t[24]!==a||t[25]!==M||t[26]!==l||t[27]!==c?(F=a&&(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 ${A?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:M}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(Y,{id:`XyOUTJ`})}),(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:k,children:`Undo`}),c&&(0,Z.jsx)(X,{variant:`default`,size:`sm`,disabled:!A,onClick:D,children:(0,Z.jsx)(Y,{id:`Lcehxn`})})]})]}),t[23]=A,t[24]=a,t[25]=M,t[26]=l,t[27]=c,t[28]=F):F=t[28];let I;return t[29]!==F||t[30]!==P?(I=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[N,P,F]}),t[29]=F,t[30]=P,t[31]=I):I=t[31],I}async function kM(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 AM(e,t){return kM(e,`content`,t)}async function jM(e){return kM(e,`mine`)}async function MM(e){return kM(e,`theirs`)}async function NM(e){return kM(e,`delete`)}async function PM(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 FM(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=an(),{conflicts:i,loading:a}=Li(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>gl(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h,g;t[5]===n?(h=t[6],g=t[7]):(h=()=>(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}))}),g=[n],t[5]=n,t[6]=h,t[7]=g),(0,Q.useEffect)(h,g);let _=a||s===void 0,v,y;t[8]!==_||t[9]!==c?(v=()=>{if(_)return;let e=!1;return u(null),f(!1),PM(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},y=[c,_],t[8]=_,t[9]=c,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,Q.useEffect)(v,y);let b;t[12]!==r||t[13]!==c?(b=async function(e){let t=await AM(c,e);t.ok||Ss.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=b):b=t[14];let x=b,S;t[15]!==r||t[16]!==c?(S=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),Ss.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=S):S=t[17];let C=S;if(d){let e;return t[18]===c?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)(Y,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?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)(Y,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(OM,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,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)(Y,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===C?a=t[30]:(a=()=>void C(NM),t[29]=C,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===C?u=t[36]:(u=()=>void C(MM),t[35]=C,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let h;t[44]!==i||t[45]!==m?(h=(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]=h):h=t[46];let g;return t[47]!==h||t[48]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[47]=h,t[48]=e,t[49]=g):g=t[49],g}if(l.kind===`modify-delete`){let e;t[50]===l.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(OM,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[50]=l.ours,t[51]=e);let n;t[52]===c?n=t[53]:(n={filePath:c},t[52]=c,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)(Y,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===C?a=t[58]:(a=()=>void C(jM),t[57]=C,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`0NA4b3`}),t[59]=o):o=t[59];let s;t[60]!==p||t[61]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[60]=p,t[61]=a,t[62]=s):s=t[62];let u;t[63]===C?u=t[64]:(u=()=>void C(NM),t[63]=C,t[64]=u);let d;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`qSxaOz`}),t[65]=d):d=t[65];let f;t[66]!==p||t[67]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[66]=p,t[67]=u,t[68]=f):f=t[68];let m;t[69]!==s||t[70]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[69]=s,t[70]=f,t[71]=m):m=t[71];let h;t[72]!==i||t[73]!==m?(h=(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]=h):h=t[74];let g;return t[75]!==h||t[76]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[75]=h,t[76]=e,t[77]=g):g=t[77],g}let w;t[78]===x?w=t[79]:(w=e=>void x(e),t[78]=x,t[79]=w);let T;return t[80]!==l.ours||t[81]!==l.theirs||t[82]!==w?(T=(0,Z.jsx)(OM,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:w}),t[80]=l.ours,t[81]=l.theirs,t[82]=w,t[83]=T):T=t[83],T}function IM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(zt(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 LM=`__back-nav__`;function RM(e){return e instanceof Oe||e instanceof gt||e instanceof xe||e instanceof Ze||e instanceof jt||e instanceof A?e.docName:null}function zM(e){return e instanceof Oe||e instanceof gt}function BM(e){if(e instanceof Oe){let t=e.docName;return{title:Ms._({id:`Jejur6`}),summary:Ms._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof gt){let t=e.docName;return{title:Ms._({id:`V7QxyT`}),summary:Ms._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof xe){let t=e.docName;return{title:Ms._({id:`1di5fu`}),summary:Ms._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Ze){let t=e.docName;return{title:Ms._({id:`wvbc1r`}),summary:Ms._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:Ms._({id:`Gfr4fu`}),summary:Ms._({id:`UW2Fg3`})};if(e instanceof A){let t=e.docName;return{title:Ms._({id:`vv7kpg`}),summary:Ms._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Ms._({id:`W5A0Ly`});return{title:Ms._({id:`29VNqC`}),summary:t}}function VM(e){let t=(0,$.c)(31),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=BM(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f=typeof window<`u`?window.okDesktop:void 0,p=f&&zM(n)?f:null,m,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{d.current?.focus()},h=[],t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(pT,{size:80,variant:`sleeping`}),t[4]=g):g=t[4];let _;t[5]===c?_=t[6]:(_=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=_);let v;t[7]===l?v=t[8]:(v=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=v);let y;t[9]!==_||t[10]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[12]=b):b=t[12];let x;t[13]===r?x=t[14]:(x=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:b}),t[13]=r,t[14]=x);let S;t[15]===p?S=t[16]:(S=p?(0,Z.jsx)(X,{variant:`secondary`,onClick:()=>{Oy(p).then(UM).catch(HM)},children:(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,t[15]=p,t[16]=S);let C;t[17]!==i||t[18]!==u||t[19]!==n||t[20]!==o||t[21]!==a||t[22]!==r?(C=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(at(RM(n)??i),o(a),r(LM))},children:(0,Z.jsx)(Y,{id:`CKyk7Q`})}):null,t[17]=i,t[18]=u,t[19]=n,t[20]=o,t[21]=a,t[22]=r,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C||t[26]!==x?(w=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[x,S,C]}),t[24]=S,t[25]=C,t[26]=x,t[27]=w):w=t[27];let T;return t[28]!==w||t[29]!==y?(T=(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:[g,y,w]}),t[28]=w,t[29]=y,t[30]=T):T=t[30],T}function HM(){}function UM(e){e.ok||Ss.error(e.message,{id:`server-restart-error`,duration:1/0})}function WM(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)(VM,{...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]===LM){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}: ${BM(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)(h,{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 GM(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=ii(t);return{map:n,keys:Br(t),parseError:r}}function KM(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>GM(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=Xn(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=lt(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)(qM,{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)(JM,{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 qM(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 JM(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}var YM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CRYWYGK4.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([74,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,69,70,21,75,8,76,77,47,24]),import.meta.url)).ManagedArtifactProperties})),XM=bl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function ZM(e){let t=e.threshold??XM;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function QM(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var $M=bl(`ACTIVITY_MOUNT_LIMIT`,3);function eN(){return n(()=>import(`./SourceEditor-CAUoNOTU.js`),__vite__mapDeps([78,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,79,34,77,73]),import.meta.url)}var tN=(0,Q.lazy)(async()=>({default:(await eN()).SourceEditor}));function nN(e,t,n){if(n<=0)return[];let r=e.filter(e=>!ze(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 rN(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Ms._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Ms._({id:`Sc1bKE`,values:{docName:e}}):Ms._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Ms._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Ms._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Ms._({id:`bmC18N`,values:{docName:e}}):Ms._({id:`pAgkuZ`,values:{docName:e}})}:null}function iN(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(yl,{name:`activity-pool`,children:(0,Z.jsx)(aN,{...e})}),t[0]=e,t[1]=n),n}function aN(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=pt(),{pages:u,loading:d}=to(),f=nN(c,n,$M),p=(0,Q.useRef)(``),m=f.map(oN).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)ue(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;se(e,t&&t.length>0?t:crypto.randomUUID())}vl(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,S(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(fN,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!br(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function oN(e){return e.docName}function sN(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&&vl(`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&&(vl(`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&&vl(`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:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function cN(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)(XC,{}),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)(tN,{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 lN(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)(ao,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Fo,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:uN,children:[(0,Z.jsx)(ao,{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 uN(){return window.location.reload()}function dN(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 fN(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=rN(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=aD(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),[y,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==y?(S=()=>{i&&!_?v(!0):!i&&!y&&x(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=ZM({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,k;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&&vl(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},k=[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]=k):(D=t[17],k=t[18]),(0,Q.useEffect)(D,k);let A;t[19]===n.docName?A=t[20]:(A=()=>H(n.docName),t[19]=n.docName,t[20]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==N||t[26]!==i||t[27]!==g?(F=()=>{QM({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:N})&&(vl(`ok/cold/first-toggle`,{docName:n.docName,mountId:O(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),P(!0))},I=[N,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]=N,t[26]=i,t[27]=g,t[28]=F,t[29]=I):(F=t[28],I=t[29]),(0,Q.useEffect)(F,I);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;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]!==M?(B=f?(0,Z.jsx)(lN,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(WM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(dN,{html:M}):(0,Z.jsx)(XC,{}),children:(0,Z.jsx)(IM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(FM,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(br(n.docName)||b(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(YM,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(KM,{provider:n.provider}),(0,Z.jsx)(Ba,{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)(cN,{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)(NA,{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]=M,t[44]=B):B=t[44];let V;t[45]!==r||t[46]!==z||t[47]!==B?(V=(0,Z.jsx)(sN,{isActive:r,initialScrollTop:z,children:B}),t[45]=r,t[46]=z,t[47]=B,t[48]=V):V=t[48];let U;return t[49]!==L||t[50]!==R||t[51]!==V?(U=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[49]=L,t[50]=R,t[51]=V,t[52]=U):U=t[52],U}function pN(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function mN(e){let{value:t,unit:n}=pN(e);return n===`rem`?t*16:t}function hN(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var gN=3600*24*7;function _N(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?vN:m,O=g===void 0?gN: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 ee=mN(b),te;t[6]===x?te=t[7]:(te=mN(x),t[6]=x,t[7]=te);let q=te,J;t[8]!==E||t[9]!==k?(J=function(e){E&&(P.current=!0,j.current=H.current?0:mN(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]=J):J=t[10];let ne=J,re,ie;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==q||t[18]!==ee||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}=pN(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<=ee*w;else if(e<=ee){let n=ee*(w-1);t=ee-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>ee*T){a();let t=n(r,M.current,j.current,s),c=Math.max(ee,Math.min(q,t)),u=hN(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(ee,Math.min(q,u)),f=hN(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)}},ie=[i,a,D,ee,q,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]=q,t[18]=ee,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=ie):(re=t[24],ie=t[25]),(0,Q.useEffect)(re,ie);let ae;return t[26]===ne?ae=t[27]:(ae={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ae),ae}function vN(){}var yN=3600*24*7,bN=`18rem`,xN=`3rem`,SN=`app-file-sidebar`,CN=`14.625rem`,wN=`32rem`,TN=`sidebar_width`,EN=/^\d+(?:\.\d+)?(?:rem|px)$/,DN=Q.createContext(null);function ON(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${TN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return EN.test(n)?n:e}function kN(){let e=Q.use(DN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function AN(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?bN:c,[u]=Q.useState(MN),d;t[8]===u?d=t[9]:(d=()=>hD(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>ON(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=SD();return wD(`left`,hD(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),TD(`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(jN)},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: ${fD}px)`),t=()=>{let e=hD(u,window.innerWidth,`left`);p(e),C(wD(`left`,e,SD())===`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(SN)?.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=>{El(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":xN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=wi(`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 ee;return t[55]!==H||t[56]!==K?(ee=(0,Z.jsx)(DN.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=ee):ee=t[57],ee}function jN(e){return!e}function MN(){return Fr()}function NN(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=an(),{state:f,isDraggingRail:p}=kN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=wi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=wi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=wi(`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)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:SN,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function PN(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=an(),{toggleSidebar:o,state:s}=kN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Dl(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=SN,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=wi(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(ht,{}):(0,Z.jsx)(Zd,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function FN(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=an(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=kN(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:CN,maxResizeWidth:wN,setIsDraggingRail:m,widthCookieName:TN,widthCookieMaxAge:yN},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=_N(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=wi(`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]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function IN(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}=kN(),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=wi(`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 LN(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=wi(`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 RN(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=wi(`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 zN(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=wi(`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 BN(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=wi(`relative flex w-full min-w-0 flex-col 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-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Ti:`div`,o;t[4]===n?o=t[5]:(o=wi(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function HN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Ti:`button`,o;t[4]===n?o=t[5]:(o=wi(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function UN(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=wi(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WN(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=wi(`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 GN(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=wi(`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 KN=Ci(`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 qN(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?Ti:`button`,{state:m}=kN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=wi(KN({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)(Vs,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Hs,{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)(Ws,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function JN(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,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?Ti:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=wi(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function YN(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=wi(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,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-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function XN(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=wi(`group/menu-sub-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-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ZN(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?Ti:`a`,d;t[6]===n?d=t[7]:(d=wi(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden 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-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function QN(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 $N(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Xr.safeParse(t);return n.success?n.data.currentBranch??null:null}var eP=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:QN({fetchBranch:$N,subscribeToEvent:Ts}),tP=eP.subscribe,nP=eP.getSnapshot;function rP(){return(0,Q.useSyncExternalStore)(tP,nP,nP)}function iP(){let e=(0,$.c)(6),t=rP(),n=so(),{state:r}=kN(),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&&Pi(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 aP(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=an(),u=iP();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=wi(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(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[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(us,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(Jt,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(oP,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`d5rK4X`,values:{chars:m}})]}),(0,Z.jsxs)(`span`,{children:[d.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.tokens.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function oP(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)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Hs,{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)(St,{"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 sP(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{_:i}=an(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=wi(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function cP(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=wi(`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 lP(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=wi(`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 uP(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=wi(`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 dP(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=wi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Qa,{}),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 fP=1,pP=2,mP=4;function hP(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 e=ni(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:ie(n,``).prefix.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>mP?[...u.slice(0,fP).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(fP,-pP)},...u.slice(-pP).map((e,t)=>d(e,u.length-pP+t))]:u.map((e,t)=>d(e,t));a=sP,t[8]===r?c=t[9]:(c=wi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=cP,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(gP)}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 gP(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(dP,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(lP,{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)(Sd,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(lP,{className:`min-w-0`,children:(0,Z.jsx)(uP,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var _P={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`},vP=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`,..._P,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},yP=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)(vP,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},bP=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)(vP,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function xP(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=an(),s=n?`source`:`wysiwyg`,c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l;t[2]===o?l=t[3]:(l=o({id:`n7aopT`}),t[2]=o,t[3]=l);let u;t[4]===o?u=t[5]:(u=o({id:`ur2XSb`}),t[4]=o,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Vs,{children:(0,Z.jsx)(bP,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(ka,{value:`wysiwyg`,"aria-label":u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:d}),t[7]=u,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(Ws,{children:[f,p]}),t[10]=f,t[11]=m);let h;t[12]===o?h=t[13]:(h=o({id:`xbdtfY`}),t[12]=o,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(yP,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(ka,{value:`source`,"aria-label":h,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:g})})}),t[15]=a,t[16]=h,t[17]=_):_=t[17];let v;t[18]===a?v=t[19]:(v=(0,Z.jsx)(Hs,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`G-JBA1`}):(0,Z.jsx)(Y,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(Ws,{children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==c||t[26]!==l||t[27]!==m?(b=(0,Z.jsxs)(ja,{type:`single`,value:s,onValueChange:c,"aria-label":l,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[m,y]}),t[23]=y,t[24]=s,t[25]=c,t[26]=l,t[27]=m,t[28]=b):b=t[28],b}var SP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-Bfh-iuK_.js`);return{SkillEditorActions:e}},__vite__mapDeps([80,1,30,3,7,31,6,10,70,20,9,11,32,12,13,21,16,60,72,18,61,65,23]),import.meta.url)).SkillEditorActions}));function CP(e){let t=(0,$.c)(82),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=an(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Tl(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,x,S,C,w,T,E,D,O,k,A;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=Dl(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?ni(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?b(n):null,t[28]=n,t[29]=m);let j=m,M;t[30]!==p||t[31]!==j?(M=p?.kind===`skill`?{scope:p.scope,name:p.name}:j?{scope:`project`,name:j}:null,t[30]=p,t[31]=j,t[32]=M):M=t[32];let N=M;x=`editor-toolbar`,S=`pointer-events-none absolute inset-x-0 top-0 z-10`;let P;t[33]!==n||t[34]!==N?(P=N?null:(0,Z.jsx)(hP,{docName:n}),t[33]=n,t[34]=N,t[35]=P):P=t[35];let F;t[36]===P?F=t[37]:(F=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:P}),t[36]=P,t[37]=F);let I;t[38]!==r||t[39]!==a||t[40]!==i?(I=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(xP,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[38]=r,t[39]=a,t[40]=i,t[41]=I):I=t[41],t[42]!==F||t[43]!==I?(C=(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:[F,I]})}),t[42]=F,t[43]=I,t[44]=C):C=t[44];let L=d&&`pr-9`;t[45]===L?_=t[46]:(_=wi(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,L),t[45]=L,t[46]=_),t[47]===N?v=t[48]:(v=N?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(SP,{scope:N.scope,name:N.name})}):null,t[47]=N,t[48]=v),t[49]!==f||t[50]!==s||t[51]!==o?(y=o&&(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Vs,{children:(0,Z.jsx)(Vd,{})})}),(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`81H_23`})})]}),t[49]=f,t[50]=s,t[51]=o,t[52]=y):y=t[52],g=Ws,h=X,w=``,T=`ghost`,E=`icon`,D=l,O=!c,k=`doc-panel`,A=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25];let j;t[53]===c?j=t[54]:(j=(0,Z.jsx)(Vs,{children:c?(0,Z.jsx)($d,{}):(0,Z.jsx)(Qd,{})}),t[53]=c,t[54]=j);let M;t[55]!==h||t[56]!==j||t[57]!==w||t[58]!==T||t[59]!==E||t[60]!==D||t[61]!==O||t[62]!==k||t[63]!==A?(M=(0,Z.jsx)(h,{"data-doc-panel-toggle":w,variant:T,size:E,onClick:D,"aria-expanded":O,"aria-controls":k,"aria-label":A,asChild:!0,children:j}),t[55]=h,t[56]=j,t[57]=w,t[58]=T,t[59]=E,t[60]=D,t[61]=O,t[62]=k,t[63]=A,t[64]=M):M=t[64];let N;t[65]===c?N=t[66]:(N=(0,Z.jsx)(Hs,{side:`bottom`,children:c?(0,Z.jsx)(Y,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(Y,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[65]=c,t[66]=N);let P;t[67]!==g||t[68]!==M||t[69]!==N?(P=(0,Z.jsxs)(g,{children:[M,N]}),t[67]=g,t[68]=M,t[69]=N,t[70]=P):P=t[70];let F;t[71]!==_||t[72]!==v||t[73]!==y||t[74]!==P?(F=(0,Z.jsxs)(`div`,{className:_,children:[v,y,P]}),t[71]=_,t[72]=v,t[73]=y,t[74]=P,t[75]=F):F=t[75];let I;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[76]=I):I=t[76];let L;return t[77]!==x||t[78]!==S||t[79]!==C||t[80]!==F?(L=(0,Z.jsxs)(`div`,{"data-testid":x,className:S,children:[C,F,I]}),t[77]=x,t[78]=S,t[79]=C,t[80]=F,t[81]=L):L=t[81],L}function wP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function TP(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var EP=`ok-terminal-height-v1`,DP=1/3,OP=.5;function kP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*OP))}function AP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*DP)}function jP(e,t){let n=kP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(AP(t),n)}function MP(){return typeof window>`u`?0:window.innerHeight}function NP(e,t){try{let n=e??localStorage,r=t??MP(),i=n.getItem(EP);if(i==null)return jP(AP(r),r);let a=Number.parseInt(i,10);return jP(Number.isFinite(a)?a:AP(r),r)}catch{return 240}}function PP(e,t,n){try{let r=t??localStorage,i=n??MP();r.setItem(EP,String(jP(e,i)))}catch{}}function FP(){try{return typeof localStorage>`u`?240:NP()}catch{return 240}}function IP(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=an(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`0SBTff`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=wi(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(Za,{"aria-hidden":`true`}):(0,Z.jsx)(Jt,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(Hs,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(Ws,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var LP=`terminal-dock-panel`;function RP(e){let t=(0,$.c)(44),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c}=e,l=a===void 0?`bottom`:a,{resolvedTheme:u}=tr(),d=PC(),[f,p]=(0,Q.useState)(!r),m;t[0]===u?m=t[1]:(m=yu(u),t[0]=u,t[1]=m);let h=m.background,g=r&&l===`bottom`,_=!r&&l===`bottom`&&c!=null,[v]=(0,Q.useState)(zP),y=(0,Q.useRef)(v),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(e){C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{PP(e),C.current=null},100)},t[2]=w):w=t[2];let T=w,E=(0,Q.useRef)(null),D,O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{C.current!=null&&clearTimeout(C.current),E.current!=null&&(window.removeEventListener(`pointerup`,E.current),E.current=null)},O=[],t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A;t[5]!==g||t[6]!==d?(k=()=>{let e=d.current;e!=null&&(g?e.resize(`${y.current}px`):e.collapse())},A=[g,d],t[5]=g,t[6]=d,t[7]=k,t[8]=A):(k=t[7],A=t[8]),(0,Q.useEffect)(k,A);let j=b||void 0,M;t[9]!==c||t[10]!==_?(M=_&&c?(0,Z.jsx)(IP,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[9]=c,t[10]=_,t[11]=M):M=t[11];let N;t[12]!==n||t[13]!==s||t[14]!==M?(N=(0,Z.jsx)(PE,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,M]})}),t[12]=n,t[13]=s,t[14]=M,t[15]=N):N=t[15];let P=!g,F;t[16]===g?F=t[17]:(F=()=>{if(!g)return;x(!0),S.current=!0;let e=()=>{x(!1),S.current=!1,window.removeEventListener(`pointerup`,e),E.current=null};E.current=e,window.addEventListener(`pointerup`,e)},t[16]=g,t[17]=F);let I;t[18]!==g||t[19]!==P||t[20]!==F?(I=(0,Z.jsx)(FE,{withHandle:g,disabled:P,onPointerDown:F}),t[18]=g,t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]===h?L=t[23]:(L={backgroundColor:h},t[22]=h,t[23]=L);let R=g?`${v}px`:0,z;t[24]!==i||t[25]!==r?(z=e=>{let t=e.asPercentage===0;p(t),S.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(y.current=e.inPixels,T(e.inPixels)))},t[24]=i,t[25]=r,t[26]=z):z=t[26];let B=!b&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,V;t[27]===B?V=t[28]:(V=wi(`flex flex-col`,B),t[27]=B,t[28]=V);let H;t[29]===o?H=t[30]:(H=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[29]=o,t[30]=H);let U;t[31]!==f||t[32]!==d||t[33]!==L||t[34]!==R||t[35]!==z||t[36]!==V||t[37]!==H?(U=(0,Z.jsx)(PE,{id:LP,style:L,panelRef:d,defaultSize:R,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:z,inert:f,className:V,children:H}),t[31]=f,t[32]=d,t[33]=L,t[34]=R,t[35]=z,t[36]=V,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==N||t[40]!==I||t[41]!==U||t[42]!==j?(W=(0,Z.jsxs)(NE,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":j,children:[N,I,U]}),t[39]=N,t[40]=I,t[41]=U,t[42]=j,t[43]=W):W=t[43],W}function zP(){return FP()}var BP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CNxdYTCc.js`),__vite__mapDeps([48,1,2,49,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,64,65]),import.meta.url)).ActivityModeContent})),VP=`300px`,HP=`600px`,UP=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function WP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(KP,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(GP,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(yl,{name:`editor-area`,children:(0,Z.jsxs)(Fa,{children:[n,r]})}),t[3]=n,t[4]=i),i}function GP(){let e=(0,$.c)(5),t=Vi(),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)(OE,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function KP(e){let t=(0,$.c)(237),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u,onRevealTerminal:d}=e,f=s===void 0?!1:s,p=l===void 0?`right`:l,{_:m}=an(),{resolvedTheme:h}=tr(),g;t[0]===h?g=t[1]:(g=yu(h),t[0]=h,t[1]=g);let _=g.background,{activeDocName:v,activeProvider:y,activeTarget:b,recycleDocument:x,docPanelMode:S,docPanelAgentId:C,docPanelExpandSignal:w}=pt(),{openDocumentTransition:T}=Dt(),{requestAddProperty:E}=Ma(),D=rD(y,v),O=oD(v,n===`source`?`source`:`wysiwyg`),k=jD(y),A=k===`connected`||k===`synced`,j=aD(v)===`conflict`,[M,N]=(0,Q.useState)(!1),P,F;t[2]!==y||t[3]!==M?(P=()=>{y!=null&&!M&&N(!0)},F=[y,M],t[2]=y,t[3]=M,t[4]=P,t[5]=F):(P=t[4],F=t[5]),(0,Q.useEffect)(P,F);let I=(0,Q.useDeferredValue)(v),L=b?.kind===`missing`,R=!!v&&b?.kind!==`folder`,z;t[6]!==m||t[7]!==L?(z=L?m({id:`K-a33w`}):void 0,t[6]=m,t[7]=L,t[8]=z):z=t[8];let B=z,[V]=(0,Q.useState)(ZP),H=V!==null,U;t[9]===V?U=t[10]:(U=()=>hD(V,window.innerWidth,`right`),t[9]=V,t[10]=U);let[W,G]=(0,Q.useState)(U),K=(0,Q.useRef)(W),ee,q;t[11]===W?(ee=t[12],q=t[13]):(ee=()=>{K.current=W},q=[W],t[11]=W,t[12]=ee,t[13]=q),(0,Q.useEffect)(ee,q);let J=PC(),ne=PC(),re;t[14]===W?re=t[15]:(re=()=>wD(`right`,W,SD())===`collapsed`,t[14]=W,t[15]=re);let[ie]=(0,Q.useState)(re),[ae,oe]=(0,Q.useState)(ie),se=(0,Q.useRef)(ae),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),me=p===`right`,he=me?`right`:`bottom`,ge=o!=null&&me&&f,_e=o!=null&&!f&&d!=null,ve=_e&&!me,ye=_e&&me,be=me&&f&&ce!=null,xe=be?ce:ue,Se=(me?be:f)&&xe!=null,Ce,we;t[16]!==xe||t[17]!==u||t[18]!==he||t[19]!==fe||t[20]!==Se?(Ce=()=>{u?.({container:xe,isShowing:Se,dockPosition:he,editorRegion:fe})},we=[u,xe,Se,he,fe],t[16]=xe,t[17]=u,t[18]=he,t[19]=fe,t[20]=Se,t[21]=Ce,t[22]=we):(Ce=t[21],we=t[22]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[23]===ae?(Te=t[24],Ee=t[25]):(Te=()=>{se.current=ae},Ee=[ae],t[23]=ae,t[24]=Te,t[25]=Ee),(0,Q.useEffect)(Te,Ee);let[De,Oe]=(0,Q.useState)(!1),ke=(0,Q.useRef)(!1),[Ae]=(0,Q.useState)(XP),je=(0,Q.useRef)(Ae),Ne=(0,Q.useRef)(null),Pe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=function(e){Ne.current!=null&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>{uD(e),Ne.current=null},100)},t[26]=Pe):Pe=t[26];let Fe=Pe,[Ie]=(0,Q.useState)(YP),Le=(0,Q.useRef)(Ie),[Re,ze]=(0,Q.useState)(!1),Be=(0,Q.useRef)(!1),Ve=(0,Q.useRef)(null),He;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(He=function(e){Ve.current!=null&&clearTimeout(Ve.current),Ve.current=setTimeout(()=>{kD(e),Ve.current=null},100)},t[27]=He):He=t[27];let Ue=He,We,Ge;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(We=()=>()=>{Ne.current!=null&&clearTimeout(Ne.current),Ve.current!=null&&clearTimeout(Ve.current)},Ge=[],t[28]=We,t[29]=Ge):(We=t[28],Ge=t[29]),(0,Q.useEffect)(We,Ge);let[Ke,qe]=(0,Q.useState)(null),Je=(0,Q.useRef)(null),Ye=kC(),Xe=(0,Q.useRef)(ge),Ze,Qe;t[30]===ge?(Ze=t[31],Qe=t[32]):(Ze=()=>{Xe.current=ge},Qe=[ge],t[30]=ge,t[31]=Ze,t[32]=Qe),(0,Q.useEffect)(Ze,Qe);let $e;t[33]!==J||t[34]!==ne?($e=function(){for(let e of[J,ne]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=Je.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[33]=J,t[34]=ne,t[35]=$e):$e=t[35];let et=$e,tt;t[36]!==Ye||t[37]!==et?(tt=function(e){if(ke.current||Be.current)return;let t=Ye.current;if(t!=null)try{let n=et();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(JP);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:je.current),`terminal-column`in r&&(o[`terminal-column`]=Le.current),Object.keys(o).length===0)return;let s=TP({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[36]=Ye,t[37]=et,t[38]=tt):tt=t[38];let nt=tt,rt=(0,Q.useRef)(nt),it;t[39]===nt?it=t[40]:(it=()=>{rt.current=nt},t[39]=nt,t[40]=it),(0,Q.useEffect)(it);let at;t[41]!==nt||t[42]!==J?(at=function(){Xe.current?nt(!1):J.current?.expand()},t[41]=nt,t[42]=J,t[43]=at):at=t[43];let ot=at,st;t[44]!==nt||t[45]!==ae||t[46]!==J?(st=function(){if(J.current==null)return;let e=K.current;ae?(TD(`right`,e,`open`),Xe.current?nt(!1):J.current?.expand()):(TD(`right`,e,`collapsed`),Xe.current?nt(!0):J.current?.collapse())},t[44]=nt,t[45]=ae,t[46]=J,t[47]=st):st=t[47];let ct=st,lt,ut;t[48]!==nt||t[49]!==V||t[50]!==J?(lt=()=>{let e=window.matchMedia(`(min-width: ${pD}px)`),t=()=>{let e=hD(V,window.innerWidth,`right`);G(e);let t=wD(`right`,e,SD())===`collapsed`;oe(t),Xe.current?nt(t):t?J.current?.collapse():J.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ut=[V,J,nt],t[48]=nt,t[49]=V,t[50]=J,t[51]=lt,t[52]=ut):(lt=t[51],ut=t[52]),(0,Q.useEffect)(lt,ut);let dt,ft;t[53]!==Ke||t[54]!==H?(dt=()=>{if(Ke==null||H)return;let e=new ResizeObserver(()=>{rt.current(se.current)});return e.observe(Ke),()=>e.disconnect()},ft=[Ke,H],t[53]=Ke,t[54]=H,t[55]=dt,t[56]=ft):(dt=t[55],ft=t[56]),(0,Q.useEffect)(dt,ft);let mt,ht;t[57]!==ot||t[58]!==a?(mt=()=>{let e=e=>{a(e),ot()},t=dv();return t&&e(t),pv(t=>{dv(),e(t)})},ht=[a,ot],t[57]=ot,t[58]=a,t[59]=mt,t[60]=ht):(mt=t[59],ht=t[60]),(0,Q.useEffect)(mt,ht);let gt,_t;t[61]!==w||t[62]!==ot?(gt=()=>{w!==0&&ot()},_t=[w,ot],t[61]=w,t[62]=ot,t[63]=gt,t[64]=_t):(gt=t[63],_t=t[64]),(0,Q.useEffect)(gt,_t);let vt=(0,Q.useRef)(ge),yt,bt;t[65]!==ae||t[66]!==ge?(yt=()=>{if(vt.current===ge)return;vt.current=ge;let e=ae;queueMicrotask(()=>{rt.current(e)})},bt=[ge,ae],t[65]=ae,t[66]=ge,t[67]=yt,t[68]=bt):(yt=t[67],bt=t[68]),(0,Q.useLayoutEffect)(yt,bt);let xt,St;t[69]===ae?(xt=t[70],St=t[71]):(xt=()=>{if(!ae||!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()},St=[ae],t[69]=ae,t[70]=xt,t[71]=St),(0,Q.useLayoutEffect)(xt,St);let Ct,wt;t[72]===ae?(Ct=t[73],wt=t[74]):(Ct=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ae})},wt=[ae],t[72]=ae,t[73]=Ct,t[74]=wt),(0,Q.useEffect)(Ct,wt);let Tt,Et;t[75]===ct?(Tt=t[76],Et=t[77]):(Tt=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&ct()})},Et=[ct],t[75]=ct,t[76]=Tt,t[77]=Et),(0,Q.useEffect)(Tt,Et);let Ot,kt;t[78]===ct?(Ot=t[79],kt=t[80]):(Ot=()=>{if(window.okDesktop!=null)return;let e=e=>{El(e,`toggle-document-panel`)&&(e.preventDefault(),ct())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},kt=[ct],t[78]=ct,t[79]=Ot,t[80]=kt),(0,Q.useEffect)(Ot,kt);let At=(0,Q.useRef)(null),[jt,Mt]=(0,Q.useState)(null),[Nt,Pt]=(0,Q.useState)(!1),Ft=b?.kind===`large-file`?b.docName:v,It,Lt;t[81]===Ft?(It=t[82],Lt=t[83]):(It=()=>{if(Ft&&Ft!==At.current){let e=At.current;At.current=Ft,Mt(e)}},Lt=[Ft],t[81]=Ft,t[82]=It,t[83]=Lt),(0,Q.useEffect)(It,Lt);let Rt;t[84]===T?Rt=t[85]:(Rt=function(e){let t=Jc(e);window.location.hash===t?T(e):window.location.hash=t},t[84]=T,t[85]=Rt);let zt=Rt,Bt,Vt=null;if(b?.kind===`large-file`){let e;t[86]!==zt||t[87]!==jt?(e=jt?{previousDocName:jt,onNavigateBack:zt}:void 0,t[86]=zt,t[87]=jt,t[88]=e):e=t[88];let n;t[89]!==b.docName||t[90]!==b.limit||t[91]!==b.size||t[92]!==e?(n=(0,Z.jsx)(dE,{docName:b.docName,size:b.size,limit:b.limit,backNav:e}),t[89]=b.docName,t[90]=b.limit,t[91]=b.size,t[92]=e,t[93]=n):n=t[93],Bt=n}else if(b?.kind===`folder`){let e;t[94]!==H||t[95]!==f?(e=sO({terminalVisible:f,isEmbedded:H}),t[94]=H,t[95]=f,t[96]=e):e=t[96];let n=e,r;t[97]===b.folderPath?r=t[98]:(r=(0,Z.jsx)(sE,{folderPath:b.folderPath}),t[97]=b.folderPath,t[98]=r);let i;t[99]!==b.folderPath||t[100]!==n?(i=n?(0,Z.jsx)(JD,{folderPath:b.folderPath}):null,t[99]=b.folderPath,t[100]=n,t[101]=i):i=t[101];let a;if(t[102]!==r||t[103]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[102]=r,t[103]=i,t[104]=a):a=t[104],Bt=a,S===`agent`&&C!==null){let e;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(FE,{withHandle:!0}),t[105]=e):e=t[105];let n;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(PE,{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)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(BP,{showBackButton:!1})})})]}),t[106]=n):n=t[106],Vt=n}}else if(b?.kind===`asset`){let e;t[107]!==b.assetPath||t[108]!==b.mediaKind?(e=(0,Z.jsx)(YC,{assetPath:b.assetPath,mediaKind:b.mediaKind},b.assetPath),t[107]=b.assetPath,t[108]=b.mediaKind,t[109]=e):e=t[109],Bt=e}else if(b?.kind===`skill-file`){let e=`${b.scope}/${b.name}/${b.path}`,n;t[110]!==b.name||t[111]!==b.path||t[112]!==b.scope||t[113]!==e?(n=(0,Z.jsx)(yE,{scope:b.scope,name:b.name,path:b.path},e),t[110]=b.name,t[111]=b.path,t[112]=b.scope,t[113]=e,t[114]=n):n=t[114],Bt=n}else if(!y||!v)if((typeof window<`u`?_l(window.location.hash):null)!==null)if(o!=null&&M){let e;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XC,{}),t[115]=e):e=t[115],Bt=e;let n;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(FE,{withHandle:!0,disabled:!0}),t[116]=n):n=t[116];let r=ie?0:`${Ae}px`,i;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[117]=i):i=t[117];let a;t[118]===r?a=t[119]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(PE,{id:`doc-panel`,defaultSize:r,minSize:VP,maxSize:HP,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[118]=r,t[119]=a),Vt=a}else{let e;return t[120]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XC,{}),t[120]=e):e=t[120],e}else{let e=f&&he===`bottom`,n;t[121]===e?n=t[122]:(n=(0,Z.jsx)(OT,{terminalVisible:e}),t[121]=e,t[122]=n),Bt=n}else{let e=n===`source`,o=!A,s=ae,c;t[123]!==v||t[124]!==E?(c=function(){v&&E(v)},t[123]=v,t[124]=E,t[125]=c):c=t[125];let l=c,u;t[126]!==v||t[127]!==H||t[128]!==f?(u=oO({terminalVisible:f,isEmbedded:H,activeDocName:v}),t[126]=v,t[127]=H,t[128]=f,t[129]=u):u=t[129];let d=u,p=I??v,m=jt??void 0,h;t[130]!==B||t[131]!==e||t[132]!==zt||t[133]!==x||t[134]!==p||t[135]!==m?(h=(0,Z.jsx)(iN,{activeDocName:p,isSourceMode:e,editorPlaceholder:B,previousDocName:m,onNavigateBack:zt,onRecycle:x}),t[130]=B,t[131]=e,t[132]=zt,t[133]=x,t[134]=p,t[135]=m,t[136]=h):h=t[136];let g;t[137]!==v||t[138]!==e?(g=(0,Z.jsx)($E,{activeDocName:v,isSourceMode:e}),t[137]=v,t[138]=e,t[139]=g):g=t[139];let _;t[140]!==v||t[141]!==I?(_=wP({activeDocName:v,deferredActiveDocName:I,mountResolved:v!==null&&te(v),syncResolved:v!==null&&Me(v)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(XC,{}),v===null?null:(0,Z.jsx)(fE,{docName:v})]}):null,t[140]=v,t[141]=I,t[142]=_):_=t[142];let y;t[143]!==h||t[144]!==g||t[145]!==_?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_]}),t[143]=h,t[144]=g,t[145]=_,t[146]=y):y=t[146];let b;t[147]!==v||t[148]!==j||t[149]!==s||t[150]!==e||t[151]!==r||t[152]!==l||t[153]!==ye||t[154]!==o||t[155]!==ct?(b=!j&&(0,Z.jsx)(CP,{activeDocName:v,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:ct,reserveRightGutter:ye&&s}),t[147]=v,t[148]=j,t[149]=s,t[150]=e,t[151]=r,t[152]=l,t[153]=ye,t[154]=o,t[155]=ct,t[156]=b):b=t[156];let C;t[157]!==v||t[158]!==Nt||t[159]!==e||t[160]!==d?(C=d?(0,Z.jsx)(JD,{docName:v,surface:e?`source`:`wysiwyg`,dismissed:Nt,onDismiss:()=>Pt(!0),onReopen:()=>Pt(!1)}):null,t[157]=v,t[158]=Nt,t[159]=e,t[160]=d,t[161]=C):C=t[161];let w;t[162]!==y||t[163]!==b||t[164]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,b,C]}),t[162]=y,t[163]=b,t[164]=C,t[165]=w):w=t[165];let T;t[166]!==Nt||t[167]!==d?(T=d&&Nt?{onReopen:()=>Pt(!1)}:null,t[166]=Nt,t[167]=d,t[168]=T):T=t[168];let k;t[169]!==ve||t[170]!==O||t[171]!==R||t[172]!==D||t[173]!==T?(k=(0,Z.jsx)(aP,{stats:D,selectionStats:O,showStats:R,composerBadge:T,reserveRightGutter:ve}),t[169]=ve,t[170]=O,t[171]=R,t[172]=D,t[173]=T,t[174]=k):k=t[174];let M;t[175]!==w||t[176]!==k?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,k]}),t[175]=w,t[176]=k,t[177]=M):M=t[177],Bt=M;let N=ge&&ae,P=!ae,F;t[178]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{Oe(!0),ke.current=!0;let e=()=>{Oe(!1),ke.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[178]=F):F=t[178];let L;t[179]!==ae||t[180]!==P?(L=(0,Z.jsx)(FE,{withHandle:P,disabled:ae,onPointerDown:F}),t[179]=ae,t[180]=P,t[181]=L):L=t[181];let z=ie?0:`${Ae}px`,V=N?`0px`:VP,U;t[182]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{oe(e.asPercentage===0),e.inPixels>0&&ke.current&&(je.current=e.inPixels,Fe(e.inPixels))},t[182]=U):U=t[182];let W=!De&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[183]===W?G=t[184]:(G=wi(`flex flex-col bg-muted/20`,W),t[183]=W,t[184]=G);let K;t[185]!==v||t[186]!==i||t[187]!==S||t[188]!==e||t[189]!==a?(K=(0,Z.jsx)(zx,{docName:v,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:S}),t[185]=v,t[186]=i,t[187]=S,t[188]=e,t[189]=a,t[190]=K):K=t[190];let ee;t[191]!==N||t[192]!==ae||t[193]!==J||t[194]!==z||t[195]!==V||t[196]!==G||t[197]!==K?(ee=(0,Z.jsx)(PE,{id:`doc-panel`,panelRef:J,disabled:N,defaultSize:z,minSize:V,maxSize:HP,collapsible:!0,collapsedSize:0,onResize:U,inert:ae,className:G,children:K}),t[191]=N,t[192]=ae,t[193]=J,t[194]=z,t[195]=V,t[196]=G,t[197]=K,t[198]=ee):ee=t[198];let q;t[199]!==L||t[200]!==ee?(q=(0,Z.jsxs)(Z.Fragment,{children:[L,ee]}),t[199]=L,t[200]=ee,t[201]=q):q=t[201],Vt=q}let Ht;t[202]!==d||t[203]!==c||t[204]!==o||t[205]!==he||t[206]!==f||t[207]!==Bt?(Ht=o==null?Bt:(0,Z.jsx)(RP,{visible:f,onVisibleChange:c??qP,dockPosition:he,onBottomContainer:de,onEditorRegion:pe,onReveal:d,children:Bt}),t[202]=d,t[203]=c,t[204]=o,t[205]=he,t[206]=f,t[207]=Bt,t[208]=Ht):Ht=t[208];let Ut=Ht,Wt;t[209]!==Ie||t[210]!==Re||t[211]!==c||t[212]!==ne||t[213]!==ge||t[214]!==_?(Wt=ge?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(FE,{withHandle:!0,onPointerDown:()=>{ze(!0),Be.current=!0;let e=()=>{ze(!1),Be.current=!1,window.removeEventListener(`pointerup`,e),ne.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(PE,{id:`terminal-column`,panelRef:ne,style:{backgroundColor:_},defaultSize:`${Ie}px`,minSize:`320px`,maxSize:`900px`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&Be.current&&(Le.current=e.inPixels,Ue(e.inPixels))},className:wi(`flex flex-col`,!Re&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:le,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[209]=Ie,t[210]=Re,t[211]=c,t[212]=ne,t[213]=ge,t[214]=_,t[215]=Wt):Wt=t[215];let Gt=Wt,Kt=Vt!=null&&!ie||ge,qt;t[216]===Symbol.for(`react.memo_cache_sentinel`)?(qt=e=>{qe(e),Je.current=e},t[216]=qt):qt=t[216];let Jt=De||Re||void 0,Yt;t[217]===Kt?Yt=t[218]:(Yt=Kt?{}:{defaultSize:`100%`},t[217]=Kt,t[218]=Yt);let Xt=!(De||Re)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Zt;t[219]===Xt?Zt=t[220]:(Zt=wi(Xt),t[219]=Xt,t[220]=Zt);let Qt;t[221]!==Ut||t[222]!==Yt||t[223]!==Zt?(Qt=(0,Z.jsx)(PE,{minSize:`30%`,...Yt,className:Zt,children:Ut}),t[221]=Ut,t[222]=Yt,t[223]=Zt,t[224]=Qt):Qt=t[224];let $t;t[225]!==Ye||t[226]!==Vt||t[227]!==Jt||t[228]!==Qt||t[229]!==Gt?($t=(0,Z.jsxs)(NE,{orientation:`horizontal`,groupRef:Ye,"data-dragging":Jt,children:[Qt,Vt,Gt]}),t[225]=Ye,t[226]=Vt,t[227]=Jt,t[228]=Qt,t[229]=Gt,t[230]=$t):$t=t[230];let en;t[231]!==d||t[232]!==ye?(en=ye?(0,Z.jsx)(IP,{dockPosition:`right`,onReveal:d,className:`top-2.5 right-0`}):null,t[231]=d,t[232]=ye,t[233]=en):en=t[233];let tn;return t[234]!==$t||t[235]!==en?(tn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:qt,children:[$t,en]}),t[234]=$t,t[235]=en,t[236]=tn):tn=t[236],tn}function qP(){}function JP(e){return!UP.has(e)}function YP(){return AD()}function XP(){return dD()}function ZP(){return Fr()}function QP(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 $P(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 eF=1e3,tF=!1;function nF(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function rF(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:xs(i)?a=i:(a=void 0,tF||(tF=!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`&&(nF({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=$P(i),{current:c,crossDoc:l}=a?_s(a,n,Date.now()):{current:[],crossDoc:[]},u=iF,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>QP(e.current,p)&&QP(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,eF);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 iF(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var aF=`sync-status`;async function oF(e){try{let t=await Oy(e);t.ok||Ss.error(t.message,{id:aF,duration:1/0})}catch{}}function sF(e,t){let n=(0,$.c)(6),{_:r}=an(),i=Ig(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){Ss.dismiss(aF);return}o.current=!0;let e=window.okDesktop;Ss.warning(r({id:`HGNCsl`}),{id:aF,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{oF(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,Ss.success(r({id:`GhjUB_`}),{id:aF,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var cF=4,lF=3,uF={Bird:od,Cat:pd,Dog:xd,Fish:Dd,Mouse:of,Rabbit:af,Shrimp:ff,Snail:pf,Squirrel:_f,Turtle:Df};Object.freeze(Object.keys(uF));function dF(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(uF,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var fF={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function pF(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=an(),o=dF(n),s=o.kind===`animal`?uF[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Or(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=fi(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(Hs,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Ws,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function mF(e){let t=fF[e.icon];return e.displayName||t||Ms._({id:`iEQQyu`})}function hF(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 gF(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=an(),{activeDocName:s}=pt(),{presence:c,agentId:l}=n,u=mF(c),d=hF(c.mode),f=!r&&d,p=c.currentDoc&&c.currentDoc!==`(connected)`?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(ys,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(ys,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(Vs,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(Hs,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(Ws,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function _F(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?Ms._({id:`9euN0m`,values:{count:n}}):Ms._({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)(pF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(gF,{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)(Tt,{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)(w,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function vF(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(pF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(gF,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function yF(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=pt(),{current:s,crossDoc:c}=rF(t,r,n);if(sF(jD(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,cF),n;e[6]===s?n=e[7]:(n=s.slice(cF),e[6]=s,e[7]=n);let r=n,u=c.slice(0,lF),d;e[8]===c?d=e[9]:(d=c.slice(lF),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=>vF(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)(_F,{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=>vF(e,p,!0,m)),f.length>0?(0,Z.jsx)(_F,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function bF(e,t){return t.trim()}function xF(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function SF(e,t){let n=bF(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function CF(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(dl(e)){let t=s.get(Iu(e.docName,e.docExt));if(t){let n=ol(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:qn(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(cl(e))return{...e,path:AF(e.path,n)};if(il(e)){let t=s.get(e.path);return t&&xl(t)?{kind:`document`,docName:Su(t),docExt:Cl(t),size:e.size,modified:e.modified}:{...e,path:t??AF(e.path,n)}}return e})}function wF(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=>dl(e)?!i.has(e.docName)&&!PF(e.docName,n):cl(e)?!PF(e.path,n):il(e)?!a.has(e.path)&&!PF(e.path,n):!0)}function TF(e,t){if(e.kind!==`asset`||t.some(t=>il(t)&&t.path===e.path))return e;let n=zu(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function EF(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>jF(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>dl(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=>cl(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(dl(i)){let e=NF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(cl(i)){let e=MF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function DF(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function OF(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function kF(e,t){let n=e.kind===`file`?Iu(e.path,e.docExt):e.path;return co(t.contentDir,n,t.pathSeparator)}function AF(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 jF(e,t){return dl(e)&&dl(t)?e.docName===t.docName:cl(e)&&cl(t)||il(e)&&il(t)?e.path===t.path:!1}function MF(e,t,n){return e===t?n:NF(e,t,n)}function NF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function PF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function FF(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)(Op,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function IF(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=wi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(kp,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function LF(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)(Mp,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function RF(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)(Rp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function zF(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=wi(`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)(Ap,{children:(0,Z.jsx)(jp,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function BF(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=wi(`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)(Pp,{"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 VF(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=wi(`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)(Qa,{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)(zp,{"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 HF(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=wi(`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)(Bp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UF(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=wi(`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)(Ip,{children:(0,Z.jsx)(Ha,{})})}),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)(Fp,{"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 WF(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=wi(`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)(Np,{"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 GF(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=wi(`-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)(Lp,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var KF=`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`,qF=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,JF={start:[es.Space],cancel:[es.Esc],end:[es.Space,es.Enter]};function YF(e){return wi(KF,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function XF(e){return e?void 0:-1}function ZF({className:e,isDragging:t}){return wi(e,t&&qF)}function QF(e){return e.code===es.Enter&&e.target===e.currentTarget}function $F({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&QF(e)?`activate-tab`:`delegate-sortable`}function eI({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:as.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 tI(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 nI(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 rI=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 Jo(e)},iI=[`.md`,`.mdx`],aI=`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`,oI=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,sI=wi(oI,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),cI=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function lI(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function uI(e){let t=Jc(e);window.location.hash!==t&&(window.location.hash=t)}function dI(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function fI(e,t){let n=[t,...iI].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 pI(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:_}=rs(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=eI({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=$F({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=ZF({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 mI(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=De(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=De(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(IF,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Y,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(BF,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Y,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(BF,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(Y,{id:`U2Kx6T`}):(0,Z.jsx)(Y,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(BF,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(GF,{}),(0,Z.jsx)(BF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(Y,{id:`SYfHmN`}):(0,Z.jsx)(Y,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(zF,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(FF,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function hI(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:i,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=an();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(rf,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(X,{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 l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]===i?u=t[14]:(u=YF(i),t[13]=i,t[14]=u);let d;t[15]===i?d=t[16]:(d=XF(i),t[15]=i,t[16]=d);let f;t[17]!==r||t[18]!==o?(f=e=>{e.stopPropagation(),r(o)},t[17]=r,t[18]=o,t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Cs,{"aria-hidden":`true`}),t[20]=p):p=t[20];let m;return t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f?(m=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:u,tabIndex:d,onClick:f,children:p}),t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=m):m=t[25],m}function gI(e){let t=(0,$.c)(1),{docName:n}=e;if(aD(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(eo,{"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 _I(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:c,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,newTabIds:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=pt(),{_:w}=an(),{pageMeta:T}=to(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(t),H;e[0]!==n||e[1]!==t||e[2]!==i?(H=n??(i?Yt(i):t?en(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=H):H=e[3];let U=H,W;e[4]!==r||e[5]!==U||e[6]!==m||e[7]!==h||e[8]!==_?(W=m?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:U?`${U}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=U,e[6]=m,e[7]=h,e[8]=_,e[9]=W):W=e[9];let G=W,K,ee;e[10]===t?(K=e[11],ee=e[12]):(K=()=>{V.current=t},ee=[t],e[10]=t,e[11]=K,e[12]=ee),(0,Q.useEffect)(K,ee);let te,q;e[13]===G?(te=e[14],q=e[15]):(te=()=>{G&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[G],e[13]=G,e[14]=te,e[15]=q),(0,Q.useEffect)(te,q);let J,re;e[16]===k?(J=e[17],re=e[18]):(J=()=>{k&&(L.current?.focus(),L.current?.select())},re=[k],e[16]=k,e[17]=J,e[18]=re),(0,Q.useEffect)(J,re);let ae,oe;e[19]!==_||e[20]!==k?(ae=()=>{!k||_.includes(k.tabId)||(z.current=!0,B.current=null,A(null),M(``),P(null),I(!1))},oe=[_,k],e[19]=_,e[20]=k,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(`/`);z.current=!1,B.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),P(null)},ce=function(){z.current=!0,B.current=null,A(null),M(``),P(null),I(!1)},le=async function(){if(z.current){z.current=!1;return}if(R.current)return;let e=k?.docName;if(!e){ce();return}let t=bF(`file`,fI(j,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===B.current){L.current?.focus();return}if(!xF(t)){P(w({id:`P8yDjG`})),L.current?.focus();return}let i=SF({kind:`file`,path:e,name:r},t);R.current=!0,I(!0),P(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(z.current){I(!1),R.current=!1;return}let r=await s(n,`Server error (HTTP ${n.status})`);if(!r.ok){P(r.title),I(!1),R.current=!1,B.current=t,L.current?.focus();return}let a=Ie(Nr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=V.current,l=DF(o,a);it(a);let u=!0;try{let e=OF(a,f(),p);await Promise.all(e.map(e=>c(e))),b(a),Os([`files`,`backlinks`,`graph`])}catch(n){let r=n;u=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),Ss.error(w({id:`MUBR8r`}))}z.current=!0,A(null),M(``),P(null),I(!1),R.current=!1,B.current=null,u&&l&&l!==o&&uI(l)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),P(w({id:`HIb0vl`})),I(!1),R.current=!1,B.current=t,L.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===h?de=e[24]:(de=new Set(h),e[23]=h,e[24]=de);let fe=de,pe;e[25]===D?pe=e[26]:(pe=nI(D),e[25]=D,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]!==l||e[30]!==d||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&&d(t);for(let e of n)l(e)},e[29]=l,e[30]=d,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ve;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ve={activationConstraint:{distance:8}},e[33]=ve):ve=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:Zo,keyboardCodes:JF},e[34]=ye):ye=e[34];let be=is(Go(Yo,ve),Go(Qo,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){O(tI(E.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){O(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==x||e[39]!==C?(Te=function(e){we();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=C.indexOf(t),i=C.indexOf(n);r<0||i<0||r===i||x(ts([...C],r,i),t)},e[37]=we,e[38]=x,e[39]=C,e[40]=Te):Te=e[40];let Ee=Te,De=ue?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=wi(`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]=Oe):Oe=e[41];let ke=dI,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=wi(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let je=qo,Me=rI,Ne;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={container:typeof document<`u`?document.body:void 0},e[43]=Ne):Ne=e[43];let Pe=$o,Fe;e[44]===C?Fe=e[45]:(Fe=[...C],e[44]=C,e[45]=Fe);let Le=Ko,Re=C.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(mI,{tabId:e,canPin:!1,openTabs:C,closeTab:l,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(pI,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:wi(aI,t?oI:sI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:cI,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(Y,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:YF(t),tabIndex:XF(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Cs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=ne(e),n=e===U,i=y.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=ie(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(mI,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(pI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(aI,n?oI:sI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:cI,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:wi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:wi(`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)(hI,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}if(t.kind===`asset`||t.kind===`skill-file`){let{baseName:r,label:o,prefix:s}=ie(t.kind===`asset`?t.assetPath:t.path,``),c=`${s}${o}`;return(0,Z.jsx)(mI,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(pI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(aI,n?oI:sI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:cI,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:wi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:wi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(hI,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}let s=t.docName,c=T.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=ie(s,c),h=`${m}${p}`,g=c===`.md`||c===`.mdx`,_=k?.tabId===e,b=`editor-tab-rename-error-${lI(s)}`;return(0,Z.jsx)(mI,{disabled:_,tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsx)(pI,{tabId:e,activateFromKeyboard:()=>a(e),disabled:_,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(aI,n?oI:sI,_&&N&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(IE,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(VE,{ref:L,value:j,disabled:F,"aria-label":w({id:`Dw1T_W`,values:{label:p}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?b:void 0,"aria-busy":F||void 0,title:N??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{M(fI(e.target.value,c)),P(null),B.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(RE,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(BE,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),N?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":h,title:h,className:cI,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,s)},tabIndex:-1,children:[(0,Z.jsx)(gI,{docName:s}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(hI,{accessibleLabel:h,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})})},e)}),ze;e[46]!==Pe||e[47]!==Fe||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Pe,{items:Fe,strategy:Le,children:Re}),e[46]=Pe,e[47]=Fe,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==je||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Me||e[58]!==Ne||e[59]!==ze||e[60]!==he?(Be=(0,Z.jsx)(je,{sensors:be,autoScroll:!1,collisionDetection:Me,modifiers:he,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Ne,children:ze}),e[51]=je,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Me,e[58]=Ne,e[59]=ze,e[60]=he,e[61]=Be):Be=e[61];let Ve;e[62]===w?Ve=e[63]:(Ve=w({id:`3YvS-c`}),e[62]=w,e[63]=Ve);let He;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(Lt,{"aria-hidden":`true`}),e[64]=He):He=e[64];let Ue;e[65]!==g||e[66]!==Ve?(Ue=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:He})}),e[65]=g,e[66]=Ve,e[67]=Ue):Ue=e[67];let We;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`3YvS-c`})}),e[68]=We):We=e[68];let Ge;e[69]===Ue?Ge=e[70]:(Ge=(0,Z.jsxs)(Ws,{children:[Ue,We]}),e[69]=Ue,e[70]=Ge);let Ke;e[71]!==Ae||e[72]!==Be||e[73]!==Ge?(Ke=(0,Z.jsxs)(`div`,{className:Ae,children:[Be,Ge]}),e[71]=Ae,e[72]=Be,e[73]=Ge,e[74]=Ke):Ke=e[74];let qe;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==Ke?(qe=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":De,className:Oe,onWheel:ke,children:Ke}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=Ke,e[79]=qe):qe=e[79],qe}var vI=(e,t,n)=>{if(e&&`reportValidity`in e){let r=Ai(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},yI=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?vI(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>vI(t,n,e))}},bI=(e,t)=>{t.shouldUseNativeValidation&&yI(e,t);let n={};for(let r in e){let i=Ai(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(xI(t.names||Object.keys(e),r)){let e=Object.assign({},Ai(n,r));zi(e,`root`,a),zi(n,r,e)}else zi(n,r,a)}return n},xI=(e,t)=>{let n=SI(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>SI(e).match(`^${n}\\.\\d+`))};function SI(e){return e.replace(/[\[\]]/g,``)}function CI(){return CI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},CI.apply(null,arguments)}function wI(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function TI(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ji(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function EI(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(CI({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ji(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function DI(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(wI(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&yI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:bI(TI(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(wI(function(){return Promise.resolve((n.mode===`sync`?Qn:hr)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&yI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof yr}(e))return{values:{},errors:bI(EI(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var OI=`https://openknowledge.ai/api/subscribe`;async function kI(e,t){try{let n=await fetch(OI,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function AI(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=an(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let _,v;if(t[3]!==u){let e=Rn({email:lr({message:u({id:`Wq6Wcm`})})});v=ca,_=DI(e),t[3]=u,t[4]=_,t[5]=v}else _=t[4],v=t[5];let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y={email:``},t[6]=y):y=t[6];let b;t[7]===_?b=t[8]:(b={resolver:_,defaultValues:y},t[7]=_,t[8]=b);let x=v(b),{isSubmitting:S}=x.formState,C=x.formState.errors.email?.message??x.formState.errors.root?.message,w;t[9]!==u||t[10]!==x||t[11]!==a||t[12]!==n?(w=async function(e){x.clearErrors(`root`);let t=await kI(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){x.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){x.setError(`root`,{message:u({id:`4mLBx9`})});return}x.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=x,t[11]=a,t[12]=n,t[13]=w):w=t[13];let T=w,E;t[14]===l?E=t[15]:(E=wi(`flex flex-col gap-3`,l),t[14]=l,t[15]=E);let D=d?-1:void 0,O;t[16]!==d||t[17]!==r?(O=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Ha,{className:`size-4 text-primary`}),(0,Z.jsx)(Y,{id:`PIMM5l`})]}):r??(0,Z.jsx)(Y,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=O):O=t[18];let k;t[19]!==O||t[20]!==D?(k=(0,Z.jsx)(`p`,{ref:p,tabIndex:D,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:O}),t[19]=O,t[20]=D,t[21]=k):k=t[21];let A;t[22]!==i||t[23]!==d?(A=d?(0,Z.jsx)(Y,{id:`pBROkv`}):i??(0,Z.jsx)(Y,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=A):A=t[24];let j;t[25]===A?j=t[26]:(j=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:A}),t[25]=A,t[26]=j);let M;t[27]!==k||t[28]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[k,j]}),t[27]=k,t[28]=j,t[29]=M):M=t[29];let N;t[30]!==u||t[31]!==o?(N=o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(Cs,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=N):N=t[32];let P;t[33]!==M||t[34]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[M,N]}),t[33]=M,t[34]=N,t[35]=P):P=t[35];let F;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==C||t[40]!==x||t[41]!==S||t[42]!==T||t[43]!==d?(F=d?null:(0,Z.jsxs)(`form`,{onSubmit:x.handleSubmit(T),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Ta,{control:x.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(IE,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(RE,{className:`pl-2.5`,children:(0,Z.jsx)(Wd,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(VE,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(X,{type:`submit`,disabled:S,size:c?`icon`:`default`,className:wi(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fo,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(g,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`EDl9kS`})})]}):(0,Z.jsx)(Y,{id:`EDl9kS`})})]})}}),C?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:C}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=C,t[40]=x,t[41]=S,t[42]=T,t[43]=d,t[44]=F):F=t[44];let I;return t[45]!==P||t[46]!==F||t[47]!==E?(I=(0,Z.jsxs)(`div`,{className:E,children:[P,F]}),t[45]=P,t[46]=F,t[47]=E,t[48]=I):I=t[48],I}var jI=`https://github.com/inkeep/open-knowledge`,MI=`https://discord.com/invite/YujKpFN49`,NI=`https://x.com/OpenKnowledgeAI`;function PI(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 FI(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 II=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:re},{label:{id:`PCNIuJ`},href:`${jI}/issues/new`,icon:hd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:no}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:MI,icon:PI},{label:`X (Twitter)`,href:NI,icon:FI},{label:`GitHub`,href:jI,icon:Rm}]}],LI=`${jI}/releases`,RI=`group 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`;function zI(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var BI=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=an(),i,a,o,s;t[0]!==r||t[1]!==n?(i=zI(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(vf,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},VI=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=an(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>Ns(e,o),l=e=>Ns(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:RI,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},HI=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},UI=()=>{let e=(0,$.c)(28),{_:t}=an(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c,l;e[0]!==n||e[1]!==o?(c=()=>{if(!n||o!==null)return;let e=new AbortController;return kr({signal:e.signal}).then(e=>{e!==null&&s(e)}),()=>e.abort()},l=[n,o],e[0]=n,e[1]=o,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{r(e),e||a(!1)},e[4]=u):u=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{className:`size-4`}),e[5]=d):d=e[5];let f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[d,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]})})}),e[6]=f):f=e[6];let p;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(Ws,{children:[f,(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]}),e[7]=p):p=e[7];let m;e[8]!==t||e[9]!==o?(m=II.map((e,n)=>(0,Z.jsxs)(`div`,{className:wi(n>0&&`mt-3`),children:[(0,Z.jsx)(HI,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:e.links.map(e=>(0,Z.jsx)(VI,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&o!==null?(0,Z.jsx)(BI,{count:o}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=o,e[10]=m):m=e[10];let h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(HI,{children:(0,Z.jsx)(Y,{id:`arUUsK`})}),e[11]=h):h=e[11];let g;e[12]===t?g=e[13]:(g=t({id:`arUUsK`}),e[12]=t,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(VI,{link:{label:{id:`3ePd3I`},href:LI,icon:Kd}}),e[14]=_):_=e[14];let v;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:wi(RI,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(Wd,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(Y,{id:`EDl9kS`})]})}),e[15]=v):v=e[15];let y;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Tt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(AI,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:WI})}),e[16]=y):y=e[16];let b;e[17]===i?b=e[18]:(b=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[_,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(w,{open:i,onOpenChange:a,children:[v,y]})})]}),e[17]=i,e[18]=b);let x;e[19]!==b||e[20]!==g?(x=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[h,(0,Z.jsx)(`nav`,{"aria-label":g,children:b})]}),e[19]=b,e[20]=g,e[21]=x):x=e[21];let S;e[22]!==x||e[23]!==m?(S=(0,Z.jsxs)(Tt,{align:`end`,className:`w-56 p-3`,children:[m,x]}),e[22]=x,e[23]=m,e[24]=S):S=e[24];let C;return e[25]!==n||e[26]!==S?(C=(0,Z.jsxs)(w,{open:n,onOpenChange:u,children:[p,S]}),e[25]=n,e[26]=S,e[27]=C):C=e[27],C};function WI(){return Yg.markSubscribed()}var GI=50,KI=()=>{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,xE.preload()},GI))},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,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Gi)},l=(0,Z.jsx)(uf,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Ws,{children:[u,(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},qI=`https://openknowledge.ai/docs/features/share`;function JI(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:i}=an(),{status:a}=Ki(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(h=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Mi({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:To,toastSuccess:nL,toastError:tL,logEvent:eL});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0})}catch{Ss.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=h):h=t[9];let g=h,_=c!==null,v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||l(null)},t[10]=v):v=t[10];let y;t[11]!==i||t[12]!==n?.kind?(y=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=y):y=t[13];let b=o||m,x,S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(df,{className:`size-3.5`,"aria-hidden":!0}),S=(0,Z.jsx)(Y,{id:`Z8lGw6`}),t[14]=x,t[15]=S):(x=t[14],S=t[15]);let C;t[16]!==g||t[17]!==y||t[18]!==b?(C=(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":y,onClick:g,disabled:b,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[x,S]})}),t[16]=g,t[17]=y,t[18]=b,t[19]=C):C=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`Z8lGw6`})}),t[20]=T):T=t[20];let E;t[21]===c?.autoCopyFailed?E=t[22]:(E=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ndeI89`})}):null,t[21]=c?.autoCopyFailed,t[22]=E);let D=c?.url??``,O;t[23]===i?O=t[24]:(O=i({id:`5-FeN2`}),t[23]=i,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsx)(Vc,{ref:u,readOnly:!0,value:D,onFocus:$I,onClick:QI,onContextMenu:ZI,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":O}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A=c?.url??``,j=c?.autoCopyFailed===!1,M;t[28]!==A||t[29]!==j?(M=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(z,{copyContent:A,clipboardWrite:To,initialCopied:j})})}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(`div`,{className:`relative`,children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(`a`,{href:qI,target:`_blank`,rel:`noopener noreferrer`,onClick:XI,onAuxClick:YI,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(J,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(Y,{id:`aByJ8j`})]}),t[34]=F):F=t[34];let I;t[35]!==E||t[36]!==N?(I=(0,Z.jsxs)(Tt,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[T,E,N,F]}),t[35]=E,t[36]=N,t[37]=I):I=t[37];let L;return t[38]!==C||t[39]!==I||t[40]!==_?(L=(0,Z.jsxs)(w,{open:_,onOpenChange:v,children:[C,I]}),t[38]=C,t[39]=I,t[40]=_,t[41]=L):L=t[41],L}function YI(e){return Ns(e,qI)}function XI(e){return Ns(e,qI)}function ZI(e){return e.currentTarget.select()}function QI(e){return e.currentTarget.select()}function $I(e){return e.currentTarget.select()}function eL(e){return console.log(e)}function tL(e){e!==`Link ready but could not copy to clipboard.`&&Ss.error(e)}function nL(e){return Ss.success(e)}function rL(e){let t=(0,$.c)(35),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=an(),{activeDocName:s,activeTarget:c}=pt(),l=s?ni(s):null,{state:u,isDraggingRail:d}=kN(),f=uy(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Tl(`toggle-files-sidebar`),t[0]=p):p=t[0];let m=p,h=Tl(`command-palette`),[g,_]=(0,Q.useState)(!1),v;bb0:{if(c?.kind===`folder`){let e;t[1]===c.folderPath?e=t[2]:(e=Bi(c.folderPath),t[1]=c.folderPath,t[2]=e),v=e;break bb0}if(s&&!l){let e;t[3]===s?e=t[4]:(e=Ri(s),t[3]=s,t[4]=e),v=e;break bb0}if(!c&&!s){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Bi(``),t[5]=e):e=t[5],v=e;break bb0}v=null}let y=v,b=typeof window<`u`&&window.okDesktop!=null,x=u===`collapsed`,S=b?``:void 0,C=b&&x&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,w=b&&!d&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,T;t[6]!==C||t[7]!==w?(T=wi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,b&&`[-webkit-app-region:drag]`,C,w),t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(PN,{className:wi(`-ml-1 shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Hs,{children:u===`expanded`?(0,Z.jsx)(Y,{id:`ZxXhLY`,values:{sidebarShortcut:m}}):(0,Z.jsx)(Y,{id:`Zz25kq`,values:{sidebarShortcut:m}})})]}),x&&i&&(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:h}}),"data-telemetry-event":`ok.editor_header.search.click`,className:wi(`shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(o,{"aria-hidden":`true`})})}),(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`IN4UX8`,values:{searchShortcut:h}})})]}),(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(_I,{})]}),D;t[9]===E?D=t[10]:(D=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:E}),t[9]=E,t[10]=D);let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=wi(`flex shrink-0 items-center justify-end gap-2 px-3`,b&&`[&>*]:[-webkit-app-region:no-drag]`),t[11]=O):O=t[11];let k;t[12]!==g||t[13]!==_||t[14]!==y||t[15]!==f?(k=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(JI,{input:y,onClickWhenNoRemote:()=>_(!0)}),(0,Z.jsx)(ki,{open:g,onOpenChange:_})]}),t[12]=g,t[13]=_,t[14]=y,t[15]=f,t[16]=k):k=t[16];let A;t[17]!==r||t[18]!==n?(A=(0,Z.jsx)(Ca,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=A):A=t[19];let j,M,N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(yF,{}),M=(0,Z.jsx)(Xi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),N=(0,Z.jsx)(cm,{}),t[20]=j,t[21]=M,t[22]=N):(j=t[20],M=t[21],N=t[22]);let P;t[23]===f?P=t[24]:(P=!f&&(0,Z.jsx)(KI,{}),t[23]=f,t[24]=P);let F;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(UI,{}),t[25]=F):F=t[25];let I;t[26]!==k||t[27]!==A||t[28]!==P?(I=(0,Z.jsxs)(`div`,{className:O,children:[k,A,j,M,N,P,F]}),t[26]=k,t[27]=A,t[28]=P,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==S||t[32]!==T||t[33]!==D?(L=(0,Z.jsxs)(`header`,{"data-electron-drag":S,className:T,children:[D,I]}),t[30]=I,t[31]=S,t[32]=T,t[33]=D,t[34]=L):L=t[34],L}var iL=`open-knowledge:terminal-launch`;function aL(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(iL,{detail:{prompt:e,cli:t}}))}function oL(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli)};return t.addEventListener(iL,n),()=>t.removeEventListener(iL,n)}function sL(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=wi(`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)(nm,{"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 cL=Ci(`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 lL(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=wi(cL({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)(rm,{"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 uL(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=wi(`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)(im,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dL(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=wi(`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)(am,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var fL=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-Ds-ev2-D.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([81,1,30,3,7,31,6,10,13,11,82,62,44,83]),import.meta.url));function pL(e){let t=(0,$.c)(14),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o,onPtyId:s}=e,c=a===void 0?null:a,l=o===void 0?null:o,{enabled:u,synced:d}=ra(),f=Ji(),{_:p}=an(),m=d&&u===!1,g;t[0]!==p||t[1]!==f?(g=function(){if(f===null){Ss.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||Ss.error(p({id:`jKd3AP`,values:{0:e.error}}))},t[0]=p,t[1]=f,t[2]=g):g=t[2];let _=g;if(d&&!m){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 a;return t[4]!==l||t[5]!==n||t[6]!==c||t[7]!==r||t[8]!==s||t[9]!==i?(a=(0,Z.jsx)(h,{fallbackRender:hL,onError:mL,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(fL,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:c,adoptPtyId:l,onPtyId:s})})}),t[4]=l,t[5]=n,t[6]=c,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a}let v;return t[11]!==_||t[12]!==m?(v=m?(0,Z.jsx)(vL,{onEnable:_}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[11]=_,t[12]=m,t[13]=v):v=t[13],v}function mL(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function hL(e){return(0,Z.jsx)(gL,{...e})}function gL(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=an(),i;t[0]!==r||t[1]!==n?(i=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]=i):i=t[2];let a=i,o;t[3]===r?o=t[4]:(o=r({id:`6MnZEC`}),t[3]=r,t[4]=o);let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[5]=a,t[6]=s);let c;t[7]===r?c=t[8]:(c=r({id:`HpK_8d`}),t[7]=r,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,Z.jsx)(X,{onClick:_L,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==o||t[12]!==s||t[13]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":o,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[s,l]}),t[11]=o,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function _L(){return window.location.reload()}function vL(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=an(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`oYepHb`}),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=r({id:`v2ZW0K`}),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==s?(c=(0,Z.jsx)(X,{onClick:n,children:s}),t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;t[11]===r?l=t[12]:(l=r({id:`ICoNYz`}),t[11]=r,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;return t[15]!==i||t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[o,c,u]}),t[15]=i,t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function yL(e){let t=(0,$.c)(48),{selected:n,onLaunchSelected:r,onPickCli:i,onPickTerminal:a,className:o}=e,{_:s}=an(),c=n===`terminal`,l;t[0]!==s||t[1]!==c||t[2]!==n?(l=s(c?{id:`AB4qw9`}:{id:`nP-KFo`,values:{0:Vn[n].displayName}}),t[0]=s,t[1]=c,t[2]=n,t[3]=l):l=t[3];let u=l,d;t[4]===o?d=t[5]:(d=wi(`flex shrink-0 items-center`,o),t[4]=o,t[5]=d);let f;t[6]!==c||t[7]!==n?(f=c?(0,Z.jsx)(gf,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(go,{id:ho(n),className:`size-3.5`,"aria-hidden":`true`}),t[6]=c,t[7]=n,t[8]=f):f=t[8];let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`size-3`}),t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==u||t[12]!==f?(m=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":u,"data-testid":`terminal-new-chat`,className:`cursor-pointer gap-0.5 rounded-r-none px-1.5 text-muted-foreground hover:text-foreground`,onClick:r,children:[f,p]})}),t[10]=r,t[11]=u,t[12]=f,t[13]=m):m=t[13];let h;t[14]===u?h=t[15]:(h=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:u}),t[14]=u,t[15]=h);let g;t[16]!==m||t[17]!==h?(g=(0,Z.jsxs)(Ws,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18];let _;t[19]===s?_=t[20]:(_=s({id:`QJaG-9`}),t[19]=s,t[20]=_);let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Xa,{"aria-hidden":`true`,className:`size-3`}),t[21]=v):v=t[21];let y;t[22]===_?y=t[23]:(y=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:v})}),t[22]=_,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`hIQkLb`})}),t[24]=b):b=t[24];let x;t[25]!==s||t[26]!==i||t[27]!==n?(x=Do.map(e=>{let{displayName:t}=Vn[e];return(0,Z.jsxs)(Cc,{onSelect:()=>i(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":s({id:`9mEZeD`,values:{name:t}}),"aria-current":n===e?`true`:void 0,children:[(0,Z.jsx)(go,{id:ho(e),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),n===e?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)}),t[25]=s,t[26]=i,t[27]=n,t[28]=x):x=t[28];let S;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Ic,{}),t[29]=S):S=t[29];let C=c?`true`:void 0,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(gf,{"aria-hidden":`true`,className:`size-4`}),t[30]=w):w=t[30];let T;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),t[31]=T):T=t[31];let E;t[32]===c?E=t[33]:(E=c?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null,t[32]=c,t[33]=E);let D;t[34]!==a||t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(Cc,{onSelect:a,"data-testid":`terminal-new-chat-terminal`,"aria-current":C,children:[w,T,E]}),t[34]=a,t[35]=C,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==x||t[39]!==D?(O=(0,Z.jsxs)(Tc,{align:`start`,className:`min-w-[180px]`,children:[b,x,S,D]}),t[38]=x,t[39]=D,t[40]=O):O=t[40];let k;t[41]!==y||t[42]!==O?(k=(0,Z.jsxs)(jc,{children:[y,O]}),t[41]=y,t[42]=O,t[43]=k):k=t[43];let A;return t[44]!==d||t[45]!==k||t[46]!==g?(A=(0,Z.jsxs)(`div`,{className:d,children:[g,k]}),t[44]=d,t[45]=k,t[46]=g,t[47]=A):A=t[47],A}function bL(e){let t=(0,$.c)(60),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,newChatSelected:o,onNewChatLaunch:s,onNewChatPickCli:c,onNewChatPickTerminal:l,onClose:u,dockPosition:d,onToggleDock:f,onCollapse:p,children:m,className:h}=e,{_:g}=an(),_=d===`right`,v;t[0]===h?v=t[1]:(v=wi(`flex min-h-0 min-w-0 flex-1 flex-col`,h),t[0]=h,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`1MGRQl`}),t[2]=g,t[3]=y);let b;if(t[4]!==g||t[5]!==r||t[6]!==u||t[7]!==a||t[8]!==n){let e;t[10]!==g||t[11]!==r||t[12]!==u||t[13]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:wi(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(uL,{value:e.id,onClick:()=>a?.(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)(Hs,{side:`bottom`,sideOffset:8,children:e.label})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":g({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:wi(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),u(e.id)},children:(0,Z.jsx)(Cs,{"aria-hidden":`true`})})]},e.id)},t[10]=g,t[11]=r,t[12]=u,t[13]=a,t[14]=e):e=t[14],b=n.map(e),t[4]=g,t[5]=r,t[6]=u,t[7]=a,t[8]=n,t[9]=b}else b=t[9];let x;t[15]!==y||t[16]!==b?(x=(0,Z.jsx)(lL,{variant:`line`,"aria-label":y,className:`flex h-auto min-w-0 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:b}),t[15]=y,t[16]=b,t[17]=x):x=t[17];let S;t[18]!==o||t[19]!==s||t[20]!==c||t[21]!==l?(S=(0,Z.jsx)(yL,{selected:o,onLaunchSelected:s,onPickCli:c,onPickTerminal:l,className:`shrink-0`}),t[18]=o,t[19]=s,t[20]=c,t[21]=l,t[22]=S):S=t[22];let C;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(`div`,{className:`flex-1`}),t[23]=C):C=t[23];let w;t[24]!==g||t[25]!==_?(w=g(_?{id:`rf6x3F`}:{id:`QNxpRm`}),t[24]=g,t[25]=_,t[26]=w):w=t[26];let T;t[27]===_?T=t[28]:(T=_?(0,Z.jsx)(Xd,{"aria-hidden":`true`}):(0,Z.jsx)(ef,{"aria-hidden":`true`}),t[27]=_,t[28]=T);let E;t[29]!==f||t[30]!==w||t[31]!==T?(E=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":w,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:f,children:T})}),t[29]=f,t[30]=w,t[31]=T,t[32]=E):E=t[32];let D;t[33]===_?D=t[34]:(D=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:_?(0,Z.jsx)(Y,{id:`rf6x3F`}):(0,Z.jsx)(Y,{id:`QNxpRm`})}),t[33]=_,t[34]=D);let O;t[35]!==D||t[36]!==E?(O=(0,Z.jsxs)(Ws,{children:[E,D]}),t[35]=D,t[36]=E,t[37]=O):O=t[37];let k;t[38]===g?k=t[39]:(k=g({id:`VZGGPK`}),t[38]=g,t[39]=k);let A;t[40]===_?A=t[41]:(A=_?(0,Z.jsx)(Qa,{"aria-hidden":`true`}):(0,Z.jsx)(Xa,{"aria-hidden":`true`}),t[40]=_,t[41]=A);let j;t[42]!==p||t[43]!==k||t[44]!==A?(j=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":k,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:p,children:A})}),t[42]=p,t[43]=k,t[44]=A,t[45]=j):j=t[45];let M;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`VZGGPK`})}),t[46]=M):M=t[46];let N;t[47]===j?N=t[48]:(N=(0,Z.jsxs)(Ws,{children:[j,M]}),t[47]=j,t[48]=N);let P;t[49]!==O||t[50]!==N||t[51]!==x||t[52]!==S?(P=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[x,S,C,O,N]}),t[49]=O,t[50]=N,t[51]=x,t[52]=S,t[53]=P):P=t[53];let F;return t[54]!==r||t[55]!==m||t[56]!==i||t[57]!==v||t[58]!==P?(F=(0,Z.jsxs)(sL,{value:r,onValueChange:i,className:v,children:[P,m]}),t[54]=r,t[55]=m,t[56]=i,t[57]=v,t[58]=P,t[59]=F):F=t[59],F}function xL(e){return`terminal-session-${e}`}function SL(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function CL(e){let t=(0,$.c)(77),{bridge:n,visible:r,onVisibleChange:i,launch:a,installedClis:o,container:s,isShowing:c,onRequestEditorFocus:l,dockPosition:u,onToggleDock:d,onHasSessionsChange:f}=e,p=a===void 0?null:a,{_:m}=an(),[h]=(0,Q.useState)(kL),g,_;t[0]!==s||t[1]!==h?(g=()=>{h==null||s==null||h.parentElement!==s&&s.appendChild(h)},_=[h,s],t[0]=s,t[1]=h,t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useLayoutEffect)(g,_);let v=typeof n.terminal?.list==`function`,y;t[4]!==v||t[5]!==p||t[6]!==r?(y=()=>!v&&r?[{id:xL(1),launch:p,title:null,adoptPtyId:null}]:[],t[4]=v,t[5]=p,t[6]=r,t[7]=y):y=t[7];let[b,x]=(0,Q.useState)(y),S;t[8]!==v||t[9]!==r?(S=()=>!v&&r?xL(1):``,t[8]=v,t[9]=r,t[10]=S):S=t[10];let[C,w]=(0,Q.useState)(S),[T,E]=(0,Q.useState)(!v),D=(0,Q.useRef)(!1),O=(0,Q.useRef)(C),k=(0,Q.useRef)(b),A=(0,Q.useRef)(!v&&r?1:0),j=(0,Q.useRef)(r&&p?p.nonce:null),M=(0,Q.useRef)(r),N=(0,Q.useRef)(new Map),P=function(e,t){t===null?N.current.delete(e):N.current.set(e,t)},F=(0,Q.useRef)(0),I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){A.current+=1;let t=xL(A.current);x(n=>[...n,{id:t,launch:e,title:null,adoptPtyId:null}]),w(t)},t[11]=I):I=t[11];let L=I,[R,z]=(0,Q.useState)(OL),[B,V]=(0,Q.useState)(DL),H;t[12]===o?H=t[13]:(H=o??{},t[12]=o,t[13]=H);let U;t[14]!==R||t[15]!==H?(U=cb(R,H),t[14]=R,t[15]=H,t[16]=U):U=t[16];let W=U,G=B?`terminal`:W,K;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){F.current+=1,L({prompt:null,cli:e,nonce:F.current})},t[17]=K):K=t[17];let ee=K,te;t[18]!==W||t[19]!==B?(te=function(){B?L(null):ee(W)},t[18]=W,t[19]=B,t[20]=te):te=t[20];let q=te,J;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(J=function(e){V(!1),_b(!1);let t=nb(e);z(t),ob(t),ee(e)},t[21]=J):J=t[21];let ne=J,re;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){V(!0),_b(!0),L(null)},t[22]=re):re=t[22];let ie=re,ae;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e,t){let n=t.trim()===``?null:t.trim();x(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[23]=ae):ae=t[23];let oe=ae,se=(0,Q.useRef)(L),ce;t[24]!==C||t[25]!==l||t[26]!==i?(ce=function(e){let t=k.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===C){let e=(t[n-1]??t[n+1])?.id??``;w(e),e!==``&&queueMicrotask(()=>SL(e))}x(r),r.length===0&&(i(!1),l())},t[24]=C,t[25]=l,t[26]=i,t[27]=ce):ce=t[27];let le=ce,ue=(0,Q.useRef)(EL),de;t[28]!==C||t[29]!==le||t[30]!==b?(de=()=>{se.current=L,O.current=C,k.current=b,ue.current=()=>{C!==``&&le(C)}},t[28]=C,t[29]=le,t[30]=b,t[31]=de):de=t[31],(0,Q.useEffect)(de);let fe,pe;t[32]!==p||t[33]!==T||t[34]!==b.length||t[35]!==r?(fe=()=>{if(!T)return;let e=M.current;if(M.current=r,p!=null&&p.nonce!==j.current){j.current=p.nonce,se.current(p);return}r&&!e&&b.length===0&&se.current(null)},pe=[r,p,b.length,T],t[32]=p,t[33]=T,t[34]=b.length,t[35]=r,t[36]=fe,t[37]=pe):(fe=t[36],pe=t[37]),(0,Q.useEffect)(fe,pe);let me;t[38]===n.terminal?me=t[39]:(me=()=>{if(typeof n.terminal?.list!=`function`||D.current)return;D.current=!0;let e=!1;return(async()=>{let t;try{t=await n.terminal.list()??[]}catch(e){console.error(`[terminal] reload session list() failed; cold-starting:`,e),t=[]}if(!e){if(t.length>0){let e=t.map(TL);A.current=e.length,x(e),w(e[0]?.id??``)}E(!0)}})(),()=>{e=!0,D.current=!1}},t[38]=n.terminal,t[39]=me);let he;t[40]===n?he=t[41]:(he=[n],t[40]=n,t[41]=he),(0,Q.useEffect)(me,he);let ge;t[42]===n?ge=t[43]:(ge=[n],t[42]=n,t[43]=ge),(0,Q.useEffect)(()=>ok(e=>{let t=O.current,r=t===``?void 0:N.current.get(t);r==null?au():(n.terminal.input(r,e),queueMicrotask(()=>SL(t)))}),ge);let _e,ve;t[44]===n?(_e=t[45],ve=t[46]):(_e=()=>n.onMenuAction(e=>{e===`new-terminal`?se.current(null):e===`kill-terminal`&&ue.current()}),ve=[n],t[44]=n,t[45]=_e,t[46]=ve),(0,Q.useEffect)(_e,ve);let ye,be;t[47]===h?(ye=t[48],be=t[49]):(ye=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||h==null||!h.contains(document.activeElement))return;let t=k.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),w(t.id),queueMicrotask(()=>SL(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},be=[h],t[47]=h,t[48]=ye,t[49]=be),(0,Q.useEffect)(ye,be);let xe;t[50]!==n.editor||t[51]!==b.length?(xe=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:b.length>0})},t[50]=n.editor,t[51]=b.length,t[52]=xe):xe=t[52];let Se;t[53]!==n||t[54]!==b.length?(Se=[n,b.length],t[53]=n,t[54]=b.length,t[55]=Se):Se=t[55],(0,Q.useEffect)(xe,Se);let Ce,we;t[56]!==f||t[57]!==b.length?(Ce=()=>{f?.(b.length>0)},we=[f,b.length],t[56]=f,t[57]=b.length,t[58]=Ce,t[59]=we):(Ce=t[58],we=t[59]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[60]!==h||t[61]!==c||t[62]!==l||t[63]!==r?(Te=()=>{c||r||h==null||!h.contains(document.activeElement)||l()},Ee=[c,r,h,l],t[60]=h,t[61]=c,t[62]=l,t[63]=r,t[64]=Te,t[65]=Ee):(Te=t[64],Ee=t[65]),(0,Q.useLayoutEffect)(Te,Ee);let De,Oe;t[66]===c?(De=t[67],Oe=t[68]):(De=()=>{c&&SL(O.current)},Oe=[c],t[66]=c,t[67]=De,t[68]=Oe),(0,Q.useEffect)(De,Oe);let ke;if(t[69]!==m||t[70]!==b){let e;t[72]===m?e=t[73]:(e=(e,t)=>({id:e.id,label:e.title??m({id:`OVjNeX`,values:{0:t+1}})}),t[72]=m,t[73]=e),ke=b.map(e),t[69]=m,t[70]=b,t[71]=ke}else ke=t[71];let Ae=ke,je=b.length>0?(0,Z.jsx)(bL,{sessions:Ae,activeSessionId:C,onSelect:w,onTabActivate:wL,newChatSelected:G,onNewChatLaunch:q,onNewChatPickCli:ne,onNewChatPickTerminal:ie,onClose:le,dockPosition:u,onToggleDock:d,onCollapse:()=>i(!1),className:`h-full`,children:b.map(e=>(0,Z.jsx)(dL,{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)(pL,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>P(e.id,t),onTitleChange:t=>oe(e.id,t),onClose:()=>le(e.id)})},e.id))}):null,Me;return t[74]!==h||t[75]!==je?(Me=h==null?null:(0,ld.createPortal)(je,h),t[74]=h,t[75]=je,t[76]=Me):Me=t[76],Me}function wL(e){return queueMicrotask(()=>SL(e))}function TL(e,t){return{id:xL(t+1),launch:null,title:null,adoptPtyId:e.ptyId}}function EL(){}function DL(){return vb()}function OL(){return ab()}function kL(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function AL(e){let t=(0,$.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=qy(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Px[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null,[v,y]=(0,Q.useState)(!1),b=Jy(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(mb),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),pb(e),y(!0)},t[2]=A):A=t[2];let j=A,M;t[3]===O?M=t[4]:(M=function(){j(O===`right`?`bottom`:`right`)},t[3]=O,t[4]=M);let N=M,P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=P):P=t[5];let[F,I]=(0,Q.useState)(P),L=(0,Q.useRef)(0),R;t[6]===b?R=t[7]:(R=function(e){let t=e??cb(ab(),b);y(!0),L.current+=1,D({prompt:null,cli:t,nonce:L.current})},t[6]=b,t[7]=R);let z=R,B;t[8]!==x||t[9]!==z?(B=function(){y(!0),!x&&!gb()&&z()},t[8]=x,t[9]=z,t[10]=B):B=t[10];let V=B,H=Fi(),{projectConfig:U,projectLocalConfig:W,projectLocalSynced:G,projectSynced:K}=Bo(),{activeDocName:ee}=pt(),te=H?.hasRemote,q=H?.pushPermission?.checkStatus,J;t[11]!==m||t[12]!==U||t[13]!==W||t[14]!==G||t[15]!==K||t[16]!==te||t[17]!==q?(J=xb({autoSyncOnboardingDismissed:m,hasRemote:te,projectLocalSynced:G,projectSynced:K,projectLocalConfig:W,projectConfig:U,pushPermissionCheckStatus:q}),t[11]=m,t[12]=U,t[13]=W,t[14]=G,t[15]=K,t[16]=te,t[17]=q,t[18]=J):J=t[18];let ne=J,re,ie;t[19]===ee?(re=t[20],ie=t[21]):(re=()=>{let e=function(e){let t=e.detail;t&&ee&&Zl(ee,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(zy,e),()=>window.removeEventListener(zy,e)},ie=[ee],t[19]=ee,t[20]=re,t[21]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?y(NL):e===`new-terminal`&&y(!0)})},oe=[],t[22]=ae,t[23]=oe):(ae=t[22],oe=t[23]),(0,Q.useEffect)(ae,oe);let se,ce;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{if(window.okDesktop!=null)return;let e=function(e){El(e,`toggle-terminal-panel`)&&(e.preventDefault(),y(ML))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ce=[],t[24]=se,t[25]=ce):(se=t[24],ce=t[25]),(0,Q.useEffect)(se,ce);let le,ue;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>oL((e,t)=>{y(!0),L.current+=1,D({prompt:e,cli:t,nonce:L.current})}),ue=[],t[26]=le,t[27]=ue):(le=t[26],ue=t[27]),(0,Q.useEffect)(le,ue);let de,fe;t[28]===v?(de=t[29],fe=t[30]):(de=()=>{v||D(null)},fe=[v],t[28]=v,t[29]=de,t[30]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[31]!==C||t[32]!==v?(pe=()=>{window.okDesktop!=null&&C&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v})},me=[v,C],t[31]=C,t[32]=v,t[33]=pe,t[34]=me):(pe=t[33],me=t[34]),(0,Q.useEffect)(pe,me);let he,ge;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(jL).finally(()=>{t||w(!0)}),()=>{t=!0}},ge=[],t[35]=he,t[36]=ge):(he=t[35],ge=t[36]),(0,Q.useEffect)(he,ge);let _e,ve;t[37]===v?(_e=t[38],ve=t[39]):(_e=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&ha()}},ve=[v],t[37]=v,t[38]=_e,t[39]=ve),(0,Q.useEffect)(_e,ve),Xy(H?.pausedReason),Zy();let ye;t[40]===a?ye=t[41]:(ye=function(e){s(e),a(e)},t[40]=a,t[41]=ye);let be=ye,xe,Se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>{d(`auth`),l(!0)},Se=()=>{d(`identity`),l(!0)},t[42]=xe,t[43]=Se):(xe=t[42],Se=t[43]);let Ce;t[44]===r?Ce=t[45]:(Ce=(0,Z.jsx)(rL,{onSignIn:xe,onSetIdentity:Se,onOpenSearch:r}),t[44]=r,t[45]=Ce);let we=_?V:void 0,Te;t[46]!==f||t[47]!==o||t[48]!==be||t[49]!==we||t[50]!==O||t[51]!==v?(Te=(0,Z.jsx)(WP,{editorMode:o,onModeChange:be,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:I,onRevealTerminal:we}),t[46]=f,t[47]=o,t[48]=be,t[49]=we,t[50]=O,t[51]=v,t[52]=Te):Te=t[52];let Ee;t[53]!==b||t[54]!==O||t[55]!==E||t[56]!==F||t[57]!==v||t[58]!==N?(Ee=_&&g!=null?(0,Z.jsx)(CL,{bridge:g,visible:v,onVisibleChange:y,launch:E,installedClis:b,container:F.container,isShowing:F.isShowing,onRequestEditorFocus:()=>F.editorRegion?.focus(),dockPosition:O,onToggleDock:N,onHasSessionsChange:S}):null,t[53]=b,t[54]=O,t[55]=E,t[56]=F,t[57]=v,t[58]=N,t[59]=Ee):Ee=t[59];let De=u===`identity`,Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>{l(!1)},t[60]=Oe):Oe=t[60];let ke;t[61]!==c||t[62]!==De?(ke=(0,Z.jsx)($i,{open:c,onOpenChange:l,identityPrompt:De,onSuccess:Oe}),t[61]=c,t[62]=De,t[63]=ke):ke=t[63];let Ae;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=()=>h(!0),t[64]=Ae):Ae=t[64];let je;t[65]===ne?je=t[66]:(je=(0,Z.jsx)(yb,{open:ne,onResolved:Ae}),t[65]=ne,t[66]=je);let Me;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(Iy,{}),t[67]=Me):Me=t[67];let Ne;return t[68]!==Ce||t[69]!==Te||t[70]!==Ee||t[71]!==ke||t[72]!==je?(Ne=(0,Z.jsxs)(Z.Fragment,{children:[Ce,Te,Ee,ke,je,Me]}),t[68]=Ce,t[69]=Te,t[70]=Ee,t[71]=ke,t[72]=je,t[73]=Ne):Ne=t[73],Ne}function jL(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function ML(e){return!e}function NL(e){return!e}function PL(e){let t=Jc(gl(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function FL(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Li();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)(eo,{"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)(eo,{"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(IL),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 IL(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{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:()=>PL(e.file),children:[(0,Z.jsx)(eo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var LL=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
31
|
+
`,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;Nl(t,{style:t=>ql(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 pM.set(t.changes,i),i}function gM(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Sj).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(fM);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Al.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:dM.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function _M(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Sj).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(fM).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 vM(e){let t=new Il;for(let n of e.field(Sj)){let r=e.facet(yj).overrideChunk&&xM(e,n);t.add(n.fromB,n.fromB,hM(e,n,!!r))}return t.finish()}var yM=Ml.define({create:e=>vM(e),update(e,t){return t.state.field(Sj,!1)==t.startState.field(Sj,!1)?e:vM(t.state)},provide:e=>Vl.decorations.from(e)}),bM=new WeakMap;function xM(e,t){let n=bM.get(t);if(n!==void 0)return n;n=null;let r=e.field(fM),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(Fl.widget({widget:new SM(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Rj.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return bM.set(t,n),n}var SM=class extends Ol{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}},CM=new class extends Hl{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},wM=Fl.line({class:`cm-inlineChangedLine`});function TM(e,t,n,r){let i=xM(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,CM),n.add(o.from,o.from,wM);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 EM=ae({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),DM=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),OM=Vl.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 kM({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 AM(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=an(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=tr(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C=RA(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?EM:DM,u=[Vl.editable.of(!1),jl.readOnly.of(!0)],g=[ou,Jl(),...u,l,Vl.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Vl({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=kM({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Vl({doc:d,extensions:[ou,Jl(),Vl.editable.of(!1),l,OM,Vl.lineWrapping,uM({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Vl.updateListener.of(e=>{let t=Cj(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=Cj(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new oM({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Vl({doc:d,extensions:[...g,uM({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Vl)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Vl)||U(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):Ms._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,ld.createPortal)((0,Z.jsx)(X,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(Y,{id:`XyOUTJ`})}),(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(X,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(Y,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function jM(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 MM(e,t){return jM(e,`content`,t)}async function NM(e){return jM(e,`mine`)}async function PM(e){return jM(e,`theirs`)}async function FM(e){return jM(e,`delete`)}async function IM(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 LM(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=an(),{conflicts:i,loading:a}=Li(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>gl(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=RA(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(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}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),IM(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await MM(c,e);t.ok||Ss.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),Ss.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?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)(Y,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?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)(Y,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(AM,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,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)(Y,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(FM),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(PM),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,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]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(AM,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(NM),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(FM),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,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[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(AM,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function RM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(zt(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 zM=`__back-nav__`;function BM(e){return e instanceof Oe||e instanceof gt||e instanceof xe||e instanceof Ze||e instanceof jt||e instanceof A?e.docName:null}function VM(e){return e instanceof Oe||e instanceof gt}function HM(e){if(e instanceof Oe){let t=e.docName;return{title:Ms._({id:`Jejur6`}),summary:Ms._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof gt){let t=e.docName;return{title:Ms._({id:`V7QxyT`}),summary:Ms._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof xe){let t=e.docName;return{title:Ms._({id:`1di5fu`}),summary:Ms._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Ze){let t=e.docName;return{title:Ms._({id:`wvbc1r`}),summary:Ms._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:Ms._({id:`Gfr4fu`}),summary:Ms._({id:`UW2Fg3`})};if(e instanceof A){let t=e.docName;return{title:Ms._({id:`vv7kpg`}),summary:Ms._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Ms._({id:`W5A0Ly`});return{title:Ms._({id:`29VNqC`}),summary:t}}function UM(e){let t=(0,$.c)(31),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=HM(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f=typeof window<`u`?window.okDesktop:void 0,p=f&&VM(n)?f:null,m,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{d.current?.focus()},h=[],t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(pT,{size:80,variant:`sleeping`}),t[4]=g):g=t[4];let _;t[5]===c?_=t[6]:(_=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=_);let v;t[7]===l?v=t[8]:(v=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=v);let y;t[9]!==_||t[10]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[12]=b):b=t[12];let x;t[13]===r?x=t[14]:(x=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:b}),t[13]=r,t[14]=x);let S;t[15]===p?S=t[16]:(S=p?(0,Z.jsx)(X,{variant:`secondary`,onClick:()=>{Oy(p).then(GM).catch(WM)},children:(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,t[15]=p,t[16]=S);let C;t[17]!==i||t[18]!==u||t[19]!==n||t[20]!==o||t[21]!==a||t[22]!==r?(C=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(at(BM(n)??i),o(a),r(zM))},children:(0,Z.jsx)(Y,{id:`CKyk7Q`})}):null,t[17]=i,t[18]=u,t[19]=n,t[20]=o,t[21]=a,t[22]=r,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C||t[26]!==x?(w=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[x,S,C]}),t[24]=S,t[25]=C,t[26]=x,t[27]=w):w=t[27];let T;return t[28]!==w||t[29]!==y?(T=(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:[g,y,w]}),t[28]=w,t[29]=y,t[30]=T):T=t[30],T}function WM(){}function GM(e){e.ok||Ss.error(e.message,{id:`server-restart-error`,duration:1/0})}function KM(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)(UM,{...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]===zM){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}: ${HM(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)(h,{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 qM(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=ii(t);return{map:n,keys:Br(t),parseError:r}}function JM(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>qM(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=Xn(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=lt(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)(YM,{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)(XM,{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 YM(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 XM(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}var ZM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CRYWYGK4.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([74,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,69,70,21,75,8,76,77,47,24]),import.meta.url)).ManagedArtifactProperties})),QM=bl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function $M(e){let t=e.threshold??QM;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function eN(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var tN=bl(`ACTIVITY_MOUNT_LIMIT`,3);function nN(){return n(()=>import(`./SourceEditor-CAUoNOTU.js`),__vite__mapDeps([78,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,79,34,77,73]),import.meta.url)}var rN=(0,Q.lazy)(async()=>({default:(await nN()).SourceEditor}));function iN(e,t,n){if(n<=0)return[];let r=e.filter(e=>!ze(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 aN(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Ms._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Ms._({id:`Sc1bKE`,values:{docName:e}}):Ms._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Ms._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Ms._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Ms._({id:`bmC18N`,values:{docName:e}}):Ms._({id:`pAgkuZ`,values:{docName:e}})}:null}function oN(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(yl,{name:`activity-pool`,children:(0,Z.jsx)(sN,{...e})}),t[0]=e,t[1]=n),n}function sN(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=pt(),{pages:u,loading:d}=to(),f=iN(c,n,tN),p=(0,Q.useRef)(``),m=f.map(cN).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)ue(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;se(e,t&&t.length>0?t:crypto.randomUUID())}vl(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,S(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(mN,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!br(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function cN(e){return e.docName}function lN(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&&vl(`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&&(vl(`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&&vl(`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:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function uN(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)(XC,{}),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)(rN,{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 dN(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)(ao,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Fo,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:fN,children:[(0,Z.jsx)(ao,{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 fN(){return window.location.reload()}function pN(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 mN(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=aN(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=aD(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),[y,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==y?(S=()=>{i&&!_?v(!0):!i&&!y&&x(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=$M({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,k;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&&vl(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},k=[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]=k):(D=t[17],k=t[18]),(0,Q.useEffect)(D,k);let A;t[19]===n.docName?A=t[20]:(A=()=>H(n.docName),t[19]=n.docName,t[20]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==N||t[26]!==i||t[27]!==g?(F=()=>{eN({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:N})&&(vl(`ok/cold/first-toggle`,{docName:n.docName,mountId:O(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),P(!0))},I=[N,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]=N,t[26]=i,t[27]=g,t[28]=F,t[29]=I):(F=t[28],I=t[29]),(0,Q.useEffect)(F,I);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;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]!==M?(B=f?(0,Z.jsx)(dN,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(KM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(pN,{html:M}):(0,Z.jsx)(XC,{}),children:(0,Z.jsx)(RM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(LM,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(br(n.docName)||b(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(ZM,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(JM,{provider:n.provider}),(0,Z.jsx)(Ba,{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)(uN,{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)(NA,{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]=M,t[44]=B):B=t[44];let V;t[45]!==r||t[46]!==z||t[47]!==B?(V=(0,Z.jsx)(lN,{isActive:r,initialScrollTop:z,children:B}),t[45]=r,t[46]=z,t[47]=B,t[48]=V):V=t[48];let U;return t[49]!==L||t[50]!==R||t[51]!==V?(U=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[49]=L,t[50]=R,t[51]=V,t[52]=U):U=t[52],U}function hN(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function gN(e){let{value:t,unit:n}=hN(e);return n===`rem`?t*16:t}function _N(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var vN=3600*24*7;function yN(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?bN:m,O=g===void 0?vN: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 ee=gN(b),te;t[6]===x?te=t[7]:(te=gN(x),t[6]=x,t[7]=te);let q=te,J;t[8]!==E||t[9]!==k?(J=function(e){E&&(P.current=!0,j.current=H.current?0:gN(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]=J):J=t[10];let ne=J,re,ie;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==q||t[18]!==ee||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}=hN(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<=ee*w;else if(e<=ee){let n=ee*(w-1);t=ee-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>ee*T){a();let t=n(r,M.current,j.current,s),c=Math.max(ee,Math.min(q,t)),u=_N(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(ee,Math.min(q,u)),f=_N(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)}},ie=[i,a,D,ee,q,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]=q,t[18]=ee,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=ie):(re=t[24],ie=t[25]),(0,Q.useEffect)(re,ie);let ae;return t[26]===ne?ae=t[27]:(ae={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ae),ae}function bN(){}var xN=3600*24*7,SN=`18rem`,CN=`3rem`,wN=`app-file-sidebar`,TN=`14.625rem`,EN=`32rem`,DN=`sidebar_width`,ON=/^\d+(?:\.\d+)?(?:rem|px)$/,kN=Q.createContext(null);function AN(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${DN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return ON.test(n)?n:e}function jN(){let e=Q.use(kN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function MN(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?SN:c,[u]=Q.useState(PN),d;t[8]===u?d=t[9]:(d=()=>hD(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>AN(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=SD();return wD(`left`,hD(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),TD(`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(NN)},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: ${fD}px)`),t=()=>{let e=hD(u,window.innerWidth,`left`);p(e),C(wD(`left`,e,SD())===`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(wN)?.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=>{El(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":CN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=wi(`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 ee;return t[55]!==H||t[56]!==K?(ee=(0,Z.jsx)(kN.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=ee):ee=t[57],ee}function NN(e){return!e}function PN(){return Fr()}function FN(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=an(),{state:f,isDraggingRail:p}=jN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=wi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=wi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=wi(`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)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:wN,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function IN(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=an(),{toggleSidebar:o,state:s}=jN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Dl(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=wN,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=wi(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(ht,{}):(0,Z.jsx)(Zd,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function LN(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=an(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=jN(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:TN,maxResizeWidth:EN,setIsDraggingRail:m,widthCookieName:DN,widthCookieMaxAge:xN},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=yN(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=wi(`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]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function RN(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}=jN(),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=wi(`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 zN(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=wi(`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 BN(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=wi(`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 VN(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=wi(`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 HN(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=wi(`relative flex w-full min-w-0 flex-col 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-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Ti:`div`,o;t[4]===n?o=t[5]:(o=wi(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function WN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Ti:`button`,o;t[4]===n?o=t[5]:(o=wi(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function GN(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=wi(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function KN(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=wi(`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 qN(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=wi(`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 JN=Ci(`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 YN(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?Ti:`button`,{state:m}=jN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=wi(JN({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)(Vs,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Hs,{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)(Ws,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function XN(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,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?Ti:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=wi(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function ZN(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=wi(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,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-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QN(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=wi(`group/menu-sub-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-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $N(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?Ti:`a`,d;t[6]===n?d=t[7]:(d=wi(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden 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-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function eP(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 tP(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Xr.safeParse(t);return n.success?n.data.currentBranch??null:null}var nP=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:eP({fetchBranch:tP,subscribeToEvent:Ts}),rP=nP.subscribe,iP=nP.getSnapshot;function aP(){return(0,Q.useSyncExternalStore)(rP,iP,iP)}function oP(){let e=(0,$.c)(6),t=aP(),n=so(),{state:r}=jN(),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&&Pi(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 sP(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=an(),u=oP();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=wi(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(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[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(us,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(Jt,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(cP,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`d5rK4X`,values:{chars:m}})]}),(0,Z.jsxs)(`span`,{children:[d.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.tokens.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function cP(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)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Hs,{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)(St,{"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 lP(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{_:i}=an(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=wi(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function uP(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=wi(`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 dP(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=wi(`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 fP(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=wi(`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 pP(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=wi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Qa,{}),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 mP=1,hP=2,gP=4;function _P(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 e=ni(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:ie(n,``).prefix.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>gP?[...u.slice(0,mP).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(mP,-hP)},...u.slice(-hP).map((e,t)=>d(e,u.length-hP+t))]:u.map((e,t)=>d(e,t));a=lP,t[8]===r?c=t[9]:(c=wi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=uP,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(vP)}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 vP(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(pP,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(dP,{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)(Sd,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(dP,{className:`min-w-0`,children:(0,Z.jsx)(fP,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var yP={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`},bP=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`,...yP,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},xP=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)(bP,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},SP=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)(bP,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function CP(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=an(),s=n?`source`:`wysiwyg`,c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l;t[2]===o?l=t[3]:(l=o({id:`n7aopT`}),t[2]=o,t[3]=l);let u;t[4]===o?u=t[5]:(u=o({id:`ur2XSb`}),t[4]=o,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Vs,{children:(0,Z.jsx)(SP,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(ka,{value:`wysiwyg`,"aria-label":u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:d}),t[7]=u,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(Ws,{children:[f,p]}),t[10]=f,t[11]=m);let h;t[12]===o?h=t[13]:(h=o({id:`xbdtfY`}),t[12]=o,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(xP,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(ka,{value:`source`,"aria-label":h,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:g})})}),t[15]=a,t[16]=h,t[17]=_):_=t[17];let v;t[18]===a?v=t[19]:(v=(0,Z.jsx)(Hs,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`G-JBA1`}):(0,Z.jsx)(Y,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(Ws,{children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==c||t[26]!==l||t[27]!==m?(b=(0,Z.jsxs)(ja,{type:`single`,value:s,onValueChange:c,"aria-label":l,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[m,y]}),t[23]=y,t[24]=s,t[25]=c,t[26]=l,t[27]=m,t[28]=b):b=t[28],b}var wP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-Bfh-iuK_.js`);return{SkillEditorActions:e}},__vite__mapDeps([80,1,30,3,7,31,6,10,70,20,9,11,32,12,13,21,16,60,72,18,61,65,23]),import.meta.url)).SkillEditorActions}));function TP(e){let t=(0,$.c)(82),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=an(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Tl(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,x,S,C,w,T,E,D,O,k,A;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=Dl(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?ni(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?b(n):null,t[28]=n,t[29]=m);let j=m,M;t[30]!==p||t[31]!==j?(M=p?.kind===`skill`?{scope:p.scope,name:p.name}:j?{scope:`project`,name:j}:null,t[30]=p,t[31]=j,t[32]=M):M=t[32];let N=M;x=`editor-toolbar`,S=`pointer-events-none absolute inset-x-0 top-0 z-10`;let P;t[33]!==n||t[34]!==N?(P=N?null:(0,Z.jsx)(_P,{docName:n}),t[33]=n,t[34]=N,t[35]=P):P=t[35];let F;t[36]===P?F=t[37]:(F=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:P}),t[36]=P,t[37]=F);let I;t[38]!==r||t[39]!==a||t[40]!==i?(I=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(CP,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[38]=r,t[39]=a,t[40]=i,t[41]=I):I=t[41],t[42]!==F||t[43]!==I?(C=(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:[F,I]})}),t[42]=F,t[43]=I,t[44]=C):C=t[44];let L=d&&`pr-9`;t[45]===L?_=t[46]:(_=wi(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,L),t[45]=L,t[46]=_),t[47]===N?v=t[48]:(v=N?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(wP,{scope:N.scope,name:N.name})}):null,t[47]=N,t[48]=v),t[49]!==f||t[50]!==s||t[51]!==o?(y=o&&(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Vs,{children:(0,Z.jsx)(Vd,{})})}),(0,Z.jsx)(Hs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`81H_23`})})]}),t[49]=f,t[50]=s,t[51]=o,t[52]=y):y=t[52],g=Ws,h=X,w=``,T=`ghost`,E=`icon`,D=l,O=!c,k=`doc-panel`,A=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25];let j;t[53]===c?j=t[54]:(j=(0,Z.jsx)(Vs,{children:c?(0,Z.jsx)($d,{}):(0,Z.jsx)(Qd,{})}),t[53]=c,t[54]=j);let M;t[55]!==h||t[56]!==j||t[57]!==w||t[58]!==T||t[59]!==E||t[60]!==D||t[61]!==O||t[62]!==k||t[63]!==A?(M=(0,Z.jsx)(h,{"data-doc-panel-toggle":w,variant:T,size:E,onClick:D,"aria-expanded":O,"aria-controls":k,"aria-label":A,asChild:!0,children:j}),t[55]=h,t[56]=j,t[57]=w,t[58]=T,t[59]=E,t[60]=D,t[61]=O,t[62]=k,t[63]=A,t[64]=M):M=t[64];let N;t[65]===c?N=t[66]:(N=(0,Z.jsx)(Hs,{side:`bottom`,children:c?(0,Z.jsx)(Y,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(Y,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[65]=c,t[66]=N);let P;t[67]!==g||t[68]!==M||t[69]!==N?(P=(0,Z.jsxs)(g,{children:[M,N]}),t[67]=g,t[68]=M,t[69]=N,t[70]=P):P=t[70];let F;t[71]!==_||t[72]!==v||t[73]!==y||t[74]!==P?(F=(0,Z.jsxs)(`div`,{className:_,children:[v,y,P]}),t[71]=_,t[72]=v,t[73]=y,t[74]=P,t[75]=F):F=t[75];let I;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[76]=I):I=t[76];let L;return t[77]!==x||t[78]!==S||t[79]!==C||t[80]!==F?(L=(0,Z.jsxs)(`div`,{"data-testid":x,className:S,children:[C,F,I]}),t[77]=x,t[78]=S,t[79]=C,t[80]=F,t[81]=L):L=t[81],L}function EP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function DP(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var OP=`ok-terminal-height-v1`,kP=1/3,AP=.5;function jP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*AP))}function MP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*kP)}function NP(e,t){let n=jP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(MP(t),n)}function PP(){return typeof window>`u`?0:window.innerHeight}function FP(e,t){try{let n=e??localStorage,r=t??PP(),i=n.getItem(OP);if(i==null)return NP(MP(r),r);let a=Number.parseInt(i,10);return NP(Number.isFinite(a)?a:MP(r),r)}catch{return 240}}function IP(e,t,n){try{let r=t??localStorage,i=n??PP();r.setItem(OP,String(NP(e,i)))}catch{}}function LP(){try{return typeof localStorage>`u`?240:FP()}catch{return 240}}function RP(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=an(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`0SBTff`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=wi(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(Za,{"aria-hidden":`true`}):(0,Z.jsx)(Jt,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(Hs,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(Ws,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var zP=`terminal-dock-panel`;function BP(e){let t=(0,$.c)(44),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c}=e,l=a===void 0?`bottom`:a,{resolvedTheme:u}=tr(),d=PC(),[f,p]=(0,Q.useState)(!r),m;t[0]===u?m=t[1]:(m=yu(u),t[0]=u,t[1]=m);let h=m.background,g=r&&l===`bottom`,_=!r&&l===`bottom`&&c!=null,[v]=(0,Q.useState)(VP),y=(0,Q.useRef)(v),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(e){C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{IP(e),C.current=null},100)},t[2]=w):w=t[2];let T=w,E=(0,Q.useRef)(null),D,O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{C.current!=null&&clearTimeout(C.current),E.current!=null&&(window.removeEventListener(`pointerup`,E.current),E.current=null)},O=[],t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A;t[5]!==g||t[6]!==d?(k=()=>{let e=d.current;e!=null&&(g?e.resize(`${y.current}px`):e.collapse())},A=[g,d],t[5]=g,t[6]=d,t[7]=k,t[8]=A):(k=t[7],A=t[8]),(0,Q.useEffect)(k,A);let j=b||void 0,M;t[9]!==c||t[10]!==_?(M=_&&c?(0,Z.jsx)(RP,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[9]=c,t[10]=_,t[11]=M):M=t[11];let N;t[12]!==n||t[13]!==s||t[14]!==M?(N=(0,Z.jsx)(PE,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,M]})}),t[12]=n,t[13]=s,t[14]=M,t[15]=N):N=t[15];let P=!g,F;t[16]===g?F=t[17]:(F=()=>{if(!g)return;x(!0),S.current=!0;let e=()=>{x(!1),S.current=!1,window.removeEventListener(`pointerup`,e),E.current=null};E.current=e,window.addEventListener(`pointerup`,e)},t[16]=g,t[17]=F);let I;t[18]!==g||t[19]!==P||t[20]!==F?(I=(0,Z.jsx)(FE,{withHandle:g,disabled:P,onPointerDown:F}),t[18]=g,t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]===h?L=t[23]:(L={backgroundColor:h},t[22]=h,t[23]=L);let R=g?`${v}px`:0,z;t[24]!==i||t[25]!==r?(z=e=>{let t=e.asPercentage===0;p(t),S.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(y.current=e.inPixels,T(e.inPixels)))},t[24]=i,t[25]=r,t[26]=z):z=t[26];let B=!b&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,V;t[27]===B?V=t[28]:(V=wi(`flex flex-col`,B),t[27]=B,t[28]=V);let H;t[29]===o?H=t[30]:(H=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[29]=o,t[30]=H);let U;t[31]!==f||t[32]!==d||t[33]!==L||t[34]!==R||t[35]!==z||t[36]!==V||t[37]!==H?(U=(0,Z.jsx)(PE,{id:zP,style:L,panelRef:d,defaultSize:R,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:z,inert:f,className:V,children:H}),t[31]=f,t[32]=d,t[33]=L,t[34]=R,t[35]=z,t[36]=V,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==N||t[40]!==I||t[41]!==U||t[42]!==j?(W=(0,Z.jsxs)(NE,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":j,children:[N,I,U]}),t[39]=N,t[40]=I,t[41]=U,t[42]=j,t[43]=W):W=t[43],W}function VP(){return LP()}var HP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CNxdYTCc.js`),__vite__mapDeps([48,1,2,49,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,64,65]),import.meta.url)).ActivityModeContent})),UP=`300px`,WP=`600px`,GP=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function KP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(JP,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(qP,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(yl,{name:`editor-area`,children:(0,Z.jsxs)(Fa,{children:[n,r]})}),t[3]=n,t[4]=i),i}function qP(){let e=(0,$.c)(5),t=Vi(),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)(OE,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function JP(e){let t=(0,$.c)(237),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u,onRevealTerminal:d}=e,f=s===void 0?!1:s,p=l===void 0?`right`:l,{_:m}=an(),{resolvedTheme:h}=tr(),g;t[0]===h?g=t[1]:(g=yu(h),t[0]=h,t[1]=g);let _=g.background,{activeDocName:v,activeProvider:y,activeTarget:b,recycleDocument:x,docPanelMode:S,docPanelAgentId:C,docPanelExpandSignal:w}=pt(),{openDocumentTransition:T}=Dt(),{requestAddProperty:E}=Ma(),D=rD(y,v),O=oD(v,n===`source`?`source`:`wysiwyg`),k=jD(y),A=k===`connected`||k===`synced`,j=aD(v)===`conflict`,[M,N]=(0,Q.useState)(!1),P,F;t[2]!==y||t[3]!==M?(P=()=>{y!=null&&!M&&N(!0)},F=[y,M],t[2]=y,t[3]=M,t[4]=P,t[5]=F):(P=t[4],F=t[5]),(0,Q.useEffect)(P,F);let I=(0,Q.useDeferredValue)(v),L=b?.kind===`missing`,R=!!v&&b?.kind!==`folder`,z;t[6]!==m||t[7]!==L?(z=L?m({id:`K-a33w`}):void 0,t[6]=m,t[7]=L,t[8]=z):z=t[8];let B=z,[V]=(0,Q.useState)($P),H=V!==null,U;t[9]===V?U=t[10]:(U=()=>hD(V,window.innerWidth,`right`),t[9]=V,t[10]=U);let[W,G]=(0,Q.useState)(U),K=(0,Q.useRef)(W),ee,q;t[11]===W?(ee=t[12],q=t[13]):(ee=()=>{K.current=W},q=[W],t[11]=W,t[12]=ee,t[13]=q),(0,Q.useEffect)(ee,q);let J=PC(),ne=PC(),re;t[14]===W?re=t[15]:(re=()=>wD(`right`,W,SD())===`collapsed`,t[14]=W,t[15]=re);let[ie]=(0,Q.useState)(re),[ae,oe]=(0,Q.useState)(ie),se=(0,Q.useRef)(ae),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),me=p===`right`,he=me?`right`:`bottom`,ge=o!=null&&me&&f,_e=o!=null&&!f&&d!=null,ve=_e&&!me,ye=_e&&me,be=me&&f&&ce!=null,xe=be?ce:ue,Se=(me?be:f)&&xe!=null,Ce,we;t[16]!==xe||t[17]!==u||t[18]!==he||t[19]!==fe||t[20]!==Se?(Ce=()=>{u?.({container:xe,isShowing:Se,dockPosition:he,editorRegion:fe})},we=[u,xe,Se,he,fe],t[16]=xe,t[17]=u,t[18]=he,t[19]=fe,t[20]=Se,t[21]=Ce,t[22]=we):(Ce=t[21],we=t[22]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[23]===ae?(Te=t[24],Ee=t[25]):(Te=()=>{se.current=ae},Ee=[ae],t[23]=ae,t[24]=Te,t[25]=Ee),(0,Q.useEffect)(Te,Ee);let[De,Oe]=(0,Q.useState)(!1),ke=(0,Q.useRef)(!1),[Ae]=(0,Q.useState)(QP),je=(0,Q.useRef)(Ae),Ne=(0,Q.useRef)(null),Pe;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=function(e){Ne.current!=null&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>{uD(e),Ne.current=null},100)},t[26]=Pe):Pe=t[26];let Fe=Pe,[Ie]=(0,Q.useState)(ZP),Le=(0,Q.useRef)(Ie),[Re,ze]=(0,Q.useState)(!1),Be=(0,Q.useRef)(!1),Ve=(0,Q.useRef)(null),He;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(He=function(e){Ve.current!=null&&clearTimeout(Ve.current),Ve.current=setTimeout(()=>{kD(e),Ve.current=null},100)},t[27]=He):He=t[27];let Ue=He,We,Ge;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(We=()=>()=>{Ne.current!=null&&clearTimeout(Ne.current),Ve.current!=null&&clearTimeout(Ve.current)},Ge=[],t[28]=We,t[29]=Ge):(We=t[28],Ge=t[29]),(0,Q.useEffect)(We,Ge);let[Ke,qe]=(0,Q.useState)(null),Je=(0,Q.useRef)(null),Ye=kC(),Xe=(0,Q.useRef)(ge),Ze,Qe;t[30]===ge?(Ze=t[31],Qe=t[32]):(Ze=()=>{Xe.current=ge},Qe=[ge],t[30]=ge,t[31]=Ze,t[32]=Qe),(0,Q.useEffect)(Ze,Qe);let $e;t[33]!==J||t[34]!==ne?($e=function(){for(let e of[J,ne]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=Je.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[33]=J,t[34]=ne,t[35]=$e):$e=t[35];let et=$e,tt;t[36]!==Ye||t[37]!==et?(tt=function(e){if(ke.current||Be.current)return;let t=Ye.current;if(t!=null)try{let n=et();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(XP);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:je.current),`terminal-column`in r&&(o[`terminal-column`]=Le.current),Object.keys(o).length===0)return;let s=DP({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[36]=Ye,t[37]=et,t[38]=tt):tt=t[38];let nt=tt,rt=(0,Q.useRef)(nt),it;t[39]===nt?it=t[40]:(it=()=>{rt.current=nt},t[39]=nt,t[40]=it),(0,Q.useEffect)(it);let at;t[41]!==nt||t[42]!==J?(at=function(){Xe.current?nt(!1):J.current?.expand()},t[41]=nt,t[42]=J,t[43]=at):at=t[43];let ot=at,st;t[44]!==nt||t[45]!==ae||t[46]!==J?(st=function(){if(J.current==null)return;let e=K.current;ae?(TD(`right`,e,`open`),Xe.current?nt(!1):J.current?.expand()):(TD(`right`,e,`collapsed`),Xe.current?nt(!0):J.current?.collapse())},t[44]=nt,t[45]=ae,t[46]=J,t[47]=st):st=t[47];let ct=st,lt,ut;t[48]!==nt||t[49]!==V||t[50]!==J?(lt=()=>{let e=window.matchMedia(`(min-width: ${pD}px)`),t=()=>{let e=hD(V,window.innerWidth,`right`);G(e);let t=wD(`right`,e,SD())===`collapsed`;oe(t),Xe.current?nt(t):t?J.current?.collapse():J.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ut=[V,J,nt],t[48]=nt,t[49]=V,t[50]=J,t[51]=lt,t[52]=ut):(lt=t[51],ut=t[52]),(0,Q.useEffect)(lt,ut);let dt,ft;t[53]!==Ke||t[54]!==H?(dt=()=>{if(Ke==null||H)return;let e=new ResizeObserver(()=>{rt.current(se.current)});return e.observe(Ke),()=>e.disconnect()},ft=[Ke,H],t[53]=Ke,t[54]=H,t[55]=dt,t[56]=ft):(dt=t[55],ft=t[56]),(0,Q.useEffect)(dt,ft);let mt,ht;t[57]!==ot||t[58]!==a?(mt=()=>{let e=e=>{a(e),ot()},t=dv();return t&&e(t),pv(t=>{dv(),e(t)})},ht=[a,ot],t[57]=ot,t[58]=a,t[59]=mt,t[60]=ht):(mt=t[59],ht=t[60]),(0,Q.useEffect)(mt,ht);let gt,_t;t[61]!==w||t[62]!==ot?(gt=()=>{w!==0&&ot()},_t=[w,ot],t[61]=w,t[62]=ot,t[63]=gt,t[64]=_t):(gt=t[63],_t=t[64]),(0,Q.useEffect)(gt,_t);let vt=(0,Q.useRef)(ge),yt,bt;t[65]!==ae||t[66]!==ge?(yt=()=>{if(vt.current===ge)return;vt.current=ge;let e=ae;queueMicrotask(()=>{rt.current(e)})},bt=[ge,ae],t[65]=ae,t[66]=ge,t[67]=yt,t[68]=bt):(yt=t[67],bt=t[68]),(0,Q.useLayoutEffect)(yt,bt);let xt,St;t[69]===ae?(xt=t[70],St=t[71]):(xt=()=>{if(!ae||!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()},St=[ae],t[69]=ae,t[70]=xt,t[71]=St),(0,Q.useLayoutEffect)(xt,St);let Ct,wt;t[72]===ae?(Ct=t[73],wt=t[74]):(Ct=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ae})},wt=[ae],t[72]=ae,t[73]=Ct,t[74]=wt),(0,Q.useEffect)(Ct,wt);let Tt,Et;t[75]===ct?(Tt=t[76],Et=t[77]):(Tt=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&ct()})},Et=[ct],t[75]=ct,t[76]=Tt,t[77]=Et),(0,Q.useEffect)(Tt,Et);let Ot,kt;t[78]===ct?(Ot=t[79],kt=t[80]):(Ot=()=>{if(window.okDesktop!=null)return;let e=e=>{El(e,`toggle-document-panel`)&&(e.preventDefault(),ct())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},kt=[ct],t[78]=ct,t[79]=Ot,t[80]=kt),(0,Q.useEffect)(Ot,kt);let At=(0,Q.useRef)(null),[jt,Mt]=(0,Q.useState)(null),[Nt,Pt]=(0,Q.useState)(!1),Ft=b?.kind===`large-file`?b.docName:v,It,Lt;t[81]===Ft?(It=t[82],Lt=t[83]):(It=()=>{if(Ft&&Ft!==At.current){let e=At.current;At.current=Ft,Mt(e)}},Lt=[Ft],t[81]=Ft,t[82]=It,t[83]=Lt),(0,Q.useEffect)(It,Lt);let Rt;t[84]===T?Rt=t[85]:(Rt=function(e){let t=Jc(e);window.location.hash===t?T(e):window.location.hash=t},t[84]=T,t[85]=Rt);let zt=Rt,Bt,Vt=null;if(b?.kind===`large-file`){let e;t[86]!==zt||t[87]!==jt?(e=jt?{previousDocName:jt,onNavigateBack:zt}:void 0,t[86]=zt,t[87]=jt,t[88]=e):e=t[88];let n;t[89]!==b.docName||t[90]!==b.limit||t[91]!==b.size||t[92]!==e?(n=(0,Z.jsx)(dE,{docName:b.docName,size:b.size,limit:b.limit,backNav:e}),t[89]=b.docName,t[90]=b.limit,t[91]=b.size,t[92]=e,t[93]=n):n=t[93],Bt=n}else if(b?.kind===`folder`){let e;t[94]!==H||t[95]!==f?(e=sO({terminalVisible:f,isEmbedded:H}),t[94]=H,t[95]=f,t[96]=e):e=t[96];let n=e,r;t[97]===b.folderPath?r=t[98]:(r=(0,Z.jsx)(sE,{folderPath:b.folderPath}),t[97]=b.folderPath,t[98]=r);let i;t[99]!==b.folderPath||t[100]!==n?(i=n?(0,Z.jsx)(JD,{folderPath:b.folderPath}):null,t[99]=b.folderPath,t[100]=n,t[101]=i):i=t[101];let a;if(t[102]!==r||t[103]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[102]=r,t[103]=i,t[104]=a):a=t[104],Bt=a,S===`agent`&&C!==null){let e;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(FE,{withHandle:!0}),t[105]=e):e=t[105];let n;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(PE,{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)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(HP,{showBackButton:!1})})})]}),t[106]=n):n=t[106],Vt=n}}else if(b?.kind===`asset`){let e;t[107]!==b.assetPath||t[108]!==b.mediaKind?(e=(0,Z.jsx)(YC,{assetPath:b.assetPath,mediaKind:b.mediaKind},b.assetPath),t[107]=b.assetPath,t[108]=b.mediaKind,t[109]=e):e=t[109],Bt=e}else if(b?.kind===`skill-file`){let e=`${b.scope}/${b.name}/${b.path}`,n;t[110]!==b.name||t[111]!==b.path||t[112]!==b.scope||t[113]!==e?(n=(0,Z.jsx)(yE,{scope:b.scope,name:b.name,path:b.path},e),t[110]=b.name,t[111]=b.path,t[112]=b.scope,t[113]=e,t[114]=n):n=t[114],Bt=n}else if(!y||!v)if((typeof window<`u`?_l(window.location.hash):null)!==null)if(o!=null&&M){let e;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XC,{}),t[115]=e):e=t[115],Bt=e;let n;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(FE,{withHandle:!0,disabled:!0}),t[116]=n):n=t[116];let r=ie?0:`${Ae}px`,i;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[117]=i):i=t[117];let a;t[118]===r?a=t[119]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(PE,{id:`doc-panel`,defaultSize:r,minSize:UP,maxSize:WP,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[118]=r,t[119]=a),Vt=a}else{let e;return t[120]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XC,{}),t[120]=e):e=t[120],e}else{let e=f&&he===`bottom`,n;t[121]===e?n=t[122]:(n=(0,Z.jsx)(OT,{terminalVisible:e}),t[121]=e,t[122]=n),Bt=n}else{let e=n===`source`,o=!A,s=ae,c;t[123]!==v||t[124]!==E?(c=function(){v&&E(v)},t[123]=v,t[124]=E,t[125]=c):c=t[125];let l=c,u;t[126]!==v||t[127]!==H||t[128]!==f?(u=oO({terminalVisible:f,isEmbedded:H,activeDocName:v}),t[126]=v,t[127]=H,t[128]=f,t[129]=u):u=t[129];let d=u,p=I??v,m=jt??void 0,h;t[130]!==B||t[131]!==e||t[132]!==zt||t[133]!==x||t[134]!==p||t[135]!==m?(h=(0,Z.jsx)(oN,{activeDocName:p,isSourceMode:e,editorPlaceholder:B,previousDocName:m,onNavigateBack:zt,onRecycle:x}),t[130]=B,t[131]=e,t[132]=zt,t[133]=x,t[134]=p,t[135]=m,t[136]=h):h=t[136];let g;t[137]!==v||t[138]!==e?(g=(0,Z.jsx)($E,{activeDocName:v,isSourceMode:e}),t[137]=v,t[138]=e,t[139]=g):g=t[139];let _;t[140]!==v||t[141]!==I?(_=EP({activeDocName:v,deferredActiveDocName:I,mountResolved:v!==null&&te(v),syncResolved:v!==null&&Me(v)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(XC,{}),v===null?null:(0,Z.jsx)(fE,{docName:v})]}):null,t[140]=v,t[141]=I,t[142]=_):_=t[142];let y;t[143]!==h||t[144]!==g||t[145]!==_?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_]}),t[143]=h,t[144]=g,t[145]=_,t[146]=y):y=t[146];let b;t[147]!==v||t[148]!==j||t[149]!==s||t[150]!==e||t[151]!==r||t[152]!==l||t[153]!==ye||t[154]!==o||t[155]!==ct?(b=!j&&(0,Z.jsx)(TP,{activeDocName:v,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:ct,reserveRightGutter:ye&&s}),t[147]=v,t[148]=j,t[149]=s,t[150]=e,t[151]=r,t[152]=l,t[153]=ye,t[154]=o,t[155]=ct,t[156]=b):b=t[156];let C;t[157]!==v||t[158]!==Nt||t[159]!==e||t[160]!==d?(C=d?(0,Z.jsx)(JD,{docName:v,surface:e?`source`:`wysiwyg`,dismissed:Nt,onDismiss:()=>Pt(!0),onReopen:()=>Pt(!1)}):null,t[157]=v,t[158]=Nt,t[159]=e,t[160]=d,t[161]=C):C=t[161];let w;t[162]!==y||t[163]!==b||t[164]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,b,C]}),t[162]=y,t[163]=b,t[164]=C,t[165]=w):w=t[165];let T;t[166]!==Nt||t[167]!==d?(T=d&&Nt?{onReopen:()=>Pt(!1)}:null,t[166]=Nt,t[167]=d,t[168]=T):T=t[168];let k;t[169]!==ve||t[170]!==O||t[171]!==R||t[172]!==D||t[173]!==T?(k=(0,Z.jsx)(sP,{stats:D,selectionStats:O,showStats:R,composerBadge:T,reserveRightGutter:ve}),t[169]=ve,t[170]=O,t[171]=R,t[172]=D,t[173]=T,t[174]=k):k=t[174];let M;t[175]!==w||t[176]!==k?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,k]}),t[175]=w,t[176]=k,t[177]=M):M=t[177],Bt=M;let N=ge&&ae,P=!ae,F;t[178]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{Oe(!0),ke.current=!0;let e=()=>{Oe(!1),ke.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[178]=F):F=t[178];let L;t[179]!==ae||t[180]!==P?(L=(0,Z.jsx)(FE,{withHandle:P,disabled:ae,onPointerDown:F}),t[179]=ae,t[180]=P,t[181]=L):L=t[181];let z=ie?0:`${Ae}px`,V=N?`0px`:UP,U;t[182]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{oe(e.asPercentage===0),e.inPixels>0&&ke.current&&(je.current=e.inPixels,Fe(e.inPixels))},t[182]=U):U=t[182];let W=!De&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[183]===W?G=t[184]:(G=wi(`flex flex-col bg-muted/20`,W),t[183]=W,t[184]=G);let K;t[185]!==v||t[186]!==i||t[187]!==S||t[188]!==e||t[189]!==a?(K=(0,Z.jsx)(zx,{docName:v,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:S}),t[185]=v,t[186]=i,t[187]=S,t[188]=e,t[189]=a,t[190]=K):K=t[190];let ee;t[191]!==N||t[192]!==ae||t[193]!==J||t[194]!==z||t[195]!==V||t[196]!==G||t[197]!==K?(ee=(0,Z.jsx)(PE,{id:`doc-panel`,panelRef:J,disabled:N,defaultSize:z,minSize:V,maxSize:WP,collapsible:!0,collapsedSize:0,onResize:U,inert:ae,className:G,children:K}),t[191]=N,t[192]=ae,t[193]=J,t[194]=z,t[195]=V,t[196]=G,t[197]=K,t[198]=ee):ee=t[198];let q;t[199]!==L||t[200]!==ee?(q=(0,Z.jsxs)(Z.Fragment,{children:[L,ee]}),t[199]=L,t[200]=ee,t[201]=q):q=t[201],Vt=q}let Ht;t[202]!==d||t[203]!==c||t[204]!==o||t[205]!==he||t[206]!==f||t[207]!==Bt?(Ht=o==null?Bt:(0,Z.jsx)(BP,{visible:f,onVisibleChange:c??YP,dockPosition:he,onBottomContainer:de,onEditorRegion:pe,onReveal:d,children:Bt}),t[202]=d,t[203]=c,t[204]=o,t[205]=he,t[206]=f,t[207]=Bt,t[208]=Ht):Ht=t[208];let Ut=Ht,Wt;t[209]!==Ie||t[210]!==Re||t[211]!==c||t[212]!==ne||t[213]!==ge||t[214]!==_?(Wt=ge?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(FE,{withHandle:!0,onPointerDown:()=>{ze(!0),Be.current=!0;let e=()=>{ze(!1),Be.current=!1,window.removeEventListener(`pointerup`,e),ne.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(PE,{id:`terminal-column`,panelRef:ne,style:{backgroundColor:_},defaultSize:`${Ie}px`,minSize:`320px`,maxSize:`900px`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&Be.current&&(Le.current=e.inPixels,Ue(e.inPixels))},className:wi(`flex flex-col`,!Re&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:le,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[209]=Ie,t[210]=Re,t[211]=c,t[212]=ne,t[213]=ge,t[214]=_,t[215]=Wt):Wt=t[215];let Gt=Wt,Kt=Vt!=null&&!ie||ge,qt;t[216]===Symbol.for(`react.memo_cache_sentinel`)?(qt=e=>{qe(e),Je.current=e},t[216]=qt):qt=t[216];let Jt=De||Re||void 0,Yt;t[217]===Kt?Yt=t[218]:(Yt=Kt?{}:{defaultSize:`100%`},t[217]=Kt,t[218]=Yt);let Xt=!(De||Re)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Zt;t[219]===Xt?Zt=t[220]:(Zt=wi(Xt),t[219]=Xt,t[220]=Zt);let Qt;t[221]!==Ut||t[222]!==Yt||t[223]!==Zt?(Qt=(0,Z.jsx)(PE,{minSize:`30%`,...Yt,className:Zt,children:Ut}),t[221]=Ut,t[222]=Yt,t[223]=Zt,t[224]=Qt):Qt=t[224];let $t;t[225]!==Ye||t[226]!==Vt||t[227]!==Jt||t[228]!==Qt||t[229]!==Gt?($t=(0,Z.jsxs)(NE,{orientation:`horizontal`,groupRef:Ye,"data-dragging":Jt,children:[Qt,Vt,Gt]}),t[225]=Ye,t[226]=Vt,t[227]=Jt,t[228]=Qt,t[229]=Gt,t[230]=$t):$t=t[230];let en;t[231]!==d||t[232]!==ye?(en=ye?(0,Z.jsx)(RP,{dockPosition:`right`,onReveal:d,className:`top-2.5 right-0`}):null,t[231]=d,t[232]=ye,t[233]=en):en=t[233];let tn;return t[234]!==$t||t[235]!==en?(tn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:qt,children:[$t,en]}),t[234]=$t,t[235]=en,t[236]=tn):tn=t[236],tn}function YP(){}function XP(e){return!GP.has(e)}function ZP(){return AD()}function QP(){return dD()}function $P(){return Fr()}function eF(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 tF(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 nF=1e3,rF=!1;function iF(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function aF(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:xs(i)?a=i:(a=void 0,rF||(rF=!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`&&(iF({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=tF(i),{current:c,crossDoc:l}=a?_s(a,n,Date.now()):{current:[],crossDoc:[]},u=oF,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>eF(e.current,p)&&eF(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,nF);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 oF(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var sF=`sync-status`;async function cF(e){try{let t=await Oy(e);t.ok||Ss.error(t.message,{id:sF,duration:1/0})}catch{}}function lF(e,t){let n=(0,$.c)(6),{_:r}=an(),i=Ig(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){Ss.dismiss(sF);return}o.current=!0;let e=window.okDesktop;Ss.warning(r({id:`HGNCsl`}),{id:sF,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{cF(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,Ss.success(r({id:`GhjUB_`}),{id:sF,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var uF=4,dF=3,fF={Bird:od,Cat:pd,Dog:xd,Fish:Dd,Mouse:of,Rabbit:af,Shrimp:ff,Snail:pf,Squirrel:_f,Turtle:Df};Object.freeze(Object.keys(fF));function pF(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(fF,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var mF={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function hF(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=an(),o=pF(n),s=o.kind===`animal`?fF[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Or(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=fi(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(Hs,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Ws,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function gF(e){let t=mF[e.icon];return e.displayName||t||Ms._({id:`iEQQyu`})}function _F(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 vF(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=an(),{activeDocName:s}=pt(),{presence:c,agentId:l}=n,u=gF(c),d=_F(c.mode),f=!r&&d,p=c.currentDoc&&c.currentDoc!==`(connected)`?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(ys,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(ys,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(Vs,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(Hs,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(Ws,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function yF(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?Ms._({id:`9euN0m`,values:{count:n}}):Ms._({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)(hF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(vF,{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)(Tt,{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)(w,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function bF(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(hF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(vF,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function xF(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=pt(),{current:s,crossDoc:c}=aF(t,r,n);if(lF(jD(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,uF),n;e[6]===s?n=e[7]:(n=s.slice(uF),e[6]=s,e[7]=n);let r=n,u=c.slice(0,dF),d;e[8]===c?d=e[9]:(d=c.slice(dF),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=>bF(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)(yF,{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=>bF(e,p,!0,m)),f.length>0?(0,Z.jsx)(yF,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function SF(e,t){return t.trim()}function CF(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function wF(e,t){let n=SF(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function TF(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(dl(e)){let t=s.get(Iu(e.docName,e.docExt));if(t){let n=ol(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:qn(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(cl(e))return{...e,path:MF(e.path,n)};if(il(e)){let t=s.get(e.path);return t&&xl(t)?{kind:`document`,docName:Su(t),docExt:Cl(t),size:e.size,modified:e.modified}:{...e,path:t??MF(e.path,n)}}return e})}function EF(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=>dl(e)?!i.has(e.docName)&&!IF(e.docName,n):cl(e)?!IF(e.path,n):il(e)?!a.has(e.path)&&!IF(e.path,n):!0)}function DF(e,t){if(e.kind!==`asset`||t.some(t=>il(t)&&t.path===e.path))return e;let n=zu(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function OF(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>NF(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>dl(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=>cl(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(dl(i)){let e=FF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(cl(i)){let e=PF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function kF(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function AF(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function jF(e,t){let n=e.kind===`file`?Iu(e.path,e.docExt):e.path;return co(t.contentDir,n,t.pathSeparator)}function MF(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 NF(e,t){return dl(e)&&dl(t)?e.docName===t.docName:cl(e)&&cl(t)||il(e)&&il(t)?e.path===t.path:!1}function PF(e,t,n){return e===t?n:FF(e,t,n)}function FF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function IF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function LF(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)(Op,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function RF(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=wi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(kp,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zF(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)(Mp,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function BF(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)(Rp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function VF(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=wi(`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)(Ap,{children:(0,Z.jsx)(jp,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HF(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=wi(`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)(Pp,{"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 UF(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=wi(`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)(Qa,{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)(zp,{"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 WF(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=wi(`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)(Bp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function GF(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=wi(`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)(Ip,{children:(0,Z.jsx)(Ha,{})})}),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)(Fp,{"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 KF(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=wi(`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)(Np,{"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 qF(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=wi(`-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)(Lp,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var JF=`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`,YF=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,XF={start:[es.Space],cancel:[es.Esc],end:[es.Space,es.Enter]};function ZF(e){return wi(JF,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function QF(e){return e?void 0:-1}function $F({className:e,isDragging:t}){return wi(e,t&&YF)}function eI(e){return e.code===es.Enter&&e.target===e.currentTarget}function tI({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&eI(e)?`activate-tab`:`delegate-sortable`}function nI({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:as.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 rI(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 iI(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 aI=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 Jo(e)},oI=[`.md`,`.mdx`],sI=`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`,cI=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,lI=wi(cI,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),uI=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function dI(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function fI(e){let t=Jc(e);window.location.hash!==t&&(window.location.hash=t)}function pI(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function mI(e,t){let n=[t,...oI].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 hI(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:_}=rs(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=nI({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=tI({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=$F({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 gI(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=De(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=De(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(RF,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Y,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(HF,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Y,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(HF,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(Y,{id:`U2Kx6T`}):(0,Z.jsx)(Y,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(HF,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qF,{}),(0,Z.jsx)(HF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(Y,{id:`SYfHmN`}):(0,Z.jsx)(Y,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(VF,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(LF,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function _I(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:i,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=an();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(rf,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(X,{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 l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]===i?u=t[14]:(u=ZF(i),t[13]=i,t[14]=u);let d;t[15]===i?d=t[16]:(d=QF(i),t[15]=i,t[16]=d);let f;t[17]!==r||t[18]!==o?(f=e=>{e.stopPropagation(),r(o)},t[17]=r,t[18]=o,t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Cs,{"aria-hidden":`true`}),t[20]=p):p=t[20];let m;return t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f?(m=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:u,tabIndex:d,onClick:f,children:p}),t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=m):m=t[25],m}function vI(e){let t=(0,$.c)(1),{docName:n}=e;if(aD(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(eo,{"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 yI(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:c,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,newTabIds:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=pt(),{_:w}=an(),{pageMeta:T}=to(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(t),H;e[0]!==n||e[1]!==t||e[2]!==i?(H=n??(i?Yt(i):t?en(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=H):H=e[3];let U=H,W;e[4]!==r||e[5]!==U||e[6]!==m||e[7]!==h||e[8]!==_?(W=m?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:U?`${U}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=U,e[6]=m,e[7]=h,e[8]=_,e[9]=W):W=e[9];let G=W,K,ee;e[10]===t?(K=e[11],ee=e[12]):(K=()=>{V.current=t},ee=[t],e[10]=t,e[11]=K,e[12]=ee),(0,Q.useEffect)(K,ee);let te,q;e[13]===G?(te=e[14],q=e[15]):(te=()=>{G&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[G],e[13]=G,e[14]=te,e[15]=q),(0,Q.useEffect)(te,q);let J,re;e[16]===k?(J=e[17],re=e[18]):(J=()=>{k&&(L.current?.focus(),L.current?.select())},re=[k],e[16]=k,e[17]=J,e[18]=re),(0,Q.useEffect)(J,re);let ae,oe;e[19]!==_||e[20]!==k?(ae=()=>{!k||_.includes(k.tabId)||(z.current=!0,B.current=null,A(null),M(``),P(null),I(!1))},oe=[_,k],e[19]=_,e[20]=k,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(`/`);z.current=!1,B.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),P(null)},ce=function(){z.current=!0,B.current=null,A(null),M(``),P(null),I(!1)},le=async function(){if(z.current){z.current=!1;return}if(R.current)return;let e=k?.docName;if(!e){ce();return}let t=SF(`file`,mI(j,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===B.current){L.current?.focus();return}if(!CF(t)){P(w({id:`P8yDjG`})),L.current?.focus();return}let i=wF({kind:`file`,path:e,name:r},t);R.current=!0,I(!0),P(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(z.current){I(!1),R.current=!1;return}let r=await s(n,`Server error (HTTP ${n.status})`);if(!r.ok){P(r.title),I(!1),R.current=!1,B.current=t,L.current?.focus();return}let a=Ie(Nr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=V.current,l=kF(o,a);it(a);let u=!0;try{let e=AF(a,f(),p);await Promise.all(e.map(e=>c(e))),b(a),Os([`files`,`backlinks`,`graph`])}catch(n){let r=n;u=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),Ss.error(w({id:`MUBR8r`}))}z.current=!0,A(null),M(``),P(null),I(!1),R.current=!1,B.current=null,u&&l&&l!==o&&fI(l)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),P(w({id:`HIb0vl`})),I(!1),R.current=!1,B.current=t,L.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===h?de=e[24]:(de=new Set(h),e[23]=h,e[24]=de);let fe=de,pe;e[25]===D?pe=e[26]:(pe=iI(D),e[25]=D,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]!==l||e[30]!==d||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&&d(t);for(let e of n)l(e)},e[29]=l,e[30]=d,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ve;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ve={activationConstraint:{distance:8}},e[33]=ve):ve=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:Zo,keyboardCodes:XF},e[34]=ye):ye=e[34];let be=is(Go(Yo,ve),Go(Qo,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){O(rI(E.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){O(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==x||e[39]!==C?(Te=function(e){we();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=C.indexOf(t),i=C.indexOf(n);r<0||i<0||r===i||x(ts([...C],r,i),t)},e[37]=we,e[38]=x,e[39]=C,e[40]=Te):Te=e[40];let Ee=Te,De=ue?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=wi(`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]=Oe):Oe=e[41];let ke=pI,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=wi(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let je=qo,Me=aI,Ne;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={container:typeof document<`u`?document.body:void 0},e[43]=Ne):Ne=e[43];let Pe=$o,Fe;e[44]===C?Fe=e[45]:(Fe=[...C],e[44]=C,e[45]=Fe);let Le=Ko,Re=C.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(gI,{tabId:e,canPin:!1,openTabs:C,closeTab:l,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(hI,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:wi(sI,t?cI:lI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:uI,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(Y,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:ZF(t),tabIndex:QF(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Cs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=ne(e),n=e===U,i=y.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=ie(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(gI,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(hI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(sI,n?cI:lI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:uI,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:wi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:wi(`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)(_I,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}if(t.kind===`asset`||t.kind===`skill-file`){let{baseName:r,label:o,prefix:s}=ie(t.kind===`asset`?t.assetPath:t.path,``),c=`${s}${o}`;return(0,Z.jsx)(gI,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(hI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(sI,n?cI:lI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:uI,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:wi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:wi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(_I,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}let s=t.docName,c=T.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=ie(s,c),h=`${m}${p}`,g=c===`.md`||c===`.mdx`,_=k?.tabId===e,b=`editor-tab-rename-error-${dI(s)}`;return(0,Z.jsx)(gI,{disabled:_,tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsx)(hI,{tabId:e,activateFromKeyboard:()=>a(e),disabled:_,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:wi(sI,n?cI:lI,_&&N&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(IE,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(VE,{ref:L,value:j,disabled:F,"aria-label":w({id:`Dw1T_W`,values:{label:p}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?b:void 0,"aria-busy":F||void 0,title:N??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{M(mI(e.target.value,c)),P(null),B.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(RE,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(BE,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),N?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":h,title:h,className:uI,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,s)},tabIndex:-1,children:[(0,Z.jsx)(vI,{docName:s}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(_I,{accessibleLabel:h,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})})},e)}),ze;e[46]!==Pe||e[47]!==Fe||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Pe,{items:Fe,strategy:Le,children:Re}),e[46]=Pe,e[47]=Fe,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==je||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Me||e[58]!==Ne||e[59]!==ze||e[60]!==he?(Be=(0,Z.jsx)(je,{sensors:be,autoScroll:!1,collisionDetection:Me,modifiers:he,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Ne,children:ze}),e[51]=je,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Me,e[58]=Ne,e[59]=ze,e[60]=he,e[61]=Be):Be=e[61];let Ve;e[62]===w?Ve=e[63]:(Ve=w({id:`3YvS-c`}),e[62]=w,e[63]=Ve);let He;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(Lt,{"aria-hidden":`true`}),e[64]=He):He=e[64];let Ue;e[65]!==g||e[66]!==Ve?(Ue=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:He})}),e[65]=g,e[66]=Ve,e[67]=Ue):Ue=e[67];let We;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`3YvS-c`})}),e[68]=We):We=e[68];let Ge;e[69]===Ue?Ge=e[70]:(Ge=(0,Z.jsxs)(Ws,{children:[Ue,We]}),e[69]=Ue,e[70]=Ge);let Ke;e[71]!==Ae||e[72]!==Be||e[73]!==Ge?(Ke=(0,Z.jsxs)(`div`,{className:Ae,children:[Be,Ge]}),e[71]=Ae,e[72]=Be,e[73]=Ge,e[74]=Ke):Ke=e[74];let qe;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==Ke?(qe=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":De,className:Oe,onWheel:ke,children:Ke}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=Ke,e[79]=qe):qe=e[79],qe}var bI=(e,t,n)=>{if(e&&`reportValidity`in e){let r=Ai(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},xI=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?bI(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>bI(t,n,e))}},SI=(e,t)=>{t.shouldUseNativeValidation&&xI(e,t);let n={};for(let r in e){let i=Ai(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(CI(t.names||Object.keys(e),r)){let e=Object.assign({},Ai(n,r));zi(e,`root`,a),zi(n,r,e)}else zi(n,r,a)}return n},CI=(e,t)=>{let n=wI(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>wI(e).match(`^${n}\\.\\d+`))};function wI(e){return e.replace(/[\[\]]/g,``)}function TI(){return TI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TI.apply(null,arguments)}function EI(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function DI(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ji(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function OI(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(TI({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ji(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function kI(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(EI(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&xI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:SI(DI(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(EI(function(){return Promise.resolve((n.mode===`sync`?Qn:hr)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&xI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof yr}(e))return{values:{},errors:SI(OI(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var AI=`https://openknowledge.ai/api/subscribe`;async function jI(e,t){try{let n=await fetch(AI,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function MI(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=an(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let _,v;if(t[3]!==u){let e=Rn({email:lr({message:u({id:`Wq6Wcm`})})});v=ca,_=kI(e),t[3]=u,t[4]=_,t[5]=v}else _=t[4],v=t[5];let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y={email:``},t[6]=y):y=t[6];let b;t[7]===_?b=t[8]:(b={resolver:_,defaultValues:y},t[7]=_,t[8]=b);let x=v(b),{isSubmitting:S}=x.formState,C=x.formState.errors.email?.message??x.formState.errors.root?.message,w;t[9]!==u||t[10]!==x||t[11]!==a||t[12]!==n?(w=async function(e){x.clearErrors(`root`);let t=await jI(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){x.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){x.setError(`root`,{message:u({id:`4mLBx9`})});return}x.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=x,t[11]=a,t[12]=n,t[13]=w):w=t[13];let T=w,E;t[14]===l?E=t[15]:(E=wi(`flex flex-col gap-3`,l),t[14]=l,t[15]=E);let D=d?-1:void 0,O;t[16]!==d||t[17]!==r?(O=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Ha,{className:`size-4 text-primary`}),(0,Z.jsx)(Y,{id:`PIMM5l`})]}):r??(0,Z.jsx)(Y,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=O):O=t[18];let k;t[19]!==O||t[20]!==D?(k=(0,Z.jsx)(`p`,{ref:p,tabIndex:D,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:O}),t[19]=O,t[20]=D,t[21]=k):k=t[21];let A;t[22]!==i||t[23]!==d?(A=d?(0,Z.jsx)(Y,{id:`pBROkv`}):i??(0,Z.jsx)(Y,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=A):A=t[24];let j;t[25]===A?j=t[26]:(j=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:A}),t[25]=A,t[26]=j);let M;t[27]!==k||t[28]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[k,j]}),t[27]=k,t[28]=j,t[29]=M):M=t[29];let N;t[30]!==u||t[31]!==o?(N=o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(Cs,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=N):N=t[32];let P;t[33]!==M||t[34]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[M,N]}),t[33]=M,t[34]=N,t[35]=P):P=t[35];let F;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==C||t[40]!==x||t[41]!==S||t[42]!==T||t[43]!==d?(F=d?null:(0,Z.jsxs)(`form`,{onSubmit:x.handleSubmit(T),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Ta,{control:x.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(IE,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(RE,{className:`pl-2.5`,children:(0,Z.jsx)(Wd,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(VE,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(X,{type:`submit`,disabled:S,size:c?`icon`:`default`,className:wi(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fo,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(g,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`EDl9kS`})})]}):(0,Z.jsx)(Y,{id:`EDl9kS`})})]})}}),C?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:C}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=C,t[40]=x,t[41]=S,t[42]=T,t[43]=d,t[44]=F):F=t[44];let I;return t[45]!==P||t[46]!==F||t[47]!==E?(I=(0,Z.jsxs)(`div`,{className:E,children:[P,F]}),t[45]=P,t[46]=F,t[47]=E,t[48]=I):I=t[48],I}var NI=`https://github.com/inkeep/open-knowledge`,PI=`https://discord.com/invite/YujKpFN49`,FI=`https://x.com/OpenKnowledgeAI`;function II(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 LI(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 RI=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:re},{label:{id:`PCNIuJ`},href:`${NI}/issues/new`,icon:hd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:no}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:PI,icon:II},{label:`X (Twitter)`,href:FI,icon:LI},{label:`GitHub`,href:NI,icon:Rm}]}],zI=`${NI}/releases`,BI=`group 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`;function VI(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var HI=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=an(),i,a,o,s;t[0]!==r||t[1]!==n?(i=VI(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(vf,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},UI=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=an(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>Ns(e,o),l=e=>Ns(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:BI,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},WI=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},GI=()=>{let e=(0,$.c)(28),{_:t}=an(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c,l;e[0]!==n||e[1]!==o?(c=()=>{if(!n||o!==null)return;let e=new AbortController;return kr({signal:e.signal}).then(e=>{e!==null&&s(e)}),()=>e.abort()},l=[n,o],e[0]=n,e[1]=o,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{r(e),e||a(!1)},e[4]=u):u=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{className:`size-4`}),e[5]=d):d=e[5];let f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[d,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]})})}),e[6]=f):f=e[6];let p;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(Ws,{children:[f,(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]}),e[7]=p):p=e[7];let m;e[8]!==t||e[9]!==o?(m=RI.map((e,n)=>(0,Z.jsxs)(`div`,{className:wi(n>0&&`mt-3`),children:[(0,Z.jsx)(WI,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:e.links.map(e=>(0,Z.jsx)(UI,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&o!==null?(0,Z.jsx)(HI,{count:o}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=o,e[10]=m):m=e[10];let h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(WI,{children:(0,Z.jsx)(Y,{id:`arUUsK`})}),e[11]=h):h=e[11];let g;e[12]===t?g=e[13]:(g=t({id:`arUUsK`}),e[12]=t,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(UI,{link:{label:{id:`3ePd3I`},href:zI,icon:Kd}}),e[14]=_):_=e[14];let v;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:wi(BI,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(Wd,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(Y,{id:`EDl9kS`})]})}),e[15]=v):v=e[15];let y;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Tt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(MI,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:KI})}),e[16]=y):y=e[16];let b;e[17]===i?b=e[18]:(b=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[_,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(w,{open:i,onOpenChange:a,children:[v,y]})})]}),e[17]=i,e[18]=b);let x;e[19]!==b||e[20]!==g?(x=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[h,(0,Z.jsx)(`nav`,{"aria-label":g,children:b})]}),e[19]=b,e[20]=g,e[21]=x):x=e[21];let S;e[22]!==x||e[23]!==m?(S=(0,Z.jsxs)(Tt,{align:`end`,className:`w-56 p-3`,children:[m,x]}),e[22]=x,e[23]=m,e[24]=S):S=e[24];let C;return e[25]!==n||e[26]!==S?(C=(0,Z.jsxs)(w,{open:n,onOpenChange:u,children:[p,S]}),e[25]=n,e[26]=S,e[27]=C):C=e[27],C};function KI(){return Yg.markSubscribed()}var qI=50,JI=()=>{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,xE.preload()},qI))},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,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Gi)},l=(0,Z.jsx)(uf,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Ws,{children:[u,(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},YI=`https://openknowledge.ai/docs/features/share`;function XI(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:i}=an(),{status:a}=Ki(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(h=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Mi({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:To,toastSuccess:iL,toastError:rL,logEvent:nL});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0})}catch{Ss.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=h):h=t[9];let g=h,_=c!==null,v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||l(null)},t[10]=v):v=t[10];let y;t[11]!==i||t[12]!==n?.kind?(y=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=y):y=t[13];let b=o||m,x,S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(df,{className:`size-3.5`,"aria-hidden":!0}),S=(0,Z.jsx)(Y,{id:`Z8lGw6`}),t[14]=x,t[15]=S):(x=t[14],S=t[15]);let C;t[16]!==g||t[17]!==y||t[18]!==b?(C=(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":y,onClick:g,disabled:b,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[x,S]})}),t[16]=g,t[17]=y,t[18]=b,t[19]=C):C=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`Z8lGw6`})}),t[20]=T):T=t[20];let E;t[21]===c?.autoCopyFailed?E=t[22]:(E=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ndeI89`})}):null,t[21]=c?.autoCopyFailed,t[22]=E);let D=c?.url??``,O;t[23]===i?O=t[24]:(O=i({id:`5-FeN2`}),t[23]=i,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsx)(Vc,{ref:u,readOnly:!0,value:D,onFocus:tL,onClick:eL,onContextMenu:$I,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":O}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A=c?.url??``,j=c?.autoCopyFailed===!1,M;t[28]!==A||t[29]!==j?(M=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(z,{copyContent:A,clipboardWrite:To,initialCopied:j})})}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(`div`,{className:`relative`,children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(`a`,{href:YI,target:`_blank`,rel:`noopener noreferrer`,onClick:QI,onAuxClick:ZI,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(J,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(Y,{id:`aByJ8j`})]}),t[34]=F):F=t[34];let I;t[35]!==E||t[36]!==N?(I=(0,Z.jsxs)(Tt,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[T,E,N,F]}),t[35]=E,t[36]=N,t[37]=I):I=t[37];let L;return t[38]!==C||t[39]!==I||t[40]!==_?(L=(0,Z.jsxs)(w,{open:_,onOpenChange:v,children:[C,I]}),t[38]=C,t[39]=I,t[40]=_,t[41]=L):L=t[41],L}function ZI(e){return Ns(e,YI)}function QI(e){return Ns(e,YI)}function $I(e){return e.currentTarget.select()}function eL(e){return e.currentTarget.select()}function tL(e){return e.currentTarget.select()}function nL(e){return console.log(e)}function rL(e){e!==`Link ready but could not copy to clipboard.`&&Ss.error(e)}function iL(e){return Ss.success(e)}function aL(e){let t=(0,$.c)(35),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=an(),{activeDocName:s,activeTarget:c}=pt(),l=s?ni(s):null,{state:u,isDraggingRail:d}=jN(),f=uy(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Tl(`toggle-files-sidebar`),t[0]=p):p=t[0];let m=p,h=Tl(`command-palette`),[g,_]=(0,Q.useState)(!1),v;bb0:{if(c?.kind===`folder`){let e;t[1]===c.folderPath?e=t[2]:(e=Bi(c.folderPath),t[1]=c.folderPath,t[2]=e),v=e;break bb0}if(s&&!l){let e;t[3]===s?e=t[4]:(e=Ri(s),t[3]=s,t[4]=e),v=e;break bb0}if(!c&&!s){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Bi(``),t[5]=e):e=t[5],v=e;break bb0}v=null}let y=v,b=typeof window<`u`&&window.okDesktop!=null,x=u===`collapsed`,S=b?``:void 0,C=b&&x&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,w=b&&!d&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,T;t[6]!==C||t[7]!==w?(T=wi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,b&&`[-webkit-app-region:drag]`,C,w),t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(IN,{className:wi(`-ml-1 shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Hs,{children:u===`expanded`?(0,Z.jsx)(Y,{id:`ZxXhLY`,values:{sidebarShortcut:m}}):(0,Z.jsx)(Y,{id:`Zz25kq`,values:{sidebarShortcut:m}})})]}),x&&i&&(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:h}}),"data-telemetry-event":`ok.editor_header.search.click`,className:wi(`shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(o,{"aria-hidden":`true`})})}),(0,Z.jsx)(Hs,{children:(0,Z.jsx)(Y,{id:`IN4UX8`,values:{searchShortcut:h}})})]}),(0,Z.jsx)(Xi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(yI,{})]}),D;t[9]===E?D=t[10]:(D=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:E}),t[9]=E,t[10]=D);let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=wi(`flex shrink-0 items-center justify-end gap-2 px-3`,b&&`[&>*]:[-webkit-app-region:no-drag]`),t[11]=O):O=t[11];let k;t[12]!==g||t[13]!==_||t[14]!==y||t[15]!==f?(k=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(XI,{input:y,onClickWhenNoRemote:()=>_(!0)}),(0,Z.jsx)(ki,{open:g,onOpenChange:_})]}),t[12]=g,t[13]=_,t[14]=y,t[15]=f,t[16]=k):k=t[16];let A;t[17]!==r||t[18]!==n?(A=(0,Z.jsx)(Ca,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=A):A=t[19];let j,M,N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(xF,{}),M=(0,Z.jsx)(Xi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),N=(0,Z.jsx)(cm,{}),t[20]=j,t[21]=M,t[22]=N):(j=t[20],M=t[21],N=t[22]);let P;t[23]===f?P=t[24]:(P=!f&&(0,Z.jsx)(JI,{}),t[23]=f,t[24]=P);let F;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(GI,{}),t[25]=F):F=t[25];let I;t[26]!==k||t[27]!==A||t[28]!==P?(I=(0,Z.jsxs)(`div`,{className:O,children:[k,A,j,M,N,P,F]}),t[26]=k,t[27]=A,t[28]=P,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==S||t[32]!==T||t[33]!==D?(L=(0,Z.jsxs)(`header`,{"data-electron-drag":S,className:T,children:[D,I]}),t[30]=I,t[31]=S,t[32]=T,t[33]=D,t[34]=L):L=t[34],L}var oL=`open-knowledge:terminal-launch`;function sL(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(oL,{detail:{prompt:e,cli:t}}))}function cL(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli)};return t.addEventListener(oL,n),()=>t.removeEventListener(oL,n)}function lL(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=wi(`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)(nm,{"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 uL=Ci(`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 dL(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=wi(uL({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)(rm,{"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 fL(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=wi(`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)(im,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pL(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=wi(`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)(am,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var mL=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-Ds-ev2-D.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([81,1,30,3,7,31,6,10,13,11,82,62,44,83]),import.meta.url));function hL(e){let t=(0,$.c)(14),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o,onPtyId:s}=e,c=a===void 0?null:a,l=o===void 0?null:o,{enabled:u,synced:d}=ra(),f=Ji(),{_:p}=an(),m=d&&u===!1,g;t[0]!==p||t[1]!==f?(g=function(){if(f===null){Ss.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||Ss.error(p({id:`jKd3AP`,values:{0:e.error}}))},t[0]=p,t[1]=f,t[2]=g):g=t[2];let _=g;if(d&&!m){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 a;return t[4]!==l||t[5]!==n||t[6]!==c||t[7]!==r||t[8]!==s||t[9]!==i?(a=(0,Z.jsx)(h,{fallbackRender:_L,onError:gL,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(mL,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:c,adoptPtyId:l,onPtyId:s})})}),t[4]=l,t[5]=n,t[6]=c,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a}let v;return t[11]!==_||t[12]!==m?(v=m?(0,Z.jsx)(bL,{onEnable:_}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[11]=_,t[12]=m,t[13]=v):v=t[13],v}function gL(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function _L(e){return(0,Z.jsx)(vL,{...e})}function vL(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=an(),i;t[0]!==r||t[1]!==n?(i=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]=i):i=t[2];let a=i,o;t[3]===r?o=t[4]:(o=r({id:`6MnZEC`}),t[3]=r,t[4]=o);let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[5]=a,t[6]=s);let c;t[7]===r?c=t[8]:(c=r({id:`HpK_8d`}),t[7]=r,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,Z.jsx)(X,{onClick:yL,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==o||t[12]!==s||t[13]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":o,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[s,l]}),t[11]=o,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function yL(){return window.location.reload()}function bL(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=an(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`oYepHb`}),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=r({id:`v2ZW0K`}),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==s?(c=(0,Z.jsx)(X,{onClick:n,children:s}),t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;t[11]===r?l=t[12]:(l=r({id:`ICoNYz`}),t[11]=r,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;return t[15]!==i||t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[o,c,u]}),t[15]=i,t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function xL(e){let t=(0,$.c)(48),{selected:n,onLaunchSelected:r,onPickCli:i,onPickTerminal:a,className:o}=e,{_:s}=an(),c=n===`terminal`,l;t[0]!==s||t[1]!==c||t[2]!==n?(l=s(c?{id:`AB4qw9`}:{id:`nP-KFo`,values:{0:Vn[n].displayName}}),t[0]=s,t[1]=c,t[2]=n,t[3]=l):l=t[3];let u=l,d;t[4]===o?d=t[5]:(d=wi(`flex shrink-0 items-center`,o),t[4]=o,t[5]=d);let f;t[6]!==c||t[7]!==n?(f=c?(0,Z.jsx)(gf,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(go,{id:ho(n),className:`size-3.5`,"aria-hidden":`true`}),t[6]=c,t[7]=n,t[8]=f):f=t[8];let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`size-3`}),t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==u||t[12]!==f?(m=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":u,"data-testid":`terminal-new-chat`,className:`cursor-pointer gap-0.5 rounded-r-none px-1.5 text-muted-foreground hover:text-foreground`,onClick:r,children:[f,p]})}),t[10]=r,t[11]=u,t[12]=f,t[13]=m):m=t[13];let h;t[14]===u?h=t[15]:(h=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:u}),t[14]=u,t[15]=h);let g;t[16]!==m||t[17]!==h?(g=(0,Z.jsxs)(Ws,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18];let _;t[19]===s?_=t[20]:(_=s({id:`QJaG-9`}),t[19]=s,t[20]=_);let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Xa,{"aria-hidden":`true`,className:`size-3`}),t[21]=v):v=t[21];let y;t[22]===_?y=t[23]:(y=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:v})}),t[22]=_,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Pc,{children:(0,Z.jsx)(Y,{id:`hIQkLb`})}),t[24]=b):b=t[24];let x;t[25]!==s||t[26]!==i||t[27]!==n?(x=Do.map(e=>{let{displayName:t}=Vn[e];return(0,Z.jsxs)(Cc,{onSelect:()=>i(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":s({id:`9mEZeD`,values:{name:t}}),"aria-current":n===e?`true`:void 0,children:[(0,Z.jsx)(go,{id:ho(e),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),n===e?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)}),t[25]=s,t[26]=i,t[27]=n,t[28]=x):x=t[28];let S;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Ic,{}),t[29]=S):S=t[29];let C=c?`true`:void 0,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(gf,{"aria-hidden":`true`,className:`size-4`}),t[30]=w):w=t[30];let T;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),t[31]=T):T=t[31];let E;t[32]===c?E=t[33]:(E=c?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null,t[32]=c,t[33]=E);let D;t[34]!==a||t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(Cc,{onSelect:a,"data-testid":`terminal-new-chat-terminal`,"aria-current":C,children:[w,T,E]}),t[34]=a,t[35]=C,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==x||t[39]!==D?(O=(0,Z.jsxs)(Tc,{align:`start`,className:`min-w-[180px]`,children:[b,x,S,D]}),t[38]=x,t[39]=D,t[40]=O):O=t[40];let k;t[41]!==y||t[42]!==O?(k=(0,Z.jsxs)(jc,{children:[y,O]}),t[41]=y,t[42]=O,t[43]=k):k=t[43];let A;return t[44]!==d||t[45]!==k||t[46]!==g?(A=(0,Z.jsxs)(`div`,{className:d,children:[g,k]}),t[44]=d,t[45]=k,t[46]=g,t[47]=A):A=t[47],A}function SL(e){let t=(0,$.c)(60),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,newChatSelected:o,onNewChatLaunch:s,onNewChatPickCli:c,onNewChatPickTerminal:l,onClose:u,dockPosition:d,onToggleDock:f,onCollapse:p,children:m,className:h}=e,{_:g}=an(),_=d===`right`,v;t[0]===h?v=t[1]:(v=wi(`flex min-h-0 min-w-0 flex-1 flex-col`,h),t[0]=h,t[1]=v);let y;t[2]===g?y=t[3]:(y=g({id:`1MGRQl`}),t[2]=g,t[3]=y);let b;if(t[4]!==g||t[5]!==r||t[6]!==u||t[7]!==a||t[8]!==n){let e;t[10]!==g||t[11]!==r||t[12]!==u||t[13]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:wi(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsxs)(Ws,{children:[(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(fL,{value:e.id,onClick:()=>a?.(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)(Hs,{side:`bottom`,sideOffset:8,children:e.label})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":g({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:wi(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),u(e.id)},children:(0,Z.jsx)(Cs,{"aria-hidden":`true`})})]},e.id)},t[10]=g,t[11]=r,t[12]=u,t[13]=a,t[14]=e):e=t[14],b=n.map(e),t[4]=g,t[5]=r,t[6]=u,t[7]=a,t[8]=n,t[9]=b}else b=t[9];let x;t[15]!==y||t[16]!==b?(x=(0,Z.jsx)(dL,{variant:`line`,"aria-label":y,className:`flex h-auto min-w-0 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:b}),t[15]=y,t[16]=b,t[17]=x):x=t[17];let S;t[18]!==o||t[19]!==s||t[20]!==c||t[21]!==l?(S=(0,Z.jsx)(xL,{selected:o,onLaunchSelected:s,onPickCli:c,onPickTerminal:l,className:`shrink-0`}),t[18]=o,t[19]=s,t[20]=c,t[21]=l,t[22]=S):S=t[22];let C;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(`div`,{className:`flex-1`}),t[23]=C):C=t[23];let w;t[24]!==g||t[25]!==_?(w=g(_?{id:`rf6x3F`}:{id:`QNxpRm`}),t[24]=g,t[25]=_,t[26]=w):w=t[26];let T;t[27]===_?T=t[28]:(T=_?(0,Z.jsx)(Xd,{"aria-hidden":`true`}):(0,Z.jsx)(ef,{"aria-hidden":`true`}),t[27]=_,t[28]=T);let E;t[29]!==f||t[30]!==w||t[31]!==T?(E=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":w,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:f,children:T})}),t[29]=f,t[30]=w,t[31]=T,t[32]=E):E=t[32];let D;t[33]===_?D=t[34]:(D=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:_?(0,Z.jsx)(Y,{id:`rf6x3F`}):(0,Z.jsx)(Y,{id:`QNxpRm`})}),t[33]=_,t[34]=D);let O;t[35]!==D||t[36]!==E?(O=(0,Z.jsxs)(Ws,{children:[E,D]}),t[35]=D,t[36]=E,t[37]=O):O=t[37];let k;t[38]===g?k=t[39]:(k=g({id:`VZGGPK`}),t[38]=g,t[39]=k);let A;t[40]===_?A=t[41]:(A=_?(0,Z.jsx)(Qa,{"aria-hidden":`true`}):(0,Z.jsx)(Xa,{"aria-hidden":`true`}),t[40]=_,t[41]=A);let j;t[42]!==p||t[43]!==k||t[44]!==A?(j=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":k,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:p,children:A})}),t[42]=p,t[43]=k,t[44]=A,t[45]=j):j=t[45];let M;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(Hs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`VZGGPK`})}),t[46]=M):M=t[46];let N;t[47]===j?N=t[48]:(N=(0,Z.jsxs)(Ws,{children:[j,M]}),t[47]=j,t[48]=N);let P;t[49]!==O||t[50]!==N||t[51]!==x||t[52]!==S?(P=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[x,S,C,O,N]}),t[49]=O,t[50]=N,t[51]=x,t[52]=S,t[53]=P):P=t[53];let F;return t[54]!==r||t[55]!==m||t[56]!==i||t[57]!==v||t[58]!==P?(F=(0,Z.jsxs)(lL,{value:r,onValueChange:i,className:v,children:[P,m]}),t[54]=r,t[55]=m,t[56]=i,t[57]=v,t[58]=P,t[59]=F):F=t[59],F}function CL(e){return`terminal-session-${e}`}function wL(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function TL(e){let t=(0,$.c)(77),{bridge:n,visible:r,onVisibleChange:i,launch:a,installedClis:o,container:s,isShowing:c,onRequestEditorFocus:l,dockPosition:u,onToggleDock:d,onHasSessionsChange:f}=e,p=a===void 0?null:a,{_:m}=an(),[h]=(0,Q.useState)(jL),g,_;t[0]!==s||t[1]!==h?(g=()=>{h==null||s==null||h.parentElement!==s&&s.appendChild(h)},_=[h,s],t[0]=s,t[1]=h,t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useLayoutEffect)(g,_);let v=typeof n.terminal?.list==`function`,y;t[4]!==v||t[5]!==p||t[6]!==r?(y=()=>!v&&r?[{id:CL(1),launch:p,title:null,adoptPtyId:null}]:[],t[4]=v,t[5]=p,t[6]=r,t[7]=y):y=t[7];let[b,x]=(0,Q.useState)(y),S;t[8]!==v||t[9]!==r?(S=()=>!v&&r?CL(1):``,t[8]=v,t[9]=r,t[10]=S):S=t[10];let[C,w]=(0,Q.useState)(S),[T,E]=(0,Q.useState)(!v),D=(0,Q.useRef)(!1),O=(0,Q.useRef)(C),k=(0,Q.useRef)(b),A=(0,Q.useRef)(!v&&r?1:0),j=(0,Q.useRef)(r&&p?p.nonce:null),M=(0,Q.useRef)(r),N=(0,Q.useRef)(new Map),P=function(e,t){t===null?N.current.delete(e):N.current.set(e,t)},F=(0,Q.useRef)(0),I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){A.current+=1;let t=CL(A.current);x(n=>[...n,{id:t,launch:e,title:null,adoptPtyId:null}]),w(t)},t[11]=I):I=t[11];let L=I,[R,z]=(0,Q.useState)(AL),[B,V]=(0,Q.useState)(kL),H;t[12]===o?H=t[13]:(H=o??{},t[12]=o,t[13]=H);let U;t[14]!==R||t[15]!==H?(U=cb(R,H),t[14]=R,t[15]=H,t[16]=U):U=t[16];let W=U,G=B?`terminal`:W,K;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){F.current+=1,L({prompt:null,cli:e,nonce:F.current})},t[17]=K):K=t[17];let ee=K,te;t[18]!==W||t[19]!==B?(te=function(){B?L(null):ee(W)},t[18]=W,t[19]=B,t[20]=te):te=t[20];let q=te,J;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(J=function(e){V(!1),_b(!1);let t=nb(e);z(t),ob(t),ee(e)},t[21]=J):J=t[21];let ne=J,re;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){V(!0),_b(!0),L(null)},t[22]=re):re=t[22];let ie=re,ae;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e,t){let n=t.trim()===``?null:t.trim();x(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[23]=ae):ae=t[23];let oe=ae,se=(0,Q.useRef)(L),ce;t[24]!==C||t[25]!==l||t[26]!==i?(ce=function(e){let t=k.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===C){let e=(t[n-1]??t[n+1])?.id??``;w(e),e!==``&&queueMicrotask(()=>wL(e))}x(r),r.length===0&&(i(!1),l())},t[24]=C,t[25]=l,t[26]=i,t[27]=ce):ce=t[27];let le=ce,ue=(0,Q.useRef)(OL),de;t[28]!==C||t[29]!==le||t[30]!==b?(de=()=>{se.current=L,O.current=C,k.current=b,ue.current=()=>{C!==``&&le(C)}},t[28]=C,t[29]=le,t[30]=b,t[31]=de):de=t[31],(0,Q.useEffect)(de);let fe,pe;t[32]!==p||t[33]!==T||t[34]!==b.length||t[35]!==r?(fe=()=>{if(!T)return;let e=M.current;if(M.current=r,p!=null&&p.nonce!==j.current){j.current=p.nonce,se.current(p);return}r&&!e&&b.length===0&&se.current(null)},pe=[r,p,b.length,T],t[32]=p,t[33]=T,t[34]=b.length,t[35]=r,t[36]=fe,t[37]=pe):(fe=t[36],pe=t[37]),(0,Q.useEffect)(fe,pe);let me;t[38]===n.terminal?me=t[39]:(me=()=>{if(typeof n.terminal?.list!=`function`||D.current)return;D.current=!0;let e=!1;return(async()=>{let t;try{t=await n.terminal.list()??[]}catch(e){console.error(`[terminal] reload session list() failed; cold-starting:`,e),t=[]}if(!e){if(t.length>0){let e=t.map(DL);A.current=e.length,x(e),w(e[0]?.id??``)}E(!0)}})(),()=>{e=!0,D.current=!1}},t[38]=n.terminal,t[39]=me);let he;t[40]===n?he=t[41]:(he=[n],t[40]=n,t[41]=he),(0,Q.useEffect)(me,he);let ge;t[42]===n?ge=t[43]:(ge=[n],t[42]=n,t[43]=ge),(0,Q.useEffect)(()=>ok(e=>{let t=O.current,r=t===``?void 0:N.current.get(t);r==null?au():(n.terminal.input(r,e),queueMicrotask(()=>wL(t)))}),ge);let _e,ve;t[44]===n?(_e=t[45],ve=t[46]):(_e=()=>n.onMenuAction(e=>{e===`new-terminal`?se.current(null):e===`kill-terminal`&&ue.current()}),ve=[n],t[44]=n,t[45]=_e,t[46]=ve),(0,Q.useEffect)(_e,ve);let ye,be;t[47]===h?(ye=t[48],be=t[49]):(ye=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||h==null||!h.contains(document.activeElement))return;let t=k.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),w(t.id),queueMicrotask(()=>wL(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},be=[h],t[47]=h,t[48]=ye,t[49]=be),(0,Q.useEffect)(ye,be);let xe;t[50]!==n.editor||t[51]!==b.length?(xe=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:b.length>0})},t[50]=n.editor,t[51]=b.length,t[52]=xe):xe=t[52];let Se;t[53]!==n||t[54]!==b.length?(Se=[n,b.length],t[53]=n,t[54]=b.length,t[55]=Se):Se=t[55],(0,Q.useEffect)(xe,Se);let Ce,we;t[56]!==f||t[57]!==b.length?(Ce=()=>{f?.(b.length>0)},we=[f,b.length],t[56]=f,t[57]=b.length,t[58]=Ce,t[59]=we):(Ce=t[58],we=t[59]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[60]!==h||t[61]!==c||t[62]!==l||t[63]!==r?(Te=()=>{c||r||h==null||!h.contains(document.activeElement)||l()},Ee=[c,r,h,l],t[60]=h,t[61]=c,t[62]=l,t[63]=r,t[64]=Te,t[65]=Ee):(Te=t[64],Ee=t[65]),(0,Q.useLayoutEffect)(Te,Ee);let De,Oe;t[66]===c?(De=t[67],Oe=t[68]):(De=()=>{c&&wL(O.current)},Oe=[c],t[66]=c,t[67]=De,t[68]=Oe),(0,Q.useEffect)(De,Oe);let ke;if(t[69]!==m||t[70]!==b){let e;t[72]===m?e=t[73]:(e=(e,t)=>({id:e.id,label:e.title??m({id:`OVjNeX`,values:{0:t+1}})}),t[72]=m,t[73]=e),ke=b.map(e),t[69]=m,t[70]=b,t[71]=ke}else ke=t[71];let Ae=ke,je=b.length>0?(0,Z.jsx)(SL,{sessions:Ae,activeSessionId:C,onSelect:w,onTabActivate:EL,newChatSelected:G,onNewChatLaunch:q,onNewChatPickCli:ne,onNewChatPickTerminal:ie,onClose:le,dockPosition:u,onToggleDock:d,onCollapse:()=>i(!1),className:`h-full`,children:b.map(e=>(0,Z.jsx)(pL,{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)(hL,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>P(e.id,t),onTitleChange:t=>oe(e.id,t),onClose:()=>le(e.id)})},e.id))}):null,Me;return t[74]!==h||t[75]!==je?(Me=h==null?null:(0,ld.createPortal)(je,h),t[74]=h,t[75]=je,t[76]=Me):Me=t[76],Me}function EL(e){return queueMicrotask(()=>wL(e))}function DL(e,t){return{id:CL(t+1),launch:null,title:null,adoptPtyId:e.ptyId}}function OL(){}function kL(){return vb()}function AL(){return ab()}function jL(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function ML(e){let t=(0,$.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=qy(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Px[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null,[v,y]=(0,Q.useState)(!1),b=Jy(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(mb),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),pb(e),y(!0)},t[2]=A):A=t[2];let j=A,M;t[3]===O?M=t[4]:(M=function(){j(O===`right`?`bottom`:`right`)},t[3]=O,t[4]=M);let N=M,P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=P):P=t[5];let[F,I]=(0,Q.useState)(P),L=(0,Q.useRef)(0),R;t[6]===b?R=t[7]:(R=function(e){let t=e??cb(ab(),b);y(!0),L.current+=1,D({prompt:null,cli:t,nonce:L.current})},t[6]=b,t[7]=R);let z=R,B;t[8]!==x||t[9]!==z?(B=function(){y(!0),!x&&!gb()&&z()},t[8]=x,t[9]=z,t[10]=B):B=t[10];let V=B,H=Fi(),{projectConfig:U,projectLocalConfig:W,projectLocalSynced:G,projectSynced:K}=Bo(),{activeDocName:ee}=pt(),te=H?.hasRemote,q=H?.pushPermission?.checkStatus,J;t[11]!==m||t[12]!==U||t[13]!==W||t[14]!==G||t[15]!==K||t[16]!==te||t[17]!==q?(J=xb({autoSyncOnboardingDismissed:m,hasRemote:te,projectLocalSynced:G,projectSynced:K,projectLocalConfig:W,projectConfig:U,pushPermissionCheckStatus:q}),t[11]=m,t[12]=U,t[13]=W,t[14]=G,t[15]=K,t[16]=te,t[17]=q,t[18]=J):J=t[18];let ne=J,re,ie;t[19]===ee?(re=t[20],ie=t[21]):(re=()=>{let e=function(e){let t=e.detail;t&&ee&&Zl(ee,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(zy,e),()=>window.removeEventListener(zy,e)},ie=[ee],t[19]=ee,t[20]=re,t[21]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?y(FL):e===`new-terminal`&&y(!0)})},oe=[],t[22]=ae,t[23]=oe):(ae=t[22],oe=t[23]),(0,Q.useEffect)(ae,oe);let se,ce;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{if(window.okDesktop!=null)return;let e=function(e){El(e,`toggle-terminal-panel`)&&(e.preventDefault(),y(PL))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ce=[],t[24]=se,t[25]=ce):(se=t[24],ce=t[25]),(0,Q.useEffect)(se,ce);let le,ue;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>cL((e,t)=>{y(!0),L.current+=1,D({prompt:e,cli:t,nonce:L.current})}),ue=[],t[26]=le,t[27]=ue):(le=t[26],ue=t[27]),(0,Q.useEffect)(le,ue);let de,fe;t[28]===v?(de=t[29],fe=t[30]):(de=()=>{v||D(null)},fe=[v],t[28]=v,t[29]=de,t[30]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[31]!==C||t[32]!==v?(pe=()=>{window.okDesktop!=null&&C&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v})},me=[v,C],t[31]=C,t[32]=v,t[33]=pe,t[34]=me):(pe=t[33],me=t[34]),(0,Q.useEffect)(pe,me);let he,ge;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(NL).finally(()=>{t||w(!0)}),()=>{t=!0}},ge=[],t[35]=he,t[36]=ge):(he=t[35],ge=t[36]),(0,Q.useEffect)(he,ge);let _e,ve;t[37]===v?(_e=t[38],ve=t[39]):(_e=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&ha()}},ve=[v],t[37]=v,t[38]=_e,t[39]=ve),(0,Q.useEffect)(_e,ve),Xy(H?.pausedReason),Zy();let ye;t[40]===a?ye=t[41]:(ye=function(e){s(e),a(e)},t[40]=a,t[41]=ye);let be=ye,xe,Se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>{d(`auth`),l(!0)},Se=()=>{d(`identity`),l(!0)},t[42]=xe,t[43]=Se):(xe=t[42],Se=t[43]);let Ce;t[44]===r?Ce=t[45]:(Ce=(0,Z.jsx)(aL,{onSignIn:xe,onSetIdentity:Se,onOpenSearch:r}),t[44]=r,t[45]=Ce);let we=_?V:void 0,Te;t[46]!==f||t[47]!==o||t[48]!==be||t[49]!==we||t[50]!==O||t[51]!==v?(Te=(0,Z.jsx)(KP,{editorMode:o,onModeChange:be,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:I,onRevealTerminal:we}),t[46]=f,t[47]=o,t[48]=be,t[49]=we,t[50]=O,t[51]=v,t[52]=Te):Te=t[52];let Ee;t[53]!==b||t[54]!==O||t[55]!==E||t[56]!==F||t[57]!==v||t[58]!==N?(Ee=_&&g!=null?(0,Z.jsx)(TL,{bridge:g,visible:v,onVisibleChange:y,launch:E,installedClis:b,container:F.container,isShowing:F.isShowing,onRequestEditorFocus:()=>F.editorRegion?.focus(),dockPosition:O,onToggleDock:N,onHasSessionsChange:S}):null,t[53]=b,t[54]=O,t[55]=E,t[56]=F,t[57]=v,t[58]=N,t[59]=Ee):Ee=t[59];let De=u===`identity`,Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>{l(!1)},t[60]=Oe):Oe=t[60];let ke;t[61]!==c||t[62]!==De?(ke=(0,Z.jsx)($i,{open:c,onOpenChange:l,identityPrompt:De,onSuccess:Oe}),t[61]=c,t[62]=De,t[63]=ke):ke=t[63];let Ae;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=()=>h(!0),t[64]=Ae):Ae=t[64];let je;t[65]===ne?je=t[66]:(je=(0,Z.jsx)(yb,{open:ne,onResolved:Ae}),t[65]=ne,t[66]=je);let Me;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(Iy,{}),t[67]=Me):Me=t[67];let Ne;return t[68]!==Ce||t[69]!==Te||t[70]!==Ee||t[71]!==ke||t[72]!==je?(Ne=(0,Z.jsxs)(Z.Fragment,{children:[Ce,Te,Ee,ke,je,Me]}),t[68]=Ce,t[69]=Te,t[70]=Ee,t[71]=ke,t[72]=je,t[73]=Ne):Ne=t[73],Ne}function NL(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function PL(e){return!e}function FL(e){return!e}function IL(e){let t=Jc(gl(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function LL(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Li();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)(eo,{"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)(eo,{"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(RL),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 RL(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{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:()=>IL(e.file),children:[(0,Z.jsx)(eo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var zL=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
32
32
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
33
33
|
<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"/>
|
|
34
34
|
</symbol>
|
|
@@ -45,72 +45,72 @@ Error generating stack: `+e.message+`
|
|
|
45
45
|
<symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
|
|
46
46
|
<path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
|
|
47
47
|
</symbol>
|
|
48
|
-
</svg>`,
|
|
48
|
+
</svg>`,BL=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
|
|
49
49
|
<path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
|
|
50
50
|
<path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
|
|
51
|
-
</symbol>`,
|
|
51
|
+
</symbol>`,VL=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
|
|
52
52
|
<path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
|
|
53
|
-
</symbol>`,
|
|
53
|
+
</symbol>`,HL=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
|
|
54
54
|
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
55
55
|
<path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
|
|
56
|
-
</symbol>`,
|
|
56
|
+
</symbol>`,UL=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
|
|
57
57
|
<path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
|
|
58
|
-
</symbol>`,
|
|
58
|
+
</symbol>`,WL=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
|
|
59
59
|
<path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
|
|
60
60
|
<path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
|
|
61
|
-
</symbol>`,
|
|
61
|
+
</symbol>`,GL=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
|
|
62
62
|
<path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
|
|
63
63
|
<path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
|
|
64
64
|
<path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
|
|
65
|
-
</symbol>`,
|
|
65
|
+
</symbol>`,KL=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
|
|
66
66
|
<path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
|
|
67
|
-
</symbol>`,
|
|
67
|
+
</symbol>`,qL=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
|
|
68
68
|
<path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
|
|
69
|
-
</symbol>`,
|
|
69
|
+
</symbol>`,JL=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
|
|
70
70
|
<path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
|
|
71
|
-
</symbol>`,
|
|
71
|
+
</symbol>`,YL=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
|
|
72
72
|
<path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
|
|
73
|
-
</symbol>`,
|
|
73
|
+
</symbol>`,XL=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
|
|
74
74
|
<path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
|
|
75
75
|
<path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
|
|
76
|
-
</symbol>`,
|
|
76
|
+
</symbol>`,ZL=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
|
|
77
77
|
<path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
|
|
78
78
|
<path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
|
|
79
79
|
<path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
|
|
80
|
-
</symbol>`,
|
|
80
|
+
</symbol>`,QL=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
|
|
81
81
|
<path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
|
|
82
82
|
<path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
|
|
83
|
-
</symbol
|
|
83
|
+
</symbol>`,$L=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
|
|
84
84
|
<path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
|
|
85
85
|
<path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
|
|
86
|
-
</symbol>`,
|
|
86
|
+
</symbol>`,eR=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
|
|
87
87
|
<path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
|
|
88
88
|
<path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
|
|
89
|
-
</symbol
|
|
89
|
+
</symbol>`,tR=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
|
|
90
90
|
<path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
|
|
91
|
-
</symbol>`,
|
|
91
|
+
</symbol>`,nR=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
|
|
92
92
|
<path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
|
|
93
|
-
</symbol>`,
|
|
93
|
+
</symbol>`,rR=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
|
|
94
94
|
<path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
|
|
95
|
-
</symbol>`,
|
|
95
|
+
</symbol>`,iR=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
|
|
96
96
|
<path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
|
|
97
|
-
</symbol>`,
|
|
97
|
+
</symbol>`,aR=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
|
|
98
98
|
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
99
99
|
<path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
|
|
100
|
-
</symbol>`,
|
|
100
|
+
</symbol>`,oR=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
|
|
101
101
|
<path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
|
|
102
102
|
<path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
|
|
103
|
-
</symbol>`,
|
|
103
|
+
</symbol>`,sR=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
|
|
104
104
|
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
105
105
|
<path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
|
|
106
|
-
</symbol>`,
|
|
106
|
+
</symbol>`,cR=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
|
|
107
107
|
<path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
|
|
108
|
-
</symbol>`,
|
|
108
|
+
</symbol>`,lR=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
|
|
109
109
|
<path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
|
|
110
|
-
</symbol>`,
|
|
110
|
+
</symbol>`,uR=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
|
|
111
111
|
<path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
|
|
112
112
|
<path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
|
|
113
|
-
</symbol>`,
|
|
113
|
+
</symbol>`,dR=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
|
|
114
114
|
<defs>
|
|
115
115
|
<linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
|
|
116
116
|
<stop stop-color="currentColor"/>
|
|
@@ -120,82 +120,82 @@ Error generating stack: `+e.message+`
|
|
|
120
120
|
<path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
|
|
121
121
|
<path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
|
|
122
122
|
<path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
|
|
123
|
-
</symbol>`,
|
|
123
|
+
</symbol>`,fR=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
|
|
124
124
|
<path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
|
|
125
125
|
<path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
|
|
126
|
-
</symbol>`,
|
|
126
|
+
</symbol>`,pR=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
|
|
127
127
|
<path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
|
|
128
|
-
</symbol>`,
|
|
128
|
+
</symbol>`,mR=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
|
|
129
129
|
<path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
|
|
130
|
-
</symbol>`,
|
|
130
|
+
</symbol>`,hR=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
|
|
131
131
|
<path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
|
|
132
132
|
<path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
|
|
133
133
|
<path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
|
|
134
134
|
<path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
|
|
135
|
-
</symbol>`,
|
|
135
|
+
</symbol>`,gR=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
|
|
136
136
|
<path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
|
|
137
137
|
<path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
|
|
138
|
-
</symbol>`,
|
|
138
|
+
</symbol>`,_R=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
|
|
139
139
|
<path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
|
|
140
140
|
<path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
|
|
141
|
-
</symbol>`,
|
|
141
|
+
</symbol>`,vR=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
|
|
142
142
|
<path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
|
|
143
|
-
</symbol>`,
|
|
143
|
+
</symbol>`,yR=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
|
|
144
144
|
<path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
|
|
145
|
-
</symbol>`,
|
|
145
|
+
</symbol>`,bR=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
|
|
146
146
|
<path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
|
|
147
|
-
</symbol>`,
|
|
147
|
+
</symbol>`,xR=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
|
|
148
148
|
<path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
|
|
149
149
|
<path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
|
|
150
|
-
</symbol>`,
|
|
150
|
+
</symbol>`,SR=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
|
|
151
151
|
<path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
|
|
152
|
-
</symbol>`,
|
|
152
|
+
</symbol>`,CR=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
|
|
153
153
|
<path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
|
|
154
154
|
<path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
|
|
155
|
-
</symbol>`,
|
|
155
|
+
</symbol>`,wR=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
|
|
156
156
|
<path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
|
|
157
157
|
<path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
|
|
158
|
-
</symbol>`,
|
|
158
|
+
</symbol>`,TR=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
|
|
159
159
|
<path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
|
|
160
|
-
</symbol>`,
|
|
160
|
+
</symbol>`,ER=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
|
|
161
161
|
<path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
|
|
162
162
|
<path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
|
|
163
|
-
</symbol>`,
|
|
163
|
+
</symbol>`,DR=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
|
|
164
164
|
<path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
|
|
165
|
-
</symbol>`,
|
|
165
|
+
</symbol>`,OR=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
|
|
166
166
|
<path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
|
|
167
|
-
</symbol>`,
|
|
167
|
+
</symbol>`,kR=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
|
|
168
168
|
<path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
|
|
169
169
|
<path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
|
|
170
|
-
</symbol>`,
|
|
170
|
+
</symbol>`,AR=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
|
|
171
171
|
<path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
|
|
172
172
|
<path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
|
|
173
|
-
</symbol>`,
|
|
173
|
+
</symbol>`,jR=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
|
|
174
174
|
<path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
|
|
175
|
-
</symbol>`,
|
|
175
|
+
</symbol>`,MR=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
|
|
176
176
|
<path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
|
|
177
177
|
<path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
|
|
178
178
|
<path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
|
|
179
|
-
</symbol>`,
|
|
179
|
+
</symbol>`,NR=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
|
|
180
180
|
<path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
|
|
181
181
|
<path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
|
|
182
|
-
</symbol>`,
|
|
182
|
+
</symbol>`,PR=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
|
|
183
183
|
<path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
|
|
184
184
|
<path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
|
|
185
185
|
<path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
|
|
186
|
-
</symbol>`,
|
|
186
|
+
</symbol>`,FR=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
|
|
187
187
|
<path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
|
|
188
188
|
<path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
|
|
189
|
-
</symbol>`,
|
|
189
|
+
</symbol>`,IR=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
|
|
190
190
|
<path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
|
|
191
|
-
</symbol>`,
|
|
191
|
+
</symbol>`,LR=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
|
|
192
192
|
<path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
|
|
193
193
|
<path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
|
|
194
|
-
</symbol>`,
|
|
194
|
+
</symbol>`,RR=[HL,qL,YL,XL,ZL,QL,tR,nR,rR,aR,oR,sR,cR,lR,uR,gR,vR,yR,TR,ER,kR,AR,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
|
|
195
195
|
<path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
|
|
196
196
|
<path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
|
|
197
|
-
</symbol>`],
|
|
198
|
-
`)}\n</svg>`)}var zR=RR(LL,IR),BR={minimal:LL,standard:zR,complete:RR(zR,LR)},VR={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},HR={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},UR={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},WR=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),GR=new Set([`complete`]);function KR(e){return BR[e===`none`?`minimal`:e]}function qR(e){return`file-tree-builtin-${e}`}function JR(e){return e!==`none`&&GR.has(e)}function YR(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=VR[t.toLowerCase()];if(i!=null&&(r||WR.has(i)))return i;for(let e of n){if(r){let t=UR[e];if(t!=null)return t}let t=HR[e];if(t!=null&&(r||WR.has(t)))return t}return`default`}var XR=`file-tree-container`,ZR=`data-file-tree-style`,QR=`data-file-tree-unsafe-css`,$R=`data-file-tree-scrollbar-measure`,ez=`data-file-tree-scrollbar-gutter-measured`,tz=`--trees-scrollbar-gutter-measured`,nz=`header`,rz=`context-menu`,iz=`context-menu-trigger`;function az(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function oz(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(az(e)?`none`:`complete`),colored:e.colored??!0}}var sz=e=>e.trim().toLowerCase(),cz=e=>e.split(`/`).at(-1)??e,lz=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function uz(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function dz(e){let t=oz(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(sz(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=cz(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return uz(c,e);for(let[t,n]of a)if(s.includes(t))return uz(n,e);let l=lz(n);for(let t of l){let n=i.get(t);if(n!=null)return uz(n,e)}let u=YR(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:qR(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:uz(s,e)}}}var fz=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,pz=/^0(?:\.0+)?%?$/;function mz(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function hz(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||fz.test(t))return!0;let n=mz(t);return n!=null&&pz.test(n)}function gz(e){return hz(e)?void 0:e}function _z(e){let t=e.colors??{},n=t[`sideBar.background`]??t[`editor.background`]??e.bg,r=t[`sideBar.foreground`]??t[`editor.foreground`]??e.fg,i=t[`sideBar.border`],a=t[`list.activeSelectionForeground`]??t[`sideBar.foreground`],o=n?.toLowerCase(),s=t[`list.hoverBackground`],c=s?.toLowerCase()===o?void 0:s,l=t[`list.activeSelectionBackground`],u=l?.toLowerCase()===o?t[`list.focusBackground`]??t[`editor.selectionBackground`]:l??t[`editor.selectionBackground`],d=gz(t[`list.focusOutline`])??gz(t.focusBorder),f=t[`input.background`]??n,p=t[`input.border`],m=t[`scrollbarSlider.background`],h=t[`sideBarSectionHeader.foreground`]??r,g=t[`gitDecoration.addedResourceForeground`]??t[`terminal.ansiGreen`]??t[`editorGutter.addedBackground`],_=t[`gitDecoration.modifiedResourceForeground`]??t[`terminal.ansiBlue`]??t[`editorGutter.modifiedBackground`],v=t[`gitDecoration.deletedResourceForeground`]??t[`terminal.ansiRed`]??t[`editorGutter.deletedBackground`],y=e.type===`dark`,b={colorScheme:y?`dark`:`light`,backgroundColor:n??``,color:r??``,borderColor:`var(--trees-theme-sidebar-border, light-dark(oklch(0% 0 0 / 0.15), oklch(100% 0 0 / 0.15)))`,"--trees-theme-sidebar-bg":n??``,"--trees-theme-sidebar-fg":r??``,"--trees-theme-sidebar-header-fg":h??``,"--trees-theme-list-active-selection-fg":a??r??``,"--trees-theme-list-hover-bg":c??(y?`rgba(255,255,255,0.08)`:`rgba(0,0,0,0.06)`),"--trees-theme-list-active-selection-bg":u??`transparent`,"--trees-theme-focus-ring":d??r??``,"--trees-theme-input-bg":f??``};return i!=null&&i!==``&&(b[`--trees-theme-sidebar-border`]=i),p!=null&&p!==``&&(b[`--trees-theme-input-border`]=p),m!=null&&m!==``&&(b[`--trees-theme-scrollbar-thumb`]=m),g!=null&&g!==``&&(b[`--trees-theme-git-added-fg`]=g),_!=null&&_!==``&&(b[`--trees-theme-git-modified-fg`]=_),v!=null&&v!==``&&(b[`--trees-theme-git-deleted-fg`]=v),b}var vz=5,yz=1<<vz,bz=yz*4;function xz(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Sz(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Cz(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function wz(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Tz(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Ez(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function Dz(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,jz(e,t)}function Oz(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=wz(e).get(t);if(i===void 0)return;let a=i>>vz;e.childVisibleChunkSums[a]+=r}function kz(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=Mz(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=yz}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function Az(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>vz;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<vz}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function jz(e,t){if(t.childIds.length<bz){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/yz),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>vz]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Mz(e,t,n,r){let i=Math.min(t.childIds.length,n+yz),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Nz=7,Pz=3,Fz=1<<Pz,Iz=4;function Lz(e,t,n=0){return e<<Iz|n<<Pz|t}function Rz(e){return e.depthAndFlags>>>Iz}function zz(e){return(e.depthAndFlags&Fz)>>Pz}function Bz(e){return(e.depthAndFlags&Fz)!==0}function Vz(e){return e.depthAndFlags&Nz}function Hz(e,t){return(Vz(e)&t)!==0}function Uz(e,t){e.depthAndFlags|=t}function Wz(e,t){e.depthAndFlags=Lz(t,Vz(e),zz(e))}var Gz=Symbol(`benchmarkInstrumentation`);function Kz(e,t){return t==null||Object.defineProperty(e,Gz,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function qz(e){return e==null?null:e[Gz]??null}function Jz(e,t,n){return e==null?n():e.measurePhase(t,n)}function Yz(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Xz(e){return e>=48&&e<=57}function Zz(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Xz(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Xz(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Qz(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Zz(t)}}function $z(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function eB(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=$z(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function tB(e,t,n){let r=eB(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function nB(e,t){return tB(e,t,Qz)}function rB(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function iB(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=rB(e,r);return a===rB(t,r)?nB(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function aB(e,t){return iB(e,t)}function oB(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Qz(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=rB(e,n);return o===rB(t,n)?tB(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function sB(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Qz(r);return e.sortKeyById[t]=i,i}function cB(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function lB(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function uB(e){let{hasTrailingSlash:t,segments:n}=lB(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function dB(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=lB(e);return{requiresDirectory:t,segments:n}}var fB=``;function pB(){let e=new Map;return e.set(fB,0),{idByValue:e,valueById:[fB],sortKeyById:[Qz(fB)]}}function mB(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function hB(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var gB=Symbol(`pathStorePreparedInputKind`);function _B(e,t){return e[gB]=t,e}function vB(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function yB(e,t,n){return n===`default`?aB(e,t):n(vB(e),vB(t))}function bB(){return{depthAndFlags:Lz(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function xB(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function SB(e){return e.isDirectory?e.segments.length:e.segments.length-1}function CB(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function wB(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function TB(e,t={}){return jB(e,t).map(e=>e.path)}function EB(e,t={}){let n=jB(e,t);return _B({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function DB(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return _B({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function OB(e){let t=e,n=t.preparedPaths;if(t[gB]===`prepared`&&n!=null)return n;if(!CB(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function kB(e){let t=e;return t[gB]===`presorted`&&t.presortedPaths!=null||wB(t.presortedPaths)?t.presortedPaths:null}function AB(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function jB(e,t={}){let n=cB(t),r=qz(t);Yz(r,`workload.inputFiles`,e.length);let i=Jz(r,`store.preparePathEntries.parse`,()=>e.map(e=>uB(e)));return Jz(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>yB(e,t,n.sort))),i}var MB=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[bB()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=pB();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=qz(e),this.options=cB(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,xz())}appendPaths(e){return Jz(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>uB(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Jz(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Jz(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Lz(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Lz(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Lz(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=uB(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Lz(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Lz(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=uB(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Jz(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Jz(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?oB(this.lastPreparedPath,e,this.segmentSortKeyCache):yB(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=SB(e),i=n==null?0:SB(n),a=n==null?0:xB(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=mB(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Lz(Rz(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Tz(i,s),s}createFileChildUnchecked(e,t){let n=mB(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lz(Rz(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tz(r,a),a}getOrCreateDirectoryChild(e,t){let n=mB(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!Bz(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lz(Rz(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tz(r,a),this.directories.set(a,xz()),a}createDirectoryChild(e,t){let n=mB(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lz(Rz(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tz(r,a),this.directories.set(a,xz()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Bz(n))throw Error(`Path is not a directory: "${t}"`);if(Hz(n,1))throw Error(`Duplicate path: "${t}"`);Uz(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,Sz());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Bz(a)){let t=Sz();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;Bz(n)&&this.directories.set(t,xz());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Tz(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Bz(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return Dz(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function NB(e,t=`closed`,n=null){let r=FB(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function PB(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function FB(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function IB(e,t){return Hz(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Rz(t)<=e.defaultExpansion}function LB(e,t,n=e.snapshot.nodes[t]){return n==null||!Bz(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:IB(e,n)}function RB(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Bz(r))return;let i=IB(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function zB(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function BB(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function VB(e,t){let n=zB(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function HB(e,t){let n=zB(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function UB(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function WB(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function GB(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function KB(e,t){e.directoryLoadInfoById.delete(t)}function qB(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function JB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function YB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function XB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function ZB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function QB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function $B(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function eV(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function tV(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function nV(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function rV(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function iV(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function aV(e,t,n){return{...n,visibleCountDelta:gV(e)-t}}function oV(e,t){let n=gV(e),r=PB();e.transactionStack.push(r);try{t()}catch(t){throw lV(e,r,!1),t}lV(e,r,!0,gV(e)-n)}function sV(e,t){let n=e.instrumentation;if(n==null){cV(e,t);return}Jz(n,`store.events.record`,()=>cV(e,t))}function cV(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){mV(e,t);return}n.events.push(t),pV(n,t)}function lV(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?fV(i,t):Jz(n,`store.events.batch.merge`,()=>fV(i,t));return}let a=uV(t,r),o=e.instrumentation;if(o==null){mV(e,a);return}Jz(o,`store.events.batch.commit`,()=>mV(e,a))}function uV(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function dV(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function fV(e,t){for(let n of t.events)e.events.push(n);dV(e,t)}function pV(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function mV(e,t){let n=e.instrumentation;if(n==null){hV(e,t);return}Jz(n,`store.events.emit`,()=>hV(e,t))}function hV(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function gV(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function _V(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Bz(n)||Hz(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!Bz(a)?null:i}function vV(e,t){let n=t;for(;;){let t=_V(e,n);if(t==null)return n;n=t}}function yV(e,t){let n=[t],r=t;for(;;){let t=_V(e,r);if(t==null)return n;n.push(t),r=t}}function bV(e,t){let n=t==null?e.snapshot.rootId:AV(e,t);return n==null?[]:PV(e,n)}function xV(e,t){let n=uB(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=YV(e,JV(e,r)),{createdNodeIds:a,directoryId:o}=FV(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=NV(e,o);if(Hz(n,1))throw Error(`Path already exists: "${t}"`);Uz(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=LV(e,o,n.basename),s.add(c);DV(e,o);let l=YV(e,o);return JB({affectedAncestorIds:kV(e,c),affectedNodeIds:[...s],path:t,projectionChanged:XV(i,l)})}function SV(e,t,n){let r=AV(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=NV(e,r);if(Hz(i,2))throw Error(`The root node cannot be removed`);if(Bz(i)&&MV(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=YV(e,a),s=KV(e,r);BV(e,a,r,i.nameId),qV(e,a),DV(e,a);let c=YV(e,a);return YB({affectedAncestorIds:kV(e,a),affectedNodeIds:s,path:t,projectionChanged:XV(o,c),recursive:n.recursive===!0})}function CV(e,t,n,r){let i=AV(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=NV(e,i);if(Hz(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=WV(e,i,n),c=YV(e,a.parentId),l=YV(e,s.parentId),u=hB(e.snapshot.segmentTable,a.nameId),d=mB(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Bz(a)&&eH(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Cz(e.snapshot.nodes,MV(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&GV(e,p,o,zz(a))===`skip`)return null;let m=a.parentId;BV(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),$V(e,i),zV(e,s.parentId,i),qV(e,m),e.pathCacheVersion++,DV(e,m),s.parentId!==m&&DV(e,s.parentId);let h=YV(e,m),g=YV(e,s.parentId);return XB({affectedAncestorIds:[...new Set([...kV(e,m),...kV(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:ZV([c,l],[h,g]),to:EV(e,i)})}function wV(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function TV(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function EV(e,t){let n=NV(e,t),r=wV(e,t);if(r!=null)return r;if(Hz(n,2))return TV(e,t,``);let i=EV(e,n.parentId),a=hB(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return TV(e,t,Bz(n)?`${o}/`:o)}function DV(e,t){let n=e.instrumentation;if(n==null){nH(e,t);return}Jz(n,`store.recomputeCountsUpwardFrom`,()=>nH(e,t))}function OV(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!Bz(o)){tH(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){tH(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function kV(e,t){let n=[],r=t;for(;r!=null;){let t=NV(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function AV(e,t){if(t.length===0)return e.snapshot.rootId;let n=dB(t);return jV(e,n.segments,n.requiresDirectory)}function jV(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=MV(e,r),a=Cz(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=NV(e,r);return n&&!Bz(i)?null:r}function MV(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function NV(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Hz(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function PV(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Hz(n,4))return[];if(!Bz(n))return[EV(e,t)];if(MV(e,t).childIds.length===0)return Hz(n,1)&&!Hz(n,2)?[EV(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||Hz(n,4)){i.pop();continue}if(!Bz(n)){r.push(EV(e,t.nodeId)),i.pop();continue}let a=MV(e,t.nodeId);if(a.childIds.length===0){Hz(n,1)&&!Hz(n,2)&&r.push(EV(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function FV(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=mB(e.snapshot.segmentTable,i),a=MV(e,r),o=Cz(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Bz(NV(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=IV(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function IV(e,t,n){let r=NV(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Lz(Rz(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,xz()),zV(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function LV(e,t,n){let r=mB(e.snapshot.segmentTable,n),i=MV(e,t);if(Cz(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${iH(e,t,n)}"`);let a=NV(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Lz(Rz(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),zV(e,t,o),e.activeNodeCount++,o}function RV(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}VV(e,n,o)<0?i=a:r=a+1}return r}function zV(e,t,n){let r=MV(e,t),i=NV(e,n);Cz(e.snapshot.nodes,r).set(i.nameId,n),Oz(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=RV(e,r,n);r.childIds.splice(a,0,n),Ez(r,a),jz(e.snapshot.nodes,r)}function BV(e,t,n,r){let i=MV(e,t),a=wz(i),o=a.get(n)??-1;Cz(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Oz(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Ez(i,o),jz(e.snapshot.nodes,i))}function VV(e,t,n){let r=e.snapshot.options.sort;return r===`default`?HV(e,t,n):r(UV(e,t),UV(e,n))}function HV(e,t,n){let r=NV(e,t),i=NV(e,n),a=Bz(r);if(a!==Bz(i))return a?-1:1;let o=eB(sB(e.snapshot.segmentTable,r.nameId),sB(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=hB(e.snapshot.segmentTable,r.nameId),c=hB(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function UV(e,t){let n=NV(e,t),r=EV(e,t),i=Bz(n),a=i?r.slice(0,-1):r;return{basename:hB(e.snapshot.segmentTable,n.nameId),depth:Rz(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function WV(e,t,n){let r=NV(e,t),i=AV(e,n);if(i!=null){let t=NV(e,i);if(Bz(t))return{basename:hB(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=dB(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=dB(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:jV(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function GV(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${EV(e,t)}"`);let i=NV(e,t);if(zz(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Bz(i)&&MV(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return KV(e,t),BV(e,a,t,o),qV(e,a),DV(e,a),`handled`}function KV(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=NV(e,t.nodeId);if(t.visitedChildren||!Bz(i)){Bz(i)&&e.snapshot.directories.delete(t.nodeId),Uz(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),KB(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=MV(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function qV(e,t){let n=t;for(;n!=null;){let t=NV(e,n);if(!Bz(t)||Hz(t,2)||MV(e,n).childIds.length>0)return;Uz(t,1),n=t.parentId===n?null:t.parentId}}function JV(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=Cz(e.snapshot.nodes,MV(e,n)).get(t);if(i==null||!Bz(NV(e,i)))break;n=i}return n}function YV(e,t){let n=QV(e,t);if(n==null)return null;let r=vV(e,n),i=NV(e,r),a=n===r?null:yV(e,n).map(t=>EV(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:MV(e,r).childIds.length>0,path:EV(e,r),terminalKind:zz(i)})}function XV(e,t){return ZV([e],[t])}function ZV(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function QV(e,t){let n=t;for(;n!=null;){let t=NV(e,n);if(!Bz(t)||Hz(t,2))return null;if(!LB(e,n,t))return n;n=t.parentId}return null}function $V(e,t){let n=NV(e,t);if(Wz(n,(t===e.snapshot.rootId?-1:Rz(NV(e,n.parentId)))+1),!Bz(n))return;let r=MV(e,t);for(let t of r.childIds)$V(e,t)}function eH(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=NV(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function tH(e,t,n=NV(e,t),r=!1){let i=e.instrumentation;if(i==null){rH(e,t,n,r);return}Jz(i,`store.recomputeNodeCounts`,()=>rH(e,t,n,r))}function nH(e,t){let n=t;for(;n!=null;){let t=NV(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(tH(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Oz(MV(e,s),n,a,o),n=s}}function rH(e,t,n,r){if(!Bz(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=MV(e,t);if(r){let t=e.instrumentation;t==null?Dz(e.snapshot.nodes,i):Jz(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>Dz(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Hz(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=_V(e,t)==null?LB(e,t,n)?1+o:1:o}function iH(e,t,n){let r=EV(e,t);return r.length===0?n:`${r}${n}`}function aH(e){return e!=null&&!Hz(e,4)}function oH(e,t){let n=e.snapshot.nodes[t];return!aH(n)||!Bz(n)||Hz(n,2)?null:n}function sH(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&aH(e.snapshot.nodes[n])&&(t+=1);return t}function cH(e){return Math.max(0,e.valueById.length-1)}function lH(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:sH(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:cH(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function uH(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function dH(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)oH(e,n)!=null&&t.push(EV(e,n));for(let t of e.expandedDirectoryIds)oH(e,t)!=null&&n.push(EV(e,t));return{collapsedPaths:t,expandedPaths:n}}function fH(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)oH(e,n)==null||BB(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:EV(e,n)});return t}function pH(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=AV(e,n);t!=null&&RB(e,t,!0,NV(e,t))}for(let n of t.collapsedPaths){let t=AV(e,n);t!=null&&RB(e,t,!1,NV(e,t))}}function mH(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=AV(e,n.path);t!=null&&oH(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function hH(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function gH(e){let t=e.snapshot.segmentTable,n=pB();for(let r of e.snapshot.nodes)if(aH(r)){if(Hz(r,2)){r.nameId=0;continue}r.nameId=mB(n,hB(t,r.nameId))}e.snapshot.segmentTable=n}function _H(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!aH(r)||!Bz(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return aH(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[NV(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),Dz(e.snapshot.nodes,n)}}function vH(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(aH(n))break;--t}e.snapshot.nodes.length=t+1}function yH(e){let t=dH(e),n=fH(e);Jz(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>hH(e)),Jz(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>gH(e)),Jz(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>_H(e)),Jz(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>vH(e)),Jz(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>pH(e,t)),Jz(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>mH(e,n)),Jz(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>OV(e,e.snapshot.rootId))}function bH(e){let t=dH(e),n=fH(e),r=Jz(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>bV(e)),i=Kz({...e.snapshot.options},e.instrumentation),a=Jz(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new MB(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,Jz(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>pH(e,t)),Jz(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>mH(e,n)),Jz(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>OV(e,e.snapshot.rootId))}function xH(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function SH(e,t){let n=lH(e);t===`stable`?Jz(e.instrumentation,`store.cleanup.stable`,()=>yH(e)):Jz(e.instrumentation,`store.cleanup.aggressive`,()=>bH(e));let r=lH(e);return uH(t,t===`stable`,n,r)}var CH=64;function wH(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function TH(e){return NV(e,e.snapshot.rootId).visibleSubtreeCount}function EH(e,t,n,r){let i=NV(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function DH(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:KH(e,t.cursor),setSize:t.setSize,subtreeEndIndex:EH(e,t.cursor,t.index,n)}}function OH(e,t,n,r,i,a){let o=MV(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=kz(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return kH(e,u,l,r+c,i+1,s,o.childIds.length,a)}function kH(e,t,n,r,i,a,o,s){if(!Bz(NV(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=BH(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=NV(e,c.terminalNodeId);if(!Bz(l)||!LB(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return OH(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function AH(e,t){let n=TH(e);if(t<0||t>=n)return null;let r=OH(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>EV(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=DH(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:KH(e,r.cursor),setSize:r.setSize,subtreeEndIndex:EH(e,r.cursor,r.index,n)}}function jH(e,t,n){let r=e.instrumentation,i=TH(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return GH(e,o+1);let t=[],n=LH(e,a);for(let r=a;r<=o&&n!=null;r++){let r=KH(e,n);t.push(r),n=HH(e,n)}return t}let s=[],c=0,l=0,u=Jz(r,`store.getVisibleSlice.selectFirstRow`,()=>LH(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Jz(r,`store.getVisibleSlice.materializeRow`,()=>KH(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Jz(r,`store.getVisibleSlice.advanceCursor`,()=>HH(e,u))}return Yz(r,`workload.visibleRowsRead`,s.length),Yz(r,`workload.flattenedRowsRead`,c),Yz(r,`workload.flattenedSegmentsRead`,l),s}function MH(e,t=TH(e)){let n=e.instrumentation;return n==null?WH(e,t):Jz(n,`store.getVisibleTreeProjection`,()=>WH(e,t))}function NH(e){return UH(MH(e))}function PH(e,t){let n=AV(e,t);if(n==null||n===e.snapshot.rootId||Bz(NV(e,n))&&vV(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=NV(e,i).parentId,n=MV(e,t),s=wz(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=Az(a,n,s),t!==o){let n=NV(e,t),a=_V(e,t);if(!LB(e,t,n)&&a!==i)return null;vV(e,t)===t&&(r+=1)}i=t}return r}function FH(e,t){let n=AV(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=NV(e,n);if(!Bz(r))throw Error(`Path is not a directory: "${t}"`);return LB(e,n,r)?null:(RB(e,n,!0,r),DV(e,n),ZB({affectedAncestorIds:kV(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function IH(e,t){let n=AV(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=NV(e,n);if(!Bz(r))throw Error(`Path is not a directory: "${t}"`);return LB(e,n,r)?(RB(e,n,!1,r),DV(e,n),QB({affectedAncestorIds:kV(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function LH(e,t){return t<0||t>=TH(e)?null:RH(e,e.snapshot.rootId,t,-1)}function RH(e,t,n,r){let i=MV(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?kz(e.snapshot.nodes,i,n):Jz(a,`store.getVisibleSlice.selectChildIndex`,()=>kz(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return zH(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function zH(e,t,n,r){if(!Bz(NV(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=BH(e,t,r);if(n===0)return i;let a=NV(e,i.terminalNodeId);if(!Bz(a)||!LB(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return RH(e,i.terminalNodeId,n-1,i.visibleDepth)}function BH(e,t,n){return Bz(NV(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:vV(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Jz(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>vV(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function VH(e,t){let n=NV(e,t);if(!Bz(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:_V(e,r)!==t}function HH(e,t){let n=NV(e,t.terminalNodeId);if(Bz(n)){let r=MV(e,t.terminalNodeId);if(LB(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:zH(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=NV(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=MV(e,n),o=wz(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return zH(e,s,0,i);VH(e,r)&&i--,r=n}}function UH(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function WH(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(CH);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=wH(o,y);let x,S=_;if(Bz(v))S=f?vV(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:EV(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&Bz(C)&&LB(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function GH(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!Bz(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:EV(e,f)};continue}let h=l?vV(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=KH(e,g);let _=i[h];_!=null&&Bz(_)&&LB(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function KH(e,t){let n=NV(e,t.terminalNodeId),r=Bz(n)?qH(e,t):null,i=EV(e,t.terminalNodeId),a=hB(e.snapshot.segmentTable,n.nameId),o=Bz(n)&&MV(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?yV(e,t.headNodeId).map(n=>{let r=NV(e,n);return{isTerminal:n===t.terminalNodeId,name:hB(e.snapshot.segmentTable,r.nameId),nodeId:n,path:EV(e,n)}}):Jz(c,`store.getVisibleSlice.flatten.collectSegments`,()=>yV(e,t.headNodeId).map(n=>{let r=NV(e,n);return{isTerminal:n===t.terminalNodeId,name:hB(e.snapshot.segmentTable,r.nameId),nodeId:n,path:EV(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Bz(n)&&LB(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Bz(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function qH(e,t){if(t.headNodeId===t.terminalNodeId)return BB(e,t.terminalNodeId);let n=yV(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=BB(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function JH(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!Bz(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&jz(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Bz(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,jz(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function YH(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var XH=class e{#e;constructor(e={}){let t=qz(e),n=Jz(t,`store.builder.create`,()=>new MB(e));if(e.preparedInput!=null){let t=kB(e.preparedInput);t==null?n.appendPreparedPaths(OB(e.preparedInput),!1):n.appendPresortedPaths(t,AB(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Jz(t,`store.preparePathEntries`,()=>jB(r,e)))}let r=Jz(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Jz(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Jz(t,`store.state.create`,()=>NB(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Jz(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||YH(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Jz(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?Jz(t,`store.state.initializeOpenVisibleCounts`,()=>JH(this.#e)):Jz(t,`store.state.recomputeCounts`,()=>OV(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return TB(e,t)}static prepareInput(e,t={}){return EB(e,t)}static preparePresortedInput(e){return DB(e)}list(e){return Jz(this.#e.instrumentation,`store.list`,()=>bV(this.#e,e))}add(e){Jz(this.#e.instrumentation,`store.add`,()=>{let t=TH(this.#e);sV(this.#e,aV(this.#e,t,xV(this.#e,e)))})}remove(e,t={}){Jz(this.#e.instrumentation,`store.remove`,()=>{let n=TH(this.#e);sV(this.#e,aV(this.#e,n,SV(this.#e,e,t)))})}move(e,t,n={}){Jz(this.#e.instrumentation,`store.move`,()=>{let r=TH(this.#e),i=CV(this.#e,e,t,n);i!=null&&sV(this.#e,aV(this.#e,r,i))})}batch(e){oV(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return Jz(this.#e.instrumentation,`store.getVisibleCount`,()=>TH(this.#e))}getVisibleSlice(e,t){return Jz(this.#e.instrumentation,`store.getVisibleSlice`,()=>jH(this.#e,e,t))}getVisibleRowContext(e){return Jz(this.#e.instrumentation,`store.getVisibleRowContext`,()=>AH(this.#e,e))}getVisibleTreeProjection(){return NH(this.#e)}getVisibleTreeProjectionData(e){return MH(this.#e,e)}getVisibleIndex(e){return Jz(this.#e.instrumentation,`store.getVisibleIndex`,()=>PH(this.#e,e))}getPathInfo(e){return Jz(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=AV(this.#e,e);if(t==null)return null;let n=NV(this.#e,t);return{depth:Rz(n),kind:Bz(n)?`directory`:`file`,path:EV(this.#e,t)}})}isExpanded(e){return Jz(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=NV(this.#e,t);return LB(this.#e,t,n)})}expand(e){Jz(this.#e.instrumentation,`store.expand`,()=>{let t=TH(this.#e),n=FH(this.#e,e);n!=null&&sV(this.#e,aV(this.#e,t,n))})}collapse(e){Jz(this.#e.instrumentation,`store.collapse`,()=>{let t=TH(this.#e),n=IH(this.#e,e);n!=null&&sV(this.#e,aV(this.#e,t,n))})}on(e,t){return qB(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return BB(this.#e,t)}markDirectoryUnloaded(e){Jz(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(MV(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=TH(this.#e);HB(this.#e,t),sV(this.#e,aV(this.#e,n,$B({affectedAncestorIds:kV(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Jz(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=TH(this.#e),r=VB(this.#e,t);return sV(this.#e,aV(this.#e,n,eV({affectedAncestorIds:kV(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Jz(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||BB(this.#e,n)!==`loading`||!WB(this.#e,n,e.attemptId))return!1;let r=EV(this.#e,n);this.validateChildPatch(r,t);let i=TH(this.#e),a=[];for(let e of t.operations){ZH(r,e);let t=TH(this.#e);switch(e.type){case`add`:a.push(aV(this.#e,t,xV(this.#e,e.path)));break;case`remove`:a.push(aV(this.#e,t,SV(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=CV(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(aV(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return sV(this.#e,aV(this.#e,i,tV({affectedAncestorIds:kV(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:EV(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Jz(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=TH(this.#e),r=UB(this.#e,t,e.attemptId);return sV(this.#e,aV(this.#e,n,nV({affectedAncestorIds:kV(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:EV(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Jz(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=TH(this.#e),i=GB(this.#e,n,e.attemptId,t);return sV(this.#e,aV(this.#e,r,rV({affectedAncestorIds:kV(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:EV(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Jz(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(xH(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=TH(this.#e),n=SH(this.#e,e.mode??`stable`);return sV(this.#e,aV(this.#e,t,iV({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=MV(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Qz(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=eB(sB(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!Bz(NV(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=NV(this.#e,n);LB(this.#e,n,i)||(RB(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=NV(this.#e,e);if(!LB(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=AV(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Bz(NV(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Bz(NV(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=NV(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=NV(this.#e,e),r=_V(this.#e,e);if(!LB(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function ZH(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var QH={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function $H(e,t){if(typeof e==`number`)return{itemHeight:t??QH.default.itemHeight,factor:e};let n=QH[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var eU=QH.default.itemHeight,tU=`@layer base, theme, unsafe;
|
|
197
|
+
</symbol>`],zR=[BL,VL,UL,WL,GL,KL,JL,$L,eR,iR,dR,fR,pR,mR,hR,_R,bR,xR,SR,CR,wR,DR,OR,jR,MR,NR,PR,FR,IR,LR];function BR(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
|
|
198
|
+
`)}\n</svg>`)}var VR=BR(zL,RR),HR={minimal:zL,standard:VR,complete:BR(VR,zR)},UR={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},WR={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},GR={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},KR=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),qR=new Set([`complete`]);function JR(e){return HR[e===`none`?`minimal`:e]}function YR(e){return`file-tree-builtin-${e}`}function XR(e){return e!==`none`&&qR.has(e)}function ZR(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=UR[t.toLowerCase()];if(i!=null&&(r||KR.has(i)))return i;for(let e of n){if(r){let t=GR[e];if(t!=null)return t}let t=WR[e];if(t!=null&&(r||KR.has(t)))return t}return`default`}var QR=`file-tree-container`,$R=`data-file-tree-style`,ez=`data-file-tree-unsafe-css`,tz=`data-file-tree-scrollbar-measure`,nz=`data-file-tree-scrollbar-gutter-measured`,rz=`--trees-scrollbar-gutter-measured`,iz=`header`,az=`context-menu`,oz=`context-menu-trigger`;function sz(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function cz(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(sz(e)?`none`:`complete`),colored:e.colored??!0}}var lz=e=>e.trim().toLowerCase(),uz=e=>e.split(`/`).at(-1)??e,dz=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function fz(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function pz(e){let t=cz(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(lz(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=uz(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return fz(c,e);for(let[t,n]of a)if(s.includes(t))return fz(n,e);let l=dz(n);for(let t of l){let n=i.get(t);if(n!=null)return fz(n,e)}let u=ZR(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:YR(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:fz(s,e)}}}var mz=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,hz=/^0(?:\.0+)?%?$/;function gz(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function _z(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||mz.test(t))return!0;let n=gz(t);return n!=null&&hz.test(n)}function vz(e){return _z(e)?void 0:e}function yz(e){let t=e.colors??{},n=t[`sideBar.background`]??t[`editor.background`]??e.bg,r=t[`sideBar.foreground`]??t[`editor.foreground`]??e.fg,i=t[`sideBar.border`],a=t[`list.activeSelectionForeground`]??t[`sideBar.foreground`],o=n?.toLowerCase(),s=t[`list.hoverBackground`],c=s?.toLowerCase()===o?void 0:s,l=t[`list.activeSelectionBackground`],u=l?.toLowerCase()===o?t[`list.focusBackground`]??t[`editor.selectionBackground`]:l??t[`editor.selectionBackground`],d=vz(t[`list.focusOutline`])??vz(t.focusBorder),f=t[`input.background`]??n,p=t[`input.border`],m=t[`scrollbarSlider.background`],h=t[`sideBarSectionHeader.foreground`]??r,g=t[`gitDecoration.addedResourceForeground`]??t[`terminal.ansiGreen`]??t[`editorGutter.addedBackground`],_=t[`gitDecoration.modifiedResourceForeground`]??t[`terminal.ansiBlue`]??t[`editorGutter.modifiedBackground`],v=t[`gitDecoration.deletedResourceForeground`]??t[`terminal.ansiRed`]??t[`editorGutter.deletedBackground`],y=e.type===`dark`,b={colorScheme:y?`dark`:`light`,backgroundColor:n??``,color:r??``,borderColor:`var(--trees-theme-sidebar-border, light-dark(oklch(0% 0 0 / 0.15), oklch(100% 0 0 / 0.15)))`,"--trees-theme-sidebar-bg":n??``,"--trees-theme-sidebar-fg":r??``,"--trees-theme-sidebar-header-fg":h??``,"--trees-theme-list-active-selection-fg":a??r??``,"--trees-theme-list-hover-bg":c??(y?`rgba(255,255,255,0.08)`:`rgba(0,0,0,0.06)`),"--trees-theme-list-active-selection-bg":u??`transparent`,"--trees-theme-focus-ring":d??r??``,"--trees-theme-input-bg":f??``};return i!=null&&i!==``&&(b[`--trees-theme-sidebar-border`]=i),p!=null&&p!==``&&(b[`--trees-theme-input-border`]=p),m!=null&&m!==``&&(b[`--trees-theme-scrollbar-thumb`]=m),g!=null&&g!==``&&(b[`--trees-theme-git-added-fg`]=g),_!=null&&_!==``&&(b[`--trees-theme-git-modified-fg`]=_),v!=null&&v!==``&&(b[`--trees-theme-git-deleted-fg`]=v),b}var bz=5,xz=1<<bz,Sz=xz*4;function Cz(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function wz(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Tz(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function Ez(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Dz(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Oz(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function kz(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,Nz(e,t)}function Az(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=Ez(e).get(t);if(i===void 0)return;let a=i>>bz;e.childVisibleChunkSums[a]+=r}function jz(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=Pz(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=xz}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function Mz(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>bz;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<bz}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function Nz(e,t){if(t.childIds.length<Sz){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/xz),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>bz]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Pz(e,t,n,r){let i=Math.min(t.childIds.length,n+xz),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Fz=7,Iz=3,Lz=1<<Iz,Rz=4;function zz(e,t,n=0){return e<<Rz|n<<Iz|t}function Bz(e){return e.depthAndFlags>>>Rz}function Vz(e){return(e.depthAndFlags&Lz)>>Iz}function Hz(e){return(e.depthAndFlags&Lz)!==0}function Uz(e){return e.depthAndFlags&Fz}function Wz(e,t){return(Uz(e)&t)!==0}function Gz(e,t){e.depthAndFlags|=t}function Kz(e,t){e.depthAndFlags=zz(t,Uz(e),Vz(e))}var qz=Symbol(`benchmarkInstrumentation`);function Jz(e,t){return t==null||Object.defineProperty(e,qz,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Yz(e){return e==null?null:e[qz]??null}function Xz(e,t,n){return e==null?n():e.measurePhase(t,n)}function Zz(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Qz(e){return e>=48&&e<=57}function $z(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Qz(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Qz(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function eB(e){let t=e.toLowerCase();return{lowerValue:t,tokens:$z(t)}}function tB(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function nB(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=tB(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function rB(e,t,n){let r=nB(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function iB(e,t){return rB(e,t,eB)}function aB(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function oB(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=aB(e,r);return a===aB(t,r)?iB(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function sB(e,t){return oB(e,t)}function cB(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=eB(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=aB(e,n);return o===aB(t,n)?rB(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function lB(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=eB(r);return e.sortKeyById[t]=i,i}function uB(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function dB(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function fB(e){let{hasTrailingSlash:t,segments:n}=dB(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function pB(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=dB(e);return{requiresDirectory:t,segments:n}}var mB=``;function hB(){let e=new Map;return e.set(mB,0),{idByValue:e,valueById:[mB],sortKeyById:[eB(mB)]}}function gB(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function _B(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var vB=Symbol(`pathStorePreparedInputKind`);function yB(e,t){return e[vB]=t,e}function bB(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function xB(e,t,n){return n===`default`?sB(e,t):n(bB(e),bB(t))}function SB(){return{depthAndFlags:zz(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function CB(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function wB(e){return e.isDirectory?e.segments.length:e.segments.length-1}function TB(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function EB(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function DB(e,t={}){return NB(e,t).map(e=>e.path)}function OB(e,t={}){let n=NB(e,t);return yB({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function kB(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return yB({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function AB(e){let t=e,n=t.preparedPaths;if(t[vB]===`prepared`&&n!=null)return n;if(!TB(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function jB(e){let t=e;return t[vB]===`presorted`&&t.presortedPaths!=null||EB(t.presortedPaths)?t.presortedPaths:null}function MB(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function NB(e,t={}){let n=uB(t),r=Yz(t);Zz(r,`workload.inputFiles`,e.length);let i=Xz(r,`store.preparePathEntries.parse`,()=>e.map(e=>fB(e)));return Xz(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>xB(e,t,n.sort))),i}var PB=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[SB()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=hB();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Yz(e),this.options=uB(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Cz())}appendPaths(e){return Xz(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>fB(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Xz(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Xz(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:zz(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:zz(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:zz(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=fB(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:zz(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:zz(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=fB(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Xz(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Xz(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?cB(this.lastPreparedPath,e,this.segmentSortKeyCache):xB(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=wB(e),i=n==null?0:wB(n),a=n==null?0:CB(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=gB(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:zz(Bz(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Dz(i,s),s}createFileChildUnchecked(e,t){let n=gB(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:zz(Bz(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Dz(r,a),a}getOrCreateDirectoryChild(e,t){let n=gB(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!Hz(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:zz(Bz(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Dz(r,a),this.directories.set(a,Cz()),a}createDirectoryChild(e,t){let n=gB(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:zz(Bz(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Dz(r,a),this.directories.set(a,Cz()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Hz(n))throw Error(`Path is not a directory: "${t}"`);if(Wz(n,1))throw Error(`Duplicate path: "${t}"`);Gz(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,wz());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Hz(a)){let t=wz();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;Hz(n)&&this.directories.set(t,Cz());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Dz(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Hz(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return kz(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function FB(e,t=`closed`,n=null){let r=LB(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function IB(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function LB(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function RB(e,t){return Wz(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Bz(t)<=e.defaultExpansion}function zB(e,t,n=e.snapshot.nodes[t]){return n==null||!Hz(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:RB(e,n)}function BB(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Hz(r))return;let i=RB(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function VB(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function HB(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function UB(e,t){let n=VB(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function WB(e,t){let n=VB(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function GB(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function KB(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function qB(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function JB(e,t){e.directoryLoadInfoById.delete(t)}function YB(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function XB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function ZB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function QB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function $B(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function eV(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function tV(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function nV(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function rV(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function iV(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function aV(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function oV(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function sV(e,t,n){return{...n,visibleCountDelta:vV(e)-t}}function cV(e,t){let n=vV(e),r=IB();e.transactionStack.push(r);try{t()}catch(t){throw dV(e,r,!1),t}dV(e,r,!0,vV(e)-n)}function lV(e,t){let n=e.instrumentation;if(n==null){uV(e,t);return}Xz(n,`store.events.record`,()=>uV(e,t))}function uV(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){gV(e,t);return}n.events.push(t),hV(n,t)}function dV(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?mV(i,t):Xz(n,`store.events.batch.merge`,()=>mV(i,t));return}let a=fV(t,r),o=e.instrumentation;if(o==null){gV(e,a);return}Xz(o,`store.events.batch.commit`,()=>gV(e,a))}function fV(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function pV(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function mV(e,t){for(let n of t.events)e.events.push(n);pV(e,t)}function hV(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function gV(e,t){let n=e.instrumentation;if(n==null){_V(e,t);return}Xz(n,`store.events.emit`,()=>_V(e,t))}function _V(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function vV(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function yV(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Hz(n)||Wz(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!Hz(a)?null:i}function bV(e,t){let n=t;for(;;){let t=yV(e,n);if(t==null)return n;n=t}}function xV(e,t){let n=[t],r=t;for(;;){let t=yV(e,r);if(t==null)return n;n.push(t),r=t}}function SV(e,t){let n=t==null?e.snapshot.rootId:MV(e,t);return n==null?[]:IV(e,n)}function CV(e,t){let n=fB(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=ZV(e,XV(e,r)),{createdNodeIds:a,directoryId:o}=LV(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=FV(e,o);if(Wz(n,1))throw Error(`Path already exists: "${t}"`);Gz(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=zV(e,o,n.basename),s.add(c);kV(e,o);let l=ZV(e,o);return XB({affectedAncestorIds:jV(e,c),affectedNodeIds:[...s],path:t,projectionChanged:QV(i,l)})}function wV(e,t,n){let r=MV(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=FV(e,r);if(Wz(i,2))throw Error(`The root node cannot be removed`);if(Hz(i)&&PV(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=ZV(e,a),s=JV(e,r);HV(e,a,r,i.nameId),YV(e,a),kV(e,a);let c=ZV(e,a);return ZB({affectedAncestorIds:jV(e,a),affectedNodeIds:s,path:t,projectionChanged:QV(o,c),recursive:n.recursive===!0})}function TV(e,t,n,r){let i=MV(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=FV(e,i);if(Wz(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=KV(e,i,n),c=ZV(e,a.parentId),l=ZV(e,s.parentId),u=_B(e.snapshot.segmentTable,a.nameId),d=gB(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Hz(a)&&nH(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Tz(e.snapshot.nodes,PV(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&qV(e,p,o,Vz(a))===`skip`)return null;let m=a.parentId;HV(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),tH(e,i),VV(e,s.parentId,i),YV(e,m),e.pathCacheVersion++,kV(e,m),s.parentId!==m&&kV(e,s.parentId);let h=ZV(e,m),g=ZV(e,s.parentId);return QB({affectedAncestorIds:[...new Set([...jV(e,m),...jV(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:$V([c,l],[h,g]),to:OV(e,i)})}function EV(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function DV(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function OV(e,t){let n=FV(e,t),r=EV(e,t);if(r!=null)return r;if(Wz(n,2))return DV(e,t,``);let i=OV(e,n.parentId),a=_B(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return DV(e,t,Hz(n)?`${o}/`:o)}function kV(e,t){let n=e.instrumentation;if(n==null){iH(e,t);return}Xz(n,`store.recomputeCountsUpwardFrom`,()=>iH(e,t))}function AV(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!Hz(o)){rH(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){rH(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function jV(e,t){let n=[],r=t;for(;r!=null;){let t=FV(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function MV(e,t){if(t.length===0)return e.snapshot.rootId;let n=pB(t);return NV(e,n.segments,n.requiresDirectory)}function NV(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=PV(e,r),a=Tz(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=FV(e,r);return n&&!Hz(i)?null:r}function PV(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function FV(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Wz(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function IV(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Wz(n,4))return[];if(!Hz(n))return[OV(e,t)];if(PV(e,t).childIds.length===0)return Wz(n,1)&&!Wz(n,2)?[OV(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||Wz(n,4)){i.pop();continue}if(!Hz(n)){r.push(OV(e,t.nodeId)),i.pop();continue}let a=PV(e,t.nodeId);if(a.childIds.length===0){Wz(n,1)&&!Wz(n,2)&&r.push(OV(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function LV(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=gB(e.snapshot.segmentTable,i),a=PV(e,r),o=Tz(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Hz(FV(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=RV(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function RV(e,t,n){let r=FV(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:zz(Bz(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,Cz()),VV(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function zV(e,t,n){let r=gB(e.snapshot.segmentTable,n),i=PV(e,t);if(Tz(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${oH(e,t,n)}"`);let a=FV(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:zz(Bz(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),VV(e,t,o),e.activeNodeCount++,o}function BV(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}UV(e,n,o)<0?i=a:r=a+1}return r}function VV(e,t,n){let r=PV(e,t),i=FV(e,n);Tz(e.snapshot.nodes,r).set(i.nameId,n),Az(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=BV(e,r,n);r.childIds.splice(a,0,n),Oz(r,a),Nz(e.snapshot.nodes,r)}function HV(e,t,n,r){let i=PV(e,t),a=Ez(i),o=a.get(n)??-1;Tz(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Az(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Oz(i,o),Nz(e.snapshot.nodes,i))}function UV(e,t,n){let r=e.snapshot.options.sort;return r===`default`?WV(e,t,n):r(GV(e,t),GV(e,n))}function WV(e,t,n){let r=FV(e,t),i=FV(e,n),a=Hz(r);if(a!==Hz(i))return a?-1:1;let o=nB(lB(e.snapshot.segmentTable,r.nameId),lB(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=_B(e.snapshot.segmentTable,r.nameId),c=_B(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function GV(e,t){let n=FV(e,t),r=OV(e,t),i=Hz(n),a=i?r.slice(0,-1):r;return{basename:_B(e.snapshot.segmentTable,n.nameId),depth:Bz(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function KV(e,t,n){let r=FV(e,t),i=MV(e,n);if(i!=null){let t=FV(e,i);if(Hz(t))return{basename:_B(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=pB(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=pB(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:NV(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function qV(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${OV(e,t)}"`);let i=FV(e,t);if(Vz(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Hz(i)&&PV(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return JV(e,t),HV(e,a,t,o),YV(e,a),kV(e,a),`handled`}function JV(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=FV(e,t.nodeId);if(t.visitedChildren||!Hz(i)){Hz(i)&&e.snapshot.directories.delete(t.nodeId),Gz(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),JB(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=PV(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function YV(e,t){let n=t;for(;n!=null;){let t=FV(e,n);if(!Hz(t)||Wz(t,2)||PV(e,n).childIds.length>0)return;Gz(t,1),n=t.parentId===n?null:t.parentId}}function XV(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=Tz(e.snapshot.nodes,PV(e,n)).get(t);if(i==null||!Hz(FV(e,i)))break;n=i}return n}function ZV(e,t){let n=eH(e,t);if(n==null)return null;let r=bV(e,n),i=FV(e,r),a=n===r?null:xV(e,n).map(t=>OV(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:PV(e,r).childIds.length>0,path:OV(e,r),terminalKind:Vz(i)})}function QV(e,t){return $V([e],[t])}function $V(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function eH(e,t){let n=t;for(;n!=null;){let t=FV(e,n);if(!Hz(t)||Wz(t,2))return null;if(!zB(e,n,t))return n;n=t.parentId}return null}function tH(e,t){let n=FV(e,t);if(Kz(n,(t===e.snapshot.rootId?-1:Bz(FV(e,n.parentId)))+1),!Hz(n))return;let r=PV(e,t);for(let t of r.childIds)tH(e,t)}function nH(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=FV(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function rH(e,t,n=FV(e,t),r=!1){let i=e.instrumentation;if(i==null){aH(e,t,n,r);return}Xz(i,`store.recomputeNodeCounts`,()=>aH(e,t,n,r))}function iH(e,t){let n=t;for(;n!=null;){let t=FV(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(rH(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Az(PV(e,s),n,a,o),n=s}}function aH(e,t,n,r){if(!Hz(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=PV(e,t);if(r){let t=e.instrumentation;t==null?kz(e.snapshot.nodes,i):Xz(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>kz(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Wz(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=yV(e,t)==null?zB(e,t,n)?1+o:1:o}function oH(e,t,n){let r=OV(e,t);return r.length===0?n:`${r}${n}`}function sH(e){return e!=null&&!Wz(e,4)}function cH(e,t){let n=e.snapshot.nodes[t];return!sH(n)||!Hz(n)||Wz(n,2)?null:n}function lH(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&sH(e.snapshot.nodes[n])&&(t+=1);return t}function uH(e){return Math.max(0,e.valueById.length-1)}function dH(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:lH(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:uH(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function fH(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function pH(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)cH(e,n)!=null&&t.push(OV(e,n));for(let t of e.expandedDirectoryIds)cH(e,t)!=null&&n.push(OV(e,t));return{collapsedPaths:t,expandedPaths:n}}function mH(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)cH(e,n)==null||HB(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:OV(e,n)});return t}function hH(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=MV(e,n);t!=null&&BB(e,t,!0,FV(e,t))}for(let n of t.collapsedPaths){let t=MV(e,n);t!=null&&BB(e,t,!1,FV(e,t))}}function gH(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=MV(e,n.path);t!=null&&cH(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function _H(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function vH(e){let t=e.snapshot.segmentTable,n=hB();for(let r of e.snapshot.nodes)if(sH(r)){if(Wz(r,2)){r.nameId=0;continue}r.nameId=gB(n,_B(t,r.nameId))}e.snapshot.segmentTable=n}function yH(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!sH(r)||!Hz(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return sH(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[FV(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),kz(e.snapshot.nodes,n)}}function bH(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(sH(n))break;--t}e.snapshot.nodes.length=t+1}function xH(e){let t=pH(e),n=mH(e);Xz(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>_H(e)),Xz(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>vH(e)),Xz(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>yH(e)),Xz(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>bH(e)),Xz(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>hH(e,t)),Xz(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>gH(e,n)),Xz(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>AV(e,e.snapshot.rootId))}function SH(e){let t=pH(e),n=mH(e),r=Xz(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>SV(e)),i=Jz({...e.snapshot.options},e.instrumentation),a=Xz(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new PB(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,Xz(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>hH(e,t)),Xz(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>gH(e,n)),Xz(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>AV(e,e.snapshot.rootId))}function CH(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function wH(e,t){let n=dH(e);t===`stable`?Xz(e.instrumentation,`store.cleanup.stable`,()=>xH(e)):Xz(e.instrumentation,`store.cleanup.aggressive`,()=>SH(e));let r=dH(e);return fH(t,t===`stable`,n,r)}var TH=64;function EH(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function DH(e){return FV(e,e.snapshot.rootId).visibleSubtreeCount}function OH(e,t,n,r){let i=FV(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function kH(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:JH(e,t.cursor),setSize:t.setSize,subtreeEndIndex:OH(e,t.cursor,t.index,n)}}function AH(e,t,n,r,i,a){let o=PV(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=jz(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return jH(e,u,l,r+c,i+1,s,o.childIds.length,a)}function jH(e,t,n,r,i,a,o,s){if(!Hz(FV(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=HH(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=FV(e,c.terminalNodeId);if(!Hz(l)||!zB(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return AH(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function MH(e,t){let n=DH(e);if(t<0||t>=n)return null;let r=AH(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>OV(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=kH(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:JH(e,r.cursor),setSize:r.setSize,subtreeEndIndex:OH(e,r.cursor,r.index,n)}}function NH(e,t,n){let r=e.instrumentation,i=DH(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return qH(e,o+1);let t=[],n=zH(e,a);for(let r=a;r<=o&&n!=null;r++){let r=JH(e,n);t.push(r),n=WH(e,n)}return t}let s=[],c=0,l=0,u=Xz(r,`store.getVisibleSlice.selectFirstRow`,()=>zH(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Xz(r,`store.getVisibleSlice.materializeRow`,()=>JH(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Xz(r,`store.getVisibleSlice.advanceCursor`,()=>WH(e,u))}return Zz(r,`workload.visibleRowsRead`,s.length),Zz(r,`workload.flattenedRowsRead`,c),Zz(r,`workload.flattenedSegmentsRead`,l),s}function PH(e,t=DH(e)){let n=e.instrumentation;return n==null?KH(e,t):Xz(n,`store.getVisibleTreeProjection`,()=>KH(e,t))}function FH(e){return GH(PH(e))}function IH(e,t){let n=MV(e,t);if(n==null||n===e.snapshot.rootId||Hz(FV(e,n))&&bV(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=FV(e,i).parentId,n=PV(e,t),s=Ez(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=Mz(a,n,s),t!==o){let n=FV(e,t),a=yV(e,t);if(!zB(e,t,n)&&a!==i)return null;bV(e,t)===t&&(r+=1)}i=t}return r}function LH(e,t){let n=MV(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=FV(e,n);if(!Hz(r))throw Error(`Path is not a directory: "${t}"`);return zB(e,n,r)?null:(BB(e,n,!0,r),kV(e,n),$B({affectedAncestorIds:jV(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function RH(e,t){let n=MV(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=FV(e,n);if(!Hz(r))throw Error(`Path is not a directory: "${t}"`);return zB(e,n,r)?(BB(e,n,!1,r),kV(e,n),eV({affectedAncestorIds:jV(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function zH(e,t){return t<0||t>=DH(e)?null:BH(e,e.snapshot.rootId,t,-1)}function BH(e,t,n,r){let i=PV(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?jz(e.snapshot.nodes,i,n):Xz(a,`store.getVisibleSlice.selectChildIndex`,()=>jz(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return VH(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function VH(e,t,n,r){if(!Hz(FV(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=HH(e,t,r);if(n===0)return i;let a=FV(e,i.terminalNodeId);if(!Hz(a)||!zB(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return BH(e,i.terminalNodeId,n-1,i.visibleDepth)}function HH(e,t,n){return Hz(FV(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:bV(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Xz(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>bV(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function UH(e,t){let n=FV(e,t);if(!Hz(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:yV(e,r)!==t}function WH(e,t){let n=FV(e,t.terminalNodeId);if(Hz(n)){let r=PV(e,t.terminalNodeId);if(zB(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:VH(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=FV(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=PV(e,n),o=Ez(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return VH(e,s,0,i);UH(e,r)&&i--,r=n}}function GH(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function KH(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(TH);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=EH(o,y);let x,S=_;if(Hz(v))S=f?bV(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:OV(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&Hz(C)&&zB(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function qH(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!Hz(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:OV(e,f)};continue}let h=l?bV(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=JH(e,g);let _=i[h];_!=null&&Hz(_)&&zB(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function JH(e,t){let n=FV(e,t.terminalNodeId),r=Hz(n)?YH(e,t):null,i=OV(e,t.terminalNodeId),a=_B(e.snapshot.segmentTable,n.nameId),o=Hz(n)&&PV(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?xV(e,t.headNodeId).map(n=>{let r=FV(e,n);return{isTerminal:n===t.terminalNodeId,name:_B(e.snapshot.segmentTable,r.nameId),nodeId:n,path:OV(e,n)}}):Xz(c,`store.getVisibleSlice.flatten.collectSegments`,()=>xV(e,t.headNodeId).map(n=>{let r=FV(e,n);return{isTerminal:n===t.terminalNodeId,name:_B(e.snapshot.segmentTable,r.nameId),nodeId:n,path:OV(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Hz(n)&&zB(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Hz(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function YH(e,t){if(t.headNodeId===t.terminalNodeId)return HB(e,t.terminalNodeId);let n=xV(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=HB(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function XH(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!Hz(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&Nz(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Hz(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,Nz(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function ZH(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var QH=class e{#e;constructor(e={}){let t=Yz(e),n=Xz(t,`store.builder.create`,()=>new PB(e));if(e.preparedInput!=null){let t=jB(e.preparedInput);t==null?n.appendPreparedPaths(AB(e.preparedInput),!1):n.appendPresortedPaths(t,MB(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Xz(t,`store.preparePathEntries`,()=>NB(r,e)))}let r=Xz(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Xz(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Xz(t,`store.state.create`,()=>FB(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Xz(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||ZH(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Xz(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?Xz(t,`store.state.initializeOpenVisibleCounts`,()=>XH(this.#e)):Xz(t,`store.state.recomputeCounts`,()=>AV(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return DB(e,t)}static prepareInput(e,t={}){return OB(e,t)}static preparePresortedInput(e){return kB(e)}list(e){return Xz(this.#e.instrumentation,`store.list`,()=>SV(this.#e,e))}add(e){Xz(this.#e.instrumentation,`store.add`,()=>{let t=DH(this.#e);lV(this.#e,sV(this.#e,t,CV(this.#e,e)))})}remove(e,t={}){Xz(this.#e.instrumentation,`store.remove`,()=>{let n=DH(this.#e);lV(this.#e,sV(this.#e,n,wV(this.#e,e,t)))})}move(e,t,n={}){Xz(this.#e.instrumentation,`store.move`,()=>{let r=DH(this.#e),i=TV(this.#e,e,t,n);i!=null&&lV(this.#e,sV(this.#e,r,i))})}batch(e){cV(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return Xz(this.#e.instrumentation,`store.getVisibleCount`,()=>DH(this.#e))}getVisibleSlice(e,t){return Xz(this.#e.instrumentation,`store.getVisibleSlice`,()=>NH(this.#e,e,t))}getVisibleRowContext(e){return Xz(this.#e.instrumentation,`store.getVisibleRowContext`,()=>MH(this.#e,e))}getVisibleTreeProjection(){return FH(this.#e)}getVisibleTreeProjectionData(e){return PH(this.#e,e)}getVisibleIndex(e){return Xz(this.#e.instrumentation,`store.getVisibleIndex`,()=>IH(this.#e,e))}getPathInfo(e){return Xz(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=MV(this.#e,e);if(t==null)return null;let n=FV(this.#e,t);return{depth:Bz(n),kind:Hz(n)?`directory`:`file`,path:OV(this.#e,t)}})}isExpanded(e){return Xz(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=FV(this.#e,t);return zB(this.#e,t,n)})}expand(e){Xz(this.#e.instrumentation,`store.expand`,()=>{let t=DH(this.#e),n=LH(this.#e,e);n!=null&&lV(this.#e,sV(this.#e,t,n))})}collapse(e){Xz(this.#e.instrumentation,`store.collapse`,()=>{let t=DH(this.#e),n=RH(this.#e,e);n!=null&&lV(this.#e,sV(this.#e,t,n))})}on(e,t){return YB(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return HB(this.#e,t)}markDirectoryUnloaded(e){Xz(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(PV(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=DH(this.#e);WB(this.#e,t),lV(this.#e,sV(this.#e,n,tV({affectedAncestorIds:jV(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Xz(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=DH(this.#e),r=UB(this.#e,t);return lV(this.#e,sV(this.#e,n,nV({affectedAncestorIds:jV(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Xz(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||HB(this.#e,n)!==`loading`||!KB(this.#e,n,e.attemptId))return!1;let r=OV(this.#e,n);this.validateChildPatch(r,t);let i=DH(this.#e),a=[];for(let e of t.operations){$H(r,e);let t=DH(this.#e);switch(e.type){case`add`:a.push(sV(this.#e,t,CV(this.#e,e.path)));break;case`remove`:a.push(sV(this.#e,t,wV(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=TV(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(sV(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return lV(this.#e,sV(this.#e,i,rV({affectedAncestorIds:jV(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:OV(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Xz(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=DH(this.#e),r=GB(this.#e,t,e.attemptId);return lV(this.#e,sV(this.#e,n,iV({affectedAncestorIds:jV(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:OV(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Xz(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=DH(this.#e),i=qB(this.#e,n,e.attemptId,t);return lV(this.#e,sV(this.#e,r,aV({affectedAncestorIds:jV(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:OV(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Xz(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(CH(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=DH(this.#e),n=wH(this.#e,e.mode??`stable`);return lV(this.#e,sV(this.#e,t,oV({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=PV(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??eB(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=nB(lB(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!Hz(FV(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=FV(this.#e,n);zB(this.#e,n,i)||(BB(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=FV(this.#e,e);if(!zB(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=MV(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Hz(FV(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Hz(FV(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=FV(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=FV(this.#e,e),r=yV(this.#e,e);if(!zB(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function $H(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var eU={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function tU(e,t){if(typeof e==`number`)return{itemHeight:t??eU.default.itemHeight,factor:e};let n=eU[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var nU=eU.default.itemHeight,rU=`@layer base, theme, unsafe;
|
|
199
199
|
|
|
200
200
|
@layer base {
|
|
201
201
|
:host {
|
|
@@ -1859,20 +1859,20 @@ Error generating stack: `+e.message+`
|
|
|
1859
1859
|
}
|
|
1860
1860
|
}
|
|
1861
1861
|
}
|
|
1862
|
-
`,
|
|
1862
|
+
`,iU=`@layer base, unsafe;`;function aU(e){return`${iU}
|
|
1863
1863
|
@layer base {
|
|
1864
1864
|
${e}
|
|
1865
|
-
}`}function
|
|
1865
|
+
}`}function oU(e){return`${iU}
|
|
1866
1866
|
@layer unsafe {
|
|
1867
1867
|
${e}
|
|
1868
|
-
}`}var aU=new WeakMap;function oU(e){let t=aU.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute($R,`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(),aU.set(e,i),i}function sU(e,t){if(!e.isConnected)return;let n=oU(t);if(n==null)return;let r=t.querySelector(`style[${ez}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(ez,``),t.appendChild(i)),i.textContent=`:host { ${tz}: ${n}px; }`}var cU;function lU(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){cU??(cU=new CSSStyleSheet,cU.replaceSync(rU(tU)));let t=!1;try{e.adoptedStyleSheets=[cU],t=!0}catch{}if(t){e.querySelector(`style[${ZR}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(ZR,``),t.textContent=rU(tU),e.prepend(t)}}function uU(e,t){dU(e,t),lU(t),sU(e,t)}function dU(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`});uU(this,e)}}if(customElements.define(XR,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(XR)))e instanceof HTMLElement&&uU(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var fU=e=>e.startsWith(`f::`)?e.slice(3):e;function pU(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function mU(e,t){return e===``?t:`${e}/${t}`}function hU({files:e,path:t,isFolder:n,nextBasename:r}){let i=fU(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}=pU(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=mU(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 gU(e){return e.endsWith(`/`)}function _U(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 vU(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 yU(e,t){return t.includes(e)?vU(t):[e]}function bU(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 xU(e,t){return{draggedPaths:e,target:t}}function SU(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(gU(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function CU(e,t){return t.kind===`root`||t.directoryPath==null?_U(e):t.directoryPath}function wU(e,t){let n=e.map(e=>{let n=CU(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 TU(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 EU(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(!TU(XH.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 DU(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function OU(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 kU(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function AU(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 kU(e,t.path)?n?e:null:e;case`move`:return OU(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=AU(r,e,n),r==null)return null;return r}}}function jU(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function MU(e){switch(e.operation){case`add`:return{...jU(e),operation:`add`,path:e.path};case`remove`:return{...jU(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...jU(e),from:e.from,operation:`move`,to:e.to}}}function NU(e){return{...jU(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>MU(e)),operation:`batch`}}function PU(e){switch(e.operation){case`add`:case`remove`:case`move`:return MU(e);case`batch`:return NU(e);default:return null}}function FU(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function IU(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 LU(e){return IU(e).at(-1)??null}function RU(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function zU(e){return e.endsWith(`/`)}var BU=e=>e.toLowerCase();function VU(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function HU(e){return e.endsWith(`/`)?e.slice(0,-1):e}function UU(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var WU=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},GU=Symbol(`FILE_TREE_RENAME_VIEW`),KU=512,qU=512;function JU(e){return e===`top`||e===`center`?e:`nearest`}function YU(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=IU(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 XU(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:YU(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var ZU=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=EU({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=LU(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:JU(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<=qU){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=yU(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=xU(t.draggedPaths,n);(SU(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}bU(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=xU(e.draggedPaths,t);if(SU(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=wU(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=zU(r),a=HU(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of IU(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=VU(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[GU](){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,zU(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,zU(e)?{recursive:!0}:void 0);return}let t=zU(e),n=hU({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:HU(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(UU(n.sourcePath,t),UU(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=EU({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=!FU(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=LU(e),n=RU(e,t),r=null,i=null;for(let e of this.#be()){if(LU(e)!==t)continue;let a=RU(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=IU(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=!FU(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 XH({...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 IU(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(BU),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(BU),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 IU(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:WU(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 IU(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 IU(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=XU(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,KU)),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=AU(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=AU(this.#c,e,!0),r=[...this.#B].map(t=>AU(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=AU(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return FU(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&&DU(e)&&(this.#i=null);let t=DU(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=PU(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},QU=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 $U(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 eW(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 tW(e,t){return t?`${e}/`:e}function nW(e,t=null){let n=QU(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=$U(t.path);if(e==null)continue;let n=tW(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 eW(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var rW,iW,aW,oW,sW,cW,lW,uW,dW,fW,pW={},mW=[],hW=Array.isArray,gW=mW.slice,_W=Object.assign;function vW(e){e&&e.parentNode&&e.remove()}function yW(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?gW.call(arguments,2):n),bW(e,o,r,i,null)}function bW(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??++iW,__i:-1,__u:0};return i==null&&rW.vnode!=null&&rW.vnode(a),a}function xW(e){return e.children}function SW(e,t){this.props=e,this.context=t,this.__g=0}function CW(e,t){if(t==null)return e.__?CW(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`?CW(e):null}function wW(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 wW(e)}}function TW(e){(8&e.__g||!(e.__g|=8)||!aW.push(e)||sW++)&&oW==rW.debounceRendering||((oW=rW.debounceRendering)||queueMicrotask)(EW)}function EW(){for(var e,t,n,r,i,a,o,s,c=1;aW.length;)aW.length>c&&aW.sort(cW),e=aW.shift(),c=aW.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=_W({},r)).__v=r.__v+1,rW.vnode&&rW.vnode(n),PW(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??CW(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,IW(a,n,o),n.__e!=i&&wW(n)));sW=0}function DW(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||mW,b=t.length;for(c=OW(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?pW:y[m.__i]||pW,m.__i=f,_=PW(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&zW(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=kW(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function OW(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?bW(null,o,null,null,null):hW(o)?bW(xW,{children:o},null,null,null):o.constructor==null&&o.__b>0?bW(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=AW(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=CW(s)),BW(s,s));return r}function kW(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=kW(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=CW(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function AW(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 jW(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function MW(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||jW(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||jW(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(lW,`$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=uW,e.addEventListener(t,a?fW:dW,a)):e.removeEventListener(t,a?fW:dW,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 NW(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=uW++;else if(t.u<n.l)return;return n(rW.event?rW.event(t):t)}}}function PW(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=rW.__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 SW(v,x),f.constructor=M,f.render=VW),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=_W({},f.__s)),_W(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=rW.__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=_W({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===xW&&d.key==null&&(E=LW(d.props.children)),s=DW(e,hW(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--;)vW(a[j]);FW(t)}else t.__e=n.__e,t.__k=n.__k,e.then||FW(t);rW.__e(e,t,n)}else s=t.__e=RW(n.__e,t,n,r,i,a,o,c,l,u);return(d=rW.diffed)&&d(t),128&t.__u?void 0:s}function FW(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(FW)}function IW(e,t,n){for(var r=0;r<n.length;r++)zW(n[r],n[++r],n[++r]);rW.__c&&rW.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){rW.__e(e,t.__v)}})}function LW(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:hW(e)?e.map(LW):_W({},e)}function RW(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&&=(rW.__m&&rW.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=gW.call(e.childNodes),v=n.props||pW,!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;MW(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&&!_||MW(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=``),DW(b==`template`?e.content:e,hW(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&CW(n,0),s,c,l),a!=null)for(u=a.length;u--;)vW(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||MW(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&MW(e,u,g,v[u],i))}return e}function zW(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){rW.__e(e,n)}}function BW(e,t,n){var r,i;if(rW.unmount&&rW.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||zW(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){rW.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&BW(r[i],t,n||typeof e.type!=`function`);n||vW(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function VW(e,t,n){return this.constructor(e,n)}function HW(e,t){var n,r,i,a;t==document&&(t=document.documentElement),rW.__&&rW.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=yW(xW,null,[e]),i=[],a=[],PW(t,e,r||pW,pW,t.namespaceURI,r?null:t.firstChild?gW.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),IW(i,e,a)}function UW(e,t){e.__u|=32,HW(e,t)}rW={__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 sW=0,e}},iW=0,SW.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=_W({},this.state);typeof e==`function`&&(e=e(_W({},n),this.props)),e&&_W(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),TW(this))},SW.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),TW(this))},SW.prototype.render=xW,aW=[],sW=0,cW=function(e,t){return e.__v.__b-t.__v.__b},lW=/(PointerCapture)$|Capture$/i,uW=0,dW=NW(!1),fW=NW(!0);var WW=0;Array.isArray;function GW(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:--WW,__i:-1,__u:0,__source:i,__self:a};return rW.vnode&&rW.vnode(l),l}var KW=16,qW=16,JW={};function YW({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}=JW[e]??{width:KW,height:qW},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return GW(`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:GW(`use`,{href:c})})}var XW=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},ZW=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)]},QW=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)]},$W=(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)]},eG=(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)]},tG=(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 nG({children:e,marker:t,variant:n=`default`}){"use no memo";return GW(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:GW(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?GW(`span`,{"data-truncate-fade":!0}):t})})}function rG(e){"use no memo";let{mode:t,children:n}=e;return GW(`div`,{children:[GW(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?GW(`span`,{children:n}):n}),GW(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?GW(`span`,{children:n}):n})]})}function iG({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=GW(rG,{mode:t,children:e},`content`),o=GW(nG,{marker:n,mode:t,variant:r},`marker`),s=GW(`div`,{"data-truncate-fill":!0},`fill`);return GW(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:GW(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function aG({children:e,...t}){"use no memo";return GW(iG,{mode:`truncate`,...t,children:e})}function oG({children:e,...t}){"use no memo";return GW(iG,{mode:`fruncate`,...t,children:e})}function sG({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=GW(aG,{...s,children:t[0]}),l=GW(oG,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return GW(`div`,{className:a,style:o});if(e.length<i)return GW(n===`end`?oG:aG,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=XW:r===`extension`?t=ZW:r===`leaf-path`&&(t=QW);else if(typeof r==`number`)t=$W,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=eG:e===`first`&&(t=tG)}else typeof r==`function`&&(t=r);t??=XW;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=GW(aG,{...s,..._,children:f}),l=GW(oG,{...s,...v,children:p})}return GW(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[GW(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),GW(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var cG={endIndex:-1,startIndex:-1};function lG(e,t,n){return Math.min(Math.max(e,t),n)}function uG(e,t){return e<0||t<e?cG:{endIndex:t,startIndex:e}}function dG(e){return e.startIndex<0||e.endIndex<e.startIndex}function fG(e,t){return dG(e)?0:(e.endIndex-e.startIndex+1)*t}function pG(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function mG(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function hG(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 gG(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 _G(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 vG(e,t,n){if(e.length===0||t<=0)return[];let r=_G(e),i=hG(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=gG(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 yG(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=lG(t.scrollTop,0,o),c=t.stickyRows??vG(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=pG(s,n,t.itemHeight),m=pG(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?cG:uG(m,mG(u+d,n,t.itemHeight)),y=g+1,b=dG(v)?cG:uG(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=fG(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:dG(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var bG={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},xG={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},SG=`Contains git status items`;function CG(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 wG(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return CG({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 TG(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 EG(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 DG(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 OG(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function kG(e,t){return e!=null&&e>0?e:t}function AG(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 jG(e,t,n,r,i=0){let a=CG({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function MG(e,t,n,r,i,a,o=0){let s=wG({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function NG(e,t,n,r,i,a){let o=TG({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function PG(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function FG(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function IG({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return GW(`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 LG(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 RG(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 zG,BG,VG,HG,UG=Object.is,WG=0,GG=[],KG=rW,qG=KG.__b,JG=KG.__r,YG=KG.diffed,XG=KG.__c,ZG=KG.unmount,QG=KG.__;function $G(e,t){KG.__h&&KG.__h(BG,e,WG||t),WG=0;var n=BG.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function eK(e){return WG=1,tK(pK,e)}function tK(e,t,n){var r=$G(zG++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):pK(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);UG(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=BG,!BG.__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,UG(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};BG.__f=!0;var a=BG.shouldComponentUpdate,o=BG.componentWillUpdate;BG.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)},BG.shouldComponentUpdate=i}return r.__N||r.__}function nK(e,t){var n=$G(zG++,3);!KG.__s&&fK(n.__H,t)&&(n.__=e,n.u=t,BG.__H.__h.push(n))}function rK(e,t){var n=$G(zG++,4);!KG.__s&&fK(n.__H,t)&&(n.__=e,n.u=t,BG.__h.push(n))}function iK(e){return WG=5,aK(function(){return{current:e}},[])}function aK(e,t){var n=$G(zG++,7);return fK(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function oK(e,t){return WG=8,aK(function(){return e},t)}function sK(){for(var e;e=GG.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(uK),e.__H.__h.forEach(dK),e.__H.__h=[]}catch(t){e.__H.__h=[],KG.__e(t,e.__v)}}KG.__b=function(e){BG=null,qG&&qG(e)},KG.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),QG&&QG(e,t)},KG.__r=function(e){JG&&JG(e),zG=0;var t=(BG=e.__c).__H;t&&(VG===BG?(t.__h=[],BG.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(uK),t.__h.forEach(dK),t.__h=[],zG=0)),VG=BG},KG.diffed=function(e){YG&&YG(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(GG.push(t)!==1&&HG===KG.requestAnimationFrame||((HG=KG.requestAnimationFrame)||lK)(sK)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),VG=BG=null},KG.__c=function(e,t){t.some(function(e){try{e.__h.forEach(uK),e.__h=e.__h.filter(function(e){return!e.__||dK(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],KG.__e(n,e.__v)}}),XG&&XG(e,t)},KG.unmount=function(e){ZG&&ZG(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{uK(e)}catch(e){t=e}}),n.__H=void 0,t&&KG.__e(t,n.__v))};var cK=typeof requestAnimationFrame==`function`;function lK(e){var t,n=function(){clearTimeout(r),cK&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);cK&&(t=requestAnimationFrame(n))}function uK(e){var t=BG,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),BG=t}function dK(e){var t=BG;e.__c=e.__(),BG=t}function fK(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!UG(t,e[n])})}function pK(e,t){return typeof t==`function`?t(e):t}function mK(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:GW(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return GW(xW,{children:[GW(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:GW(aG,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function hK(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function gK(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function _K(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 vK({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=yG(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:_K(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?_K(u,1,t,o):i&&r<=0&&c.length>0?vG(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 yK=400,bK=10,xK=40,SK=18;function CK(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))?wK(e,t,n):a instanceof HTMLElement?a:null}function wK(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 TK(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 EK(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 DK(){return navigator.vendor!==`Apple Computer, Inc.`}function OK(e,t){let n=e-t.top;if(n<xK)return-Math.ceil((xK-Math.max(0,n))/xK*SK);let r=t.bottom-e;return r<xK?Math.ceil((xK-Math.max(0,r))/xK*SK):0}function kK(e,t){if(e!=null){let t=bG[e];return t==null?null:{text:t,title:xG[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:SG}:null}function AK(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 jK(e){return e!=null&&`toggle`in e}function MK(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function NK(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function PK(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function FK(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function IK(e,t){return t&&FK(e)||(e.ctrlKey||e.metaKey)&&MK(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var LK=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function RK(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 zK(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 BK(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function VK(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function HK(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function UK(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 WK(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 GK(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 KK(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=GK(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 qK(e,t){return{kind:e.kind,name:gK(e),path:t}}function JK(e){return e==null?void 0:`${e}__tree`}function YK(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function XK(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function ZK(e,t){if(e==null)return null;if(`text`in e)return GW(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?XK(e.icon)?t(e.icon):{name:e.icon}:XK(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return GW(`span`,{title:e.title,children:GW(YW,{...n})})}function QK(e){e!=null&&EG(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function $K(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=hK(e);return GW(xW,{children:[e.depth>0?GW(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>GW(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,GW(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?GW(YW,{...t(`file-tree-icon-chevron`)}):GW(YW,{...t(`file-tree-icon-file`,u)})}),GW(`div`,{"data-item-section":`content`,children:e.isFlattened?mK(e,c,a):c??GW(sG,{minimumLength:5,split:`extension`,children:e.name})}),i?GW(`div`,{"data-item-section":`decoration`,children:r==null?null:ZK(r,t)}):null,s?GW(`div`,{"data-item-section":`git`,children:ZK(o,t)}):null,n?GW(`div`,{"data-item-section":`action`,children:l?GW(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:GW(YW,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function eq(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=hK(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??AK(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=kK(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,ee=K?a.getValue():``,te=R||!K?null:GW(IG,{ref:D,ariaLabel:`Rename ${gK(t)}`,isFlattened:t.isFlattened,value:ee,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),q=$K(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:te,showDecorativeActionAffordance:G}),J={...LG({ariaLabel:gK(t),domId:t.isFocused?YK(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:BK(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?GW(`div`,{...J,children:q}):GW(`button`,{...J,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:q})}function tq(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(hK(e))).map((n,r)=>eq(e,n,t.start+r))}function nq({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=eU,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 _=iK(null),v=iK(null),y=iK(!1),b=iK(null),x=iK(null),S=iK(null),C=iK(null),w=iK(null),T=iK(new Map),E=iK(new Map),D=iK(()=>{}),O=iK(null),k=iK(0),A=iK(!1),j=iK(null);j.current!==t&&(A.current=!1,j.current=t);let M=iK(!1),N=iK(null),P=iK(null),F=iK(!1),I=iK(null),L=iK(null),R=iK(null),z=iK(null),B=iK(null),V=iK(null),H=iK(null),U=iK(null),W=iK(!1),G=iK(null),K=iK(null),ee=iK(null),te=iK(null),q=aK(()=>new Map,[]),[,J]=eK(0),[ne,re]=eK(null),[ie,ae]=eK(null),[oe,se]=eK(null),[ce,le]=eK(null),[ue,de]=eK(0),[fe,pe]=eK(null),me=iK(fe);me.current=fe;let he=iK(null),ge=iK(null),_e=iK(null),ve=iK(null),ye=iK(null),be=iK(!1),xe=()=>{ge.current=null,_e.current=null,ve.current=null},Se=(e,t)=>{ge.current=e,_e.current=null,ve.current=t==null?null:{path:e,scrollTop:t}},Ce=(e,t)=>{ge.current=null,_e.current={path:e,viewportOffset:t},ve.current=null},we=iK(d===`retain`&&t.isSearchOpen()),[Te,Ee]=eK(p);nK(()=>{p||Ee(!1)},[p]);let De=iK(!1),Oe=oK(()=>{De.current=!0,Ee(e=>e&&!1)},[]),[ke,Ae]=eK(()=>vK({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[je,Me]=eK(!1);nK(()=>{Me(!0)},[]);let Ne=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Pe=e?.contextMenu?.triggerMode??(Ne?`right-click`:`both`),Fe=Pe===`both`||Pe===`button`,Ie=e?.contextMenu?.buttonVisibility??`when-needed`,Le=Pe===`both`||Pe===`right-click`;rK(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ye.current=t,ae(t),le(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(be.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 Re=oK((e,t)=>{HK(T.current,e,t)},[]),ze=oK((e,t)=>{HK(E.current,e,t)},[]),Be=oK(e=>{x.current=e},[]),Ve=oK(e=>UK(e,E.current,T.current),[]),He=n!=null||r!=null||i!=null,{resolveIcon:Ue}=aK(()=>dz(a),[a]),We=t[GU](),Ge=We.getPath(),Ke=Ge!=null,qe=t.isSearchOpen(),Je=t.getSearchValue(),Ye=t.getFocusedPath(),Xe=t.getFocusedIndex(),Ze=t.getScrollRequest(),Qe=t.isDragAndDropEnabled(),$e=t.getDragSession(),et=aK(()=>$e==null?null:new Set($e.draggedPaths),[$e]),tt=$e?.target??null,nt=$e?.primaryPath??null,rt=JK(o),{overlayHeight:it,overlayRows:at,snapshot:ot,visibleRows:st}=ke,ct=ot.physical.viewportHeight,lt=aK(()=>({end:ot.window.endIndex,start:ot.window.startIndex}),[ot.window.endIndex,ot.window.startIndex]),ut=at,dt=ot.sticky.rows,ft=ot.physical.totalHeight,pt=ot.sticky.height,mt=aK(()=>new Set(dt.map(e=>hK(e.row))),[dt]),ht=Xe>=0&&Xe>=lt.start&&Xe<=lt.end,gt=oK((e,t)=>u?.({item:qK(e,t),row:e})??null,[u]),_t=oK(e=>EG(e==null?null:T.current.get(e)??null)?!0:EG(S.current),[]),vt=oK(e=>{_t(t.focusNearestPath(e))},[t,_t]),yt=iK(vt);yt.current=vt;let bt=iK(!0),xt=iK(()=>{}),St=oK((t=!0)=>{let n=me.current;n!=null&&(bt.current=bt.current&&t,pe(null),e?.contextMenu?.onClose?.(),bt.current&&vt(n.path))},[e?.contextMenu,vt]);xt.current=St;let Ct=oK(e=>{let t=e==null?null:VK(S.current,e);se(e=>e===t?e:t)},[]),wt=oK((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Ve(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Se(n,e?.scrollTop??null),M.current=!0,re(e=>e===n?e:n)}i.focus(),Ct(a),bt.current=!0,pe({anchorRect:r?.anchorRect??null,item:qK(e,n),path:n,source:r?.source??`keyboard`})},[t,Ve,Ct]),Tt=oK(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=OG(e,ct);I.current=Xe<0||e==null?null:Math.max(0,Math.min(Xe*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(le(`focus`),J(e=>e+1))}},[t,Xe,s,l,ct]),Et=oK((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=OG(i,ct),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:vK({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,NG(i,a,s,l,u,d),D.current(),he.current=n?e:null,!0},[t,s,c,ct,h]),Dt=()=>y.current===!0||te.current!=null||W.current===!0,Ot=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),kt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},At=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},jt=()=>{V.current?.remove(),V.current=null},Mt=()=>{kt(L.current),L.current=null,B.current=null},Nt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Pt=()=>{U.current?.(),U.current=null,te.current!=null&&(clearTimeout(te.current),te.current=null),W.current=!1,G.current=null,ee.current=null,K.current!=null&&(K.current.setAttribute(`draggable`,`true`),K.current.style.removeProperty(`touch-action`),K.current=null),jt(),At(),Mt(),H.current=null},Ft=(e,n)=>{let r=S.current?.getRootNode(),i=TK(CK(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},It=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){At();return}let r=t.getItem(e.directoryPath),i=jK(r)?r:null;if(i==null||i.isExpanded()){At();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(At(),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))},Lt=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=OK(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()),It(Ft(e.clientX,e.clientY)),L.current=Ot(Lt)},Rt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Ot(Lt)},zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Pt(),jt(),At(),Mt(),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),DK())){let t=EK(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Nt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Bt=()=>{jt(),At(),Mt(),H.current=null,t.cancelDrag()},Vt=(e,n,r)=>{if(te.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ee.current={clientX:i.clientX,clientY:i.clientY},K.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;te.current!=null&&(clearTimeout(te.current),te.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),ee.current=null)},s=e=>{let t=e.touches[0],n=ee.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=bK*bK||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,te.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),ee.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=EK(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`}),Nt(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)`),It(Ft(t.clientX,t.clientY)),Rt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Ft(n.clientX,n.clientY),t.completeDrag(),Pt()},u=()=>{t.cancelDrag(),Pt()};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)},yK)},Ht=e=>{if(fe!=null){if(e.key===`Escape`){St(),e.preventDefault(),e.stopPropagation();return}LK.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(We.isActive()){if(e.key===`Escape`)We.cancel();else if(e.key===`Enter`)We.commit();else return;le(`focus`),J(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Tt(Ye??void 0),e.preventDefault(),e.stopPropagation();return}if(qe){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=OG(n,ct);I.current=Xe<0||n==null?null:Math.max(0,Math.min(Xe*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;le(`focus`),J(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&NK(e)){t.openSearch(e.key),J(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ne&&FK(e),r=IK(e,Ne),i=r&&S.current!=null?DG(S.current):null,a=r?new Set(WK(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Ye&&a.has(o)){let e=C.current;Se(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=jK(p)?p:null,h=u!=null&&(mt.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=UK(u,E.current,T.current);e==null||n==null?y=!1:wt(e,u)}else if((e.ctrlKey||e.metaKey)&&MK(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;le(`focus`);let b=t.getFocusedPath(),x=b!=null&&(mt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Se(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)?(Ce(b,KK(S.current,v,i,u,s,pt,ct)),M.current=!0,re(e=>e===b?e:b)):xe()}J(e=>e+1),e.preventDefault(),e.stopPropagation()};rK(()=>{if(!(!f||!qe)){if(we.current){we.current=!1;return}EG(w.current)}},[qe,f]),rK(()=>{let e=x.current;switch(FG({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ge})){case`reset`:P.current=null;return;case`reveal-canonical`:Ge!=null&&Et(Ge,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(he.current=null,P.current=Ge,EG(e),e.select());return}},[lt.end,lt.start,Ge,Et,mt]),rK(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=DG(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,DG(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)}},[]),rK(()=>{let e=S.current;e!=null&&(ot.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[ot.physical.scrollTop]),rK(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=OG(n,g);let a=()=>{let e=t.getVisibleCount(),r=kG(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ae(vK({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=kG(O.current,g),i=t.getVisibleRows(e,e)[0]??null;jG(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?J(e=>e+1):o=!0,a()}),u=()=>{be.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,de(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||be.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),me.current!=null&&y.current&&xt.current(),be.current===!0){y.current=!1;return}ae(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:AG(e[0]))??OG(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]),rK(()=>{Ne||fe==null||St(!1)},[St,Ne,fe]);let Ut=aK(()=>fe==null?null:`${fe.path}::${fe.source}`,[fe]);rK(()=>{if(Ut==null){m?.clearSlotContent(rz);return}let t=me.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??zK(n.getBoundingClientRect()),close:e=>{xt.current(e?.restoreFocus??!0)},restoreFocus:()=>{bt.current&&yt.current(me.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(rz,i),e?.contextMenu?.onOpen?.(t.item,r),QK(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&QK(i)}),()=>{m?.clearSlotContent(rz)}},[Ut,e?.contextMenu,m]),rK(()=>{fe!=null&&t.getItem(fe.path)==null&&St()},[St,fe,t]),rK(()=>{if(fe==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(RK(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&St())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),St())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[St,fe]),rK(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Ye;return}let r=Ye==null?null:T.current.get(Ye)??null,i=DG(n),a=i?.dataset.itemPath??null,o=Ke&&x.current===i,c=f&&w.current===i,l=F.current&&!qe,u=I.current??0,d=he.current,p=ge.current,m=_e.current,g=ve.current,_=i!=null,v=M.current||_,y=N.current!==Ye,b=p!=null&&p===Ye&&Ye!=null,E=!1,O=!1;if(Ze!=null&&Ze.id!==k.current){k.current=Ze.id;let n=Ze.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,ct-s))):pt;E=!0,O=MG(e,n,s,ct,ft,Ze.offset,t)}t.clearScrollRequest(Ze.id)}let A=!E&&l&&NG(e,Xe,s,ct,ft,u),j=!E&&d!=null&&d===Ye&&NG(e,Xe,s,ct,ft,pt),P=!E&&m!=null&&m.path===Ye&&NG(e,Xe,s,ct,ft,m.viewportOffset),L=!E&&g!=null&&g.path===Ye&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Ye&&!b&&jG(e,Xe,s,ct,pt))&&D.current(),E){N.current=Ye;return}if(!v){N.current=Ye;return}if(o){N.current=Ye;return}if(c&&!l){N.current=Ye;return}if(r==null){l&&Xe>=0&&(NG(e,Xe,s,ct,ft,u),D.current()),N.current=Ye;return}(y||l||d===Ye||p===Ye||m?.path===Ye||g?.path===Ye||a==null||a!==Ye)&&(EG(r),d===Ye&&(he.current=null),p===Ye&&(ge.current=null),m?.path===Ye&&(_e.current=null),g?.path===Ye&&(ve.current=null),F.current=!1,I.current=null),N.current=Ye},[t,Xe,Ye,ht,s,Ke,qe,lt,ct,f,Ze,h,pt,ft,st]);let Wt=Xe>=0&&Xe>=ot.visible.startIndex&&Xe<=ot.visible.endIndex,Gt=Ye!=null&&ut.some(e=>hK(e.row)===Ye),Kt=Wt||Gt,qt=Fe&&M.current===!0&&Kt?Ye:null,Jt=ce===`pointer`?ie:null,Yt=fe?.path??ye.current??Jt??qt??ie,Xt=fe?.source===`right-click`;rK(()=>{y.current&&fe==null||Ct(Ve(Yt))},[fe,Ve,lt,ct,ue,ut,Yt,Ct,st]);let Zt=oK(e=>{if(y.current||RK(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&&le(e=>e===`pointer`?e:`pointer`),ae(e=>e===i?e:i)},[]),Qt=oK(()=>{ae(null)},[]);rK(()=>{if(!Qe)return;let e=()=>{Pt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Pt(),t.cancelDrag()}},[t,Qe]);let $t=e=>{if(!Qe||t.getDragSession()==null||W.current)return;let n=TK(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),It(t.getDragSession()?.target??null),Rt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},en=e=>{if(!Qe||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(At(),Mt(),t.setDragTarget(null))},tn=e=>{!Qe||t.getDragSession()==null||W.current||(e.preventDefault(),Ft(e.clientX,e.clientY),t.completeDrag(),jt(),At(),Mt(),H.current=null)},nn=ot.window.height,rn=ot.window.offsetTop,Y=Math.min(0,ct-nn),an=Math.min(0,ct-nn-pt),on=ne===Ye||F.current,sn=Ye!=null&&on&&!ht&&Xe>=0?st[Xe]??t.getVisibleRows(Xe,Xe)[0]??null:null,cn=sn==null?null:PG(Xe,s,lt,nn),ln=H.current,un=nt!=null&&ln!=null&&ln.path===nt&&ln.index>=lt.start&&ln.index<=lt.end,dn=nt!=null&&ln!=null&&ln.path===nt&&!un&&ln.path!==sn?.path?ln:null,fn=dn==null?null:PG(dn.index,s,lt,nn),pn=PK((Xe>=0?st[Xe]??t.getVisibleRows(Xe,Xe)[0]??null:null)?.ancestorPaths.at(-1)??null),mn=qe&&Ye!=null?YK(o,Ye,!ht):void 0,hn=fe?.path??(qe?Ye:ne),gn=fe?.path??ie,_n=Ve(Yt),vn=Ne&&Fe&&!Xt&&!Ke&&_n!=null&&oe!=null&&Yt!=null,yn=Ne&&(vn||fe!=null),bn=fe?.anchorRect,xn=bn==null&&_n!=null&&oe!=null&&(fe!=null||vn)?oe:null,Sn=bn==null?xn==null?void 0:{top:`${xn}px`}:{left:`${bn.left}px`,position:`fixed`,right:`auto`,top:`${bn.top}px`},Cn=Xt?{opacity:`0`}:void 0,wn=oK((e,n,r,i)=>{let a=RG({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:qe,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>=ot.visible.startIndex&&n.index<=ot.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),le(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Et(c,{targetOffset:`sticky-parents`})},[t,qe,ot.visible.endIndex,ot.visible.startIndex,Et]),Tn=()=>{if(y.current||!Fe||Yt==null||_n==null)return;let e=t.getItem(Yt);e!=null&&(Ct(_n),bt.current=!0,pe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:_n.getAttribute(`aria-label`)??Yt,path:e.getPath()},path:e.getPath(),source:`button`}))},En={contextHoverPath:gn,contextMenuButtonTriggerEnabled:Fe,contextMenuButtonVisibility:Ie,contextMenuEnabled:Ne,contextMenuRightClickEnabled:Le,contextMenuTriggerMode:Pe,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Qe,draggedPathSet:et,dragTarget:tt,gitLaneActive:He,gitStatusByPath:n,handleRowDragEnd:Bt,handleRowDragStart:zt,handleRowTouchStart:Vt,ignoredGitDirectories:r,ignoredInheritanceCache:q,instanceId:o,itemHeight:s,onKeyDown:Ht,onRowClick:wn,openContextMenuForRow:wt,registerButton:Re,registerRenameInput:Be,renameView:We,renderDecorationForRow:gt,resolveIcon:Ue,shouldSuppressContextMenu:Dt,visualFocusPath:hn},Dn={...En,registerButton:ze};return GW(`div`,{ref:S,id:rt,"data-file-tree-context-menu-button-visibility":Ne&&Fe?Ie:void 0,"data-file-tree-context-menu-trigger-mode":Ne?Pe:void 0,"data-file-tree-has-context-menu-action-lane":Ne&&Fe?`true`:void 0,"data-file-tree-has-git-lane":He?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":tt?.kind===`root`?`true`:void 0,onDragLeave:Qe?en:void 0,onDragOver:Qe?$t:void 0,onDrop:Qe?tn:void 0,onKeyDown:Ht,onPointerLeave:Ne?Qt:void 0,onPointerOver:Ne?Zt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[GW(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:pn}}),GW(`slot`,{name:nz,"data-type":`header-slot`}),f?GW(`div`,{"data-file-tree-search-container":!0,"data-open":qe?`true`:`false`,children:GW(`input`,{ref:w,"aria-activedescendant":mn,"aria-controls":rt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Te?`true`:void 0,value:Je,onBlur:()=>{d===`retain`&&!De.current||t.closeSearch()},onFocus:Oe,onPointerDown:Oe,onInput:e=>{Oe();let n=e.currentTarget;t.setSearch(n.value)}})}):null,GW(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&je&&ut.length>0?GW(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:GW(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${it}px`},children:ut.map((e,t)=>eq(Dn,e.row,`sticky:${hK(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ut.length-t}`}}))})}):null,GW(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ft}px`},children:[GW(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${rn}px`}}),GW(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${nn}px`,top:`${Y}px`,bottom:`${an}px`},children:[tq(En,lt,mt),sn!=null&&cn!=null?eq(En,sn,`parked:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:nt===sn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${cn}px`}}):null,dn!=null&&fn!=null?eq(En,dn,`parked-drag:${dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${fn}px`}}):null]})]})]}),Ne?GW(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":yn?`true`:`false`,style:Sn,children:[GW(`button`,{ref:v,type:`button`,"data-type":iz,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":fe==null?`false`:`true`,"data-visible":vn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),fe!=null){St();return}Tn()},tabIndex:-1,style:Cn,children:GW(YW,{...Ue(`file-tree-icon-ellipsis`)})}),fe==null?null:GW(`slot`,{name:rz})]}):null,fe==null?null:GW(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),St()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),St()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var rq={hydrateRoot:(e,t)=>{UW(yW(nq,t),e)},renderRoot:(e,t)=>{HW(yW(nq,t),e)},unmountRoot:e=>{HW(null,e)}};function iq(e,t){rq.renderRoot(e,t)}function aq(e,t){rq.hydrateRoot(e,t)}function oq(e){rq.unmountRoot(e)}var sq=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)}}},cq=`__c`,lq=`__k`,uq=`__d`,dq=`__s`,fq=/[\s\n\\/='"\0<>]/,pq=/^(xlink|xmlns|xml)([A-Z])/,mq=/^(?: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])/,hq=/^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/,gq=new Set([`draggable`,`spellcheck`]);function _q(e){e.__g===void 0?e[uq]=!0:e.__g|=8}function vq(e){e.__g===void 0?e[uq]=!1:e.__g&=-9}function yq(e){return e.__g===void 0?!0===e[uq]:!!(8&e.__g)}var bq=/["&<]/;function xq(e){if(e.length===0||!1===bq.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 Sq={},Cq=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(`.`)),wq=/[A-Z]/g;function Tq(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:Sq[n]||(Sq[n]=n.replace(wq,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||Cq.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function Eq(){this.__d=!0}function Dq(e,t){return{__v:e,context:t,props:e.props,setState:Eq,forceUpdate:Eq,__d:!0,__h:[]}}function Oq(e,t,n){if(!e.s){if(n instanceof kq){if(!n.s)return void(n.o=Oq.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Oq.bind(null,e,t),Oq.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var kq=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{Oq(r,1,a(this.v))}catch(e){Oq(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?Oq(r,1,t?t(i):i):n?Oq(r,1,n(i)):Oq(r,2,i)}catch(e){Oq(r,2,e)}},r},e}(),Aq,jq,Mq,Nq,Pq={},Fq=Array.isArray,Iq=Object.assign,Lq=``,Rq=`<!--$s-->`,zq=`<!--/$s-->`;function Bq(e,t){var n,r=e.type,i=!0;return e[cq]?(i=!1,(n=e[cq]).state=n[dq]):n=new r(e.props,t),e[cq]=n,n.__v=e,n.props=e.props,n.context=t,_q(n),n.state??=Pq,n[dq]??(n[dq]=n.state),r.getDerivedStateFromProps?n.state=Iq({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[dq]===n.state?n.state:n[dq]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),Mq&&Mq(e),n.render(n.props,n.state,t)}function Vq(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===Lq)return Lq;var s=typeof e;if(s!=`object`)return s==`function`?Lq:s==`string`?xq(e):e+Lq;if(Fq(e)){var c,l=Lq;i[lq]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=Vq(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=Lq,Fq(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return Lq;e.__=i,Aq&&Aq(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===xW){if(`tpl`in g){for(var x=Lq,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&&!Fq(C)?x+=C:x+=Vq(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+xq(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=Bq(e,b),y=e[cq];else{e[cq]=y=Dq(e,b);for(var E=0;yq(y)&&E++<25;){vq(y),Mq&&Mq(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}_q(y)}if(y.getChildContext!=null&&(t=Iq({},t,y.getChildContext())),T&&rW.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===xW&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return Vq(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[dq]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,Pq),yq(y)?(v=Bq(e,t),(y=e[cq]).getChildContext!=null&&(t=Iq({},t,y.getChildContext())),Vq(v=v!=null&&v.type===xW&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):Lq}finally{jq&&jq(e),Nq&&Nq(e)}}}v=v!=null&&v.type===xW&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=Vq(v,t,n,r,e,a,o);return jq&&jq(e),rW.unmount&&rW.unmount(e),e._suspended?typeof D==`string`?Rq+D+zq:Fq(D)?(D.unshift(Rq),D.push(zq),D):D.then(function(e){return Rq+e+zq}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return Vq(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=rW.__e;return k&&k(i,e),Lq}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=Vq(v,t,n,r,e,a,o);return e._suspended?Rq+s+zq:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=Lq;for(var N in g){var P=g[N];if(typeof(P=Uq(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=Tq(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(pq.test(N))N=N.replace(pq,`$1:$2`).toLowerCase();else{if(fq.test(N))continue;N[4]!==`-`&&!gq.has(N)||P==null?n?hq.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):mq.test(N)&&(N=N.toLowerCase()):P+=Lq}}P!=null&&!1!==P&&(j=!0===P||P===Lq?j+` `+N:j+` `+N+`="`+(typeof P==`string`?xq(P):P+Lq)+`"`)}}if(fq.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=xq(A):A!=null&&!1!==A&&!0!==A&&(M=Vq(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),jq&&jq(e),Nq&&Nq(e),!M&&Hq.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return Fq(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var Hq=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Uq(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var Wq=0;function Gq(e){return e!=null&&e.length>0?e:(Wq+=1,`pst_ft_${Wq}`)}function Kq({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??eU)}function qq(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 Jq(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 Yq(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Xq=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new sq;#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=Gq(a),this.#p=nW(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=$H(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new ZU({...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&&(oq(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(),iq(t.wrapper,this.#w()))}setGitStatus(e){this.#p=nW(e,this.#p);let t=this.#T();t!=null&&iq(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),iq(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),aq(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),iq(r,this.#w())}#C(){return{initialViewportHeight:Kq({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(nz,e());return}this.#l.setSlotHtml(nz,this.#e?.header?.html??null)}#k(e){let t=Yq(e).find(e=>Jq(e)),n=qq(KR(oz(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Yq(e),n=t.find(e=>Jq(e)),r=t.filter(e=>e!==n),i=oz(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=qq(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=oz(this.#m);t.colored&&JR(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${QR}]`);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(QR,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=iU(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 uU(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)}},Zq=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function Qq(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:nz,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:rz,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function $q(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 eJ(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 tJ(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 nJ({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)(()=>tJ(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),Zq(()=>{n.setComposition(g)},[g,n]),Zq(()=>{if(c!=null)return r!=null&&eJ(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=$q(Qq(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)(XR,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function rJ(e){let[t]=(0,Q.useState)(()=>new Xq(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 iJ={density:`compact`,itemHeight:26,flattenEmptyDirectories:!1},aJ={"--trees-level-gap-override":`4px`,"--trees-item-row-gap-override":`4px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`${iJ.itemHeight}px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},oJ=`
|
|
1868
|
+
}`}var sU=new WeakMap;function cU(e){let t=sU.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(tz,`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(),sU.set(e,i),i}function lU(e,t){if(!e.isConnected)return;let n=cU(t);if(n==null)return;let r=t.querySelector(`style[${nz}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(nz,``),t.appendChild(i)),i.textContent=`:host { ${rz}: ${n}px; }`}var uU;function dU(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){uU??(uU=new CSSStyleSheet,uU.replaceSync(aU(rU)));let t=!1;try{e.adoptedStyleSheets=[uU],t=!0}catch{}if(t){e.querySelector(`style[${$R}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute($R,``),t.textContent=aU(rU),e.prepend(t)}}function fU(e,t){pU(e,t),dU(t),lU(e,t)}function pU(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`});fU(this,e)}}if(customElements.define(QR,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(QR)))e instanceof HTMLElement&&fU(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var mU=e=>e.startsWith(`f::`)?e.slice(3):e;function hU(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function gU(e,t){return e===``?t:`${e}/${t}`}function _U({files:e,path:t,isFolder:n,nextBasename:r}){let i=mU(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}=hU(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=gU(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 vU(e){return e.endsWith(`/`)}function yU(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 bU(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 xU(e,t){return t.includes(e)?bU(t):[e]}function SU(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 CU(e,t){return{draggedPaths:e,target:t}}function wU(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(vU(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function TU(e,t){return t.kind===`root`||t.directoryPath==null?yU(e):t.directoryPath}function EU(e,t){let n=e.map(e=>{let n=TU(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 DU(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 OU(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(!DU(QH.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 kU(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function AU(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 jU(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function MU(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 jU(e,t.path)?n?e:null:e;case`move`:return AU(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=MU(r,e,n),r==null)return null;return r}}}function NU(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function PU(e){switch(e.operation){case`add`:return{...NU(e),operation:`add`,path:e.path};case`remove`:return{...NU(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...NU(e),from:e.from,operation:`move`,to:e.to}}}function FU(e){return{...NU(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>PU(e)),operation:`batch`}}function IU(e){switch(e.operation){case`add`:case`remove`:case`move`:return PU(e);case`batch`:return FU(e);default:return null}}function LU(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function RU(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 zU(e){return RU(e).at(-1)??null}function BU(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function VU(e){return e.endsWith(`/`)}var HU=e=>e.toLowerCase();function UU(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function WU(e){return e.endsWith(`/`)?e.slice(0,-1):e}function GU(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var KU=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},qU=Symbol(`FILE_TREE_RENAME_VIEW`),JU=512,YU=512;function XU(e){return e===`top`||e===`center`?e:`nearest`}function ZU(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=RU(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 QU(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:ZU(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var $U=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=OU({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=zU(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:XU(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<=YU){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=xU(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=CU(t.draggedPaths,n);(wU(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}SU(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=CU(e.draggedPaths,t);if(wU(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=EU(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=VU(r),a=WU(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of RU(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=UU(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[qU](){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,VU(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,VU(e)?{recursive:!0}:void 0);return}let t=VU(e),n=_U({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:WU(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(GU(n.sourcePath,t),GU(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=OU({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=!LU(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=zU(e),n=BU(e,t),r=null,i=null;for(let e of this.#be()){if(zU(e)!==t)continue;let a=BU(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=RU(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=!LU(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 QH({...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 RU(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(HU),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(HU),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 RU(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:KU(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 RU(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 RU(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=QU(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,JU)),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=MU(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=MU(this.#c,e,!0),r=[...this.#B].map(t=>MU(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=MU(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return LU(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&&kU(e)&&(this.#i=null);let t=kU(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=IU(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},eW=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 tW(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 nW(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 rW(e,t){return t?`${e}/`:e}function iW(e,t=null){let n=eW(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=tW(t.path);if(e==null)continue;let n=rW(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 nW(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var aW,oW,sW,cW,lW,uW,dW,fW,pW,mW,hW={},gW=[],_W=Array.isArray,vW=gW.slice,yW=Object.assign;function bW(e){e&&e.parentNode&&e.remove()}function xW(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?vW.call(arguments,2):n),SW(e,o,r,i,null)}function SW(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??++oW,__i:-1,__u:0};return i==null&&aW.vnode!=null&&aW.vnode(a),a}function CW(e){return e.children}function wW(e,t){this.props=e,this.context=t,this.__g=0}function TW(e,t){if(t==null)return e.__?TW(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`?TW(e):null}function EW(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 EW(e)}}function DW(e){(8&e.__g||!(e.__g|=8)||!sW.push(e)||lW++)&&cW==aW.debounceRendering||((cW=aW.debounceRendering)||queueMicrotask)(OW)}function OW(){for(var e,t,n,r,i,a,o,s,c=1;sW.length;)sW.length>c&&sW.sort(uW),e=sW.shift(),c=sW.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=yW({},r)).__v=r.__v+1,aW.vnode&&aW.vnode(n),IW(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??TW(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,RW(a,n,o),n.__e!=i&&EW(n)));lW=0}function kW(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||gW,b=t.length;for(c=AW(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?hW:y[m.__i]||hW,m.__i=f,_=IW(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&VW(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=jW(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function AW(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?SW(null,o,null,null,null):_W(o)?SW(CW,{children:o},null,null,null):o.constructor==null&&o.__b>0?SW(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=MW(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=TW(s)),HW(s,s));return r}function jW(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=jW(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=TW(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function MW(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 NW(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function PW(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||NW(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||NW(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(dW,`$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=fW,e.addEventListener(t,a?mW:pW,a)):e.removeEventListener(t,a?mW:pW,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 FW(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=fW++;else if(t.u<n.l)return;return n(aW.event?aW.event(t):t)}}}function IW(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=aW.__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 wW(v,x),f.constructor=M,f.render=UW),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=yW({},f.__s)),yW(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=aW.__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=yW({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===CW&&d.key==null&&(E=zW(d.props.children)),s=kW(e,_W(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--;)bW(a[j]);LW(t)}else t.__e=n.__e,t.__k=n.__k,e.then||LW(t);aW.__e(e,t,n)}else s=t.__e=BW(n.__e,t,n,r,i,a,o,c,l,u);return(d=aW.diffed)&&d(t),128&t.__u?void 0:s}function LW(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(LW)}function RW(e,t,n){for(var r=0;r<n.length;r++)VW(n[r],n[++r],n[++r]);aW.__c&&aW.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){aW.__e(e,t.__v)}})}function zW(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:_W(e)?e.map(zW):yW({},e)}function BW(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&&=(aW.__m&&aW.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=vW.call(e.childNodes),v=n.props||hW,!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;PW(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&&!_||PW(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=``),kW(b==`template`?e.content:e,_W(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&TW(n,0),s,c,l),a!=null)for(u=a.length;u--;)bW(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||PW(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&PW(e,u,g,v[u],i))}return e}function VW(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){aW.__e(e,n)}}function HW(e,t,n){var r,i;if(aW.unmount&&aW.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||VW(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){aW.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&HW(r[i],t,n||typeof e.type!=`function`);n||bW(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function UW(e,t,n){return this.constructor(e,n)}function WW(e,t){var n,r,i,a;t==document&&(t=document.documentElement),aW.__&&aW.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=xW(CW,null,[e]),i=[],a=[],IW(t,e,r||hW,hW,t.namespaceURI,r?null:t.firstChild?vW.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),RW(i,e,a)}function GW(e,t){e.__u|=32,WW(e,t)}aW={__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 lW=0,e}},oW=0,wW.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=yW({},this.state);typeof e==`function`&&(e=e(yW({},n),this.props)),e&&yW(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),DW(this))},wW.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),DW(this))},wW.prototype.render=CW,sW=[],lW=0,uW=function(e,t){return e.__v.__b-t.__v.__b},dW=/(PointerCapture)$|Capture$/i,fW=0,pW=FW(!1),mW=FW(!0);var KW=0;Array.isArray;function qW(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:--KW,__i:-1,__u:0,__source:i,__self:a};return aW.vnode&&aW.vnode(l),l}var JW=16,YW=16,XW={};function ZW({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}=XW[e]??{width:JW,height:YW},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return qW(`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:qW(`use`,{href:c})})}var QW=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},$W=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)]},eG=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)]},tG=(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)]},nG=(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)]},rG=(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 iG({children:e,marker:t,variant:n=`default`}){"use no memo";return qW(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:qW(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?qW(`span`,{"data-truncate-fade":!0}):t})})}function aG(e){"use no memo";let{mode:t,children:n}=e;return qW(`div`,{children:[qW(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?qW(`span`,{children:n}):n}),qW(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?qW(`span`,{children:n}):n})]})}function oG({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=qW(aG,{mode:t,children:e},`content`),o=qW(iG,{marker:n,mode:t,variant:r},`marker`),s=qW(`div`,{"data-truncate-fill":!0},`fill`);return qW(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:qW(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function sG({children:e,...t}){"use no memo";return qW(oG,{mode:`truncate`,...t,children:e})}function cG({children:e,...t}){"use no memo";return qW(oG,{mode:`fruncate`,...t,children:e})}function lG({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=qW(sG,{...s,children:t[0]}),l=qW(cG,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return qW(`div`,{className:a,style:o});if(e.length<i)return qW(n===`end`?cG:sG,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=QW:r===`extension`?t=$W:r===`leaf-path`&&(t=eG);else if(typeof r==`number`)t=tG,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=nG:e===`first`&&(t=rG)}else typeof r==`function`&&(t=r);t??=QW;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=qW(sG,{...s,..._,children:f}),l=qW(cG,{...s,...v,children:p})}return qW(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[qW(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),qW(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var uG={endIndex:-1,startIndex:-1};function dG(e,t,n){return Math.min(Math.max(e,t),n)}function fG(e,t){return e<0||t<e?uG:{endIndex:t,startIndex:e}}function pG(e){return e.startIndex<0||e.endIndex<e.startIndex}function mG(e,t){return pG(e)?0:(e.endIndex-e.startIndex+1)*t}function hG(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function gG(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function _G(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 vG(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 yG(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 bG(e,t,n){if(e.length===0||t<=0)return[];let r=yG(e),i=_G(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=vG(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 xG(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=dG(t.scrollTop,0,o),c=t.stickyRows??bG(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=hG(s,n,t.itemHeight),m=hG(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?uG:fG(m,gG(u+d,n,t.itemHeight)),y=g+1,b=pG(v)?uG:fG(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=mG(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:pG(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var SG={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},CG={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},wG=`Contains git status items`;function TG(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 EG(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return TG({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 DG(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 OG(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 kG(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 AG(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function jG(e,t){return e!=null&&e>0?e:t}function MG(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 NG(e,t,n,r,i=0){let a=TG({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function PG(e,t,n,r,i,a,o=0){let s=EG({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function FG(e,t,n,r,i,a){let o=DG({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function IG(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function LG(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function RG({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return qW(`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 zG(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 BG(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 VG,HG,UG,WG,GG=Object.is,KG=0,qG=[],JG=aW,YG=JG.__b,XG=JG.__r,ZG=JG.diffed,QG=JG.__c,$G=JG.unmount,eK=JG.__;function tK(e,t){JG.__h&&JG.__h(HG,e,KG||t),KG=0;var n=HG.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function nK(e){return KG=1,rK(hK,e)}function rK(e,t,n){var r=tK(VG++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):hK(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);GG(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=HG,!HG.__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,GG(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};HG.__f=!0;var a=HG.shouldComponentUpdate,o=HG.componentWillUpdate;HG.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)},HG.shouldComponentUpdate=i}return r.__N||r.__}function iK(e,t){var n=tK(VG++,3);!JG.__s&&mK(n.__H,t)&&(n.__=e,n.u=t,HG.__H.__h.push(n))}function aK(e,t){var n=tK(VG++,4);!JG.__s&&mK(n.__H,t)&&(n.__=e,n.u=t,HG.__h.push(n))}function oK(e){return KG=5,sK(function(){return{current:e}},[])}function sK(e,t){var n=tK(VG++,7);return mK(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function cK(e,t){return KG=8,sK(function(){return e},t)}function lK(){for(var e;e=qG.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(fK),e.__H.__h.forEach(pK),e.__H.__h=[]}catch(t){e.__H.__h=[],JG.__e(t,e.__v)}}JG.__b=function(e){HG=null,YG&&YG(e)},JG.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),eK&&eK(e,t)},JG.__r=function(e){XG&&XG(e),VG=0;var t=(HG=e.__c).__H;t&&(UG===HG?(t.__h=[],HG.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(fK),t.__h.forEach(pK),t.__h=[],VG=0)),UG=HG},JG.diffed=function(e){ZG&&ZG(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(qG.push(t)!==1&&WG===JG.requestAnimationFrame||((WG=JG.requestAnimationFrame)||dK)(lK)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),UG=HG=null},JG.__c=function(e,t){t.some(function(e){try{e.__h.forEach(fK),e.__h=e.__h.filter(function(e){return!e.__||pK(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],JG.__e(n,e.__v)}}),QG&&QG(e,t)},JG.unmount=function(e){$G&&$G(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{fK(e)}catch(e){t=e}}),n.__H=void 0,t&&JG.__e(t,n.__v))};var uK=typeof requestAnimationFrame==`function`;function dK(e){var t,n=function(){clearTimeout(r),uK&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);uK&&(t=requestAnimationFrame(n))}function fK(e){var t=HG,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),HG=t}function pK(e){var t=HG;e.__c=e.__(),HG=t}function mK(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!GG(t,e[n])})}function hK(e,t){return typeof t==`function`?t(e):t}function gK(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:qW(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return qW(CW,{children:[qW(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:qW(sG,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function _K(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function vK(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function yK(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 bK({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=xG(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:yK(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?yK(u,1,t,o):i&&r<=0&&c.length>0?bG(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 xK=400,SK=10,CK=40,wK=18;function TK(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))?EK(e,t,n):a instanceof HTMLElement?a:null}function EK(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 DK(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 OK(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 kK(){return navigator.vendor!==`Apple Computer, Inc.`}function AK(e,t){let n=e-t.top;if(n<CK)return-Math.ceil((CK-Math.max(0,n))/CK*wK);let r=t.bottom-e;return r<CK?Math.ceil((CK-Math.max(0,r))/CK*wK):0}function jK(e,t){if(e!=null){let t=SG[e];return t==null?null:{text:t,title:CG[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:wG}:null}function MK(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 NK(e){return e!=null&&`toggle`in e}function PK(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function FK(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function IK(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function LK(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function RK(e,t){return t&&LK(e)||(e.ctrlKey||e.metaKey)&&PK(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var zK=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function BK(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 VK(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 HK(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function UK(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function WK(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function GK(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 KK(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 qK(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 JK(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=qK(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 YK(e,t){return{kind:e.kind,name:vK(e),path:t}}function XK(e){return e==null?void 0:`${e}__tree`}function ZK(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function QK(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function $K(e,t){if(e==null)return null;if(`text`in e)return qW(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?QK(e.icon)?t(e.icon):{name:e.icon}:QK(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return qW(`span`,{title:e.title,children:qW(ZW,{...n})})}function eq(e){e!=null&&OG(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function tq(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=_K(e);return qW(CW,{children:[e.depth>0?qW(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>qW(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,qW(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?qW(ZW,{...t(`file-tree-icon-chevron`)}):qW(ZW,{...t(`file-tree-icon-file`,u)})}),qW(`div`,{"data-item-section":`content`,children:e.isFlattened?gK(e,c,a):c??qW(lG,{minimumLength:5,split:`extension`,children:e.name})}),i?qW(`div`,{"data-item-section":`decoration`,children:r==null?null:$K(r,t)}):null,s?qW(`div`,{"data-item-section":`git`,children:$K(o,t)}):null,n?qW(`div`,{"data-item-section":`action`,children:l?qW(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:qW(ZW,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function nq(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=_K(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??MK(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=jK(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,ee=K?a.getValue():``,te=R||!K?null:qW(RG,{ref:D,ariaLabel:`Rename ${vK(t)}`,isFlattened:t.isFlattened,value:ee,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),q=tq(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:te,showDecorativeActionAffordance:G}),J={...zG({ariaLabel:vK(t),domId:t.isFocused?ZK(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:HK(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?qW(`div`,{...J,children:q}):qW(`button`,{...J,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:q})}function rq(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(_K(e))).map((n,r)=>nq(e,n,t.start+r))}function iq({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=nU,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 _=oK(null),v=oK(null),y=oK(!1),b=oK(null),x=oK(null),S=oK(null),C=oK(null),w=oK(null),T=oK(new Map),E=oK(new Map),D=oK(()=>{}),O=oK(null),k=oK(0),A=oK(!1),j=oK(null);j.current!==t&&(A.current=!1,j.current=t);let M=oK(!1),N=oK(null),P=oK(null),F=oK(!1),I=oK(null),L=oK(null),R=oK(null),z=oK(null),B=oK(null),V=oK(null),H=oK(null),U=oK(null),W=oK(!1),G=oK(null),K=oK(null),ee=oK(null),te=oK(null),q=sK(()=>new Map,[]),[,J]=nK(0),[ne,re]=nK(null),[ie,ae]=nK(null),[oe,se]=nK(null),[ce,le]=nK(null),[ue,de]=nK(0),[fe,pe]=nK(null),me=oK(fe);me.current=fe;let he=oK(null),ge=oK(null),_e=oK(null),ve=oK(null),ye=oK(null),be=oK(!1),xe=()=>{ge.current=null,_e.current=null,ve.current=null},Se=(e,t)=>{ge.current=e,_e.current=null,ve.current=t==null?null:{path:e,scrollTop:t}},Ce=(e,t)=>{ge.current=null,_e.current={path:e,viewportOffset:t},ve.current=null},we=oK(d===`retain`&&t.isSearchOpen()),[Te,Ee]=nK(p);iK(()=>{p||Ee(!1)},[p]);let De=oK(!1),Oe=cK(()=>{De.current=!0,Ee(e=>e&&!1)},[]),[ke,Ae]=nK(()=>bK({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[je,Me]=nK(!1);iK(()=>{Me(!0)},[]);let Ne=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Pe=e?.contextMenu?.triggerMode??(Ne?`right-click`:`both`),Fe=Pe===`both`||Pe===`button`,Ie=e?.contextMenu?.buttonVisibility??`when-needed`,Le=Pe===`both`||Pe===`right-click`;aK(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ye.current=t,ae(t),le(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(be.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 Re=cK((e,t)=>{WK(T.current,e,t)},[]),ze=cK((e,t)=>{WK(E.current,e,t)},[]),Be=cK(e=>{x.current=e},[]),Ve=cK(e=>GK(e,E.current,T.current),[]),He=n!=null||r!=null||i!=null,{resolveIcon:Ue}=sK(()=>pz(a),[a]),We=t[qU](),Ge=We.getPath(),Ke=Ge!=null,qe=t.isSearchOpen(),Je=t.getSearchValue(),Ye=t.getFocusedPath(),Xe=t.getFocusedIndex(),Ze=t.getScrollRequest(),Qe=t.isDragAndDropEnabled(),$e=t.getDragSession(),et=sK(()=>$e==null?null:new Set($e.draggedPaths),[$e]),tt=$e?.target??null,nt=$e?.primaryPath??null,rt=XK(o),{overlayHeight:it,overlayRows:at,snapshot:ot,visibleRows:st}=ke,ct=ot.physical.viewportHeight,lt=sK(()=>({end:ot.window.endIndex,start:ot.window.startIndex}),[ot.window.endIndex,ot.window.startIndex]),ut=at,dt=ot.sticky.rows,ft=ot.physical.totalHeight,pt=ot.sticky.height,mt=sK(()=>new Set(dt.map(e=>_K(e.row))),[dt]),ht=Xe>=0&&Xe>=lt.start&&Xe<=lt.end,gt=cK((e,t)=>u?.({item:YK(e,t),row:e})??null,[u]),_t=cK(e=>OG(e==null?null:T.current.get(e)??null)?!0:OG(S.current),[]),vt=cK(e=>{_t(t.focusNearestPath(e))},[t,_t]),yt=oK(vt);yt.current=vt;let bt=oK(!0),xt=oK(()=>{}),St=cK((t=!0)=>{let n=me.current;n!=null&&(bt.current=bt.current&&t,pe(null),e?.contextMenu?.onClose?.(),bt.current&&vt(n.path))},[e?.contextMenu,vt]);xt.current=St;let Ct=cK(e=>{let t=e==null?null:UK(S.current,e);se(e=>e===t?e:t)},[]),wt=cK((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Ve(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Se(n,e?.scrollTop??null),M.current=!0,re(e=>e===n?e:n)}i.focus(),Ct(a),bt.current=!0,pe({anchorRect:r?.anchorRect??null,item:YK(e,n),path:n,source:r?.source??`keyboard`})},[t,Ve,Ct]),Tt=cK(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=AG(e,ct);I.current=Xe<0||e==null?null:Math.max(0,Math.min(Xe*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(le(`focus`),J(e=>e+1))}},[t,Xe,s,l,ct]),Et=cK((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=AG(i,ct),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:bK({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,FG(i,a,s,l,u,d),D.current(),he.current=n?e:null,!0},[t,s,c,ct,h]),Dt=()=>y.current===!0||te.current!=null||W.current===!0,Ot=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),kt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},At=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},jt=()=>{V.current?.remove(),V.current=null},Mt=()=>{kt(L.current),L.current=null,B.current=null},Nt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Pt=()=>{U.current?.(),U.current=null,te.current!=null&&(clearTimeout(te.current),te.current=null),W.current=!1,G.current=null,ee.current=null,K.current!=null&&(K.current.setAttribute(`draggable`,`true`),K.current.style.removeProperty(`touch-action`),K.current=null),jt(),At(),Mt(),H.current=null},Ft=(e,n)=>{let r=S.current?.getRootNode(),i=DK(TK(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},It=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){At();return}let r=t.getItem(e.directoryPath),i=NK(r)?r:null;if(i==null||i.isExpanded()){At();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(At(),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))},Lt=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=AK(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()),It(Ft(e.clientX,e.clientY)),L.current=Ot(Lt)},Rt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Ot(Lt)},zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Pt(),jt(),At(),Mt(),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),kK())){let t=OK(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Nt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Bt=()=>{jt(),At(),Mt(),H.current=null,t.cancelDrag()},Vt=(e,n,r)=>{if(te.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ee.current={clientX:i.clientX,clientY:i.clientY},K.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;te.current!=null&&(clearTimeout(te.current),te.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),ee.current=null)},s=e=>{let t=e.touches[0],n=ee.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=SK*SK||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,te.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),ee.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=OK(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`}),Nt(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)`),It(Ft(t.clientX,t.clientY)),Rt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Ft(n.clientX,n.clientY),t.completeDrag(),Pt()},u=()=>{t.cancelDrag(),Pt()};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)},xK)},Ht=e=>{if(fe!=null){if(e.key===`Escape`){St(),e.preventDefault(),e.stopPropagation();return}zK.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(We.isActive()){if(e.key===`Escape`)We.cancel();else if(e.key===`Enter`)We.commit();else return;le(`focus`),J(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Tt(Ye??void 0),e.preventDefault(),e.stopPropagation();return}if(qe){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=AG(n,ct);I.current=Xe<0||n==null?null:Math.max(0,Math.min(Xe*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;le(`focus`),J(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&FK(e)){t.openSearch(e.key),J(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ne&&LK(e),r=RK(e,Ne),i=r&&S.current!=null?kG(S.current):null,a=r?new Set(KK(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Ye&&a.has(o)){let e=C.current;Se(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=NK(p)?p:null,h=u!=null&&(mt.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=GK(u,E.current,T.current);e==null||n==null?y=!1:wt(e,u)}else if((e.ctrlKey||e.metaKey)&&PK(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;le(`focus`);let b=t.getFocusedPath(),x=b!=null&&(mt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Se(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)?(Ce(b,JK(S.current,v,i,u,s,pt,ct)),M.current=!0,re(e=>e===b?e:b)):xe()}J(e=>e+1),e.preventDefault(),e.stopPropagation()};aK(()=>{if(!(!f||!qe)){if(we.current){we.current=!1;return}OG(w.current)}},[qe,f]),aK(()=>{let e=x.current;switch(LG({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ge})){case`reset`:P.current=null;return;case`reveal-canonical`:Ge!=null&&Et(Ge,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(he.current=null,P.current=Ge,OG(e),e.select());return}},[lt.end,lt.start,Ge,Et,mt]),aK(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=kG(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,kG(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)}},[]),aK(()=>{let e=S.current;e!=null&&(ot.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[ot.physical.scrollTop]),aK(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=AG(n,g);let a=()=>{let e=t.getVisibleCount(),r=jG(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ae(bK({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=jG(O.current,g),i=t.getVisibleRows(e,e)[0]??null;NG(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?J(e=>e+1):o=!0,a()}),u=()=>{be.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,de(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||be.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),me.current!=null&&y.current&&xt.current(),be.current===!0){y.current=!1;return}ae(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:MG(e[0]))??AG(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]),aK(()=>{Ne||fe==null||St(!1)},[St,Ne,fe]);let Ut=sK(()=>fe==null?null:`${fe.path}::${fe.source}`,[fe]);aK(()=>{if(Ut==null){m?.clearSlotContent(az);return}let t=me.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??VK(n.getBoundingClientRect()),close:e=>{xt.current(e?.restoreFocus??!0)},restoreFocus:()=>{bt.current&&yt.current(me.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(az,i),e?.contextMenu?.onOpen?.(t.item,r),eq(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&eq(i)}),()=>{m?.clearSlotContent(az)}},[Ut,e?.contextMenu,m]),aK(()=>{fe!=null&&t.getItem(fe.path)==null&&St()},[St,fe,t]),aK(()=>{if(fe==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(BK(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&St())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),St())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[St,fe]),aK(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Ye;return}let r=Ye==null?null:T.current.get(Ye)??null,i=kG(n),a=i?.dataset.itemPath??null,o=Ke&&x.current===i,c=f&&w.current===i,l=F.current&&!qe,u=I.current??0,d=he.current,p=ge.current,m=_e.current,g=ve.current,_=i!=null,v=M.current||_,y=N.current!==Ye,b=p!=null&&p===Ye&&Ye!=null,E=!1,O=!1;if(Ze!=null&&Ze.id!==k.current){k.current=Ze.id;let n=Ze.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,ct-s))):pt;E=!0,O=PG(e,n,s,ct,ft,Ze.offset,t)}t.clearScrollRequest(Ze.id)}let A=!E&&l&&FG(e,Xe,s,ct,ft,u),j=!E&&d!=null&&d===Ye&&FG(e,Xe,s,ct,ft,pt),P=!E&&m!=null&&m.path===Ye&&FG(e,Xe,s,ct,ft,m.viewportOffset),L=!E&&g!=null&&g.path===Ye&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Ye&&!b&&NG(e,Xe,s,ct,pt))&&D.current(),E){N.current=Ye;return}if(!v){N.current=Ye;return}if(o){N.current=Ye;return}if(c&&!l){N.current=Ye;return}if(r==null){l&&Xe>=0&&(FG(e,Xe,s,ct,ft,u),D.current()),N.current=Ye;return}(y||l||d===Ye||p===Ye||m?.path===Ye||g?.path===Ye||a==null||a!==Ye)&&(OG(r),d===Ye&&(he.current=null),p===Ye&&(ge.current=null),m?.path===Ye&&(_e.current=null),g?.path===Ye&&(ve.current=null),F.current=!1,I.current=null),N.current=Ye},[t,Xe,Ye,ht,s,Ke,qe,lt,ct,f,Ze,h,pt,ft,st]);let Wt=Xe>=0&&Xe>=ot.visible.startIndex&&Xe<=ot.visible.endIndex,Gt=Ye!=null&&ut.some(e=>_K(e.row)===Ye),Kt=Wt||Gt,qt=Fe&&M.current===!0&&Kt?Ye:null,Jt=ce===`pointer`?ie:null,Yt=fe?.path??ye.current??Jt??qt??ie,Xt=fe?.source===`right-click`;aK(()=>{y.current&&fe==null||Ct(Ve(Yt))},[fe,Ve,lt,ct,ue,ut,Yt,Ct,st]);let Zt=cK(e=>{if(y.current||BK(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&&le(e=>e===`pointer`?e:`pointer`),ae(e=>e===i?e:i)},[]),Qt=cK(()=>{ae(null)},[]);aK(()=>{if(!Qe)return;let e=()=>{Pt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Pt(),t.cancelDrag()}},[t,Qe]);let $t=e=>{if(!Qe||t.getDragSession()==null||W.current)return;let n=DK(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),It(t.getDragSession()?.target??null),Rt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},en=e=>{if(!Qe||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(At(),Mt(),t.setDragTarget(null))},tn=e=>{!Qe||t.getDragSession()==null||W.current||(e.preventDefault(),Ft(e.clientX,e.clientY),t.completeDrag(),jt(),At(),Mt(),H.current=null)},nn=ot.window.height,rn=ot.window.offsetTop,Y=Math.min(0,ct-nn),an=Math.min(0,ct-nn-pt),on=ne===Ye||F.current,sn=Ye!=null&&on&&!ht&&Xe>=0?st[Xe]??t.getVisibleRows(Xe,Xe)[0]??null:null,cn=sn==null?null:IG(Xe,s,lt,nn),ln=H.current,un=nt!=null&&ln!=null&&ln.path===nt&&ln.index>=lt.start&&ln.index<=lt.end,dn=nt!=null&&ln!=null&&ln.path===nt&&!un&&ln.path!==sn?.path?ln:null,fn=dn==null?null:IG(dn.index,s,lt,nn),pn=IK((Xe>=0?st[Xe]??t.getVisibleRows(Xe,Xe)[0]??null:null)?.ancestorPaths.at(-1)??null),mn=qe&&Ye!=null?ZK(o,Ye,!ht):void 0,hn=fe?.path??(qe?Ye:ne),gn=fe?.path??ie,_n=Ve(Yt),vn=Ne&&Fe&&!Xt&&!Ke&&_n!=null&&oe!=null&&Yt!=null,yn=Ne&&(vn||fe!=null),bn=fe?.anchorRect,xn=bn==null&&_n!=null&&oe!=null&&(fe!=null||vn)?oe:null,Sn=bn==null?xn==null?void 0:{top:`${xn}px`}:{left:`${bn.left}px`,position:`fixed`,right:`auto`,top:`${bn.top}px`},Cn=Xt?{opacity:`0`}:void 0,wn=cK((e,n,r,i)=>{let a=BG({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:qe,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>=ot.visible.startIndex&&n.index<=ot.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),le(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Et(c,{targetOffset:`sticky-parents`})},[t,qe,ot.visible.endIndex,ot.visible.startIndex,Et]),Tn=()=>{if(y.current||!Fe||Yt==null||_n==null)return;let e=t.getItem(Yt);e!=null&&(Ct(_n),bt.current=!0,pe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:_n.getAttribute(`aria-label`)??Yt,path:e.getPath()},path:e.getPath(),source:`button`}))},En={contextHoverPath:gn,contextMenuButtonTriggerEnabled:Fe,contextMenuButtonVisibility:Ie,contextMenuEnabled:Ne,contextMenuRightClickEnabled:Le,contextMenuTriggerMode:Pe,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Qe,draggedPathSet:et,dragTarget:tt,gitLaneActive:He,gitStatusByPath:n,handleRowDragEnd:Bt,handleRowDragStart:zt,handleRowTouchStart:Vt,ignoredGitDirectories:r,ignoredInheritanceCache:q,instanceId:o,itemHeight:s,onKeyDown:Ht,onRowClick:wn,openContextMenuForRow:wt,registerButton:Re,registerRenameInput:Be,renameView:We,renderDecorationForRow:gt,resolveIcon:Ue,shouldSuppressContextMenu:Dt,visualFocusPath:hn},Dn={...En,registerButton:ze};return qW(`div`,{ref:S,id:rt,"data-file-tree-context-menu-button-visibility":Ne&&Fe?Ie:void 0,"data-file-tree-context-menu-trigger-mode":Ne?Pe:void 0,"data-file-tree-has-context-menu-action-lane":Ne&&Fe?`true`:void 0,"data-file-tree-has-git-lane":He?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":tt?.kind===`root`?`true`:void 0,onDragLeave:Qe?en:void 0,onDragOver:Qe?$t:void 0,onDrop:Qe?tn:void 0,onKeyDown:Ht,onPointerLeave:Ne?Qt:void 0,onPointerOver:Ne?Zt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[qW(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:pn}}),qW(`slot`,{name:iz,"data-type":`header-slot`}),f?qW(`div`,{"data-file-tree-search-container":!0,"data-open":qe?`true`:`false`,children:qW(`input`,{ref:w,"aria-activedescendant":mn,"aria-controls":rt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Te?`true`:void 0,value:Je,onBlur:()=>{d===`retain`&&!De.current||t.closeSearch()},onFocus:Oe,onPointerDown:Oe,onInput:e=>{Oe();let n=e.currentTarget;t.setSearch(n.value)}})}):null,qW(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&je&&ut.length>0?qW(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:qW(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${it}px`},children:ut.map((e,t)=>nq(Dn,e.row,`sticky:${_K(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ut.length-t}`}}))})}):null,qW(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ft}px`},children:[qW(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${rn}px`}}),qW(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${nn}px`,top:`${Y}px`,bottom:`${an}px`},children:[rq(En,lt,mt),sn!=null&&cn!=null?nq(En,sn,`parked:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:nt===sn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${cn}px`}}):null,dn!=null&&fn!=null?nq(En,dn,`parked-drag:${dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${fn}px`}}):null]})]})]}),Ne?qW(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":yn?`true`:`false`,style:Sn,children:[qW(`button`,{ref:v,type:`button`,"data-type":oz,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":fe==null?`false`:`true`,"data-visible":vn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),fe!=null){St();return}Tn()},tabIndex:-1,style:Cn,children:qW(ZW,{...Ue(`file-tree-icon-ellipsis`)})}),fe==null?null:qW(`slot`,{name:az})]}):null,fe==null?null:qW(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),St()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),St()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var aq={hydrateRoot:(e,t)=>{GW(xW(iq,t),e)},renderRoot:(e,t)=>{WW(xW(iq,t),e)},unmountRoot:e=>{WW(null,e)}};function oq(e,t){aq.renderRoot(e,t)}function sq(e,t){aq.hydrateRoot(e,t)}function cq(e){aq.unmountRoot(e)}var lq=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)}}},uq=`__c`,dq=`__k`,fq=`__d`,pq=`__s`,mq=/[\s\n\\/='"\0<>]/,hq=/^(xlink|xmlns|xml)([A-Z])/,gq=/^(?: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])/,_q=/^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/,vq=new Set([`draggable`,`spellcheck`]);function yq(e){e.__g===void 0?e[fq]=!0:e.__g|=8}function bq(e){e.__g===void 0?e[fq]=!1:e.__g&=-9}function xq(e){return e.__g===void 0?!0===e[fq]:!!(8&e.__g)}var Sq=/["&<]/;function Cq(e){if(e.length===0||!1===Sq.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 wq={},Tq=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(`.`)),Eq=/[A-Z]/g;function Dq(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:wq[n]||(wq[n]=n.replace(Eq,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||Tq.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function Oq(){this.__d=!0}function kq(e,t){return{__v:e,context:t,props:e.props,setState:Oq,forceUpdate:Oq,__d:!0,__h:[]}}function Aq(e,t,n){if(!e.s){if(n instanceof jq){if(!n.s)return void(n.o=Aq.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Aq.bind(null,e,t),Aq.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var jq=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{Aq(r,1,a(this.v))}catch(e){Aq(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?Aq(r,1,t?t(i):i):n?Aq(r,1,n(i)):Aq(r,2,i)}catch(e){Aq(r,2,e)}},r},e}(),Mq,Nq,Pq,Fq,Iq={},Lq=Array.isArray,Rq=Object.assign,zq=``,Bq=`<!--$s-->`,Vq=`<!--/$s-->`;function Hq(e,t){var n,r=e.type,i=!0;return e[uq]?(i=!1,(n=e[uq]).state=n[pq]):n=new r(e.props,t),e[uq]=n,n.__v=e,n.props=e.props,n.context=t,yq(n),n.state??=Iq,n[pq]??(n[pq]=n.state),r.getDerivedStateFromProps?n.state=Rq({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[pq]===n.state?n.state:n[pq]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),Pq&&Pq(e),n.render(n.props,n.state,t)}function Uq(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===zq)return zq;var s=typeof e;if(s!=`object`)return s==`function`?zq:s==`string`?Cq(e):e+zq;if(Lq(e)){var c,l=zq;i[dq]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=Uq(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=zq,Lq(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return zq;e.__=i,Mq&&Mq(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===CW){if(`tpl`in g){for(var x=zq,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&&!Lq(C)?x+=C:x+=Uq(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+Cq(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=Hq(e,b),y=e[uq];else{e[uq]=y=kq(e,b);for(var E=0;xq(y)&&E++<25;){bq(y),Pq&&Pq(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}yq(y)}if(y.getChildContext!=null&&(t=Rq({},t,y.getChildContext())),T&&aW.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===CW&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return Uq(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[pq]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,Iq),xq(y)?(v=Hq(e,t),(y=e[uq]).getChildContext!=null&&(t=Rq({},t,y.getChildContext())),Uq(v=v!=null&&v.type===CW&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):zq}finally{Nq&&Nq(e),Fq&&Fq(e)}}}v=v!=null&&v.type===CW&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=Uq(v,t,n,r,e,a,o);return Nq&&Nq(e),aW.unmount&&aW.unmount(e),e._suspended?typeof D==`string`?Bq+D+Vq:Lq(D)?(D.unshift(Bq),D.push(Vq),D):D.then(function(e){return Bq+e+Vq}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return Uq(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=aW.__e;return k&&k(i,e),zq}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=Uq(v,t,n,r,e,a,o);return e._suspended?Bq+s+Vq:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=zq;for(var N in g){var P=g[N];if(typeof(P=Gq(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=Dq(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(hq.test(N))N=N.replace(hq,`$1:$2`).toLowerCase();else{if(mq.test(N))continue;N[4]!==`-`&&!vq.has(N)||P==null?n?_q.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):gq.test(N)&&(N=N.toLowerCase()):P+=zq}}P!=null&&!1!==P&&(j=!0===P||P===zq?j+` `+N:j+` `+N+`="`+(typeof P==`string`?Cq(P):P+zq)+`"`)}}if(mq.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=Cq(A):A!=null&&!1!==A&&!0!==A&&(M=Uq(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),Nq&&Nq(e),Fq&&Fq(e),!M&&Wq.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return Lq(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var Wq=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Gq(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var Kq=0;function qq(e){return e!=null&&e.length>0?e:(Kq+=1,`pst_ft_${Kq}`)}function Jq({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??nU)}function Yq(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 Xq(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 Zq(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Qq=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new lq;#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=qq(a),this.#p=iW(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=tU(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new $U({...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&&(cq(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(),oq(t.wrapper,this.#w()))}setGitStatus(e){this.#p=iW(e,this.#p);let t=this.#T();t!=null&&oq(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),oq(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),sq(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),oq(r,this.#w())}#C(){return{initialViewportHeight:Jq({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(iz,e());return}this.#l.setSlotHtml(iz,this.#e?.header?.html??null)}#k(e){let t=Zq(e).find(e=>Xq(e)),n=Yq(JR(cz(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Zq(e),n=t.find(e=>Xq(e)),r=t.filter(e=>e!==n),i=cz(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=Yq(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=cz(this.#m);t.colored&&XR(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${ez}]`);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(ez,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=oU(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 fU(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)}},$q=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function eJ(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:iz,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:az,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function tJ(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 nJ(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 rJ(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 iJ({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)(()=>rJ(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),$q(()=>{n.setComposition(g)},[g,n]),$q(()=>{if(c!=null)return r!=null&&nJ(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=tJ(eJ(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)(QR,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function aJ(e){let[t]=(0,Q.useState)(()=>new Qq(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 oJ={density:`compact`,itemHeight:26,flattenEmptyDirectories:!1},sJ={"--trees-level-gap-override":`4px`,"--trees-item-row-gap-override":`4px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`${oJ.itemHeight}px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},cJ=`
|
|
1869
1869
|
[data-item-section='spacing-item'] {
|
|
1870
1870
|
opacity: 0.5;
|
|
1871
1871
|
}
|
|
1872
1872
|
:host(:hover) [data-item-section='spacing-item'] {
|
|
1873
1873
|
opacity: 0.85;
|
|
1874
1874
|
}
|
|
1875
|
-
`,
|
|
1875
|
+
`,lJ=`
|
|
1876
1876
|
[data-file-tree-sticky-overlay-content='true'] {
|
|
1877
1877
|
--trees-bg: color-mix(in oklab, var(--sidebar) 92%, var(--sidebar-foreground) 8%);
|
|
1878
1878
|
box-shadow: 0 1px 0 0 var(--sidebar-border);
|
|
@@ -1886,17 +1886,17 @@ Error generating stack: `+e.message+`
|
|
|
1886
1886
|
border-bottom: 1px solid CanvasText;
|
|
1887
1887
|
}
|
|
1888
1888
|
}
|
|
1889
|
-
`;function
|
|
1889
|
+
`;function uJ(e){return{...yz({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`,...sJ}}var dJ=`data-ok-ext-badge`,fJ=`data-ok-ext-row`,pJ=`data-ok-fullname-row`,mJ=`
|
|
1890
1890
|
[data-item-selected='true'] [data-icon-token='markdown'] {
|
|
1891
1891
|
color: var(--trees-selected-fg);
|
|
1892
1892
|
}
|
|
1893
|
-
[data-type='item'][${
|
|
1893
|
+
[data-type='item'][${fJ}] [data-truncate-segment-priority]:last-child {
|
|
1894
1894
|
display: none;
|
|
1895
1895
|
}
|
|
1896
|
-
[data-type='item'][${
|
|
1896
|
+
[data-type='item'][${pJ}] [data-truncate-segment-priority]:last-child {
|
|
1897
1897
|
display: none;
|
|
1898
1898
|
}
|
|
1899
|
-
[${
|
|
1899
|
+
[${dJ}] {
|
|
1900
1900
|
display: inline-block;
|
|
1901
1901
|
margin-left: 0.375rem;
|
|
1902
1902
|
margin-right: 0.25rem;
|
|
@@ -1908,7 +1908,7 @@ Error generating stack: `+e.message+`
|
|
|
1908
1908
|
pointer-events: none;
|
|
1909
1909
|
user-select: none;
|
|
1910
1910
|
}
|
|
1911
|
-
`;function
|
|
1911
|
+
`;function hJ(e){let t=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of t){let t=e.dataset.itemPath;if(!t){_J(e);continue}if(t.endsWith(`/`)){yJ(e,t);continue}let n=Cl(t);if(!n){_J(e);continue}let r=vJ(e);if(r){if(e.setAttribute(fJ,``),e.removeAttribute(pJ),CJ(r),n.toLowerCase()===`.md`){gJ(e);continue}wJ(e,n.slice(1).toUpperCase())}}}function gJ(e){let t=e.querySelector(`[${dJ}]`);t&&t.remove()}function _J(e){e.removeAttribute(fJ),e.removeAttribute(pJ),gJ(e)}function vJ(e){let t=e.querySelector(`[data-truncate-group-container="middle"]`);if(!t)return null;let n=t.querySelectorAll(`[data-truncate-segment-priority]`);return n.length<2?null:n[0]??null}function yJ(e,t){e.removeAttribute(fJ),gJ(e);let n=vJ(e),r=bJ(t);if(!n||!r){e.removeAttribute(pJ);return}SJ(n,r),e.setAttribute(pJ,``)}function bJ(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function xJ(e,t){let n=e.querySelectorAll(`[data-truncate-content]`);for(let e of n){let n=e.firstChild;if(!n||n.nodeType!==Node.TEXT_NODE)continue;let r=n.textContent??``,i=t(r);i!==r&&(n.textContent=i)}}function SJ(e,t){xJ(e,()=>t)}function CJ(e){xJ(e,e=>e.replace(/\.+$/,``))}function wJ(e,t){let n=e.querySelector(`[${dJ}]`);if(!n){n=e.ownerDocument.createElement(`span`),n.setAttribute(dJ,``),n.setAttribute(`aria-hidden`,`true`);let t=e.querySelector(`[data-item-section="action"]`);t?t.before(n):e.appendChild(n)}n.textContent!==t&&(n.textContent=t)}function TJ(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function EJ(e){let t=TJ(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}var DJ=`data-ok-renaming`,OJ=`data-ok-rename-selection-applied`,kJ=null,AJ=null,jJ=5e3,MJ=`
|
|
1912
1912
|
/* Pierre's icon decoration keys off the row's data-item-path. If the user
|
|
1913
1913
|
deletes the extension before commit, Pierre can temporarily key the row
|
|
1914
1914
|
by an extensionless path and swap [data-icon-token] from 'markdown' to
|
|
@@ -1919,16 +1919,16 @@ Error generating stack: `+e.message+`
|
|
|
1919
1919
|
the row to an extensionless path, then clears it when the path next
|
|
1920
1920
|
includes the saved extension (settle / cancel / row recycle to a settled
|
|
1921
1921
|
file). */
|
|
1922
|
-
[${
|
|
1923
|
-
[${
|
|
1922
|
+
[${DJ}='.md'] [data-item-section="icon"],
|
|
1923
|
+
[${DJ}='.mdx'] [data-item-section="icon"] {
|
|
1924
1924
|
position: relative;
|
|
1925
1925
|
}
|
|
1926
|
-
[${
|
|
1927
|
-
[${
|
|
1926
|
+
[${DJ}='.md'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']),
|
|
1927
|
+
[${DJ}='.mdx'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']) {
|
|
1928
1928
|
visibility: hidden;
|
|
1929
1929
|
}
|
|
1930
|
-
[${
|
|
1931
|
-
[${
|
|
1930
|
+
[${DJ}='.md'] [data-item-section="icon"]::before,
|
|
1931
|
+
[${DJ}='.mdx'] [data-item-section="icon"]::before {
|
|
1932
1932
|
content: '';
|
|
1933
1933
|
display: block;
|
|
1934
1934
|
position: absolute;
|
|
@@ -1940,14 +1940,14 @@ Error generating stack: `+e.message+`
|
|
|
1940
1940
|
mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z'/></svg>") center / contain no-repeat;
|
|
1941
1941
|
pointer-events: none;
|
|
1942
1942
|
}
|
|
1943
|
-
`;function jJ(e){PJ(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=Cl(r);xl(r)&&MJ(i),!t.hasAttribute(EJ)&&(FJ(t),t.setAttribute(EJ,``))}function MJ(e){DJ=e,OJ!==null&&clearTimeout(OJ),OJ=setTimeout(NJ,kJ)}function NJ(){DJ=null,OJ!==null&&(clearTimeout(OJ),OJ=null)}function PJ(e){let t=e.querySelectorAll(`[${TJ}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(TJ);if(!t){e.removeAttribute(TJ);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(TJ);continue}let r=Cl(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(TJ)}if(DJ===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||Cl(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==DJ&&e.setAttribute(TJ,DJ))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&NJ()}function FJ(e){let t=Cl(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function IJ(e){let t=e.getFocusedPath();t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function LJ(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function RJ(e,t,n={}){if(!e)return LJ(t);let r=ll(e);if(t&&r!==t)return LJ(t);switch(e.kind){case`doc`:return LJ(t??e.docName);case`large-file`:return LJ(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?LJ(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:case`skill-file`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function zJ(e,t){if(!e)return{kind:`none`};let n=t.find(t=>wu(t)===e);if(n&&il(n))return{kind:`asset`,path:n.path,hash:Qc(n.path),mediaKind:n.mediaKind};let r=mu(e);return e.endsWith(`/`)?t.some(e=>cl(e)?e.path===r||e.path.startsWith(`${r}/`):(il(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>dl(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var BJ=`You can restore this file from the Trash.`;function VJ(e){let t=BJ,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function HJ(e,t){return e===`web`?null:VJ(t)}function UJ(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function WJ(e,t,n){let r=zJ(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>dl(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var GJ=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function KJ(e){return typeof e==`string`&&GJ.includes(e)?e:`system-error`}function qJ(e){switch(e){case`not-found`:return Ms._({id:`v41fCm`});case`permission-denied`:return Ms._({id:`sJK6pq`});case`system-error`:return Ms._({id:`Jqqevv`});case`path-escape`:return Ms._({id:`WL6puM`})}}function JJ(e){let t=qJ(e.reason),n=e.detail;return n?Ms._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Ms._({id:`dTaauv`,values:{reason:t}})}function YJ(e){return e.kind===`folder`?`${e.name}/`:e.name}function XJ(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,s=n.length>1,c=n[0],l=n.length,u;if(t[0]!==l||t[1]!==s||t[2]!==c){let e=c?YJ(c):``;u=s?Ms._({id:`5qNxOe`,values:{count:l}}):c?`${Ms._({id:`E_BHoD`,values:{targetName:e}})}\n${JJ(c)}`:Ms._({id:`kolRU1`}),t[0]=l,t[1]=s,t[2]=c,t[3]=u}else u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(Y,{id:`aOp3hw`})}),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=(0,Z.jsxs)(Ja,{children:[f,(0,Z.jsx)(Ua,{className:`whitespace-pre-wrap`,children:d})]}),t[5]=d,t[6]=p);let m;t[7]!==n||t[8]!==s?(m=s?(0,Z.jsx)(Ka,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(ZJ)})}):null,t[7]=n,t[8]=s,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[10]=h):h=t[10];let g;t[11]!==r||t[12]!==o?(g=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:h}),t[11]=r,t[12]=o,t[13]=g):g=t[13];let _;t[14]===r?_=t[15]:(_=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fo,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(Y,{id:`mf37rL`})]}):(0,Z.jsx)(Y,{id:`6gRgw8`}),t[14]=r,t[15]=_);let v;t[16]!==r||t[17]!==a||t[18]!==_?(v=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:_}),t[16]=r,t[17]=a,t[18]=_,t[19]=v):v=t[19];let y;t[20]===r?y=t[21]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fo,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(Y,{id:`s3caR3`})]}):(0,Z.jsx)(Y,{id:`UBv8UK`}),t[20]=r,t[21]=y);let b;t[22]!==r||t[23]!==i||t[24]!==y?(b=(0,Z.jsx)(X,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:y}),t[22]=r,t[23]=i,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g||t[28]!==v?(x=(0,Z.jsxs)(qa,{children:[g,v,b]}),t[26]=b,t[27]=g,t[28]=v,t[29]=x):x=t[29];let S;return t[30]!==x||t[31]!==p||t[32]!==m?(S=(0,Z.jsxs)(Ga,{className:`sm:max-w-md`,children:[p,m,x]}),t[30]=x,t[31]=p,t[32]=m,t[33]=S):S=t[33],S}function ZJ(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:YJ(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:JJ(e)})]},e.path)}function QJ(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=ya(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,s;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=_v(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),s=n;break bb0}let c;t[16]!==i||t[17]!==r?(c=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=c):c=t[18],o=n.map(c)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=s}else o=t[9],s=t[10];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[19]===o?c=t[20]:(c=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=c),c}function $J(e){return e?.isDirectory()?e:null}function eY(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function tY(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=$J(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}eY(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var nY=`open-knowledge:file-tree-menu-action-delete`,rY=`open-knowledge:file-tree-menu-action-rename`,iY=`open-knowledge:file-tree-menu-action-duplicate`;function aY(e){window.dispatchEvent(new CustomEvent(nY,{detail:{target:e}}))}function oY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(nY,t),()=>window.removeEventListener(nY,t)}function sY(e){window.dispatchEvent(new CustomEvent(rY,{detail:{target:e}}))}function cY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(rY,t),()=>window.removeEventListener(rY,t)}function lY(e){window.dispatchEvent(new CustomEvent(iY,{detail:{target:e}}))}function uY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(iY,t),()=>window.removeEventListener(iY,t)}function dY(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var fY={Accept:`application/x-ndjson, application/json`};function pY(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var mY=class extends Error{};function hY(e){return typeof e==`object`&&!!e&&`type`in e}async function gY(e,t={}){let n=e.body;if(!n)throw new mY(`Show All Files stream had no response body.`);let{onBatch:r}=t,i=n.getReader(),a=new TextDecoder,o=[],s=[],c=!1,l=``,u=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(hY(n)){if(n.type===`error`)throw new mY(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return c=n.truncated===!0,!0}let r=Wn.safeParse(n);return r.success?(o.push(r.data),s.push(r.data)):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1},d=()=>{if(!r||s.length===0)return;let e=s;s=[],r(e)};try{let e=!1;for(;!e;){let t=await i.read();if(t.done)break;l+=a.decode(t.value,{stream:!0});let n=l.indexOf(`
|
|
1943
|
+
`;function NJ(e){IJ(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=Cl(r);xl(r)&&PJ(i),!t.hasAttribute(OJ)&&(LJ(t),t.setAttribute(OJ,``))}function PJ(e){kJ=e,AJ!==null&&clearTimeout(AJ),AJ=setTimeout(FJ,jJ)}function FJ(){kJ=null,AJ!==null&&(clearTimeout(AJ),AJ=null)}function IJ(e){let t=e.querySelectorAll(`[${DJ}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(DJ);if(!t){e.removeAttribute(DJ);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(DJ);continue}let r=Cl(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(DJ)}if(kJ===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||Cl(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==kJ&&e.setAttribute(DJ,kJ))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&FJ()}function LJ(e){let t=Cl(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function RJ(e){let t=e.getFocusedPath();t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function zJ(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function BJ(e,t,n={}){if(!e)return zJ(t);let r=ll(e);if(t&&r!==t)return zJ(t);switch(e.kind){case`doc`:return zJ(t??e.docName);case`large-file`:return zJ(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?zJ(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:case`skill-file`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function VJ(e,t){if(!e)return{kind:`none`};let n=t.find(t=>wu(t)===e);if(n&&il(n))return{kind:`asset`,path:n.path,hash:Qc(n.path),mediaKind:n.mediaKind};let r=mu(e);return e.endsWith(`/`)?t.some(e=>cl(e)?e.path===r||e.path.startsWith(`${r}/`):(il(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>dl(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var HJ=`You can restore this file from the Trash.`;function UJ(e){let t=HJ,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function WJ(e,t){return e===`web`?null:UJ(t)}function GJ(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function KJ(e,t,n){let r=VJ(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>dl(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var qJ=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function JJ(e){return typeof e==`string`&&qJ.includes(e)?e:`system-error`}function YJ(e){switch(e){case`not-found`:return Ms._({id:`v41fCm`});case`permission-denied`:return Ms._({id:`sJK6pq`});case`system-error`:return Ms._({id:`Jqqevv`});case`path-escape`:return Ms._({id:`WL6puM`})}}function XJ(e){let t=YJ(e.reason),n=e.detail;return n?Ms._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Ms._({id:`dTaauv`,values:{reason:t}})}function ZJ(e){return e.kind===`folder`?`${e.name}/`:e.name}function QJ(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,s=n.length>1,c=n[0],l=n.length,u;if(t[0]!==l||t[1]!==s||t[2]!==c){let e=c?ZJ(c):``;u=s?Ms._({id:`5qNxOe`,values:{count:l}}):c?`${Ms._({id:`E_BHoD`,values:{targetName:e}})}\n${XJ(c)}`:Ms._({id:`kolRU1`}),t[0]=l,t[1]=s,t[2]=c,t[3]=u}else u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(Y,{id:`aOp3hw`})}),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=(0,Z.jsxs)(Ja,{children:[f,(0,Z.jsx)(Ua,{className:`whitespace-pre-wrap`,children:d})]}),t[5]=d,t[6]=p);let m;t[7]!==n||t[8]!==s?(m=s?(0,Z.jsx)(Ka,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map($J)})}):null,t[7]=n,t[8]=s,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[10]=h):h=t[10];let g;t[11]!==r||t[12]!==o?(g=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:h}),t[11]=r,t[12]=o,t[13]=g):g=t[13];let _;t[14]===r?_=t[15]:(_=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fo,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(Y,{id:`mf37rL`})]}):(0,Z.jsx)(Y,{id:`6gRgw8`}),t[14]=r,t[15]=_);let v;t[16]!==r||t[17]!==a||t[18]!==_?(v=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:_}),t[16]=r,t[17]=a,t[18]=_,t[19]=v):v=t[19];let y;t[20]===r?y=t[21]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fo,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(Y,{id:`s3caR3`})]}):(0,Z.jsx)(Y,{id:`UBv8UK`}),t[20]=r,t[21]=y);let b;t[22]!==r||t[23]!==i||t[24]!==y?(b=(0,Z.jsx)(X,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:y}),t[22]=r,t[23]=i,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g||t[28]!==v?(x=(0,Z.jsxs)(qa,{children:[g,v,b]}),t[26]=b,t[27]=g,t[28]=v,t[29]=x):x=t[29];let S;return t[30]!==x||t[31]!==p||t[32]!==m?(S=(0,Z.jsxs)(Ga,{className:`sm:max-w-md`,children:[p,m,x]}),t[30]=x,t[31]=p,t[32]=m,t[33]=S):S=t[33],S}function $J(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:ZJ(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:XJ(e)})]},e.path)}function eY(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=ya(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,s;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=_v(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Y,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),s=n;break bb0}let c;t[16]!==i||t[17]!==r?(c=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=c):c=t[18],o=n.map(c)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=s}else o=t[9],s=t[10];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[19]===o?c=t[20]:(c=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=c),c}function tY(e){return e?.isDirectory()?e:null}function nY(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function rY(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=tY(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}nY(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var iY=`open-knowledge:file-tree-menu-action-delete`,aY=`open-knowledge:file-tree-menu-action-rename`,oY=`open-knowledge:file-tree-menu-action-duplicate`;function sY(e){window.dispatchEvent(new CustomEvent(iY,{detail:{target:e}}))}function cY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(iY,t),()=>window.removeEventListener(iY,t)}function lY(e){window.dispatchEvent(new CustomEvent(aY,{detail:{target:e}}))}function uY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(aY,t),()=>window.removeEventListener(aY,t)}function dY(e){window.dispatchEvent(new CustomEvent(oY,{detail:{target:e}}))}function fY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(oY,t),()=>window.removeEventListener(oY,t)}function pY(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var mY={Accept:`application/x-ndjson, application/json`};function hY(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var gY=class extends Error{};function _Y(e){return typeof e==`object`&&!!e&&`type`in e}async function vY(e,t={}){let n=e.body;if(!n)throw new gY(`Show All Files stream had no response body.`);let{onBatch:r}=t,i=n.getReader(),a=new TextDecoder,o=[],s=[],c=!1,l=``,u=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(_Y(n)){if(n.type===`error`)throw new gY(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return c=n.truncated===!0,!0}let r=Wn.safeParse(n);return r.success?(o.push(r.data),s.push(r.data)):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1},d=()=>{if(!r||s.length===0)return;let e=s;s=[],r(e)};try{let e=!1;for(;!e;){let t=await i.read();if(t.done)break;l+=a.decode(t.value,{stream:!0});let n=l.indexOf(`
|
|
1944
1944
|
`);for(;n!==-1;){let t=u(l.slice(0,n));if(l=l.slice(n+1),t){e=!0;break}n=l.indexOf(`
|
|
1945
1945
|
`)}d()}l+=a.decode(),l.includes(`
|
|
1946
|
-
`)||u(l),d()}finally{i.releaseLock()}return{entries:o,truncated:c}}function
|
|
1947
|
-
${
|
|
1948
|
-
${
|
|
1949
|
-
${
|
|
1950
|
-
</svg>`,
|
|
1946
|
+
`)||u(l),d()}finally{i.releaseLock()}return{entries:o,truncated:c}}function yY(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>wu(e))),a=[];for(let e of t){let t=wu(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function bY(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>wu(e))),r=[...e];for(let e of t){let t=wu(e);n.has(t)||(n.add(t),r.push(e))}return r}function xY(e,t,n,r,i=Date.now()){if(t!==``&&!e.some(e=>wu(e)===t))return[...e];let a=[],o=[];for(let n of e)SY(t,wu(n))?a.push(n):o.push(n);let s=yY(n,a,r,i),c=new Set(s.map(e=>wu(e)).filter(e=>e.endsWith(`/`)));return[...o.filter(e=>{let n=wu(e);if(!n.startsWith(t))return!0;let r=n.slice(t.length),i=r.indexOf(`/`);return i===-1?!0:c.has(t+r.slice(0,i+1))}),...s]}function SY(e,t){if(!t.startsWith(e))return!1;let n=t.slice(e.length);if(n===``)return!1;let r=n.endsWith(`/`)?n.slice(0,-1):n;return r!==``&&!r.includes(`/`)}var CY=bl(`HOVER_INTENT_MS`,80),wY=3,TY=20,EY=new Map,DY=new Set,OY=[],kY=new Map;function AY(e){for(kY.delete(e),kY.set(e,!0);kY.size>TY;){let e=kY.keys().next().value;if(e===void 0)break;kY.delete(e)}}function jY(e){DY.delete(e),NY()}function MY(e,t){let n=Date.now();vl(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),G(e,t,n)}function NY(){for(;DY.size<wY&&OY.length>0;){let e=OY.shift();if(!e)break;if(!kY.has(e.docName)){DY.add(e.docName),AY(e.docName);try{let t=e.prewarm(e.docName);t&&MY(e.docName,t)}catch(t){vl(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{jY(e.docName)}}}}function PY(e,t){if(ze(e)||kY.has(e))return;let n=EY.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(EY.delete(e),DY.size>=wY){OY.push({docName:e,prewarm:t});return}AY(e),DY.add(e);try{let n=t(e);n&&MY(e,n)}catch(t){vl(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{jY(e)}},CY);EY.set(e,{timer:r,prewarm:t})}function FY(e){let t=EY.get(e);t&&(clearTimeout(t.timer),EY.delete(e))}var IY=/\.(md|mdx)$/i;function LY(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function RY(e){let t=e.match(IY);return t?t[0]:null}function zY(e){window.requestAnimationFrame(()=>{let t=pe(e);if(!(!t||t.isDestroyed))try{t.commands.focus()}catch{}})}function BY(e){let t=e.current;t.row?.removeAttribute(QY),t.root?.removeAttribute($Y),e.current={row:null,root:null}}function VY(e,t){let n=e.current;n.row===t.row&&n.root===t.root||(BY(e),t.row?.setAttribute(QY,`true`),t.root?.setAttribute($Y,`true`),e.current={row:t.row,root:t.root})}async function HY(e,t){try{await navigator.clipboard.writeText(e),Ss.success(t===`full`?Ms._({id:`6_ZOw4`}):Ms._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),Ss.error(t===`full`?Ms._({id:`vfRlCI`}):Ms._({id:`5QGTaA`}))}}var UY=new Set([`agents`,`agent`,`claude`,`skill`]),WY=`ok-file-tree-link-decoration`,GY=`ok-file-tree-agent-decoration`,KY=`ok-file-tree-markdown`,qY=`<symbol id="${KY}" viewBox="${Be}" fill="currentColor"><path d="${Ne}"/></symbol>`;function JY(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function YY(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${JY(t)}</symbol>`}var XY=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1947
|
+
${YY(WY,Nt)}
|
|
1948
|
+
${YY(GY,dd)}
|
|
1949
|
+
${qY}
|
|
1950
|
+
</svg>`,ZY=`
|
|
1951
1951
|
[data-file-tree-virtualized-root][data-file-tree-root-drag-target="true"] {
|
|
1952
1952
|
position: relative;
|
|
1953
1953
|
}
|
|
@@ -1970,15 +1970,15 @@ Error generating stack: `+e.message+`
|
|
|
1970
1970
|
border: 2px solid Highlight;
|
|
1971
1971
|
}
|
|
1972
1972
|
}
|
|
1973
|
-
`,
|
|
1974
|
-
[data-type="item"][${
|
|
1973
|
+
`,QY=`data-ok-external-file-drop-target`,$Y=`data-ok-external-file-drop-root-target`,eX=`__external-file-drop__`,tX=2e3,nX=`
|
|
1974
|
+
[data-type="item"][${QY}="true"] {
|
|
1975
1975
|
background: color-mix(in oklab, var(--color-primary) 10%, transparent);
|
|
1976
1976
|
box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-primary) 72%, transparent);
|
|
1977
1977
|
}
|
|
1978
|
-
[data-file-tree-virtualized-root][${
|
|
1978
|
+
[data-file-tree-virtualized-root][${$Y}="true"] {
|
|
1979
1979
|
position: relative;
|
|
1980
1980
|
}
|
|
1981
|
-
[data-file-tree-virtualized-root][${
|
|
1981
|
+
[data-file-tree-virtualized-root][${$Y}="true"]::after {
|
|
1982
1982
|
content: "";
|
|
1983
1983
|
position: absolute;
|
|
1984
1984
|
inset: 0;
|
|
@@ -1989,16 +1989,16 @@ Error generating stack: `+e.message+`
|
|
|
1989
1989
|
pointer-events: none;
|
|
1990
1990
|
}
|
|
1991
1991
|
@media (forced-colors: active) {
|
|
1992
|
-
[data-type="item"][${
|
|
1992
|
+
[data-type="item"][${QY}="true"] {
|
|
1993
1993
|
outline: 2px solid Highlight;
|
|
1994
1994
|
outline-offset: -2px;
|
|
1995
1995
|
}
|
|
1996
|
-
[data-file-tree-virtualized-root][${
|
|
1996
|
+
[data-file-tree-virtualized-root][${$Y}="true"]::after {
|
|
1997
1997
|
border: 2px solid Highlight;
|
|
1998
1998
|
}
|
|
1999
1999
|
}
|
|
2000
|
-
`,
|
|
2001
|
-
:host([${
|
|
2000
|
+
`,rX=`data-ok-creation-cleared`,iX=`${mJ}\n${MJ}\n${ZY}\n${nX}\n${`
|
|
2001
|
+
:host([${rX}]) [data-item-focused="true"] {
|
|
2002
2002
|
--trees-focus-ring-color: transparent;
|
|
2003
2003
|
}
|
|
2004
|
-
`}\n${oJ}\n${sJ}`;function rX(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&VY.has(t)}function iX(e){return e===`darwin`?Ms._({id:`LtSYdi`}):e===`win32`?Ms._({id:`qi1F96`}):Ms._({id:`e1Rn_k`})}function aX(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:i}=e,{_:a}=an(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let s=o.platform,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=iX(s),t[0]=c):c=t[0];let l=c,u,d;t[1]!==a||t[2]!==r?(u=r?null:a({id:`wTcjov`}),d=a(s===`darwin`?u?{id:`FvpFSZ`,values:{hint:u}}:{id:`LtSYdi`}:s===`win32`?u?{id:`o4dcAf`,values:{hint:u}}:{id:`qi1F96`}:u?{id:`zUhPuR`,values:{hint:u}}:{id:`e1Rn_k`}),t[1]=a,t[2]=r,t[3]=u,t[4]=d):(u=t[3],d=t[4]);let f=d,p=!r,m;t[5]!==n||t[6]!==i||t[7]!==r?(m=()=>{if(!r)return;i();let e=co(r.contentDir,bu(n),r.pathSeparator);o.shell.showItemInFolder(e)},t[5]=n,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h,g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Io,{"aria-hidden":`true`}),g=(0,Z.jsx)(`span`,{className:`flex-1`,children:l}),t[9]=h,t[10]=g):(h=t[9],g=t[10]);let _;t[11]===u?_=t[12]:(_=u?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:u}):null,t[11]=u,t[12]=_);let v;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(Cc,{disabled:p,onSelect:m,"aria-label":f,children:[h,g,_]}),t[13]=f,t[14]=p,t[15]=m,t[16]=_,t[17]=v):v=t[17],v}function oX(e,t){return Vu({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function sX(e,t){return e!==t&&e.startsWith(t)}function cX(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>sX(e,t))).map(e=>oX(e,t))}function lX(e,t){return e===t||e.startsWith(`${t}/`)}function uX(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function dX(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)dl(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):il(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=Hu(e);lX(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function fX(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:lX(t.createdPath,e.path)}function pX(e){let t=(0,$.c)(69),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,projectLocalBinding:l,mergedConfig:u,onStartCreating:d,onCreateFromTemplate:f,onDuplicate:p,onDelete:m,onExpandSubtree:h,onCollapseSubtree:g,folderTreePaths:_,isAsset:v,documents:y}=e,{_:b}=an(),x=Vu(n,y),S=n.kind===`directory`,C=x.kind===`asset`?null:x,w=C!==null&&c!==null,T;t[0]!==b||t[1]!==S?(T=b(S?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=b,t[1]=S,t[2]=T):T=t[2];let E=T,D=u?.appearance?.sidebar?.showHiddenFiles??!1,O=l!==null,k;t[3]!==S||t[4]!==n.path?(k=S?Hu(n.path):null,t[3]=S,t[4]=n.path,t[5]=k):k=t[5];let A=ya(k),j=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,M=s.getSelectedPaths(),N=M.includes(x.treePath)?cX(M,y):[],P=N.length>1?N:[x],F=P.length,I=Ms._({id:`djjdjr`,values:{deleteCount:F}}),L;t[6]!==v||t[7]!==S||t[8]!==n||t[9]!==a?(L=v?null:S?po({folderRelativePath:bu(n),workspace:a}):ko({docName:Su(n.path),workspace:a}),t[6]=v,t[7]=S,t[8]=n,t[9]=a,t[10]=L):L=t[10];let R=L,z;t[11]===r?z=t[12]:(z=()=>r.close({restoreFocus:!1}),t[11]=r,t[12]=z);let B=z,V;t[13]===r?V=t[14]:(V=()=>r.close(),t[13]=r,t[14]=V);let H=V,{status:U}=Ki(),W=U?.hasRemote===!0,G;t[15]!==v||t[16]!==S||t[17]!==n.path||t[18]!==x?(G=v||x.kind===`asset`?null:S?Bi(Hu(n.path)):Ri(Su(n.path)),t[15]=v,t[16]=S,t[17]=n.path,t[18]=x,t[19]=G):G=t[19];let K=G,ee=W&&K!==null,te;t[20]!==b||t[21]!==W||t[22]!==K?(te=()=>{K&&Mi({...K,hasRemote:W,onClickWhenNoRemote:()=>{Ss.error(b({id:`WyQxwa`}))}},{clipboardWrite:To,toastSuccess:gX,toastError:hX,logEvent:mX})},t[20]=b,t[21]=W,t[22]=K,t[23]=te):te=t[23];let q=te,J;t[24]!==ee||t[25]!==H||t[26]!==q?(J=ee?(0,Z.jsxs)(Cc,{"data-testid":`file-tree-menu-share`,onSelect:()=>{H(),q()},children:[(0,Z.jsx)(df,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Z8lGw6`})]}):null,t[24]=ee,t[25]=H,t[26]=q,t[27]=J):J=t[27];let ne=J,re;t[28]!==b||t[29]!==l?(re=e=>{if(l===null)return;let t=l.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,rr(t.error)),Ss.error(b({id:`P47EWZ`}),{description:rr(t.error)}))},t[28]=b,t[29]=l,t[30]=re):re=t[30];let ie=re,ae=0,oe=0;if(S){let e=Pu(n.path);for(let t of _)(t===e||t.startsWith(e))&&(ae++,$J(s.getItem(t))?.isExpanded()&&oe++)}let se=S&&oe<ae,ce=S&&oe>0,le;t[31]===H?le=t[32]:(le=e=>{e||H()},t[31]=H,t[32]=le);let ue;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[33]=ue):ue=t[33];let de;t[34]!==b||t[35]!==i||t[36]!==w||t[37]!==O||t[38]!==H||t[39]!==B||t[40]!==I||t[41]!==P||t[42]!==j||t[43]!==ie||t[44]!==o||t[45]!==R||t[46]!==E||t[47]!==v||t[48]!==S||t[49]!==n||t[50]!==s||t[51]!==c||t[52]!==C||t[53]!==g||t[54]!==f||t[55]!==m||t[56]!==p||t[57]!==h||t[58]!==d||t[59]!==ne||t[60]!==D||t[61]!==ce||t[62]!==se||t[63]!==x||t[64]!==a?(de=(0,Z.jsx)(Tc,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{B(),d(`file`,Hu(n.path))},children:[(0,Z.jsx)(hf,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`HdkSiO`})]}),j?(0,Z.jsxs)(bc,{children:[(0,Z.jsxs)(Fc,{disabled:i,children:[(0,Z.jsx)(ia,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Uuj_R4`})]}),(0,Z.jsx)(cc,{children:(0,Z.jsx)(QJ,{parentDir:Hu(n.path),onSelectTemplate:e=>{B(),f(Hu(n.path),e)},ItemComponent:Cc})})]}):null,(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{B(),d(`folder`,Hu(n.path))},children:[(0,Z.jsx)(Ad,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`96G6Re`})]}),(0,Z.jsx)(Ic,{}),(0,Z.jsx)(aX,{item:n,workspace:a,onClose:H}),(0,Z.jsx)(mo,{input:R,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),ne,(0,Z.jsxs)(bc,{children:[(0,Z.jsxs)(Fc,{children:[(0,Z.jsx)(Ho,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`oCZkaG`})]}),(0,Z.jsxs)(cc,{children:[(0,Z.jsx)(Cc,{disabled:!a,onSelect:()=>{a&&(H(),BY(co(a.contentDir,bu(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(Y,{id:`oQA-cA`})}),(0,Z.jsx)(Cc,{onSelect:()=>{H(),BY(bu(n),`relative`)},children:(0,Z.jsx)(Y,{id:`s061i4`})})]})]}),(0,Z.jsx)(Ic,{}),(0,Z.jsx)(kc,{checked:D,onCheckedChange:ie,disabled:!O,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(Y,{id:`XcGbim`})}),se||ce?(0,Z.jsx)(Ic,{}):null,se?(0,Z.jsxs)(Cc,{onSelect:()=>{H(),h(n.path)},children:[(0,Z.jsx)(kf,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,ce?(0,Z.jsxs)(Cc,{onSelect:()=>{H(),g(n.path)},children:[(0,Z.jsx)(Od,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,(0,Z.jsx)(Ic,{}),(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{x.kind!==`asset`&&(H(),p(x))},children:[(0,Z.jsx)(zo,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`euc6Ns`})]}),(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{B(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Wo,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`2wxgft`})]}),(0,Z.jsxs)(Cc,{"data-testid":`file-tree-menu-hide`,disabled:!w,onSelect:()=>{if(!c||!C)return;H();let e=wJ(C),t=ta(c.current()),n=Zi(t,e);if(n===t)return;c.patch(aa(n));let r=C.path.split(`/`).pop()||C.path;Ss.success(b({id:`4xtLTl`,values:{basename:r}}),{description:b({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Gt,{"aria-hidden":`true`}),E]}),(0,Z.jsxs)(Cc,{variant:`destructive`,disabled:i,onSelect:()=>{H(),m(P)},children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`}),I]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(aX,{item:n,workspace:a,onClose:H}),!v&&(0,Z.jsx)(mo,{input:R,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),ne,(0,Z.jsxs)(bc,{children:[(0,Z.jsxs)(Fc,{children:[(0,Z.jsx)(Ho,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`oCZkaG`})]}),(0,Z.jsxs)(cc,{children:[(0,Z.jsx)(Cc,{disabled:!a,onSelect:()=>{a&&(H(),BY(co(a.contentDir,bu(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(Y,{id:`oQA-cA`})}),(0,Z.jsx)(Cc,{onSelect:()=>{H(),BY(bu(n),`relative`)},children:(0,Z.jsx)(Y,{id:`s061i4`})})]})]}),(0,Z.jsx)(Ic,{}),v?null:(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{H(),p(x)},children:[(0,Z.jsx)(zo,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`euc6Ns`})]}),(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{B(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Wo,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`2wxgft`})]}),C?(0,Z.jsxs)(Cc,{"data-testid":`file-tree-menu-hide`,disabled:!w,onSelect:()=>{if(!c)return;H();let e=wJ(C),t=ta(c.current()),n=Zi(t,e);if(n===t)return;c.patch(aa(n));let r=C.path.split(`/`).pop()||C.path;Ss.success(b({id:`OD0FCX`,values:{basename:r}}),{description:b({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Gt,{"aria-hidden":`true`}),E]}):null,(0,Z.jsxs)(Cc,{variant:`destructive`,disabled:i,onSelect:()=>{H(),m(P)},children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`}),I]})]})}),t[34]=b,t[35]=i,t[36]=w,t[37]=O,t[38]=H,t[39]=B,t[40]=I,t[41]=P,t[42]=j,t[43]=ie,t[44]=o,t[45]=R,t[46]=E,t[47]=v,t[48]=S,t[49]=n,t[50]=s,t[51]=c,t[52]=C,t[53]=g,t[54]=f,t[55]=m,t[56]=p,t[57]=h,t[58]=d,t[59]=ne,t[60]=D,t[61]=ce,t[62]=se,t[63]=x,t[64]=a,t[65]=de):de=t[65];let fe;return t[66]!==le||t[67]!==de?(fe=(0,Z.jsxs)(jc,{open:!0,modal:!1,onOpenChange:le,children:[ue,de]}),t[66]=le,t[67]=de,t[68]=fe):fe=t[68],fe}function mX(e){return console.log(e)}function hX(e){return Ss.error(e)}function gX(e){return Ss.success(e)}async function _X(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:fY});if(pY(i)){let e=await gY(i);return{kind:`entries`,entries:al(e.entries),truncated:e.truncated}}let a=await s(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=Hn.safeParse(a.body);return o.success?{kind:`entries`,entries:al(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof mY?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function vX(e){let t=(0,$.c)(356),{ref:n,onContentHeightChange:r}=e,{_:i,i18n:a}=an(),{activeDocName:o,activeTarget:c,closeTabs:l,closeDocument:u,closeAndClearForRename:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:h,openTarget:g,prewarm:_,remapTabsForRename:v}=pt(),{notifySidebarFileSelected:y}=kN(),{resolvedTheme:b}=tr(),{addPage:x,pageMeta:S}=to(),C;t[0]===S?C=t[1]:(C=function(e,t){return sl(e,t??S.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=S,t[1]=C);let w=C,T;t[2]!==w||t[3]!==y||t[4]!==g?(T=function(e,t){g(w(e,t),{tabBehavior:`replace-active`}),Yc(Jc(e)),y()},t[2]=w,t[3]=y,t[4]=g,t[5]=T):T=t[5];let E=T,D;t[6]!==y||t[7]!==g?(D=function(e){let t=hl(e);g({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),Yc(t),y()},t[6]=y,t[7]=g,t[8]=D):D=t[8];let O=D,k;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=[],t[9]=k):k=t[9];let[A,j]=(0,Q.useState)(k),[M,N]=(0,Q.useState)(!0),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=Ig(),z=(0,Q.useRef)(null),[B,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),[K,ee]=(0,Q.useState)(null),{conflicts:te}=Li(),[q,J]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(ie),se;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(se=new Set,t[10]=se):se=t[10];let ce=(0,Q.useRef)(se),le=(0,Q.useRef)(A),ue=(0,Q.useRef)(S),de;t[11]!==A||t[12]!==O||t[13]!==E||t[14]!==y||t[15]!==g?(de=function(e,t){let n=t===void 0?A:t,r=zJ(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,mu(e));return}if(r.kind===`asset`){g({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),Yc(r.hash),y();return}if(r.kind===`folder`){O(r.path);return}let i=n.find(e=>dl(e)&&e.docName===r.path);E(r.path,i?.size)},t[11]=A,t[12]=O,t[13]=E,t[14]=y,t[15]=g,t[16]=de):de=t[16];let fe=de,pe;t[17]!==y||t[18]!==g?(pe=function(e,t){g({kind:`asset`,target:e,assetPath:e,mediaKind:(t??le.current).find(t=>il(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),Yc(Qc(e)),y()},t[17]=y,t[18]=g,t[19]=pe):pe=t[19];let me=pe,he=(0,Q.useRef)(o),ge;t[20]===A?ge=t[21]:(ge=new Set(A.filter(il).map(GX)),t[20]=A,t[21]=ge);let _e=ge,ve=(0,Q.useRef)(_e),ye;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ye=[],t[22]=ye):ye=t[22];let be=(0,Q.useRef)(ye),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(WX),Ce=(0,Q.useRef)(null),we=(0,Q.useRef)(null),Te=(0,Q.useRef)(!1),Ee=(0,Q.useRef)(!1),De=(0,Q.useRef)(null),Oe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Oe={row:null,root:null},t[23]=Oe):Oe=t[23];let ke=(0,Q.useRef)(Oe),Ae=(0,Q.useRef)(UX),je=(0,Q.useRef)(null),Me;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Me=new Map,t[24]=Me):Me=t[24];let Ne=(0,Q.useRef)(Me),Pe;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=new Set,t[25]=Pe):Pe=t[25];let Fe=(0,Q.useRef)(Pe),Le;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Le=new Map,t[26]=Le):Le=t[26];let Re=(0,Q.useRef)(Le),ze=(0,Q.useRef)(0),Ve;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=new Set,t[27]=Ve):Ve=t[27];let He=(0,Q.useRef)(Ve),Ue=(0,Q.useRef)(HX),We=(0,Q.useRef)(VX),Ge=(0,Q.useRef)(!1),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(null),Je=(0,Q.useRef)(BX),Ye=(0,Q.useRef)(zX),Xe=(0,Q.useRef)(RX),Ze=(0,Q.useRef)(LX),Qe=(0,Q.useRef)(c),[$e,et]=(0,Q.useState)(!1),tt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(tt=function(){z.current!==null&&(clearTimeout(z.current),z.current=null)},t[28]=tt):tt=t[28];let nt=tt,rt;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(rt=function(){nt(),L(!1)},t[29]=rt):rt=t[29];let at=rt,ot;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ot=function(e){at(),F(e)},t[30]=ot):ot=t[30];let st=ot,ct;t[31]===i?ct=t[32]:(ct=function(){if(nt(),Mg()){F(null),L(!0),z.current=setTimeout(()=>{z.current=null,Ke.current?.()},$Y);return}L(!1),F(i({id:`34qyH5`}))},t[31]=i,t[32]=ct);let lt=ct,ut=(0,Q.useRef)(!0),dt;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(dt=()=>{if(ut.current){ut.current=!1;return}Ke.current?.()},t[33]=dt):dt=t[33];let ft;t[34]===R?ft=t[35]:(ft=[R],t[34]=R,t[35]=ft),(0,Q.useEffect)(dt,ft);let mt,ht;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(mt=()=>nt,ht=[],t[36]=mt,t[37]=ht):(mt=t[36],ht=t[37]),(0,Q.useEffect)(mt,ht);let gt,_t;t[38]!==A.length||t[39]!==M?(gt=()=>{if(M||A.length===0)return;let e=qe.current?.querySelector(XR)?.shadowRoot;if(!e)return;let t=e,n=function(){De.current!==null&&clearTimeout(De.current),De.current=setTimeout(()=>{Ee.current=!1,De.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=qX(e),n=t?.dataset.itemPath;if(!n)return;let r=WJ(t.dataset.itemType===`folder`?Pu(n):n,le.current,ue.current);r&&(De.current!==null&&(clearTimeout(De.current),De.current=null),Ee.current=!0,e.dataTransfer?.setData(gu,ku(r)))},i=function(e){if(!(e instanceof DragEvent)||!ju(e))return;let t=YX(e);if(!t){RY(ke);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),zY(ke,t)},a=function(e){if(!(e instanceof DragEvent)||!ju(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||RY(ke)},o=function(e){if(!(e instanceof DragEvent)||!ju(e))return;let t=YX(e),n=Tu(e);if(!t||n.length===0){RY(ke);return}e.preventDefault(),e.stopPropagation(),RY(ke),Ae.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),RY(ke),De.current!==null&&(clearTimeout(De.current),De.current=null),Ee.current=!1}},_t=[A.length,M],t[38]=A.length,t[39]=M,t[40]=gt,t[41]=_t):(gt=t[40],_t=t[41]),(0,Q.useEffect)(gt,_t);let{selectedFilePath:vt,selectedFolderPath:yt,navigationPath:bt}=RJ(c,h?null:o),xt=vt?Iu(vt,A.find(e=>dl(e)&&e.docName===vt)?.docExt):yt?Pu(yt):c?.kind===`asset`?c.assetPath:null,St=ie?null:xt,Ct=So().states,{dispatch:wt}=Ao(),Tt;t[42]!==wt||t[43]!==Ct?(Tt={installStates:Ct,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:wt},t[42]=wt,t[43]=Ct,t[44]=Tt):Tt=t[44];let Et=Tt,{okignoreBinding:Dt,projectLocalBinding:Ot,merged:kt}=Bo(),At=kt?.appearance?.sidebar?.showHiddenFiles??!1,jt;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>je.current===null,t[45]=jt):jt=t[45];let Mt=jt,Nt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=[],t[46]=Nt):Nt=t[46];let Pt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Pt={set:`complete`,spriteSheet:JY,byFileExtension:{md:{name:WY,viewBox:Be},mdx:{name:WY,viewBox:Be}}},t[47]=Pt):Pt=t[47];let Ft;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ft={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[48]=Ft):Ft=t[48];let It;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(It={canDrag:Mt,canDrop:Mt,onDropComplete:e=>Ze.current(e),onDropError:IX},t[49]=It):It=t[49];let Lt,Rt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Lt={canRename:Mt,onRename:e=>Ye.current(e),onError:e=>Xe.current(e)},Rt=e=>Je.current(e),t[50]=Lt,t[51]=Rt):(Lt=t[50],Rt=t[51]);let zt;t[52]===i?zt=t[53]:(zt={paths:Nt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...iJ,icons:Pt,unsafeCSS:nX,composition:Ft,dragAndDrop:It,renaming:Lt,onSelectionChange:Rt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=le.current.find(e=>dl(e)&&Iu(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:HY,title:i(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return rX(t.path)?{icon:UY,title:i({id:`i9toLO`})}:null}let n=le.current.find(e=>cl(e)&&Pu(e.path)===Pu(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:HY,title:i(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[52]=i,t[53]=zt);let{model:Bt}=rJ(zt),Vt;t[54]===Bt?Vt=t[55]:(Vt=function(e){let t=Bt.getItem(e)??Bt.getItem(Pu(e));return t?.isDirectory()?Pu(Hu(t.getPath())):e},t[54]=Bt,t[55]=Vt);let Ht=Vt,Ut,Wt;t[56]===A?(Ut=t[57],Wt=t[58]):(Wt=Cu(A),Ut=vu(Wt),t[56]=A,t[57]=Ut,t[58]=Wt);let Gt=Ut,Kt=(0,Q.useRef)(Wt),qt;t[59]===A?qt=t[60]:(qt=Mu(A),t[59]=A,t[60]=qt);let Jt=qt,Yt=(0,Q.useRef)(Jt),Xt=yt?Fu(Pu(yt)).slice(0,-1):Fu(St??bt),Qt=Xt.join(`\0`),$t;t[61]===Bt?$t=t[62]:($t=()=>{let e=new Set;for(let t of Yt.current)$J(Bt.getItem(t))?.isExpanded()&&e.add(t);return e},t[61]=Bt,t[62]=$t);let en=$t,tn;t[63]===en?tn=t[64]:(tn=e=>{let t=new Set(Mu(e??le.current)),n=en();for(let e of be.current)n.add(e);return[...n].filter(e=>t.has(e))},t[63]=en,t[64]=tn);let nn=tn,rn;t[65]!==nn||t[66]!==Bt?(rn=e=>{let t=Cu(e??le.current);Bt.resetPaths(t,{initialExpandedPaths:nn(e)})},t[65]=nn,t[66]=Bt,t[67]=rn):rn=t[67];let on=rn,sn;t[68]!==i||t[69]!==lt?(sn=async function(e){let t=ze.current,n=new AbortController;Re.current.set(e,n);let r=await _X(Hu(e),n.signal,i({id:`8RtNI0`}),i({id:`HlmZBk`}));if(Re.current.get(e)===n&&Re.current.delete(e),n.signal.aborted||t!==ze.current)return;if(r.kind===`network-error`){lt(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,r.cause);return}if(r.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,r.title),st(r.title);return}let a=Ge.current,o=rl(r.entries,a);Fe.current.add(e),j(t=>yY(t,e,o,Ne.current)),F(null),at(),r.truncated&&V(r.entries.length)},t[68]=i,t[69]=lt,t[70]=sn):sn=t[70];let cn=sn,ln;t[71]!==en||t[72]!==cn?(ln=()=>{let e=en(),t=He.current;He.current=e;for(let n of e){if(t.has(n)||Fe.current.has(n)||Re.current.has(n))continue;let e=Hu(n);le.current.find(t=>cl(t)&&t.path===e)?.hasChildren!==!1&&cn(n)}},t[71]=en,t[72]=cn,t[73]=ln):ln=t[73];let un=ln,dn;t[74]!==en||t[75]!==cn?(dn=()=>{for(let e of en())Fe.current.has(e)||Re.current.has(e)||cn(e)},t[74]=en,t[75]=cn,t[76]=dn):dn=t[76];let fn=dn,pn;t[77]!==Bt||t[78]!==on?(pn=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>dl(e)&&e.docName===r);if(n==null||Bt.getItem(i)==null)continue;let s=Iu(i,t.find(e=>dl(e)&&e.docName===i)?.docExt??n.docExt);Bt.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=Cl(e);if(t===``)continue;let n=e.slice(0,-t.length);Bt.getItem(n)!=null&&(Bt.getItem(e)??Bt.move(n,e),o=e,a+=1)}a!==0&&(on(t),o!=null&&Bt.focusPath(o))},t[77]=Bt,t[78]=on,t[79]=pn):pn=t[79];let mn=pn,hn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(hn=e=>{Ce.current=Au(e)},t[80]=hn):hn=t[80];let gn=hn,_n;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(_n=e=>ve.current.has(e),t[81]=_n):_n=t[81];let vn=_n,yn;t[82]!==i||t[83]!==x||t[84]!==O||t[85]!==E||t[86]!==on?(yn=async function(e){if(e.kind===`asset`||je.current!==null)return;let t=()=>{U(null),je.current=null};je.current=e.path,U(e.path),F(null);try{let n=await s(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),i({id:`dw_dUJ`}));if(!n.ok){Ss.error(n.title),on(),t();return}let r=Ie(ar,n.body,`duplicate-path`,null);if(r===null){let e=i({id:`67f-3g`});Ss.error(e),F(e),Os([`files`,`backlinks`,`graph`]),on(),t();return}for(let e of r.duplicatedDocNames)x(e);j(t=>{let n=EF(t,e,r);return on(n),gn(n),n}),Os([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?O(r.path):E(r.path)),Ss.success(r.kind===`folder`?i({id:`iilQXA`}):i({id:`A6h5b-`}),{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),Ss.error(i({id:`EBVbtP`}),{description:r}),on(),t()}},t[82]=i,t[83]=x,t[84]=O,t[85]=E,t[86]=on,t[87]=yn):yn=t[87];let bn=yn,xn=(0,Q.useRef)(bn),Sn;t[88]===bn?Sn=t[89]:(Sn=()=>{xn.current=bn},t[88]=bn,t[89]=Sn),(0,Q.useEffect)(Sn);let Cn=function(e){let t=FY(e);if(!t||IY(t))return!1;let n=Bt.getFocusedPath()??Bt.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||vn(n))return!1;let r=IY(n);if(!r)return!1;let i=Pu(t);if(!Yt.current.includes(i))return!1;let a=`${t}${r}`;return Kt.current.includes(a)?!1:(ir({sourcePath:n,destinationPath:a,isFolder:!1}),Bt.move(n,a),!0)},wn;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(wn=e=>{let t=e??xe.current;!t||xe.current!==t||(t.disposeCommitListener(),xe.current=null)},t[90]=wn):wn=t[90];let Tn=wn,En;t[91]!==i||t[92]!==Tn||t[93]!==u||t[94]!==l||t[95]!==on?(En=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,a=n.restoreLocation??r;Tn(e),r&&U(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await s(t,i({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let c=o.title,l=i({id:`YPFBfr`,values:{detail:c,kind:n,createdPath:a}});r?Ss.error(l):console.warn(`[FileTree] cleanup pending create failed: ${l}`),r&&(U(null),on());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),r){let t=e.kind,n=e.createdPath;Ss.error(i({id:`_TDESN`,values:{kind:t,createdPath:n}}))}r&&(U(null),on());return}r&&(e.kind===`file`?u(e.createdPath):l([Zt(e.createdPath)],{force:!0})),r&&j(t=>{let n=wF(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return gn(n),n}),Os([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),r&&U(null)},t[91]=i,t[92]=Tn,t[93]=u,t[94]=l,t[95]=on,t[96]=En):En=t[96];let Dn=En,On,kn;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(On=()=>()=>{let e=xe.current;e&&Se.current(e,{restoreLocation:!1,updateUi:!1}).catch(FX)},kn=[],t[97]=On,t[98]=kn):(On=t[97],kn=t[98]),(0,Q.useEffect)(On,kn);let An;t[99]!==i||t[100]!==lt?(An=()=>{let e=!0,t=null,n=dY(async function(){t?.abort();let n=new AbortController;t=n,ze.current+=1;for(let e of Re.current.values())e.abort();Re.current.clear(),Fe.current.clear();try{let t=await fetch(`/api/documents?showAll=true&dir=&depth=1`,{signal:n.signal,headers:fY});if(pY(t)){let r=Ge.current,i=!1,{entries:a,truncated:o}=await gY(t,{onBatch:t=>{if(!e||n.signal.aborted)return;let a=rl(al(t),r);a.length!==0&&(j(e=>vY(e,a)),i||(i=!0,F(null),at(),N(!1)))}});if(!e)return;let s=rl(al(a),r);j(e=>yY(e,``,s,Ne.current)),F(null),at(),V(o?a.length:null),We.current()}else{let n=await s(t,i({id:`8RtNI0`}));if(!e)return;if(!n.ok)st(n.title),V(null);else{let e=Hn.safeParse(n.body);if(!e.success)st(i({id:`HlmZBk`})),V(null);else{let t=Ge.current,n=rl(al(e.data.documents),t);j(e=>yY(e,``,n,Ne.current)),F(null),at(),V(e.data.truncated===!0?e.data.documents.length:null),We.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof mY?st(r.message):lt()),console.warn(`[FileTree] fetch failed:`,r)}e&&N(!1)},()=>t?.abort());Ke.current=()=>n.request(),n.request();let r=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,r),window.addEventListener(`visibilitychange`,r);let a=ks(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Ke.current=null,n.dispose();for(let e of Re.current.values())e.abort();Re.current.clear(),window.removeEventListener(`focus`,r),window.removeEventListener(`visibilitychange`,r),a()}},t[99]=i,t[100]=lt,t[101]=An):An=t[101];let jn;t[102]===i?jn=t[103]:(jn=[i],t[102]=i,t[103]=jn),(0,Q.useEffect)(An,jn);let Mn=(0,Q.useRef)(!0),Nn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Nn=()=>{if(Mn.current){Mn.current=!1;return}Ke.current?.()},t[104]=Nn):Nn=t[104];let Pn;t[105]===At?Pn=t[106]:(Pn=[At],t[105]=At,t[106]=Pn),(0,Q.useEffect)(Nn,Pn);let Fn,In;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Fn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=Ie(Gr,n,`workspace`,null);r&&re({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(PX),()=>{e=!1}},In=[],t[107]=Fn,t[108]=In):(Fn=t[107],In=t[108]),(0,Q.useEffect)(Fn,In);let Ln;t[109]!==nn||t[110]!==Bt||t[111]!==Gt?(Ln=()=>{if(Ce.current===Gt){Ce.current=null;return}Bt.resetPaths(Kt.current,{initialExpandedPaths:nn()})},t[109]=nn,t[110]=Bt,t[111]=Gt,t[112]=Ln):Ln=t[112];let Rn;t[113]!==Bt||t[114]!==Gt?(Rn=[Bt,Gt],t[113]=Bt,t[114]=Gt,t[115]=Rn):Rn=t[115],(0,Q.useEffect)(Ln,Rn),tY(Bt,St,Qt,Te,Gt);let zn,Bn;t[116]!==Bt||t[117]!==r?(zn=()=>{if(!r)return;let e=0,t=0,n=()=>qe.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,i=()=>{let e=n();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&r(t)},a=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(i)},o=new MutationObserver(i),s=()=>{let e=n();e?(o.observe(e,{attributes:!0,attributeFilter:[`style`]}),i()):t=requestAnimationFrame(s)};s();let c=Bt.subscribe(a);return window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),o.disconnect(),c(),window.removeEventListener(`resize`,a)}},Bn=[r,Bt],t[116]=Bt,t[117]=r,t[118]=zn,t[119]=Bn):(zn=t[118],Bn=t[119]),(0,Q.useEffect)(zn,Bn);let Vn;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=()=>{ae(!1)},t[120]=Vn):Vn=t[120];let Wn;t[121]===xt?Wn=t[122]:(Wn=[xt],t[121]=xt,t[122]=Wn),(0,Q.useEffect)(Vn,Wn);let Gn,Kn;t[123]===ie?(Gn=t[124],Kn=t[125]):(Gn=()=>{oe.current=ie;for(let e of ce.current)e()},Kn=[ie],t[123]=ie,t[124]=Gn,t[125]=Kn),(0,Q.useEffect)(Gn,Kn);let qn;t[126]!==St||t[127]!==M||t[128]!==Bt?(qn=()=>{M||!St||IJ(Bt)},t[126]=St,t[127]=M,t[128]=Bt,t[129]=qn):qn=t[129];let Jn;t[130]!==Qt||t[131]!==St||t[132]!==M||t[133]!==Bt||t[134]!==Gt?(Jn=[St,Qt,Gt,M,Bt],t[130]=Qt,t[131]=St,t[132]=M,t[133]=Bt,t[134]=Gt,t[135]=Jn):Jn=t[135],(0,Q.useEffect)(qn,Jn);let Yn,Xn;t[136]===Bt?(Yn=t[137],Xn=t[138]):(Yn=()=>Bt.subscribe(()=>{if(!Bt.isSearchOpen())for(let e of be.current){let t=$J(Bt.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Xn=[Bt],t[136]=Bt,t[137]=Yn,t[138]=Xn),(0,Q.useEffect)(Yn,Xn);let Zn,Qn;t[139]===Bt?(Zn=t[140],Qn=t[141]):(Zn=()=>Bt.subscribe(()=>Ue.current()),Qn=[Bt],t[139]=Bt,t[140]=Zn,t[141]=Qn),(0,Q.useEffect)(Zn,Qn);let $n,er;t[142]===Bt?($n=t[143],er=t[144]):($n=()=>Bt.onMutation(`remove`,e=>{let t=xe.current;!t||e.path!==t.renamePath||Se.current(t)}),er=[Bt],t[142]=Bt,t[143]=$n,t[144]=er),(0,Q.useEffect)($n,er);let nr;t[145]!==x||t[146]!==d||t[147]!==f||t[148]!==me||t[149]!==O||t[150]!==E||t[151]!==p||t[152]!==mn||t[153]!==v?(nr=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??he.current,l=new Map,u=new Map;for(let e of le.current){if(dl(e)){let t=o.find(t=>t.fromPath===Iu(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(il(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&xl(t)&&u.set(e.path,Su(t))}}let h=c?l.get(c)??null:null,g=r?.folderPath??(Qe.current?.kind===`folder`?Qe.current.folderPath:null),_=g?m(g,a):null,y=r?.assetPath??(Qe.current?.kind===`asset`?Qe.current.assetPath:null),b=y?u.get(y)??null:null,S=h?null:b??DF(c,e),C=h??(y?b?null:o.find(e=>e.fromPath===y)?.toPath??m(y,a):null);it(e);let w=[...OF(e,f(),p),...l.keys()];await Promise.all(w.map(e=>d(e)));for(let t of e)x(t.toDocName);for(let e of u.values())x(e);v(e,a,o);let T=null;j(t=>{let n=CF(t,e,a,o,s);return T=n,mn(t,n,e,o),gn(n),n}),g&&_&&_!==g?O(_):S&&S!==c?(E(S),LY(S)):C&&(h||C!==y)&&me(C,T??le.current),Os([`files`,`backlinks`,`graph`])},t[145]=x,t[146]=d,t[147]=f,t[148]=me,t[149]=O,t[150]=E,t[151]=p,t[152]=mn,t[153]=v,t[154]=nr):nr=t[154];let rr=nr;async function ir(e){let t=!e.isFolder&&vn(e.sourcePath),n=t?e.sourcePath:Du(e.sourcePath,e.isFolder);U(n),F(null);try{let r=Sl(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!xl(r.destinationPath),o=t||a?r.destinationPath:Du(r.destinationPath,e.isFolder),c=e.isFolder?{kind:`folder`,fromPath:Hu(n),toPath:Hu(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:Su(n),toPath:o},l={docName:he.current,folderPath:Qe.current?.kind===`folder`?Qe.current.folderPath:null,assetPath:Qe.current?.kind===`asset`?Qe.current.assetPath:null},u=await s(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`gijbne`}));if(!u.ok){Ss.error(u.title),on();let e=xe.current;e&&e.renamePath===n?await Dn(e):Tn(),U(null);return}let d=Ie(Nr,u.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await rr(d.renamed,e.isFolder?[{fromPath:Hu(n),toPath:Hu(o)}]:[],d.renamedAssets,l,!e.isFolder&&!t&&!a?d.renamed.flatMap(e=>{let t=Cl(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:d.renamed.length,renamedAssetCount:d.renamedAssets.length}),Ss.error(i({id:`dDpCOp`}))}Tn(),U(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=i({id:`HIb0vl`});Ss.error(t),F(t),on();let r=xe.current;r&&r.renamePath===n?await Dn(r):Tn(),U(null)}}let sr;t[155]!==i||t[156]!==rr||t[157]!==on?(sr=async function(e){let t=e.draggedPaths.map(t=>{let n=Ou(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(NX);if(t.length!==0){U(t[0]?.sourcePath??null),F(null);try{let e=[],n=[],r=[],a={docName:he.current,folderPath:Qe.current?.kind===`folder`?Qe.current.folderPath:null,assetPath:Qe.current?.kind===`asset`?Qe.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&vn(a.sourcePath),c=t?{kind:`folder`,fromPath:Hu(a.sourcePath),toPath:Hu(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:Su(a.sourcePath),toPath:Su(a.destinationTreePath)},l=await s(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`dOHMA0`}));if(!l.ok){Ss.error(l.title),on(),U(null);return}let u=Ie(Nr,l.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(u.renamed),n=n.concat(u.renamedAssets),t&&r.push({fromPath:Hu(a.sourcePath),toPath:Hu(a.destinationTreePath)})}try{await rr(e,r,n,a)}catch(r){console.warn(`[FileTree] post-move reconciliation failed`,{err:r,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),Ss.error(i({id:`8OxKZy`}))}U(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Ss.error(i({id:`HIb0vl`})),on(),U(null)}}},t[155]=i,t[156]=rr,t[157]=on,t[158]=sr):sr=t[158];let cr=sr,lr;t[159]!==i||t[160]!==x||t[161]!==on?(lr=async function(e,t,n){if(e.length===0||je.current!==null)return;let r=()=>{je.current=null,U(null)};je.current=n,U(n),F(null);let a=[],o=0,c=0;for(let n of e){let e=new FormData;e.append(`file`,n),Lu(e,t,n.name||`upload`);try{let r=await s(await fetch(`/api/upload`,{method:`POST`,body:e}),i({id:`4Gz2wC`}));if(!r.ok){c+=1,Ss.error(r.title,{description:n.name});continue}let l=Ie(or,r.body,`upload:drop`,null);if(l===null){c+=1,Ss.error(i({id:`4Gz2wC`}),{description:n.name});continue}let u=Bu(t,l);if(l.deduped===!0){c+=1,Ss.error(i({id:`4sKwf6`}),{description:u});continue}o+=1;let d=Ru(u,n);d&&a.push(d)}catch(e){let t=e;c+=1,console.warn(`[FileTree] external file upload failed:`,t),Ss.error(t instanceof TypeError?i({id:`HIb0vl`}):i({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)dl(e)&&x(e.docName);j(e=>{let t=new Set(e.map(wu)),n=!1,r=[...e];for(let e of a){let i=wu(e);Ne.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(on(r),gn(r),r):e})}o>0&&(Os([`files`,`backlinks`,`graph`]),Ke.current?.(),Ss.success(Ms._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||i({id:`RSqaSd`})})),c>0&&F(o>0?Ms._({id:`yH7T4q`,values:{failedCount:c}}):i({id:`4Gz2wC`})),r()}catch(e){let t=e,n=i({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),Ss.error(n),F(n),r()}},t[159]=i,t[160]=x,t[161]=on,t[162]=lr):lr=t[162];let ur=lr,fr;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(fr=function(e){J({parentDir:e})},t[163]=fr):fr=t[163];let pr=fr,mr;t[164]!==i||t[165]!==x||t[166]!==Dn||t[167]!==Tn||t[168]!==Bt||t[169]!==O||t[170]!==E||t[171]!==on||t[172]!==Wt?(mr=async function(e,t,n){if(je.current)return;let r=xe.current;r&&Tn(r);try{let r=Nu(e,t,[...Wt,...Yt.current]);U(r.renamePath),je.current=r.renamePath;let a=window.location.hash,o;if(e===`file`){let e=xu(`file`,r.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await s(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i({id:`fJgQHX`}));if(!a.ok){Ss.error(a.title),U(null),je.current=null;return}let c=Su(e),l=Ie(dr,a.body,`create-page`,{docName:c}).docName;o=l;let u={kind:`document`,docName:l,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};x(l),j(e=>{if(e.some(e=>dl(e)&&e.docName===l))return e;let t=[...e,u];return gn(t),Ne.current.set(wu(u),Date.now()),t}),Os([`files`,`backlinks`,`graph`]),E(l)}else{let e=Hu(r.addPath),t=await s(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i({id:`K1ckLX`}));if(!t.ok){Ss.error(t.title),U(null),je.current=null;return}o=Ie(yi,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};j(e=>{if(e.some(e=>cl(e)&&e.path===o))return e;let t=[...e,n];return gn(t),Ne.current.set(wu(n),Date.now()),t}),Os([`files`]),O(o)}let c=!1,l=e=>{if(e.key!==`Enter`)return;let t=xe.current;!t||t.renamePath!==r.renamePath||queueMicrotask(()=>Tn(t))};document.addEventListener(`keydown`,l,!0),xe.current={kind:e,renamePath:r.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{c||(c=!0,document.removeEventListener(`keydown`,l,!0))}},U(null),je.current=null,Bt.add(r.addPath),Bt.startRenaming(r.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Ss.error(i({id:`S6l5dv`}));let t=xe.current;t?await Dn(t):Tn(),U(null),je.current=null,on()}},t[164]=i,t[165]=x,t[166]=Dn,t[167]=Tn,t[168]=Bt,t[169]=O,t[170]=E,t[171]=on,t[172]=Wt,t[173]=mr):mr=t[173];let hr=mr,gr;t[174]===Bt?gr=t[175]:(gr=function(e){let t=Pu(e);(0,Q.startTransition)(()=>{for(let e of Yt.current)if(e===t||e.startsWith(t)){let t=$J(Bt.getItem(e));t&&t.expand()}})},t[174]=Bt,t[175]=gr);let _r=gr,vr;t[176]===Bt?vr=t[177]:(vr=function(e){let t=Pu(e),n=new Set(be.current);(0,Q.startTransition)(()=>{for(let e of[...Yt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=$J(Bt.getItem(e));t&&t.collapse()}})},t[176]=Bt,t[177]=vr);let yr=vr,br;t[178]!==fe||t[179]!==Xt||t[180]!==o||t[181]!==c||t[182]!==_e||t[183]!==H||t[184]!==Dn||t[185]!==un||t[186]!==A||t[187]!==Jt||t[188]!==cr||t[189]!==ir||t[190]!==Ht||t[191]!==S||t[192]!==Cn||t[193]!==fn||t[194]!==At||t[195]!==Wt||t[196]!==ur?(br=()=>{le.current=A,ue.current=S,he.current=o,Qe.current=c,ve.current=_e,je.current=H,Ge.current=At,Kt.current=Wt,Yt.current=Jt,be.current=Xt,Ue.current=un,We.current=fn,Se.current=Dn,Ae.current=(e,t,n)=>{ur(e,t,n)},Je.current=e=>{if(Te.current||Ee.current||e.length!==1)return;let t=e[0];t&&(ae(!1),fe(Ht(t),A))},Xe.current=e=>{Cn(e)||Ss.error(e)},Ye.current=ir,Ze.current=cr},t[178]=fe,t[179]=Xt,t[180]=o,t[181]=c,t[182]=_e,t[183]=H,t[184]=Dn,t[185]=un,t[186]=A,t[187]=Jt,t[188]=cr,t[189]=ir,t[190]=Ht,t[191]=S,t[192]=Cn,t[193]=fn,t[194]=At,t[195]=Wt,t[196]=ur,t[197]=br):br=t[197],(0,Q.useLayoutEffect)(br);let xr,Sr;t[198]===Bt?(xr=t[199],Sr=t[200]):(xr=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||uX(e.target))return;let a=qe.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=Bt.getFocusedPath()??Bt.getSelectedPaths()[0]??null;if(!t)return;let n=Bt.getItem(t)??Bt.getItem(Pu(t)),r=n?.isDirectory()?Pu(Hu(n.getPath())):t;if(ve.current.has(r))return;xn.current(oX(r,le.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Yt.current,...Kt.current]);Te.current=!0;for(let e of u)e&&Bt.getItem(e)?.select();queueMicrotask(()=>{Te.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Sr=[Bt],t[198]=Bt,t[199]=xr,t[200]=Sr),(0,Q.useEffect)(xr,Sr);let Cr,wr;t[201]!==A.length||t[202]!==M?(Cr=()=>{if(M||A.length===0)return;let e=qe.current?.querySelector(XR)?.shadowRoot;if(!e)return;let t=MX,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},wr=[M,A.length],t[201]=A.length,t[202]=M,t[203]=Cr,t[204]=wr):(Cr=t[203],wr=t[204]),(0,Q.useEffect)(Cr,wr);let Tr,Er;t[205]!==A.length||t[206]!==M?(Tr=()=>{if(M||A.length===0)return;let e=qe.current?.querySelector(XR)?.shadowRoot;if(!e)return;let t=()=>pJ(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Er=[M,A.length],t[205]=A.length,t[206]=M,t[207]=Tr,t[208]=Er):(Tr=t[207],Er=t[208]),(0,Q.useEffect)(Tr,Er);let Dr,Or;t[209]!==A.length||t[210]!==M?(Dr=()=>{if(M||A.length===0)return;let e=qe.current?.querySelector(XR)?.shadowRoot;if(!e)return;let t=()=>jJ(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Or=[M,A.length],t[209]=A.length,t[210]=M,t[211]=Dr,t[212]=Or):(Dr=t[211],Or=t[212]),(0,Q.useEffect)(Dr,Or);let kr;t[213]===Symbol.for(`react.memo_cache_sentinel`)?(kr={folderCount:0,expandedCount:0},t[213]=kr):kr=t[213];let Ar=(0,Q.useRef)(kr),jr=(0,Q.useRef)(hr),Mr=(0,Q.useRef)(pr),Pr;t[214]===hr?Pr=t[215]:(Pr=()=>{jr.current=hr,Mr.current=pr},t[214]=hr,t[215]=Pr),(0,Q.useEffect)(Pr);let Fr,Ir;t[216]===Bt?(Fr=t[217],Ir=t[218]):(Fr=()=>({startCreating(e,t){jr.current(e,t)},startCreatingFromTemplate(e){Mr.current(e)},createFromTemplate(e,t){jr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Yt.current){let t=$J(Bt.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(be.current);(0,Q.startTransition)(()=>{for(let t of[...Yt.current].reverse()){if(e.has(t))continue;let n=$J(Bt.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Yt.current,t=0;for(let n of e)$J(Bt.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Ar.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Ar.current=i,i},isCreationTargetCleared(){return oe.current},clearCreationTarget(){ae(!0)},subscribe(e){ce.current.add(e);let t=Bt.subscribe(e);return()=>{ce.current.delete(e),t()}}}),Ir=[Bt],t[216]=Bt,t[217]=Fr,t[218]=Ir),(0,Q.useImperativeHandle)(n,Fr,Ir);let Lr;t[219]!==Tn||t[220]!==d||t[221]!==l||t[222]!==Bt?(Lr=async function(e,t,n){let r=dX(e,le.current,Yt.current),i=xe.current;i&&e.some(e=>fX(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Tn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(jX).map(AX)]);l([...[...a].map(kX),...[...o].map(OX),...[...s].map(DX)],{force:!0}),await Promise.all([...a].map(e=>d(e)));for(let t of e){let e=t.kind===`folder`?Pu(t.path):t.kind===`asset`?t.path:Iu(t.path,t.docExt);Bt.getItem(e)&&Bt.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}j(e=>{let t=wF(e,[...a],void 0,[...s]);for(let e of o)t=wF(t,[],e);return gn(t),t}),Os([`files`,`backlinks`,`graph`])},t[219]=Tn,t[220]=d,t[221]=l,t[222]=Bt,t[223]=Lr):Lr=t[223];let Rr=Lr,zr;t[224]!==i||t[225]!==Rr?(zr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;U(a.path);let o=await s(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`7JtSLi`}));if(!o.ok)return r.length>0&&await Rr(r,t,n),Ss.error(o.title),!1;let c=Ie(gi,o.body,`delete-path`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path),r.push(a)}return await Rr(r,t,n),!0},t[224]=i,t[225]=Rr,t[226]=zr):zr=t[226];let Br=zr,Vr;t[227]===Symbol.for(`react.memo_cache_sentinel`)?(Vr=async function(e,t,n){let r=[],i=[];for(let a of e){U(a.path);let e=kF(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:KJ(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[227]=Vr):Vr=t[227];let Hr=Vr,Ur;t[228]===i?Ur=t[229]:(Ur=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;try{let o=await s(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),r.push({target:a,reason:o.title});continue}let c=Ie(Un,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),r.push({target:a,reason:i({id:`r4R7AZ`})})}}if(r.length>0){let e=r.length;Ss.error(i({id:`IrB5AK`,values:{failedCount:e}}),{description:i({id:`vEJDlt`})})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[228]=i,t[229]=Ur);let Wr=Ur,Kr;t[230]!==i||t[231]!==te||t[232]!==Rr||t[233]!==Br||t[234]!==Wr||t[235]!==on||t[236]!==ne?(Kr=async function(e){let t=e.map(e=>TF(e,le.current)),n=t[0];if(!n)return;let r=te.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(r.length>0){let e=r.slice(0,3).map(EX),t=r.length>e.length?`, +${r.length-e.length} more`:``;Ss.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}U(n.path),G(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&ne){let{trashed:e,failed:n}=await Hr(t,a,ne);if(e.length>0){let t=await Wr(e);t?await Rr(e,t.deletedDocNames,t.deletedFolderPaths):await Rr(e,e.filter(TX).map(wX),e.filter(CX).map(SX))}n.length>0&&ee({failed:n,originalTargets:[...t]}),U(null)}else{let e=await Br(t);U(null),e||on()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),Ss.error(i({id:`0eHrMb`}),{description:n}),U(null),on()}},t[230]=i,t[231]=te,t[232]=Rr,t[233]=Br,t[234]=Wr,t[235]=on,t[236]=ne,t[237]=Kr):Kr=t[237];let qr=Kr,Jr;t[238]!==i||t[239]!==Br||t[240]!==on||t[241]!==K?(Jr=async function(){if(!K)return;let e=new Set(K.failed.map(xX)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(ee(null),t.length!==0){U(t[0]?.path??null);try{let e=await Br(t);U(null),e||on()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),Ss.error(i({id:`0eHrMb`}),{description:n}),U(null),on()}}},t[238]=i,t[239]=Br,t[240]=on,t[241]=K,t[242]=Jr):Jr=t[242];let Yr=Jr,Xr;t[243]!==qr||t[244]!==K?(Xr=async function(){if(!K)return;let e=new Set(K.failed.map(bX)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));ee(null),await qr(t)},t[243]=qr,t[244]=K,t[245]=Xr):Xr=t[245];let Zr=Xr,Qr=(0,Q.useRef)(qr),$r;t[246]===qr?$r=t[247]:($r=()=>{Qr.current=qr},t[246]=qr,t[247]=$r),(0,Q.useEffect)($r);let ei,ti;t[248]===Symbol.for(`react.memo_cache_sentinel`)?(ei=()=>oY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>dl(e)&&e.docName===t);Qr.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Qr.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){Qr.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),ti=[],t[248]=ei,t[249]=ti):(ei=t[248],ti=t[249]),(0,Q.useEffect)(ei,ti);let ni,ri;t[250]===Symbol.for(`react.memo_cache_sentinel`)?(ni=()=>uY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>dl(e)&&e.docName===t);xn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){xn.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),ri=[],t[250]=ni,t[251]=ri):(ni=t[250],ri=t[251]),(0,Q.useEffect)(ni,ri);let ii,ai;t[252]===Bt?(ii=t[253],ai=t[254]):(ii=()=>cY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=Iu(t,le.current.find(e=>dl(e)&&e.docName===t)?.docExt);Bt.startRenaming(n);return}if(e.kind===`folder`){Bt.startRenaming(e.folderPath);return}if(e.kind===`asset`){Bt.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),ai=[Bt],t[252]=Bt,t[253]=ii,t[254]=ai),(0,Q.useEffect)(ii,ai);let oi;t[255]===Symbol.for(`react.memo_cache_sentinel`)?(oi=function(){let e=we.current;e&&NY(e),we.current=null},t[255]=oi):oi=t[255];let si=oi,ci;t[256]===_?ci=t[257]:(ci=function(e){let t=KX(e.nativeEvent);if(!t||t.endsWith(`/`)){si();return}let n=Su(t),r=le.current.find(e=>wu(e)===t);if(r&&il(r)){si();return}if(r&&dl(r)&&xi(r.size)){si();return}we.current!==n&&(si(),we.current=n,MY(n,e=>_(e)))},t[256]=_,t[257]=ci);let li=ci,ui;t[258]!==fe||t[259]!==Bt||t[260]!==O?(ui=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=qX(e.nativeEvent);if(!t){XX(e.nativeEvent)&&ae(!0);return}if(t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?Pu(n):n;if(Bt.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=Hu(r);if(window.location.hash===hl(e))return;queueMicrotask(()=>O(e));return}let i=Su(r);window.location.hash!==Jc(i)&&queueMicrotask(()=>fe(r))},t[258]=fe,t[259]=Bt,t[260]=O,t[261]=ui):ui=t[261];let di=ui,fi;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(fi=function(e){ju(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,et(!0))},t[262]=fi):fi=t[262];let pi=fi,mi;t[263]===Symbol.for(`react.memo_cache_sentinel`)?(mi=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||et(!1)},t[263]=mi):mi=t[263];let hi=mi,_i;t[264]===ur?_i=t[265]:(_i=function(e){if(!ju(e.nativeEvent))return;let t=Tu(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),et(!1),ur(t,``,QY))},t[264]=ur,t[265]=_i);let vi=_i;if(M){let e;return t[266]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(QX,{}),t[266]=e):e=t[266],e}let bi;t[267]!==i||t[268]!==I||t[269]!==R?(bi=I?i(R?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[267]=i,t[268]=I,t[269]=R,t[270]=bi):bi=t[270];let Si=bi;if(A.length===0){if(Si!==null){let e;return t[271]===Si?e=t[272]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:Si})}),t[271]=Si,t[272]=e),e}if(P){let e;return t[273]===P?e=t[274]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:P})}),t[273]=P,t[274]=e),e}let e;t[275]===i?e=t[276]:(e=i({id:`5ZB7XC`}),t[275]=i,t[276]=e);let n=$e&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,r;t[277]===n?r=t[278]:(r=wi(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[277]=n,t[278]=r);let a;t[279]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(Y,{id:`xiv-dW`})}),t[279]=a):a=t[279];let o;t[280]===hr?o=t[281]:(o=()=>hr(`file`,``),t[280]=hr,t[281]=o);let s;t[282]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`6ibbCg`}),t[282]=s):s=t[282];let c;t[283]===o?c=t[284]:(c=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[283]=o,t[284]=c);let l;return t[285]!==vi||t[286]!==e||t[287]!==r||t[288]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:r,onDragOver:pi,onDragLeave:hi,onDrop:vi,children:[a,c]}),t[285]=vi,t[286]=e,t[287]=r,t[288]=c,t[289]=l):l=t[289],l}let Ci=H!==null,Ti=W?.targets[0]??null,Ei=null;if(B!==null){let e;if(t[290]!==a.locale||t[291]!==B){let n=new Intl.NumberFormat(a.locale).format(B);e=Ms._({id:`LuoJWu`,values:{truncatedShownCount:B,formattedCount:n}}),t[290]=a.locale,t[291]=B,t[292]=e}else e=t[292];Ei=e}let Di;t[293]!==P||t[294]!==Si||t[295]!==Ei?(Di=(P||Si!==null||Ei!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[Si===null?P&&(0,Z.jsx)(eZ,{kind:`error`,children:P}):(0,Z.jsx)(eZ,{kind:`reconnecting`,children:Si}),Ei!==null&&(0,Z.jsx)(eZ,{kind:`info`,children:Ei})]}),t[293]=P,t[294]=Si,t[295]=Ei,t[296]=Di):Di=t[296];let Oi;t[297]===b?Oi=t[298]:(Oi=cJ(b),t[297]=b,t[298]=Oi);let ki=ie?``:void 0,Ai;t[299]===ki?Ai=t[300]:(Ai={[tX]:ki},t[299]=ki,t[300]=Ai);let ji;t[301]!==Ci||t[302]!==_e||t[303]!==yr||t[304]!==A||t[305]!==_r||t[306]!==Jt||t[307]!==bn||t[308]!==Et||t[309]!==kt||t[310]!==Bt||t[311]!==Dt||t[312]!==Ot||t[313]!==hr||t[314]!==ne?(ji=(e,t)=>(0,Z.jsx)(pX,{item:e,context:t,anyActionBusy:Ci,workspace:ne,handoff:Et,model:Bt,okignoreBinding:Dt,projectLocalBinding:Ot,mergedConfig:kt,onStartCreating:hr,onCreateFromTemplate:(e,t)=>hr(`file`,e,{template:t}),onDuplicate:bn,onDelete:e=>G({targets:e}),onExpandSubtree:_r,onCollapseSubtree:yr,folderTreePaths:Jt,isAsset:_e.has(e.path),documents:A}),t[301]=Ci,t[302]=_e,t[303]=yr,t[304]=A,t[305]=_r,t[306]=Jt,t[307]=bn,t[308]=Et,t[309]=kt,t[310]=Bt,t[311]=Dt,t[312]=Ot,t[313]=hr,t[314]=ne,t[315]=ji):ji=t[315];let Mi;t[316]!==di||t[317]!==li||t[318]!==Bt||t[319]!==Di||t[320]!==Oi||t[321]!==Ai||t[322]!==ji?(Mi=(0,Z.jsx)(`div`,{ref:qe,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(nJ,{header:Di,model:Bt,style:Oi,...Ai,onClickCapture:di,onMouseMove:li,onMouseLeave:si,renderContextMenu:ji})}),t[316]=di,t[317]=li,t[318]=Bt,t[319]=Di,t[320]=Oi,t[321]=Ai,t[322]=ji,t[323]=Mi):Mi=t[323];let Ni=!!W,Pi;t[324]===H?Pi=t[325]:(Pi=e=>{!e&&!H&&G(null)},t[324]=H,t[325]=Pi);let Fi;t[326]!==i||t[327]!==H||t[328]!==W||t[329]!==qr||t[330]!==Ti?(Fi=W&&Ti&&(0,Z.jsx)(wo,{...(()=>{let e=HJ(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,W.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(yX)}):null};let t=W.targets.length,n=Ti.name;return{itemName:t===1?Ti.kind===`folder`?`${Ti.name}/`:Ti.kind===`file`?`${Ti.name}${Ti.docExt??`.md`}`:Ti.name:void 0,customTitle:t>1?i({id:`abiHje`}):void 0,customDescription:t>1?i({id:`WMIKXK`,values:{targetCount:t}}):Ti.kind===`folder`?i({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:H!==null,onDelete:()=>qr(W.targets)}),t[326]=i,t[327]=H,t[328]=W,t[329]=qr,t[330]=Ti,t[331]=Fi):Fi=t[331];let Ii;t[332]!==Ni||t[333]!==Pi||t[334]!==Fi?(Ii=(0,Z.jsx)(Ya,{open:Ni,onOpenChange:Pi,children:Fi}),t[332]=Ni,t[333]=Pi,t[334]=Fi,t[335]=Ii):Ii=t[335];let Ri=!!K,zi;t[336]===H?zi=t[337]:(zi=e=>{!e&&!H&&ee(null)},t[336]=H,t[337]=zi);let Bi;t[338]!==H||t[339]!==Yr||t[340]!==Zr||t[341]!==K?(Bi=K&&(0,Z.jsx)(XJ,{failedTargets:K.failed,isSubmitting:H!==null,onDeletePermanently:Yr,onRetry:Zr,onCancel:()=>ee(null)}),t[338]=H,t[339]=Yr,t[340]=Zr,t[341]=K,t[342]=Bi):Bi=t[342];let Vi;t[343]!==Ri||t[344]!==zi||t[345]!==Bi?(Vi=(0,Z.jsx)(Ya,{open:Ri,onOpenChange:zi,children:Bi}),t[343]=Ri,t[344]=zi,t[345]=Bi,t[346]=Vi):Vi=t[346];let Hi=q!==null,Ui;t[347]===Symbol.for(`react.memo_cache_sentinel`)?(Ui=e=>{e||J(null)},t[347]=Ui):Ui=t[347];let Wi=q?.parentDir??``,Gi;t[348]!==Hi||t[349]!==Wi?(Gi=(0,Z.jsx)(wv,{open:Hi,onOpenChange:Ui,kind:`file`,initialDir:Wi,defaultToTemplate:!0}),t[348]=Hi,t[349]=Wi,t[350]=Gi):Gi=t[350];let Ki;return t[351]!==Mi||t[352]!==Ii||t[353]!==Vi||t[354]!==Gi?(Ki=(0,Z.jsxs)(Z.Fragment,{children:[Mi,Ii,Vi,Gi]}),t[351]=Mi,t[352]=Ii,t[353]=Vi,t[354]=Gi,t[355]=Ki):Ki=t[355],Ki}function yX(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:UJ(e)},`${e.kind}:${e.path}`)}function bX(e){return`${e.kind}:${e.path}`}function xX(e){return`${e.kind}:${e.path}`}function SX(e){return e.path}function CX(e){return e.kind===`folder`}function wX(e){return e.path}function TX(e){return e.kind===`file`}function EX(e){return e.file}function DX(e){return Kt(e)}function OX(e){return Zt(e)}function kX(e){return en(e)}function AX(e){return e.path}function jX(e){return e.kind===`asset`}function MX(e){return e.endsWith(`/`)?e.slice(0,-1):e}function NX(e){return!!e}function PX(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function FX(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function IX(e){Ss.error(e)}function LX(){}function RX(e){return Ss.error(e)}function zX(){}function BX(){}function VX(){}function HX(){}function UX(){}async function WX(){}function GX(e){return wu(e)}function KX(e){return qX(e)?.dataset.itemPath??null}function qX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function JX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function YX(e){let t=qX(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=Eu(e,n);return{parentDir:r,row:t,root:null,busyPath:n?Pu(r):e}}return XX(e)?{parentDir:``,row:null,root:JX(e),busyPath:QY}:null}function XX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var ZX=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function QX(){let e=(0,$.c)(5),{_:t}=an(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=ZX.map($X),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function $X(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Qi,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Qi,{className:`h-3 ${e}`})]},t)}function eZ(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?eo:n===`reconnecting`?ao:os,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=wi(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=wi(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function tZ(e){return e?Ms._({id:`wTcjov`}):null}function nZ(e){let t=(0,$.c)(23),{_:n}=an(),r=bo(),i=Oo();if(r)return null;let{input:a,installStates:o,dispatch:s}=e,c=a===null,l,u,d,f,p,m;if(t[0]!==n||t[1]!==s||t[2]!==a||t[3]!==c||t[4]!==o||t[5]!==i){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=tZ(c),r;t[12]===o?r=t[13]:(r=e=>o[e.id]?.installed===!0,t[12]=o,t[13]=r);let h=lo.filter(r),g=h.length>0,_=i!==null;if(!g&&!_){m=null;break bb0}u=RF,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(VF,{children:[(0,Z.jsx)(us,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`O7_W_a`})]}),t[14]=p):p=t[14],l=HF,d=_?(0,Z.jsxs)(LF,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(WF,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),Do.map(t=>{let{displayName:r}=Vn[t];return(0,Z.jsxs)(BF,{onSelect:()=>{a!==null&&i.launchInTerminal(a,t)},disabled:c,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(go,{id:ho(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,f=g?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(GF,{}):null,(0,Z.jsxs)(LF,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(WF,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),h.map(t=>{let r=!c,{displayName:i}=t,o=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(BF,{disabled:!r,onSelect:()=>{a&&s(t.id,a)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":o,children:[(0,Z.jsx)(go,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null}t[0]=n,t[1]=s,t[2]=a,t[3]=c,t[4]=o,t[5]=i,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[15]!==l||t[16]!==d||t[17]!==f?(h=(0,Z.jsxs)(l,{children:[d,f]}),t[15]=l,t[16]=d,t[17]=f,t[18]=h):h=t[18];let g;return t[19]!==u||t[20]!==p||t[21]!==h?(g=(0,Z.jsxs)(u,{children:[p,h]}),t[19]=u,t[20]=p,t[21]=h,t[22]=g):g=t[22],g}async function rZ(e){try{let t=await e.project.listRecent(),n=e.config.projectPath;return t.some(e=>e.path!==n)?!1:await RD()===0}catch(e){return console.warn(`[onboarding-card-visible] fresh-project probe failed; suppressing card`,e),!1}}function iZ(e){let t=(0,$.c)(4),n=e===void 0?ag:e,{initialized:r,dismissed:i,completed:a}=(0,Q.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),o=i||a,s=!r&&!o,c,l;return t[0]!==s||t[1]!==n?(c=()=>{if(!s)return;let e=window.okDesktop;if(e==null)return;let t=!1;return rZ(e).then(e=>{!t&&e&&n.activate()}),()=>{t=!0}},l=[s,n],t[0]=s,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),(0,Q.useEffect)(c,l),r&&!o}function aZ(e){let t=(0,$.c)(3),n=e===void 0?ag:e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{if(n.getSnapshot().steps.file)return;let e=ks(e=>{e.includes(`files`)&&zD(n)});return zD(n),e},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i)}var oZ=3,sZ=5200,cZ=1500,lZ=220;function uZ(e){let t=(0,$.c)(14),{complete:n,label:r,shortcutId:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(nc,{checked:n,disabled:!0,"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none opacity-100 disabled:opacity-100`}),t[0]=n,t[1]=a);let o=n?`flex-1 text-muted-foreground/60`:`flex-1`,s;t[2]===n?s=t[3]:(s=n?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[(0,Z.jsx)(Y,{id:`Qj4RL5`}),` `]}):null,t[2]=n,t[3]=s);let c;t[4]!==r||t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(`span`,{className:o,children:[s,r]}),t[4]=r,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===i?l=t[9]:(l=i?(0,Z.jsx)(wt,{children:Tl(i)}):null,t[8]=i,t[9]=l);let u;return t[10]!==a||t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`li`,{className:`flex items-center gap-2 py-0.5 text-sm`,children:[a,c,l]}),t[10]=a,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function dZ(e){let t=(0,$.c)(24),{store:n,lingerMs:r}=e,i=n===void 0?ag:n,a=r===void 0?sZ:r,{_:o}=an(),{steps:s}=og(i);aZ(i);let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(!1),f=1+ +!!s.file+ +!!s.askedAi,p=f===oZ,m,h;t[0]!==p||t[1]!==a?(m=()=>{if(!p)return;l(pZ);let e=setInterval(()=>l(fZ),cZ),t=setTimeout(()=>{clearInterval(e),d(!0)},a);return()=>{clearInterval(e),clearTimeout(t)}},h=[p,a],t[0]=p,t[1]=a,t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g,_;t[4]!==u||t[5]!==i?(g=()=>{if(!u)return;let e=setTimeout(()=>i.markCompleted(),lZ);return()=>clearTimeout(e)},_=[u,i],t[4]=u,t[5]=i,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v;t[8]!==o||t[9]!==p?(v=p?o({id:`7jIIFX`}):``,t[8]=o,t[9]=p,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==p||t[14]!==c||t[15]!==f||t[16]!==u||t[17]!==s.askedAi||t[18]!==s.file||t[19]!==i?(b=p?(0,Z.jsxs)(`section`,{"aria-hidden":!0,className:wi(`mx-2 mb-1 flex items-center gap-3 rounded-lg border bg-card px-4 py-3 text-card-foreground`,`motion-reduce:animate-none motion-reduce:duration-0`,u?`animate-out fade-out-0 zoom-out-95 fill-mode-forwards duration-200`:`animate-in fade-in-0 zoom-in-95 duration-300`),children:[(0,Z.jsx)(pT,{size:36,celebrateSignal:c}),(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`7jIIFX`})})]}):(0,Z.jsxs)(`section`,{"aria-labelledby":`onboarding-card-heading`,className:`mx-2 mb-1 rounded-lg border bg-card px-4 py-3 text-card-foreground`,children:[(0,Z.jsxs)(`header`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsx)(`h2`,{id:`onboarding-card-heading`,className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`Y1QMlM`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/60 text-xs tabular-nums`,children:`${f} / ${oZ}`})]}),(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(uZ,{complete:!0,label:(0,Z.jsx)(Y,{id:`4E9jPa`})}),(0,Z.jsx)(uZ,{complete:s.file,label:(0,Z.jsx)(Y,{id:`6ibbCg`}),shortcutId:`new-item`}),(0,Z.jsx)(uZ,{complete:s.askedAi,label:(0,Z.jsx)(Y,{id:`xWEvuo`}),shortcutId:`open-ask-ai`})]}),(0,Z.jsx)(`footer`,{className:`-mb-1 mt-2 flex justify-end`,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto px-2 py-1 text-muted-foreground text-xs`,onClick:()=>i.dismiss(),children:(0,Z.jsx)(Y,{id:`1QfxQT`})})})]}),t[13]=p,t[14]=c,t[15]=f,t[16]=u,t[17]=s.askedAi,t[18]=s.file,t[19]=i,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function fZ(e){return e+1}function pZ(e){return e+1}function mZ(){let e=(0,$.c)(1);if(!iZ())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(dZ,{}),e[0]=t):t=e[0],t}function hZ(e){return e===null?null:e.kind===`local`?e.name:e.ref}function gZ(e,t){if(e.length===0)return null;let n=`origin/${e}`;return t.includes(n)?n:t.find(t=>pr(t)===e)??null}function _Z(e){switch(e){case`branch-exists`:return{id:`wzq9Rv`};case`already-checked-out`:return{id:`ljHjfg`};case`path-exists`:return{id:`mYzDD_`};case`invalid-branch`:return{id:`r-OJYm`};case`no-git`:return{id:`CFnavk`};default:return{id:`-zA2E7`}}}function vZ(e){let t=(0,$.c)(71),{open:n,onOpenChange:r,bridge:i,currentBranch:a,branches:s,existingWorktreeBranches:c,remoteBranches:l,behindByBranch:u,initialBranchName:d}=e,f=s===void 0?[]:s,p=l===void 0?[]:l,m=d===void 0?``:d,{_:h}=an(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useId)(),y=(0,Q.useId)(),b=(0,Q.useId)(),x=(0,Q.useId)(),[S,C]=(0,Q.useState)(``),T;t[0]===a?T=t[1]:(T=a===null?null:{kind:`local`,name:a},t[0]=a,t[1]=T);let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(!1),[A,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(null),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[2]!==a||t[3]!==m||t[4]!==n?(z=()=>{if(!n)return;C(m),D(a===null?null:{kind:`local`,name:a}),k(!1),M(``),P(!1),I(null);let e=requestAnimationFrame(()=>L.current?.focus());return()=>cancelAnimationFrame(e)},B=[n,a,m],t[2]=a,t[3]=m,t[4]=n,t[5]=z,t[6]=B):(z=t[5],B=t[6]),(0,Q.useEffect)(z,B);let V=S.trim(),H=!N&&V.length>0,U=V.length>0&&f.includes(V),W=U?null:gZ(V,p),G=W!==null,K=U||G,ee=U&&(c?.has(V)??!1),te=f.filter(e=>e.toLowerCase().startsWith(V.toLowerCase())),q=!N&&te.length>0&&!K,J=(a!==null&&!f.includes(a)?[a,...f]:f).map(CZ),ne=p.map(SZ),re=hZ(E),ie=A.trim().toLowerCase(),ae=ie===``?J:J.filter(e=>e.name.toLowerCase().includes(ie)),oe=ie===``?ne:ne.filter(e=>e.ref.toLowerCase().includes(ie)),se=ie!==``&&ae.length===0&&oe.length===0,ce=async function(e){if(e.preventDefault(),H){P(!0),I(null);try{let e=G?{branch:V,createBranch:!0,remoteRef:W}:U?{branch:V,createBranch:!1}:{branch:V,createBranch:!0,baseBranch:E?.kind===`local`?E.name:void 0,baseRef:E?.kind===`remote`?E.ref:void 0},t=await i.worktree.create(e);if(!t.ok){I(_Z(t.reason)),P(!1);return}iy(),r(!1),await i.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[NewWorktreeDialog] worktree create/open failed:`,e),Ss.error(h({id:`vAYoCZ`})),P(!1)}}},le=Ya,ue;t[7]!==N||t[8]!==r?(ue=e=>{N||r(e)},t[7]=N,t[8]=r,t[9]=ue):ue=t[9];let de=Ga,fe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(Y,{id:`DXd9LM`})}),t[10]=fe):fe=t[10];let pe;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsxs)(Ja,{children:[fe,(0,Z.jsx)(Ua,{children:(0,Z.jsx)(Y,{id:`NEzPEh`})})]}),t[11]=pe):pe=t[11];let me=Ka,he;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(Y,{id:`ng2Ibo`}),t[12]=he):he=t[12];let ge;t[13]===_?ge=t[14]:(ge=(0,Z.jsx)(Rc,{htmlFor:_,children:he}),t[13]=_,t[14]=ge);let _e;t[15]===h?_e=t[16]:(_e=h({id:`IX_uXB`}),t[15]=h,t[16]=_e);let ve;t[17]===F?ve=t[18]:(ve=e=>{C(e.target.value),F!==null&&I(null)},t[17]=F,t[18]=ve);let ye=F!==null,be=F===null?b:`${b} ${x}`,xe;t[19]!==S||t[20]!==N||t[21]!==_||t[22]!==_e||t[23]!==ve||t[24]!==ye||t[25]!==be?(xe=(0,Z.jsx)(Vc,{id:_,ref:L,value:S,placeholder:_e,onChange:ve,disabled:N,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-invalid":ye,"aria-describedby":be,"data-testid":`new-worktree-branch`}),t[19]=S,t[20]=N,t[21]=_,t[22]=_e,t[23]=ve,t[24]=ye,t[25]=be,t[26]=xe):xe=t[26];let Se=V.length>0?(0,Z.jsxs)(`p`,{id:b,className:`flex items-start gap-1.5 text-1sm text-muted-foreground`,"data-testid":ee?`new-worktree-mode-existing-worktree`:G?`new-worktree-mode-remote-checkout`:U?`new-worktree-mode-checkout`:`new-worktree-mode-create`,children:[ee?(0,Z.jsx)(Io,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):G?(0,Z.jsx)(Ea,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-400`}):U?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-blue-600 dark:text-blue-400`}):(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:ee?(0,Z.jsx)(Y,{id:`QAi7Q9`,values:{trimmed:V},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`})}}):G?(0,Z.jsx)(Y,{id:`oAGN8p`,values:{remoteCheckoutRef:W,trimmed:V},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}}):U?(0,Z.jsx)(Y,{id:`b4VvP-`,values:{trimmed:V},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):re===null?(0,Z.jsx)(Y,{id:`t4sFKC`,values:{trimmed:V},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(Y,{id:`dGAdpH`,values:{trimmed:V,currentBaseLabel:re},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}})})]}):null,Ce=q?(0,Z.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border bg-popover p-1 shadow-xs`,"data-testid":`new-worktree-branch-list`,children:te.map(e=>(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,onClick:()=>{C(e),F!==null&&I(null),L.current?.focus()},"data-testid":`new-worktree-branch-option-${e}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e})]},e))}):null,we=K?null:(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2`,children:[(0,Z.jsx)(Rc,{id:y,htmlFor:v,children:(0,Z.jsx)(Y,{id:`ZWwYwM`})}),(0,Z.jsxs)(w,{open:O,onOpenChange:e=>{k(e),e||M(``)},children:[(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{id:v,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":O,"aria-haspopup":`listbox`,"aria-labelledby":`${y} ${v}`,"aria-label":h({id:`ZWwYwM`}),disabled:N,"data-testid":`new-worktree-base-trigger`,className:`w-full justify-between font-normal`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[E?.kind===`remote`?(0,Z.jsx)(Ea,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:re===null?(0,Z.jsx)(Y,{id:`EbjWsS`}):re})]}),(0,Z.jsx)(md,{"aria-hidden":`true`,className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,Z.jsxs)(Tt,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,onWheel:xZ,onTouchMove:bZ,onOpenAutoFocus:e=>{e.preventDefault(),R.current?.focus()},children:[(0,Z.jsxs)(IE,{className:`mb-1 h-8`,children:[(0,Z.jsx)(VE,{ref:R,"aria-label":h({id:`fuJZKk`}),placeholder:h({id:`hQXiDc`}),value:A,onChange:e=>M(e.target.value),onKeyDown:yZ,"data-testid":`new-worktree-base-search`}),(0,Z.jsx)(RE,{children:(0,Z.jsx)(o,{"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{role:`listbox`,"aria-label":h({id:`ZWwYwM`}),className:`max-h-56 overflow-y-auto`,"data-testid":`new-worktree-base-list`,children:[se?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Sh3Qkg`})}):null,ae.map(e=>{let t=e.name,n=u?.get(t);return(0,Z.jsxs)(X,{type:`button`,role:`option`,"aria-selected":E?.kind===`local`&&E.name===t,variant:`ghost`,size:`sm`,onClick:()=>{D(e),k(!1),M(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),n!==void 0&&n>0?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,"data-testid":`new-worktree-base-behind-${t}`,children:(0,Z.jsx)(Y,{id:`6-wLTJ`,values:{behind:n}})}):null]},`local:${t}`)}),oe.map(e=>{let t=e.ref;return(0,Z.jsxs)(X,{type:`button`,role:`option`,"aria-selected":E?.kind===`remote`&&E.ref===t,variant:`ghost`,size:`sm`,onClick:()=>{D(e),k(!1),M(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Ea,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`dIYSqk`})})]},`remote:${t}`)})]})]})]})]}),Te;t[27]!==h||t[28]!==F||t[29]!==x?(Te=F===null?null:(0,Z.jsx)(`p`,{id:x,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`new-worktree-error`,children:h(F)}),t[27]=h,t[28]=F,t[29]=x,t[30]=Te):Te=t[30];let Ee;t[31]!==g||t[32]!==ce||t[33]!==ge||t[34]!==xe||t[35]!==Se||t[36]!==Ce||t[37]!==we||t[38]!==Te?(Ee=(0,Z.jsxs)(`form`,{id:g,onSubmit:ce,className:`flex flex-col gap-2`,children:[ge,xe,Se,Ce,we,Te]}),t[31]=g,t[32]=ce,t[33]=ge,t[34]=xe,t[35]=Se,t[36]=Ce,t[37]=we,t[38]=Te,t[39]=Ee):Ee=t[39];let De;t[40]!==me||t[41]!==Ee?(De=(0,Z.jsx)(me,{children:Ee}),t[40]=me,t[41]=Ee,t[42]=De):De=t[42];let Oe;t[43]===r?Oe=t[44]:(Oe=()=>r(!1),t[43]=r,t[44]=Oe);let ke;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[45]=ke):ke=t[45];let Ae;t[46]!==N||t[47]!==Oe?(Ae=(0,Z.jsx)(X,{type:`button`,variant:`outline`,onClick:Oe,disabled:N,"data-testid":`new-worktree-cancel`,children:ke}),t[46]=N,t[47]=Oe,t[48]=Ae):Ae=t[48];let je=!H,Me;t[49]!==N||t[50]!==ee||t[51]!==U||t[52]!==G?(Me=N?(0,Z.jsx)(Y,{id:`b4itZn`}):ee?(0,Z.jsx)(Y,{id:`XV5sC0`}):G?(0,Z.jsx)(Y,{id:`XAyxsa`}):U?(0,Z.jsx)(Y,{id:`uGaIIS`}):(0,Z.jsx)(Y,{id:`iO8V-7`}),t[49]=N,t[50]=ee,t[51]=U,t[52]=G,t[53]=Me):Me=t[53];let Ne;t[54]!==g||t[55]!==je||t[56]!==Me?(Ne=(0,Z.jsx)(X,{type:`submit`,form:g,disabled:je,"data-testid":`new-worktree-create`,children:Me}),t[54]=g,t[55]=je,t[56]=Me,t[57]=Ne):Ne=t[57];let Pe;t[58]!==Ae||t[59]!==Ne?(Pe=(0,Z.jsxs)(qa,{children:[Ae,Ne]}),t[58]=Ae,t[59]=Ne,t[60]=Pe):Pe=t[60];let Fe;t[61]!==de||t[62]!==pe||t[63]!==De||t[64]!==Pe?(Fe=(0,Z.jsxs)(de,{className:`sm:max-w-md`,"data-testid":`new-worktree-dialog`,children:[pe,De,Pe]}),t[61]=de,t[62]=pe,t[63]=De,t[64]=Pe,t[65]=Fe):Fe=t[65];let Ie;return t[66]!==le||t[67]!==n||t[68]!==Fe||t[69]!==ue?(Ie=(0,Z.jsx)(le,{open:n,onOpenChange:ue,children:Fe}),t[66]=le,t[67]=n,t[68]=Fe,t[69]=ue,t[70]=Ie):Ie=t[70],Ie}function yZ(e){return e.stopPropagation()}function bZ(e){e.stopPropagation()}function xZ(e){e.stopPropagation()}function SZ(e){return{kind:`remote`,ref:e}}function CZ(e){return{kind:`local`,name:e}}function wZ(e){let t=(0,$.c)(51),{bridge:n,recents:r,currentPath:i,query:a,worktreeModel:o,closeMenu:s,guardStaleSelect:c,flyoutPath:l,setFlyoutPath:u,openNewWorktreeWith:d}=e,{_:f}=an(),p;t[0]!==f||t[1]!==n.project||t[2]!==s?(p=function(e,t){s(),n.project.open({path:e,target:`new-window`,entryPoint:t}).catch(e=>{console.warn(`[RecentProjectsMenu] project.open failed:`,e),Ss.error(f({id:`6HCOwA`}))})},t[0]=f,t[1]=n.project,t[2]=s,t[3]=p):p=t[3];let m=p,h;t[4]!==f||t[5]!==n.project||t[6]!==n.worktree?(h=async function(e){try{let t=await n.worktree.create({branch:e,createBranch:!1});if(!t.ok){Ss.error(f({id:`teD0H9`}));return}iy(),await n.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[RecentProjectsMenu] create/open branch failed:`,e),Ss.error(f({id:`LwMxXg`}))}},t[4]=f,t[5]=n.project,t[6]=n.worktree,t[7]=h):h=t[7];let g=h,_;t[8]!==s||t[9]!==i||t[10]!==m?(_=function(e){if(e.path===i){s();return}m(e.path,e.isLinkedWorktree?`worktree`:`recents`)},t[8]=s,t[9]=i,t[10]=m,t[11]=_):_=t[11];let v=_,y;t[12]!==s||t[13]!==g||t[14]!==i||t[15]!==m?(y=function(e){if(e.path!==null){if(e.path===i){s();return}m(e.path,e.isMain?`recents`:`worktree`);return}e.branch!==null&&(s(),g(e.branch))},t[12]=s,t[13]=g,t[14]=i,t[15]=m,t[16]=y):y=t[16];let b=y;if(a!==``){let e;t[17]!==s||t[18]!==g?(e=e=>{s(),g(e)},t[17]=s,t[18]=g,t[19]=e):e=t[19];let n;return t[20]!==i||t[21]!==c||t[22]!==v||t[23]!==a||t[24]!==r||t[25]!==e||t[26]!==o?(n=(0,Z.jsx)(MZ,{recents:r,currentPath:i,query:a,worktreeModel:o,onPickEntry:v,onPickBranch:e,guardStaleSelect:c}),t[20]=i,t[21]=c,t[22]=v,t[23]=a,t[24]=r,t[25]=e,t[26]=o,t[27]=n):n=t[27],n}let x;if(t[28]!==s||t[29]!==i||t[30]!==l||t[31]!==c||t[32]!==b||t[33]!==d||t[34]!==m||t[35]!==r||t[36]!==u||t[37]!==o){let e=qm(r),n;t[39]!==s||t[40]!==i||t[41]!==l||t[42]!==c||t[43]!==b||t[44]!==d||t[45]!==m||t[46]!==u||t[47]!==o?(n=e=>(0,Z.jsx)(TZ,{group:e,currentPath:i,worktreeModel:o,flyoutOpen:l===e.project.path,setFlyoutOpen:t=>u(t?e.project.path:null),onPickProject:()=>{if(e.project.path===i){s();return}m(e.project.path,`recents`)},onPickFlyoutEntry:b,guardStaleSelect:c,openNewWorktreeWith:d},e.project.path),t[39]=s,t[40]=i,t[41]=l,t[42]=c,t[43]=b,t[44]=d,t[45]=m,t[46]=u,t[47]=o,t[48]=n):n=t[48],x=e.map(n),t[28]=s,t[29]=i,t[30]=l,t[31]=c,t[32]=b,t[33]=d,t[34]=m,t[35]=r,t[36]=u,t[37]=o,t[38]=x}else x=t[38];let S;return t[49]===x?S=t[50]:(S=(0,Z.jsx)(Z.Fragment,{children:x}),t[49]=x,t[50]=S),S}function TZ(e){let t=(0,$.c)(27),{group:n,currentPath:r,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}=e,d=n.project.path===r;if(n.worktrees.length===0){let e;t[0]!==l||t[1]!==s?(e=e=>{l(e)||s()},t[0]=l,t[1]=s,t[2]=e):e=t[2];let r=`project-switcher-recent-${n.project.path}`,i=d?`true`:void 0,a;t[3]!==n.project.name||t[4]!==n.project.path||t[5]!==d?(a=(0,Z.jsx)(FZ,{name:n.project.name,path:n.project.path,current:d}),t[3]=n.project.name,t[4]=n.project.path,t[5]=d,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==r||t[9]!==i||t[10]!==a?(o=(0,Z.jsx)(Cc,{onSelect:e,className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":r,"data-current":i,children:a}),t[7]=e,t[8]=r,t[9]=i,t[10]=a,t[11]=o):o=t[11],o}let f;t[12]!==r||t[13]!==n.worktrees||t[14]!==d?(f=d||n.worktrees.some(e=>e.path===r),t[12]=r,t[13]=n.worktrees,t[14]=d,t[15]=f):f=t[15];let p=f,m;return t[16]!==p||t[17]!==r||t[18]!==a||t[19]!==n||t[20]!==l||t[21]!==c||t[22]!==s||t[23]!==u||t[24]!==o||t[25]!==i?(m=(0,Z.jsx)(EZ,{group:n,currentPath:r,containsCurrent:p,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}),t[16]=p,t[17]=r,t[18]=a,t[19]=n,t[20]=l,t[21]=c,t[22]=s,t[23]=u,t[24]=o,t[25]=i,t[26]=m):m=t[26],m}function EZ(e){let t=(0,$.c)(56),{group:n,currentPath:r,containsCurrent:i,worktreeModel:a,flyoutOpen:o,setFlyoutOpen:s,onPickProject:c,onPickFlyoutEntry:l,guardStaleSelect:u,openNewWorktreeWith:d}=e,{_:f}=an(),p=n.project.path===r,m;t[0]!==u||t[1]!==c?(m=e=>{u(e)||c()},t[0]=u,t[1]=c,t[2]=m):m=t[2];let h;t[3]!==o||t[4]!==s?(h=e=>{e.key===`ArrowRight`?(e.preventDefault(),s(!0)):(e.key===`ArrowLeft`||e.key===`Escape`)&&o&&(e.preventDefault(),e.stopPropagation(),s(!1))},t[3]=o,t[4]=s,t[5]=h):h=t[5];let g=`project-switcher-group-${n.project.path}`,_=o?`true`:void 0,v=i?`true`:void 0,y;t[6]===n.project.name?y=t[7]:(y=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n.project.name,children:n.project.name}),t[6]=n.project.name,t[7]=y);let b;t[8]===n.project.path?b=t[9]:(b=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:n.project.path,children:n.project.path}),t[8]=n.project.path,t[9]=b);let x;t[10]!==y||t[11]!==b?(x=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[y,b]}),t[10]=y,t[11]=b,t[12]=x):x=t[12];let S;t[13]!==f||t[14]!==p?(S=p?(0,Z.jsx)(Ha,{"aria-label":f({id:`Hp1l6f`}),className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}):null,t[13]=f,t[14]=p,t[15]=S):S=t[15];let C;t[16]!==f||t[17]!==o?(C=f(o?{id:`Aj1D9r`}:{id:`UaRsDu`}),t[16]=f,t[17]=o,t[18]=C):C=t[18];let T;t[19]===s?T=t[20]:(T=()=>{s(!0)},t[19]=s,t[20]=T);let E=`project-switcher-toggle-${n.project.path}`,D;t[21]===n.worktrees.length?D=t[22]:(D=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:n.worktrees.length}),t[21]=n.worktrees.length,t[22]=D);let O;t[23]===n.worktrees.length?O=t[24]:(O=(0,Z.jsx)(Y,{id:`ij5sBu`,values:{0:n.worktrees.length}}),t[23]=n.worktrees.length,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsxs)(`span`,{className:`text-xs`,children:[D,` `,O]}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Qa,{"aria-hidden":`true`,className:`size-3.5`}),t[28]=A):A=t[28];let M;t[29]!==o||t[30]!==C||t[31]!==T||t[32]!==E||t[33]!==k?(M=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,"aria-label":C,"aria-expanded":o,onMouseDown:OZ,onClick:DZ,onMouseEnter:T,"data-testid":E,className:`-my-1 -mr-1 h-auto shrink-0 gap-1 rounded-md px-1.5 py-1 text-muted-foreground hover:bg-accent-foreground/15 hover:text-foreground hover:ring-1 hover:ring-border hover:ring-inset`,children:[k,A]})}),t[29]=o,t[30]=C,t[31]=T,t[32]=E,t[33]=k,t[34]=M):M=t[34];let N;t[35]!==m||t[36]!==M||t[37]!==h||t[38]!==g||t[39]!==_||t[40]!==v||t[41]!==x||t[42]!==S?(N=(0,Z.jsxs)(Cc,{onSelect:m,onKeyDown:h,className:`flex w-full min-w-0 items-start gap-2`,"data-testid":g,"data-flyout-open":_,"data-current":v,children:[x,S,M]}),t[35]=m,t[36]=M,t[37]=h,t[38]=g,t[39]=_,t[40]=v,t[41]=x,t[42]=S,t[43]=N):N=t[43];let P;t[44]!==r||t[45]!==n||t[46]!==u||t[47]!==l||t[48]!==d||t[49]!==a?(P=(0,Z.jsx)(kZ,{group:n,currentPath:r,worktreeModel:a,onPickFlyoutEntry:l,guardStaleSelect:u,openNewWorktreeWith:d}),t[44]=r,t[45]=n,t[46]=u,t[47]=l,t[48]=d,t[49]=a,t[50]=P):P=t[50];let F;return t[51]!==o||t[52]!==s||t[53]!==N||t[54]!==P?(F=(0,Z.jsxs)(w,{open:o,onOpenChange:s,children:[N,P]}),t[51]=o,t[52]=s,t[53]=N,t[54]=P,t[55]=F):F=t[55],F}function DZ(e){e.stopPropagation()}function OZ(e){e.stopPropagation()}function kZ(e){let t=(0,$.c)(11),{group:n,currentPath:r,worktreeModel:i,onPickFlyoutEntry:a,guardStaleSelect:s,openNewWorktreeWith:c}=e,{_:l}=an(),[u,d]=(0,Q.useState)(``),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=function(){let e=p.current;return e===null?[]:[...e.querySelectorAll(`[role="menuitem"]`)]},h=function(e){m()[e]?.focus()},g=function(e,t){if(e.key===`ArrowDown`){e.preventDefault();let t=m(),n=t.indexOf(e.currentTarget);h(Math.min(n+1,t.length-1))}else if(e.key===`ArrowUp`){e.preventDefault();let t=m().indexOf(e.currentTarget);t<=0?f.current?.focus():h(t-1)}else e.key===`Enter`&&(e.preventDefault(),t())},_=Wm(n,i,r),v=u.trim().toLowerCase(),y=v===``?_:_.filter(e=>(e.branch??``).toLowerCase().includes(v)),b=i!==null&&i.mainRoot===n.project.mainRoot,x=u.trim(),S=b&&x.length>0,C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e.preventDefault(),f.current?.focus()},t[0]=C):C=t[0];let w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(RE,{align:`inline-start`,children:(0,Z.jsx)(o,{"aria-hidden":`true`})}),t[1]=w):w=t[1];let T;t[2]===l?T=t[3]:(T=l({id:`bSD4im`}),t[2]=l,t[3]=T);let E;t[4]===l?E=t[5]:(E=l({id:`Skr_7L`}),t[4]=l,t[5]=E);let D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>d(e.target.value),t[6]=D):D=t[6];let O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(RE,{align:`inline-end`,children:(0,Z.jsx)(St,{"aria-hidden":`true`})}),t[7]=O):O=t[7];let k=y.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pc,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:l({id:`-uaQnI`})}),S?(0,Z.jsxs)(Cc,{onSelect:e=>{s(e)||c(x)},onKeyDown:e=>g(e,()=>c(x)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-create`,children:[(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:x,children:(0,Z.jsx)(Y,{id:`gHSAWT`,values:{typedName:x},components:{0:(0,Z.jsx)(`span`,{className:`font-medium`}),1:(0,Z.jsx)(`span`,{className:`font-mono`})}})})]}):null]}):y.map(e=>{let t=e.path??`branch:${e.branch}`,n=e.branch??l({id:`D12vtS`});return(0,Z.jsxs)(Cc,{onSelect:t=>{s(t)||a(e)},onKeyDown:t=>g(t,()=>a(e)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-entry-${t}`,"data-current":e.isCurrent?`true`:void 0,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:n,children:n}),e.isMain?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:l({id:`Bn9-El`})}):e.opened?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,title:l({id:`Dvwa0U`}),children:l({id:`nfoduq`})}),e.isCurrent?(0,Z.jsx)(IZ,{}):null]},t)}),A;return t[8]!==p||t[9]!==k?(A=(0,Z.jsx)(`div`,{ref:p,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar`,children:k}),t[8]=p,t[9]=k,t[10]=A):A=t[10],(0,Z.jsxs)(Tt,{side:`right`,align:`start`,sideOffset:4,className:`flex max-h-80 w-96 flex-col gap-1 overflow-hidden p-1`,onPointerDownOutside:jZ,onFocusOutside:AZ,onOpenAutoFocus:C,"data-testid":`project-switcher-flyout-${n.project.path}`,children:[(0,Z.jsxs)(IE,{className:`mb-1 h-8 shrink-0`,children:[w,(0,Z.jsx)(VE,{ref:f,"aria-label":T,placeholder:E,value:u,onChange:D,onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),h(0)),e.stopPropagation()},"data-testid":`project-switcher-flyout-search-${n.project.path}`}),O]}),A]})}function AZ(e){return e.preventDefault()}function jZ(e){return e.preventDefault()}function MZ(e){let t=(0,$.c)(41),{recents:n,currentPath:r,query:i,worktreeModel:a,onPickEntry:o,onPickBranch:s,guardStaleSelect:c}=e,{_:l}=an(),u;t[0]===i?u=t[1]:(u=e=>e.toLowerCase().includes(i),t[0]=i,t[1]=u);let d=u,f,p,m,h;if(t[2]!==l||t[3]!==r||t[4]!==c||t[5]!==d||t[6]!==s||t[7]!==o||t[8]!==n||t[9]!==a){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[14]===d?e=t[15]:(e=e=>!e.isLinkedWorktree&&(d(e.name)||d(e.path)),t[14]=d,t[15]=e);let i=n.filter(e),u;t[16]===d?u=t[17]:(u=e=>e.isLinkedWorktree===!0&&(d(e.branch??``)||d(e.path)),t[16]=d,t[17]=u);let g=n.filter(u),_=new Set(g.map(NZ)),v;t[18]===a?.entries?v=t[19]:(v=a?.entries??[],t[18]=a?.entries,t[19]=v);let y=v.filter(e=>e.branch!==null&&d(e.branch)&&(e.worktreePath===null||!_.has(e.worktreePath))&&e.worktreePath!==r);if(i.length===0&&g.length===0&&y.length===0){let e;t[20]===l?e=t[21]:(e=l({id:`pEQFsW`}),t[20]=l,t[21]=e);let n;t[22]===e?n=t[23]:(n=(0,Z.jsx)(Pc,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:e}),t[22]=e,t[23]=n),h=n;break bb0}let b;t[24]!==r||t[25]!==c||t[26]!==o?(b=e=>(0,Z.jsx)(Cc,{onSelect:t=>{c(t)||o(e)},className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:(0,Z.jsx)(FZ,{name:e.name,path:e.path,current:e.path===r})},e.path),t[24]=r,t[25]=c,t[26]=o,t[27]=b):b=t[27],f=i.map(b);let x;t[28]!==r||t[29]!==c||t[30]!==o?(x=e=>(0,Z.jsxs)(Cc,{onSelect:t=>{c(t)||o(e)},className:`flex items-start gap-2`,"data-testid":`project-switcher-worktree-${e.path}`,"data-current":e.path===r?`true`:void 0,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsx)(PZ,{branch:e.branch??e.name,project:e.mainRoot===void 0?null:Km(e.mainRoot)})]},e.path),t[28]=r,t[29]=c,t[30]=o,t[31]=x):x=t[31],p=g.map(x);let S;t[32]!==l||t[33]!==c||t[34]!==s||t[35]!==a?(S=e=>(0,Z.jsxs)(Cc,{onSelect:t=>{c(t)||e.branch!==null&&s(e.branch)},className:`flex items-start gap-2`,"data-testid":`project-switcher-branch-${e.branch}`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 opacity-40`}),(0,Z.jsx)(PZ,{branch:e.branch??``,project:a===null?null:Km(a.mainRoot),hint:l({id:`nfoduq`})})]},`branch:${e.branch}`),t[32]=l,t[33]=c,t[34]=s,t[35]=a,t[36]=S):S=t[36],m=y.map(S)}t[2]=l,t[3]=r,t[4]=c,t[5]=d,t[6]=s,t[7]=o,t[8]=n,t[9]=a,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;return t[37]!==f||t[38]!==p||t[39]!==m?(g=(0,Z.jsxs)(Z.Fragment,{children:[f,p,m]}),t[37]=f,t[38]=p,t[39]=m,t[40]=g):g=t[40],g}function NZ(e){return e.path}function PZ(e){let t=(0,$.c)(12),{branch:n,project:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:i}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:r,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function FZ(e){let t=(0,$.c)(15),{name:n,path:r,current:i}=e,a=i&&`font-medium`,o;t[0]===a?o=t[1]:(o=wi(`flex w-full items-center gap-1.5`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):null,t[4]=i,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(`span`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=(0,Z.jsx)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:r,children:r}),t[10]=r,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function IZ(){let e=(0,$.c)(4),{_:t}=an(),n;e[0]===t?n=e[1]:(n=t({id:`Hp1l6f`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Z.jsx)(Ha,{"aria-label":n,className:`size-3.5 shrink-0 text-muted-foreground`}),e[2]=n,e[3]=r),r}var LZ=(e,t,n)=>Pf(e,t,n,`ProjectSwitcher`),RZ=350;function zZ(e){let t=(0,$.c)(108),{bridge:n}=e,{_:r}=an(),[i,a]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(null),y=rP(),b=ay(),x=typeof window<`u`&&window.okDesktop!=null,S=(0,Q.useRef)(!1),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e&&(C.current=!0,w.current!==null&&clearTimeout(w.current),w.current=setTimeout(()=>{C.current=!1},RZ)),c(e),e||(u(``),v(null))},t[0]=T):T=t[0];let E=T,D;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>!x||!C.current?!1:(e.preventDefault(),!0),t[1]=D):D=t[1];let O=D,k;t[2]!==r||t[3]!==n.project||t[4]!==s?(k=()=>{if(!s)return;let e=!1;return LZ(async()=>{let t=await n.project.listRecent();e||a(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=s,t[5]=k):k=t[5];let A;t[6]!==r||t[7]!==n||t[8]!==s?(A=[s,n,r],t[6]=r,t[7]=n,t[8]=s,t[9]=A):A=t[9],(0,Q.useEffect)(k,A);let j,M;t[10]===n?(j=t[11],M=t[12]):(j=()=>n.onMenuAction(e=>{e===`new-worktree`?(c(!1),v(null),g(``),m(!0)):e===`switch-worktree`&&c(!0)}),M=[n],t[10]=n,t[11]=j,t[12]=M),(0,Q.useEffect)(j,M);let N;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(N=()=>{E(!1),LZ(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=N):N=t[16];let P=N,F;t[17]!==r||t[18]!==n.navigator?(F=()=>{E(!1),LZ(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=F):F=t[19];let I=F,L;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{E(!1),f(!0)},t[20]=L):L=t[20];let R=L,z;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{E(!1),g(e),m(!0)},t[21]=z):z=t[21];let B=z,V=n.config.projectPath,H;t[22]===l?H=t[23]:(H=l.trim().toLowerCase(),t[22]=l,t[23]=H);let U=H,W=U!==``,G;t[24]===i?G=t[25]:(G=i??[],t[24]=i,t[25]=G);let K=G,ee;t[26]!==W||t[27]!==K?(ee=W?K.filter(qZ):K,t[26]=W,t[27]=K,t[28]=ee):ee=t[28];let te=ee,q=W?null:b,J=y!==null&&`h-auto py-1.5`,ne;t[29]===J?ne=t[30]:(ne=wi(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,J),t[29]=J,t[30]=ne);let re;t[31]===r?re=t[32]:(re=r({id:`zZ_I5K`}),t[31]=r,t[32]=re);let ie;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ie=x?()=>{S.current=!0}:void 0,t[33]=ie):ie=t[33];let ae;t[34]===s?ae=t[35]:(ae=x?()=>{if(S.current){S.current=!1;return}E(!s)}:void 0,t[34]=s,t[35]=ae);let oe;t[36]===n.config.projectName?oe=t[37]:(oe=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[36]=n.config.projectName,t[37]=oe);let se;t[38]===y?se=t[39]:(se=y===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:y})]}),t[38]=y,t[39]=se);let ce;t[40]!==oe||t[41]!==se?(ce=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[oe,se]}),t[40]=oe,t[41]=se,t[42]=ce):ce=t[42];let le;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(md,{"aria-hidden":`true`,className:`opacity-60`}),t[43]=le):le=t[43];let ue;t[44]!==n.config.projectPath||t[45]!==ne||t[46]!==re||t[47]!==ae||t[48]!==ce?(ue=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsxs)(qN,{className:ne,"data-testid":`project-switcher-trigger`,"aria-label":re,title:n.config.projectPath,onPointerDown:ie,onClick:ae,children:[ce,le]})}),t[44]=n.config.projectPath,t[45]=ne,t[46]=re,t[47]=ae,t[48]=ce,t[49]=ue):ue=t[49];let de;t[50]!==r||t[51]!==n||t[52]!==V||t[53]!==_||t[54]!==te||t[55]!==q||t[56]!==U||t[57]!==i||t[58]!==l?(de=i===null?null:i.length===0?(0,Z.jsx)(Pc,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`MUrVEo`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(IE,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(VE,{"aria-label":r({id:`blFttG`}),placeholder:r({id:`RVZJWQ`}),value:l,onChange:e=>{e.target.value!==``&&v(null),u(e.target.value)},onKeyDown:KZ,"data-testid":`project-switcher-search`}),(0,Z.jsx)(RE,{children:(0,Z.jsx)(o,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Ic,{}),(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:(0,Z.jsx)(wZ,{bridge:n,recents:te,currentPath:V,query:U,worktreeModel:q,closeMenu:()=>E(!1),guardStaleSelect:O,flyoutPath:_,setFlyoutPath:v,openNewWorktreeWith:B})})]}),t[50]=r,t[51]=n,t[52]=V,t[53]=_,t[54]=te,t[55]=q,t[56]=U,t[57]=i,t[58]=l,t[59]=de):de=t[59];let fe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(Ic,{}),t[60]=fe):fe=t[60];let pe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>{O(e)||R()},t[61]=pe):pe=t[61];let me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsxs)(Cc,{onSelect:pe,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(Y,{id:`gKi-a_`})]}),t[62]=me):me=t[62];let he;t[63]===I?he=t[64]:(he=e=>{O(e)||I()},t[63]=I,t[64]=he);let ge,_e;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Ae,{"aria-hidden":`true`,className:`text-muted-foreground`}),_e=(0,Z.jsx)(Y,{id:`xaDWAI`}),t[65]=ge,t[66]=_e):(ge=t[65],_e=t[66]);let ve;t[67]===he?ve=t[68]:(ve=(0,Z.jsxs)(Cc,{onSelect:he,"data-testid":`project-switcher-switch-project`,children:[ge,_e]}),t[67]=he,t[68]=ve);let ye;t[69]===P?ye=t[70]:(ye=e=>{O(e)||P()},t[69]=P,t[70]=ye);let be,xe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(Io,{"aria-hidden":`true`,className:`text-muted-foreground`}),xe=(0,Z.jsx)(Y,{id:`PVUn_c`}),t[71]=be,t[72]=xe):(be=t[71],xe=t[72]);let Se;t[73]===ye?Se=t[74]:(Se=(0,Z.jsxs)(Cc,{onSelect:ye,"data-testid":`project-switcher-open-folder`,children:[be,xe]}),t[73]=ye,t[74]=Se);let Ce;t[75]===y?Ce=t[76]:(Ce=y===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ic,{}),(0,Z.jsxs)(Cc,{onSelect:e=>{O(e)||(E(!1),g(``),m(!0))},"data-testid":`project-switcher-new-worktree`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(Y,{id:`DXd9LM`})]})]}),t[75]=y,t[76]=Ce);let we;t[77]!==de||t[78]!==ve||t[79]!==Se||t[80]!==Ce?(we=(0,Z.jsxs)(Tc,{align:`start`,side:`top`,className:`min-w-[260px]`,"data-testid":`project-switcher-menu`,children:[de,fe,me,ve,Se,Ce]}),t[77]=de,t[78]=ve,t[79]=Se,t[80]=Ce,t[81]=we):we=t[81];let Te;t[82]!==s||t[83]!==ue||t[84]!==we?(Te=(0,Z.jsxs)(jc,{open:s,onOpenChange:E,modal:!1,children:[ue,we]}),t[82]=s,t[83]=ue,t[84]=we,t[85]=Te):Te=t[85];let Ee;t[86]!==n||t[87]!==d?(Ee=(0,Z.jsx)(km,{open:d,onOpenChange:f,bridge:n}),t[86]=n,t[87]=d,t[88]=Ee):Ee=t[88];let De;t[89]===b?.entries?De=t[90]:(De=b?.entries.map(GZ).filter(WZ),t[89]=b?.entries,t[90]=De);let Oe;t[91]===b?.entries?Oe=t[92]:(Oe=new Set(b?.entries.filter(UZ).map(HZ)),t[91]=b?.entries,t[92]=Oe);let ke=b?.remoteBranches,je;t[93]===b?.entries?je=t[94]:(je=new Map(b?.entries.filter(VZ).map(BZ)),t[93]=b?.entries,t[94]=je);let Me;t[95]!==y||t[96]!==n||t[97]!==h||t[98]!==p||t[99]!==De||t[100]!==Oe||t[101]!==ke||t[102]!==je?(Me=(0,Z.jsx)(vZ,{open:p,onOpenChange:m,bridge:n,currentBranch:y,initialBranchName:h,branches:De,existingWorktreeBranches:Oe,remoteBranches:ke,behindByBranch:je}),t[95]=y,t[96]=n,t[97]=h,t[98]=p,t[99]=De,t[100]=Oe,t[101]=ke,t[102]=je,t[103]=Me):Me=t[103];let Ne;return t[104]!==Te||t[105]!==Ee||t[106]!==Me?(Ne=(0,Z.jsxs)(Z.Fragment,{children:[Te,Ee,Me]}),t[104]=Te,t[105]=Ee,t[106]=Me,t[107]=Ne):Ne=t[107],Ne}function BZ(e){return[e.branch,e.behind]}function VZ(e){return e.branch!==null&&e.behind!==void 0}function HZ(e){return e.branch}function UZ(e){return e.branch!==null&&e.worktreePath!==null}function WZ(e){return e!==null}function GZ(e){return e.branch}function KZ(e){return e.stopPropagation()}function qZ(e){return!e.isLinkedWorktree}function JZ(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Jn(`sidebarSearchPill`)}function YZ(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=wi(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(o,{"aria-hidden":`true`}),t[2]=a):a=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(Y,{id:`A1taO8`})}),t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(wt,{className:`text-foreground/70`,children:Tl(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(X,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,s,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function XZ(){let e=(0,$.c)(31),{_:t}=an(),n=yo(),{activeDocName:r}=pt(),[i,a]=(0,Q.useState)(!1),o=Eo(),s;e[0]!==n.data||e[1]!==n.status?(s=n.status===`ready`?n.data:[],e[0]=n.data,e[1]=n.status,e[2]=s):s=e[2];let c=s,l;e[3]===c?l=e[4]:(l=No(c),e[3]=c,e[4]=l);let u=l,d=Vo(),f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={},e[5]=f):f=e[5];let[p,m]=(0,Q.useState)(f),h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(VN,{asChild:!0,children:(0,Z.jsxs)(cs,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(Pd,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(Y,{id:`PCSkw2`}),(0,Z.jsx)(Qa,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skills:rotate-90`})]})}),e[6]=h):h=e[6];let g;e[7]===t?g=e[8]:(g=t({id:`MdpSC1`}),e[7]=t,e[8]=g);let _,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>a(!0),v=(0,Z.jsx)(Lt,{}),e[9]=_,e[10]=v):(_=e[9],v=e[10]);let y;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`MdpSC1`})}),e[11]=y):y=e[11];let b;e[12]===g?b=e[13]:(b=(0,Z.jsxs)(HN,{title:g,onClick:_,children:[v,y]}),e[12]=g,e[13]=b);let x;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(rQ,{}),e[14]=x):x=e[14];let S;e[15]!==o||e[16]!==r||e[17]!==u||e[18]!==p||e[19]!==d||e[20]!==c?(S=c.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`PdJZ5p`})}):Uo.filter(e=>c.some(t=>t.scope===e)).map(e=>(0,Z.jsxs)(ls,{className:`group/scope`,open:c.some(t=>t.scope===e&&Ar(t.scope,t.name)===r)||(p[e]??!1),onOpenChange:t=>m(n=>({...n,[e]:t})),children:[(0,Z.jsxs)(cs,{className:`flex w-full items-center gap-1 px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground/70 hover:text-muted-foreground`,children:[(0,Z.jsx)(Qa,{className:`size-3 shrink-0 transition-transform group-data-[state=open]/scope:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate`,children:d[e]})]}),(0,Z.jsx)(ss,{children:(0,Z.jsx)(WN,{className:`pl-2`,children:c.filter(t=>t.scope===e).map(e=>(0,Z.jsx)(QZ,{skill:e,activeDocName:r,actions:o,existingNames:u[e.scope]},`${e.scope}::${e.name}`))})})]},e)),e[15]=o,e[16]=r,e[17]=u,e[18]=p,e[19]=d,e[20]=c,e[21]=S):S=e[21];let C;e[22]===S?C=e[23]:(C=(0,Z.jsx)(ss,{children:(0,Z.jsxs)(UN,{children:[x,S]})}),e[22]=S,e[23]=C);let w;e[24]===i?w=e[25]:(w=(0,Z.jsx)(va,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:ZZ}),e[24]=i,e[25]=w);let T;return e[26]!==o.dialogs||e[27]!==C||e[28]!==w||e[29]!==b?(T=(0,Z.jsx)(ls,{className:`group/skills shrink-0`,children:(0,Z.jsxs)(BN,{className:`px-0`,children:[h,b,C,o.dialogs,w]})}),e[26]=o.dialogs,e[27]=C,e[28]=w,e[29]=b,e[30]=T):T=e[30],T}function ZZ(e){let{scope:t,name:n}=e;return ns(Ar(t,n))}function QZ(e){let t=(0,$.c)(50),{skill:n,activeDocName:r,actions:i,existingNames:a}=e,{_:o}=an(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d;t[0]!==n.name||t[1]!==n.scope?(d=Ar(n.scope,n.name),t[0]=n.name,t[1]=n.scope,t[2]=d):d=t[2];let f=r===d,p,m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.preventDefault(),u(!0)},m=(0,Z.jsx)(Qa,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skill:rotate-90`}),h=(0,Z.jsx)(Pd,{className:`size-3 shrink-0 text-muted-foreground`}),t[3]=p,t[4]=m,t[5]=h):(p=t[3],m=t[4],h=t[5]);let g=n.name,_;t[6]===n.name?_=t[7]:(_=Lo(n.name),t[6]=n.name,t[7]=_);let v;t[8]!==n.name||t[9]!==_?(v=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:g,children:_}),t[8]=n.name,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==n.bundledVersion||t[13]!==n.updateAvailable?(y=n.updateAvailable?(0,Z.jsx)(`span`,{title:o({id:`1YJ4Yg`,values:{0:n.bundledVersion?` (${n.bundledVersion})`:``}}),className:`flex items-center`,children:(0,Z.jsx)(ao,{className:`size-3 text-primary`,"aria-label":o({id:`CifUuG`})})}):null,t[11]=o,t[12]=n.bundledVersion,t[13]=n.updateAvailable,t[14]=y):y=t[14];let b;t[15]===n.installed?b=t[16]:(b=(0,Z.jsx)(fa,{installed:n.installed,subtle:!0,className:`shrink-0`}),t[15]=n.installed,t[16]=b);let x;t[17]!==y||t[18]!==b?(x=(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19];let S;t[20]!==f||t[21]!==x||t[22]!==v?(S=(0,Z.jsx)(cs,{asChild:!0,children:(0,Z.jsxs)(qN,{size:`sm`,isActive:f,className:`h-6 text-[11px]`,onContextMenu:p,children:[m,h,v,x]})}),t[20]=f,t[21]=x,t[22]=v,t[23]=S):S=t[23];let C;t[24]!==o||t[25]!==n.name?(C=o({id:`RlLl3G`,values:{0:n.name}}),t[24]=o,t[25]=n.name,t[26]=C):C=t[26];let w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Sd,{}),t[27]=w):w=t[27];let T;t[28]===C?T=t[29]:(T=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(JN,{showOnHover:!0,"aria-label":C,children:w})}),t[28]=C,t[29]=T);let E;t[30]!==i||t[31]!==a||t[32]!==n?(E=(0,Z.jsx)(Tc,{side:`right`,align:`start`,className:`min-w-52`,children:(0,Z.jsx)(Co,{skill:n,actions:i,existingNames:a})}),t[30]=i,t[31]=a,t[32]=n,t[33]=E):E=t[33];let D;t[34]!==l||t[35]!==T||t[36]!==E?(D=(0,Z.jsxs)(jc,{open:l,onOpenChange:u,children:[T,E]}),t[34]=l,t[35]=T,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==s||t[39]!==n?(O=s?(0,Z.jsx)(tQ,{skill:n}):null,t[38]=s,t[39]=n,t[40]=O):O=t[40];let k;t[41]===O?k=t[42]:(k=(0,Z.jsx)(ss,{children:O}),t[41]=O,t[42]=k);let A;t[43]!==S||t[44]!==D||t[45]!==k?(A=(0,Z.jsxs)(GN,{children:[S,D,k]}),t[43]=S,t[44]=D,t[45]=k,t[46]=A):A=t[46];let j;return t[47]!==s||t[48]!==A?(j=(0,Z.jsx)(ls,{open:s,onOpenChange:c,className:`group/skill`,children:A}),t[47]=s,t[48]=A,t[49]=j):j=t[49],j}function $Z(e){let t=[];for(let n of e){let e=n.path.split(`/`),r=t;e.forEach((t,i)=>{let a=i===e.length-1,o=r.find(e=>e.name===t);o||(o=a?{name:t,path:n.path,text:n.text}:{name:t,path:e.slice(0,i+1).join(`/`),children:[]},r.push(o)),!a&&o.children&&(r=o.children)})}return eQ(t),t}function eQ(e){e.sort((e,t)=>{let n=+!e.children,r=+!t.children;return n===r?e.name.localeCompare(t.name):n-r});for(let t of e)t.children&&eQ(t.children)}function tQ(e){let t=(0,$.c)(27),{skill:n}=e,{_:r}=an(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),{openTarget:c}=pt(),l;t[0]===c?l=t[1]:(l=function(e){c({kind:`doc`,target:e,docName:e},{tabBehavior:`append`}),Yc(Jc(e))},t[0]=c,t[1]=l);let u=l,d;t[2]!==u||t[3]!==c||t[4]!==n.name||t[5]!==n.scope?(d=function(e){let t=e.lastIndexOf(`.`),r=t>=0?e.slice(t+1).toLowerCase():``;if(n.scope===`project`&&(r===`md`||r===`mdx`)){u(_(n.name,e.replace(/\.mdx?$/i,``)));return}c({kind:`skill-file`,target:`${n.scope}/${n.name}/${e}`,scope:n.scope,name:n.name,path:e},{tabBehavior:`replace-active`}),Yc($c({scope:n.scope,name:n.name,path:e}))},t[2]=u,t[3]=c,t[4]=n.name,t[5]=n.scope,t[6]=d):d=t[6];let f=d,p,m;t[7]!==n.name||t[8]!==n.scope?(p=()=>{let e=!0,t=()=>{Mc(n.scope,n.name).then(t=>{e&&(t.ok?(a(t.files),s(!1)):(a([]),s(!0)))})};t();let r=js(t);return()=>{e=!1,r()}},m=[n.scope,n.name],t[7]=n.name,t[8]=n.scope,t[9]=p,t[10]=m):(p=t[9],m=t[10]),(0,Q.useEffect)(p,m);let h;if(t[11]!==r||t[12]!==i||t[13]!==o||t[14]!==f||t[15]!==u||t[16]!==n.name||t[17]!==n.scope){let e=i?$Z(i):[],a;t[19]!==u||t[20]!==n.name||t[21]!==n.scope?(a=()=>n.scope===`project`?u(Ir(n.name)):ns(Ar(n.scope,n.name)),t[19]=u,t[20]=n.name,t[21]=n.scope,t[22]=a):a=t[22];let s,c;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Ye,{className:`size-3 shrink-0 text-muted-foreground`}),c=(0,Z.jsx)(`span`,{className:`truncate`,children:`SKILL.md`}),t[23]=s,t[24]=c):(s=t[23],c=t[24]);let l;t[25]===a?l=t[26]:(l=(0,Z.jsx)(XN,{children:(0,Z.jsxs)(ZN,{size:`sm`,onClick:a,className:`text-[11px]`,children:[s,c]})}),t[25]=a,t[26]=l),h=(0,Z.jsxs)(YN,{className:`mr-0 pr-0`,children:[l,i===null?(0,Z.jsx)(XN,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,children:(0,Z.jsx)(Y,{id:`yQE2r9`})})}):o?(0,Z.jsx)(XN,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,title:r({id:`3Ijjy1`}),children:(0,Z.jsx)(Y,{id:`ZARuZJ`})})}):e.map(e=>(0,Z.jsx)(nQ,{node:e,depth:0,onOpenFile:f},e.path))]}),t[11]=r,t[12]=i,t[13]=o,t[14]=f,t[15]=u,t[16]=n.name,t[17]=n.scope,t[18]=h}else h=t[18];return h}function nQ(e){let t=(0,$.c)(34),{node:n,depth:r,onOpenFile:i}=e,[a,o]=(0,Q.useState)(!1),s=`${r*.6}rem`,c;t[0]===s?c=t[1]:(c={paddingLeft:s},t[0]=s,t[1]=c);let l=c;if(n.children){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Qa,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/dir:rotate-90`}),t[2]=e):e=t[2];let s;t[3]===n.name?s=t[4]:(s=(0,Z.jsxs)(`span`,{className:`truncate`,children:[n.name,`/`]}),t[3]=n.name,t[4]=s);let c;t[5]!==l||t[6]!==s?(c=(0,Z.jsx)(cs,{asChild:!0,children:(0,Z.jsxs)(ZN,{size:`sm`,className:`text-[11px]`,style:l,children:[e,s]})}),t[5]=l,t[6]=s,t[7]=c):c=t[7];let u;if(t[8]!==r||t[9]!==n.children||t[10]!==i){let e;t[12]!==r||t[13]!==i?(e=e=>(0,Z.jsx)(nQ,{node:e,depth:r+1,onOpenFile:i},e.path),t[12]=r,t[13]=i,t[14]=e):e=t[14],u=n.children.map(e),t[8]=r,t[9]=n.children,t[10]=i,t[11]=u}else u=t[11];let d;t[15]===u?d=t[16]:(d=(0,Z.jsx)(ss,{children:u}),t[15]=u,t[16]=d);let f;t[17]!==c||t[18]!==d?(f=(0,Z.jsxs)(XN,{children:[c,d]}),t[17]=c,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==a||t[21]!==f?(p=(0,Z.jsx)(ls,{open:a,onOpenChange:o,className:`group/dir`,children:f}),t[20]=a,t[21]=f,t[22]=p):p=t[22],p}let u=`skill-file-${n.path}`,d;t[23]!==n.path||t[24]!==i?(d=()=>i(n.path),t[23]=n.path,t[24]=i,t[25]=d):d=t[25];let f;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Td,{className:`size-3 shrink-0 text-muted-foreground`}),t[26]=f):f=t[26];let p;t[27]===n.name?p=t[28]:(p=(0,Z.jsx)(`span`,{className:`truncate`,children:n.name}),t[27]=n.name,t[28]=p);let m;return t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(m=(0,Z.jsx)(XN,{children:(0,Z.jsxs)(ZN,{size:`sm`,className:`text-[11px]`,style:l,"data-testid":u,onClick:d,children:[f,p]})}),t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=m):m=t[33],m}function rQ(){let e=(0,$.c)(19),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=!1;return Ec().then(t=>{e||n(t)}),()=>{e=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o),!t||t.managed!==null||t.importable===0)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=async e=>{if(i(!0),!await Nc(e)){i(!1);return}n({managed:e,importable:0})},e[2]=s):s=e[2];let c=s,l;e[3]===t.importable?l=e[4]:(l=(0,Z.jsx)(`p`,{className:`mb-2 text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`mu1O0q`,values:{0:t.importable}})}),e[3]=t.importable,e[4]=l);let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>c(!0),d=(0,Z.jsx)(Y,{id:`l3s5ri`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===r?f=e[8]:(f=(0,Z.jsx)(X,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:u,children:d}),e[7]=r,e[8]=f);let p,m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>c(!1),m=(0,Z.jsx)(Y,{id:`PBxg_E`}),e[9]=p,e[10]=m):(p=e[9],m=e[10]);let h;e[11]===r?h=e[12]:(h=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,disabled:r,onClick:p,children:m}),e[11]=r,e[12]=h);let g;e[13]!==f||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,h]}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let _;return e[16]!==g||e[17]!==l?(_=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-border/60 bg-muted/40 p-2 text-xs`,children:[l,g]}),e[16]=g,e[17]=l,e[18]=_):_=e[18],_}var iQ=6e4,aQ=e=>{let t=(0,$.c)(11),{href:n,label:r,icon:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=e=>Ns(e,n),o=e=>Ns(e,n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=i,t[4]=s);let c;return t[5]!==n||t[6]!==r||t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:a,onAuxClick:o,"aria-label":r,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:s}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c};function oQ(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?Yg:a,c=o===void 0?iQ:o,{_:l}=an(),[u,d]=(0,Q.useState)(!1),f,p;t[0]!==c||t[1]!==i||t[2]!==u?(f=()=>{if(!u)return;let e=setTimeout(i,c);return()=>clearTimeout(e)},p=[u,i,c],t[0]=c,t[1]=i,t[2]=u,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]===l?m=t[6]:(m=l({id:`GzPQ2f`}),t[5]=l,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Y,{id:`yLEyuq`}),t[7]=h):h=t[7];let g;t[8]===s?g=t[9]:(g=()=>{s.markSubscribed(),d(!0)},t[8]=s,t[9]=g);let _;t[10]!==i||t[11]!==s?(_=()=>{s.dismiss(),i()},t[10]=i,t[11]=s,t[12]=_):_=t[12];let v;t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(AI,{source:`post_update_card`,compactSubmit:!0,description:h,onSuccess:g,onDismiss:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==l||t[17]!==u?(y=u?null:(0,Z.jsxs)(`nav`,{"aria-label":l({id:`dbapvC`}),className:`mt-3 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,Z.jsx)(`span`,{className:`mr-0.5`,children:(0,Z.jsx)(Y,{id:`9sBe85`})}),(0,Z.jsx)(aQ,{href:NI,label:l({id:`I7Exsw`}),icon:FI}),(0,Z.jsx)(aQ,{href:jI,label:l({id:`zyKa-I`}),icon:Rm}),(0,Z.jsx)(aQ,{href:MI,label:l({id:`36aWJD`}),icon:PI})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(`div`,{className:`px-3 py-2.5`,children:[v,y]}),t[19]=y,t[20]=v,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hLy8b1`,values:{version:n}})}),t[22]=n,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Y,{id:`_PACVa`}),t[24]=S):S=t[24];let C;t[25]===r?C=t[26]:(C=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto p-0 text-muted-foreground text-xs hover:text-foreground`,onClick:r,children:S}),t[25]=r,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-t bg-muted/30 px-3 py-2.5 space-x-2`,children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==b||t[31]!==w||t[32]!==m?(T=(0,Z.jsxs)(`section`,{"aria-label":m,className:`mx-1 mb-1 overflow-hidden rounded-lg border bg-card text-card-foreground`,children:[b,w]}),t[30]=b,t[31]=w,t[32]=m,t[33]=T):T=t[33],T}function sQ(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=an(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(Cs,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function cQ(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function lQ(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(D_,E_,E_),n;e[0]===t?n=e[1]:(n=cQ(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;if(r.combinedSubscribe&&r.whatsNew){let t;e[2]===r.action?t=e[3]:(t=()=>r.action?.onClick(),e[2]=r.action,e[3]=t);let n;e[4]===r.id?n=e[5]:(n=()=>T_(r.id),e[4]=r.id,e[5]=n);let i;return e[6]!==r.whatsNew.version||e[7]!==t||e[8]!==n?(i=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(oQ,{version:r.whatsNew.version,onOpenReleaseNotes:t,onClose:n})}),e[6]=r.whatsNew.version,e[7]=t,e[8]=n,e[9]=i):i=e[9],i}let i;e[10]===r?i=e[11]:(i=()=>{r.onDismiss?.(),T_(r.id)},e[10]=r,e[11]=i);let a;return e[12]!==r||e[13]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(sQ,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}function uQ(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?co(n.contentDir,fo(t),n.pathSeparator):e?.kind===`folder`?co(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?co(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function dQ(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?fo(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function fQ(e,t,n){return e===null?Mo({workspace:n}):e.kind===`folder`?n?po({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?ko({docName:t,workspace:n}):null}var pQ={folderCount:0,expandedCount:0},mQ=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function hQ(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(mQ)!==null}function gQ(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(yl,{name:`file-sidebar`,children:(0,Z.jsx)(vQ,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var _Q=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Hs,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Ws,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function vQ(e){let t=(0,$.c)(209),{onOpenSearch:n}=e,{_:r}=an(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=pt(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:pl(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,g=typeof window<`u`&&window.okDesktop!=null,{state:_,toggleSidebar:v}=kN(),y=bo(),b=_===`expanded`,x=g&&_===`collapsed`,[S,C]=(0,Q.useState)(pQ),w,T;t[3]===i?(w=t[4],T=t[5]):(w=()=>{if(i===null)return;let e=()=>{C(i.getFolderState()),p(i.isCreationTargetCleared())};return e(),i.subscribe(e)},T=[i],t[3]=i,t[4]=w,t[5]=T),(0,Q.useEffect)(w,T);let E,D;t[6]===i?(E=t[7],D=t[8]):(E=()=>{if(i!==null)return ST(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(`file`,t)})},D=[i],t[6]=i,t[7]=E,t[8]=D),(0,Q.useEffect)(E,D);let O=S.folderCount>0,k=O&&S.expandedCount===S.folderCount,A=S.expandedCount===0,j=ya(``),M=ya(m===``?null:m),N=m===``?j:M,P=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,F=N.state.status===`ready`?(N.state.data.folder.templates_available?.length??0)>0:!0,I=typeof window<`u`?window.okDesktop:void 0,L=so(),{status:R}=Ki(),z=R?.hasRemote===!0,B;t[9]!==r||t[10]!==L?.contentDir?(B=I?.config?.projectName||L?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[9]=r,t[10]=L?.contentDir,t[11]=B):B=t[11];let V=B,H=So().states,{dispatch:U}=Ao(),W;t[12]===L?W=t[13]:(W=Mo({workspace:L}),t[12]=L,t[13]=W);let G=W,{projectLocalBinding:K,merged:ee}=Bo(),te=ee?.appearance?.sidebar?.showHiddenFiles??!1,q=O&&!k,J=O&&!A,ne=q||J,re=CQ,ie;t[14]!==i||t[15]!==L?(ie=()=>{L&&i?.startCreating(`file`,``)},t[14]=i,t[15]=L,t[16]=ie):ie=t[16];let ae=ie,oe;t[17]!==i||t[18]!==L?(oe=e=>{L&&i?.createFromTemplate(``,e)},t[17]=i,t[18]=L,t[19]=oe):oe=t[19];let se=oe,ce;t[20]!==i||t[21]!==L?(ce=()=>{L&&i?.startCreating(`folder`,``)},t[20]=i,t[21]=L,t[22]=ce):ce=t[22];let le=ce,ue;t[23]===L?ue=t[24]:(ue=()=>{!L||!I||I.shell.showItemInFolder(L.contentDir)},t[23]=L,t[24]=ue);let de=ue,fe;t[25]!==r||t[26]!==L?(fe=async()=>{if(L)try{await navigator.clipboard.writeText(L.contentDir),Ss.success(r({id:`6_ZOw4`}),{description:L.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),Ss.error(r({id:`vfRlCI`}))}},t[25]=r,t[26]=L,t[27]=fe):fe=t[27];let pe=fe,me;t[28]!==r||t[29]!==z?(me=()=>{Mi({...Bi(``),hasRemote:z,onClickWhenNoRemote:()=>{Ss.error(r({id:`WyQxwa`}))}},{clipboardWrite:To,toastSuccess:SQ,toastError:xQ,logEvent:bQ})},t[28]=r,t[29]=z,t[30]=me):me=t[30];let he=me,ge;t[31]!==r||t[32]!==K?(ge=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,rr(t.error)),Ss.error(r({id:`P47EWZ`}),{description:rr(t.error)}))},t[31]=r,t[32]=K,t[33]=ge):ge=t[33];let _e=ge,ve;t[34]===i?ve=t[35]:(ve=()=>{i?.expandAll()},t[34]=i,t[35]=ve);let ye=ve,be;t[36]===i?be=t[37]:(be=()=>{i?.collapseAll()},t[36]=i,t[37]=be);let xe=be,Se,Ce;t[38]!==J||t[39]!==q||t[40]!==te||t[41]!==_?(Se=()=>{I&&I.editor.notifyViewMenuStateChanged({showHiddenFiles:te,canExpandAll:q,canCollapseAll:J,sidebarVisible:_===`expanded`})},Ce=[I,te,q,J,_],t[38]=J,t[39]=q,t[40]=te,t[41]=_,t[42]=Se,t[43]=Ce):(Se=t[42],Ce=t[43]),(0,Q.useEffect)(Se,Ce);let we,Te;t[44]!==r||t[45]!==c||t[46]!==l||t[47]!==U||t[48]!==H||t[49]!==m||t[50]!==K||t[51]!==te||t[52]!==v||t[53]!==i||t[54]!==L?(we=()=>{if(I)return I.onMenuAction(e=>{switch(e){case`new-doc`:if(!L||!i)return;i.startCreating(`file`,m);return;case`new-folder`:if(!L||!i)return;i.startCreating(`folder`,m);return;case`new-from-template`:if(!L||!i)return;i.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;sY(l);return;case`duplicate`:if(!l)return;lY(l);return;case`move-to-trash`:if(!l)return;aY(l);return;case`reveal-in-finder`:{if(!I||!L)return;let e=uQ(l,c,L);I.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=lo.filter(e=>H[e.id]?.installed===!0);if(e.length===0){Ss.error(r({id:`LKOLNn`}));return}let t=fQ(l,c,L);if(!t)return;let[n]=e;if(!n)return;U(n.id,t);return}case`copy-full-path`:{if(!L)return;let e=uQ(l,c,L);navigator.clipboard.writeText(e).then(()=>Ss.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ss.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=dQ(l,c);if(e===``){Ss.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>Ss.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ss.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(K===null)return;let e=K.patch({appearance:{sidebar:{showHiddenFiles:!te}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,rr(e.error)),Ss.error(r({id:`P47EWZ`}),{description:rr(e.error)}));return}case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:v();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},Te=[I,i,L,l,c,m,K,te,H,U,v,r],t[44]=r,t[45]=c,t[46]=l,t[47]=U,t[48]=H,t[49]=m,t[50]=K,t[51]=te,t[52]=v,t[53]=i,t[54]=L,t[55]=we,t[56]=Te):(we=t[55],Te=t[56]),(0,Q.useEffect)(we,Te);let Ee=g&&b&&`motion-safe:delay-100`,De=x&&`opacity-0`,Oe;t[57]!==Ee||t[58]!==De?(Oe=wi(`flex-row h-12 items-center py-0 px-3`,`justify-between`,g&&`overflow-x-clip`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ee,De,g&&`[-webkit-app-region:drag]`),t[57]=Ee,t[58]=De,t[59]=Oe):Oe=t[59];let ke;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ke=g?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[60]=ke):ke=t[60];let Ae;t[61]===b?Ae=t[62]:(Ae=b&&!g?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(Y,{id:`sER-bs`})}):null,t[61]=b,t[62]=Ae);let je;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(je=wi(`flex items-center gap-1`,g&&`[&>*]:[-webkit-app-region:no-drag]`),t[63]=je):je=t[63];let Me;t[64]!==r||t[65]!==k||t[66]!==O||t[67]!==A||t[68]!==i?(Me=O?(0,Z.jsxs)(jc,{children:[(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(_Q,{icon:Bd,label:r({id:`Rq1vFD`})})}),(0,Z.jsxs)(Tc,{align:`end`,className:`min-w-52`,children:[k?null:(0,Z.jsxs)(Cc,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(kf,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}),A?null:(0,Z.jsxs)(Cc,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(Od,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]})]})]}):null,t[64]=r,t[65]=k,t[66]=O,t[67]=A,t[68]=i,t[69]=Me):Me=t[69];let Ne;t[70]===r?Ne=t[71]:(Ne=r({id:`HdkSiO`}),t[70]=r,t[71]=Ne);let Pe;t[72]!==m||t[73]!==i?(Pe=()=>i?.startCreating(`file`,m),t[72]=m,t[73]=i,t[74]=Pe):Pe=t[74];let Fe;t[75]!==Ne||t[76]!==Pe?(Fe=(0,Z.jsx)(_Q,{icon:hf,label:Ne,onClick:Pe}),t[75]=Ne,t[76]=Pe,t[77]=Fe):Fe=t[77];let Ie;t[78]!==r||t[79]!==F||t[80]!==m||t[81]!==i?(Ie=F?(0,Z.jsxs)(jc,{children:[(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(_Q,{icon:ia,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(Tc,{align:`end`,className:`min-w-52`,children:(0,Z.jsx)(QJ,{parentDir:m,onSelectTemplate:e=>i?.createFromTemplate(m,e),ItemComponent:Cc})})]}):null,t[78]=r,t[79]=F,t[80]=m,t[81]=i,t[82]=Ie):Ie=t[82];let Le;t[83]===r?Le=t[84]:(Le=r({id:`96G6Re`}),t[83]=r,t[84]=Le);let Re;t[85]!==m||t[86]!==i?(Re=()=>i?.startCreating(`folder`,m),t[85]=m,t[86]=i,t[87]=Re):Re=t[87];let ze;t[88]!==Le||t[89]!==Re?(ze=(0,Z.jsx)(_Q,{icon:Ad,label:Le,onClick:Re}),t[88]=Le,t[89]=Re,t[90]=ze):ze=t[90];let Be;t[91]!==Me||t[92]!==Fe||t[93]!==Ie||t[94]!==ze?(Be=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:je,children:[Me,Fe,Ie,ze]}),t[91]=Me,t[92]=Fe,t[93]=Ie,t[94]=ze,t[95]=Be):Be=t[95];let Ve;t[96]!==Oe||t[97]!==Ae||t[98]!==Be?(Ve=(0,Z.jsxs)(LN,{"data-electron-drag":g?``:void 0,className:Oe,children:[ke,Ae,Be]}),t[96]=Oe,t[97]=Ae,t[98]=Be,t[99]=Ve):Ve=t[99];let He=g&&b&&`motion-safe:delay-100`,Ue=x&&`opacity-0`,We;t[100]!==He||t[101]!==Ue?(We=wi(`px-2 pb-2`,g&&`[-webkit-app-region:no-drag]`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,He,Ue),t[100]=He,t[101]=Ue,t[102]=We):We=t[102];let Ge;t[103]===_?Ge=t[104]:(Ge=[_],t[103]=_,t[104]=Ge);let Ke;t[105]===n?Ke=t[106]:(Ke=(0,Z.jsx)(YZ,{onClick:n}),t[105]=n,t[106]=Ke);let qe;t[107]!==Ge||t[108]!==Ke?(qe=(0,Z.jsx)(h,{fallbackRender:yQ,onError:JZ,resetKeys:Ge,children:Ke}),t[107]=Ge,t[108]=Ke,t[109]=qe):qe=t[109];let Je;t[110]!==We||t[111]!==qe?(Je=(0,Z.jsx)(`div`,{className:We,children:qe}),t[110]=We,t[111]=qe,t[112]=Je):Je=t[112];let Ye;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(FL,{}),t[113]=Ye):Ye=t[113];let Xe;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,Z.jsx)(Io,{className:`size-3.5 shrink-0`}),t[114]=Xe):Xe=t[114];let Ze;t[115]===V?Ze=t[116]:(Ze=(0,Z.jsx)(`span`,{className:`truncate`,children:V}),t[115]=V,t[116]=Ze);let Qe;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Qa,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90`}),t[117]=Qe):Qe=t[117];let $e;t[118]===Ze?$e=t[119]:($e=(0,Z.jsx)(VN,{asChild:!0,className:`shrink-0`,children:(0,Z.jsxs)(cs,{"data-sidebar-root-context":!0,className:`flex w-full items-center gap-1.5`,children:[Xe,Ze,Qe]})}),t[118]=Ze,t[119]=$e);let et=o==null?`50vh`:`${o}px`,tt;t[120]===et?tt=t[121]:(tt={height:et},t[120]=et,t[121]=tt);let nt;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,Z.jsx)(vX,{ref:a,onContentHeightChange:s}),t[122]=nt):nt=t[122];let rt;t[123]===tt?rt=t[124]:(rt=(0,Z.jsx)(ss,{className:`flex max-h-[70vh] flex-col overflow-hidden`,style:tt,children:nt}),t[123]=tt,t[124]=rt);let it;t[125]!==$e||t[126]!==rt?(it=(0,Z.jsx)(ls,{defaultOpen:!0,className:`group/files flex shrink-0 flex-col`,children:(0,Z.jsxs)(BN,{className:`min-h-0 px-0`,children:[$e,rt]})}),t[125]=$e,t[126]=rt,t[127]=it):it=t[127];let at;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(XZ,{}),t[128]=at):at=t[128];let ot;t[129]===i?ot=t[130]:(ot=(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-sidebar-empty-deselect":!0,className:`min-h-8 flex-1 cursor-default`,onClick:()=>i?.clearCreationTarget()}),t[129]=i,t[130]=ot);let st;t[131]!==it||t[132]!==ot?(st=(0,Z.jsxs)(zN,{children:[Ye,it,at,ot]}),t[131]=it,t[132]=ot,t[133]=st):st=t[133];let ct;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsxs)(RN,{className:`px-0`,children:[(0,Z.jsx)(mZ,{}),(0,Z.jsx)(lQ,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(WN,{children:(0,Z.jsx)(GN,{children:(0,Z.jsx)(zZ,{bridge:window.okDesktop})})}):null]}),t[134]=ct):ct=t[134];let lt=!(y&&_===`collapsed`),ut;t[135]===lt?ut=t[136]:(ut=(0,Z.jsx)(FN,{enableToggle:!1,enableDrag:lt}),t[135]=lt,t[136]=ut);let dt;t[137]!==Ve||t[138]!==Je||t[139]!==st||t[140]!==ut?(dt=(0,Z.jsx)(IF,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:re,children:[Ve,Je,st,ct,ut]})}),t[137]=Ve,t[138]=Je,t[139]=st,t[140]=ut,t[141]=dt):dt=t[141];let ft=!L,mt,ht;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(hf,{"aria-hidden":`true`}),ht=(0,Z.jsx)(Y,{id:`HdkSiO`}),t[142]=mt,t[143]=ht):(mt=t[142],ht=t[143]);let gt;t[144]!==ae||t[145]!==ft?(gt=(0,Z.jsxs)(BF,{disabled:ft,onSelect:ae,"data-testid":`empty-space-menu-new-file`,children:[mt,ht]}),t[144]=ae,t[145]=ft,t[146]=gt):gt=t[146];let _t;t[147]!==se||t[148]!==P||t[149]!==L?(_t=P?(0,Z.jsxs)(RF,{children:[(0,Z.jsxs)(VF,{disabled:!L,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(ia,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Uuj_R4`})]}),(0,Z.jsx)(HF,{children:(0,Z.jsx)(QJ,{parentDir:``,onSelectTemplate:se,ItemComponent:BF})})]}):null,t[147]=se,t[148]=P,t[149]=L,t[150]=_t):_t=t[150];let vt=!L,yt,bt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,Z.jsx)(Ad,{"aria-hidden":`true`}),bt=(0,Z.jsx)(Y,{id:`96G6Re`}),t[151]=yt,t[152]=bt):(yt=t[151],bt=t[152]);let xt;t[153]!==le||t[154]!==vt?(xt=(0,Z.jsxs)(BF,{disabled:vt,onSelect:le,"data-testid":`empty-space-menu-new-folder`,children:[yt,bt]}),t[153]=le,t[154]=vt,t[155]=xt):xt=t[155];let St;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(St=(0,Z.jsx)(GF,{}),t[156]=St):St=t[156];let Ct;t[157]!==r||t[158]!==de||t[159]!==L?(Ct=I?(0,Z.jsxs)(BF,{disabled:!L,onSelect:de,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(L?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(Io,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`LtSYdi`})}),L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`wTcjov`})})]}):null,t[157]=r,t[158]=de,t[159]=L,t[160]=Ct):Ct=t[160];let wt;t[161]!==U||t[162]!==G||t[163]!==H?(wt=(0,Z.jsx)(nZ,{input:G,installStates:H,dispatch:U}),t[161]=U,t[162]=G,t[163]=H,t[164]=wt):wt=t[164];let Tt;t[165]!==he||t[166]!==z?(Tt=z?(0,Z.jsxs)(BF,{onSelect:he,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(df,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Z8lGw6`})]}):null,t[165]=he,t[166]=z,t[167]=Tt):Tt=t[167];let Et=!L,Dt;t[168]!==r||t[169]!==L?(Dt=r(L?{id:`Up2_7p`}:{id:`U8CD-l`}),t[168]=r,t[169]=L,t[170]=Dt):Dt=t[170];let Ot;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=(0,Z.jsx)(Ho,{"aria-hidden":`true`}),t[171]=Ot):Ot=t[171];let kt;t[172]===Symbol.for(`react.memo_cache_sentinel`)?(kt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`Up2_7p`})}),t[172]=kt):kt=t[172];let At;t[173]===L?At=t[174]:(At=L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`wTcjov`})}),t[173]=L,t[174]=At);let jt;t[175]!==pe||t[176]!==Et||t[177]!==Dt||t[178]!==At?(jt=(0,Z.jsxs)(BF,{disabled:Et,onSelect:pe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":Dt,children:[Ot,kt,At]}),t[175]=pe,t[176]=Et,t[177]=Dt,t[178]=At,t[179]=jt):jt=t[179];let Mt;t[180]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=(0,Z.jsx)(GF,{}),t[180]=Mt):Mt=t[180];let Nt=K===null,Pt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=(0,Z.jsx)(Y,{id:`XcGbim`}),t[181]=Pt):Pt=t[181];let Ft;t[182]!==_e||t[183]!==te||t[184]!==Nt?(Ft=(0,Z.jsx)(UF,{checked:te,onCheckedChange:_e,disabled:Nt,"data-testid":`empty-space-menu-show-hidden-files`,children:Pt}),t[182]=_e,t[183]=te,t[184]=Nt,t[185]=Ft):Ft=t[185];let It;t[186]===ne?It=t[187]:(It=ne?(0,Z.jsx)(GF,{}):null,t[186]=ne,t[187]=It);let Lt;t[188]!==ye||t[189]!==q?(Lt=q?(0,Z.jsxs)(BF,{onSelect:ye,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(kf,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,t[188]=ye,t[189]=q,t[190]=Lt):Lt=t[190];let Rt;t[191]!==xe||t[192]!==J?(Rt=J?(0,Z.jsxs)(BF,{onSelect:xe,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Od,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,t[191]=xe,t[192]=J,t[193]=Rt):Rt=t[193];let zt;t[194]!==gt||t[195]!==_t||t[196]!==xt||t[197]!==Ct||t[198]!==wt||t[199]!==Tt||t[200]!==jt||t[201]!==Ft||t[202]!==It||t[203]!==Lt||t[204]!==Rt?(zt=(0,Z.jsxs)(zF,{className:`min-w-52`,children:[gt,_t,xt,St,Ct,wt,Tt,jt,Mt,Ft,It,Lt,Rt]}),t[194]=gt,t[195]=_t,t[196]=xt,t[197]=Ct,t[198]=wt,t[199]=Tt,t[200]=jt,t[201]=Ft,t[202]=It,t[203]=Lt,t[204]=Rt,t[205]=zt):zt=t[205];let Bt;return t[206]!==dt||t[207]!==zt?(Bt=(0,Z.jsx)(NN,{variant:`inset`,children:(0,Z.jsxs)(FF,{children:[dt,zt]})}),t[206]=dt,t[207]=zt,t[208]=Bt):Bt=t[208],Bt}function yQ(){return null}function bQ(e){return console.log(e)}function xQ(e){return Ss.error(e)}function SQ(e){return Ss.success(e)}function CQ(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)||hQ(e.target)&&(e.preventDefault(),e.stopPropagation())}function wQ(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function TQ(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function EQ(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var DQ={phase:`loading`};function OQ(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function kQ(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function AQ(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=EQ(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function jQ(e){return e!==null&&e.kind===`project-branch-switch`}function MQ(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,i=r===void 0?rh:r,{_:a}=an(),o=(0,Q.useSyncExternalStore)(i.subscribe,i.getSnapshot,RQ),[s,c]=(0,Q.useState)(DQ),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(!1),d;t[0]===o?d=t[1]:(d=jQ(o)?o:null,t[0]=o,t[1]=d);let f=d,p;t[2]!==a||t[3]!==f?.share.target.kind?(p=f?.share.target.kind===`folder`?a({id:`ugoTXs`}):a({id:`XH30C4`}),t[2]=a,t[3]=f?.share.target.kind,t[4]=p):p=t[4];let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{c(DQ),l.current=!1,u.current=!1},t[5]=h):h=t[5];let g;t[6]===o?g=t[7]:(g=[o],t[6]=o,t[7]=g),(0,Q.useEffect)(h,g);let _;t[8]!==f||t[9]!==n?(_=()=>{f&&(l.current||(l.current=!0,n.project.fetchBranchInfo({projectPath:f.projectPath,branch:f.share.branch,kind:f.share.target.kind,path:Po(f.share.target)}).then(e=>{c(t=>OQ(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),c(LQ)})))},t[8]=f,t[9]=n,t[10]=_):_=t[10];let v;t[11]===f?v=t[12]:(v=[f],t[11]=f,t[12]=v),(0,Q.useEffect)(_,v);let y;t[13]!==a||t[14]!==f||t[15]!==s.phase||t[16]!==n||t[17]!==i||t[18]!==m?(y=()=>{if(s.phase!==`awaiting-cc1-recycle`||!f)return;let e=f.share.branch;if(!e){i.dismiss();return}if(u.current)return;u.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:f.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(zf({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:f.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:f.share.target.kind,path:Po(f.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),Ss.error(a({id:`gQV-9w`,values:{targetNoun:m}}))}),i.dismiss();return}console.log(zf({branch_dialog_action:`branch-switch-timeout`,branch:e})),Ss.error(a({id:`LBwUR6`,values:{targetNoun:m}})),i.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),Ss.error(a({id:`Jw6EC4`,values:{targetNoun:m}})),i.dismiss())}),()=>{t=!0}},t[13]=a,t[14]=f,t[15]=s.phase,t[16]=n,t[17]=i,t[18]=m,t[19]=y):y=t[19];let b;if(t[20]!==f||t[21]!==s.phase?(b=[s.phase,f],t[20]=f,t[21]=s.phase,t[22]=b):b=t[22],(0,Q.useEffect)(y,b),!f)return null;let{share:x,projectPath:S,currentBranch:C}=f,w=x.branch,T;t[23]!==a||t[24]!==s.info||t[25]!==s.phase||t[26]!==n.project||t[27]!==S||t[28]!==x.target||t[29]!==w||t[30]!==i?(T=function(){s.phase===`ready`&&wQ(s.info).switchEnabled&&(console.log(zf({branch_dialog_action:`switch`,branch_action:`switch`,branch:w})),c(e=>kQ(e,Po(x.target))),n.project.runCheckout({projectPath:S,branch:w}).then(e=>{let t=null,n=!1;c(r=>{let{state:i,sideEffect:a}=AQ(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?Ss.error(a({id:`NJyQi_`,values:{shareBranch:w}})):t===`fetch-failed`?Ss.error(a({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&Ss.error(a({id:`c863eW`,values:{shareBranch:w}})),n&&i.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),c(IQ),Ss.error(a({id:`c863eW`,values:{shareBranch:w}}))}))},t[23]=a,t[24]=s.info,t[25]=s.phase,t[26]=n.project,t[27]=S,t[28]=x.target,t[29]=w,t[30]=i,t[31]=T):T=t[31];let E=T,D;t[32]!==a||t[33]!==n.project||t[34]!==S||t[35]!==x.target||t[36]!==w||t[37]!==i||t[38]!==m?(D=function(){console.log(zf({branch_dialog_action:`open-current`,branch:w})),n.project.open({path:S,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.target.kind,path:Po(x.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),Ss.error(a({id:`b5aNbi`,values:{targetNoun:m}}))}),i.dismiss()},t[32]=a,t[33]=n.project,t[34]=S,t[35]=x.target,t[36]=w,t[37]=i,t[38]=m,t[39]=D):D=t[39];let O=D,k;t[40]!==a||t[41]!==s.otherWorktreePath||t[42]!==s.phase||t[43]!==n.project||t[44]!==x.target||t[45]!==w||t[46]!==i?(k=function(){if(s.phase!==`branch-in-other-worktree`)return;let e=s.otherWorktreePath;console.log(zf({branch_dialog_action:`pivot-to-other-worktree`,branch:w})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.target.kind,path:Po(x.target)},pendingBranch:w}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),Ss.error(a({id:`LdABLa`,values:{target:e}}))}),i.dismiss()},t[40]=a,t[41]=s.otherWorktreePath,t[42]=s.phase,t[43]=n.project,t[44]=x.target,t[45]=w,t[46]=i,t[47]=k):k=t[47];let A=k,j;t[48]===i?j=t[49]:(j=function(){console.log(zf({branch_dialog_action:`cancel`})),i.dismiss()},t[48]=i,t[49]=j);let M=j,N,P,F,I,L,R,z,B,V,H,U,W,G,K,ee,te,q;if(t[50]!==a||t[51]!==s.info||t[52]!==s.otherWorktreePath||t[53]!==s.phase||t[54]!==M||t[55]!==C||t[56]!==x.branch||t[57]!==x.owner||t[58]!==x.repo||t[59]!==x.target||t[60]!==w||t[61]!==m){q=s.phase===`ready`||s.phase===`switching`?wQ(s.info):null;let e;t[79]!==s.info||t[80]!==s.phase||t[81]!==C?(e=s.phase===`ready`||s.phase===`switching`?TQ(s.info):C??`HEAD`,t[79]=s.info,t[80]=s.phase,t[81]=C,t[82]=e):e=t[82];let n=e;R=s.phase===`switching`||s.phase===`awaiting-cc1-recycle`;let r;t[83]===a?r=t[84]:(r=a({id:`OuY8t9`}),t[83]=a,t[84]=r),I=r;let i;t[85]!==a||t[86]!==w?(i=a({id:`_BthEY`,values:{shareBranch:w}}),t[85]=a,t[86]=w,t[87]=i):i=t[87],L=i;let o=s.phase===`loading`,c=s.phase===`error`;F=Ya,ee=!0,t[88]===M?te=t[89]:(te=e=>{e||M()},t[88]=M,t[89]=te),P=Ga,H=`sm:max-w-xl`,U=`share-branch-switch-dialog`,W=FQ,G=PQ;let l;t[90]===m?l=t[91]:(l=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(Y,{id:`RY6Bq1`,values:{targetNoun:m}})}),t[90]=m,t[91]=l);let u=x.owner,d=x.repo,f;t[92]===x.target?f=t[93]:(f=Po(x.target),t[92]=x.target,t[93]=f);let p;t[94]!==x.owner||t[95]!==x.repo||t[96]!==f?(p=(0,Z.jsx)(Ua,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`f8jU-L`,values:{0:u,1:d,2:f}})}),t[94]=x.owner,t[95]=x.repo,t[96]=f,t[97]=p):p=t[97],t[98]!==l||t[99]!==p?(K=(0,Z.jsxs)(Ja,{children:[l,p]}),t[98]=l,t[99]=p,t[100]=K):K=t[100],N=Ka;let h=x.owner,g=x.repo,_;t[101]===x.target?_=t[102]:(_=Po(x.target),t[101]=x.target,t[102]=_),t[103]!==x.branch||t[104]!==x.owner||t[105]!==x.repo||t[106]!==x.target.kind||t[107]!==_?(z=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(Ym,{owner:h,repo:g,path:_,kind:x.target.kind,branch:x.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=x.branch,t[104]=x.owner,t[105]=x.repo,t[106]=x.target.kind,t[107]=_,t[108]=z):z=t[108],B=s.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(Y,{id:`yjExfe`,values:{shareBranch:w},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:s.otherWorktreePath})]}):o?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Fo,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`w4hMYl`})}):q?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`XnoA1k`,values:{targetNoun:m,shareBranch:w},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`sZ2IOu`,values:{targetNoun:m,shareBranch:w,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`_902BE`,values:{targetNoun:m,shareBranch:w,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),V=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(Y,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(NQ)})]}):null,t[50]=a,t[51]=s.info,t[52]=s.otherWorktreePath,t[53]=s.phase,t[54]=M,t[55]=C,t[56]=x.branch,t[57]=x.owner,t[58]=x.repo,t[59]=x.target,t[60]=w,t[61]=m,t[62]=N,t[63]=P,t[64]=F,t[65]=I,t[66]=L,t[67]=R,t[68]=z,t[69]=B,t[70]=V,t[71]=H,t[72]=U,t[73]=W,t[74]=G,t[75]=K,t[76]=ee,t[77]=te,t[78]=q}else N=t[62],P=t[63],F=t[64],I=t[65],L=t[66],R=t[67],z=t[68],B=t[69],V=t[70],H=t[71],U=t[72],W=t[73],G=t[74],K=t[75],ee=t[76],te=t[77],q=t[78];let J;t[109]===R?J=t[110]:(J=R?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Fo,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`CU3AiE`})]}):null,t[109]=R,t[110]=J);let ne;t[111]!==N||t[112]!==z||t[113]!==B||t[114]!==V||t[115]!==J?(ne=(0,Z.jsxs)(N,{children:[z,B,V,J]}),t[111]=N,t[112]=z,t[113]=B,t[114]=V,t[115]=J,t[116]=ne):ne=t[116];let re;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[117]=re):re=t[117];let ie;t[118]===M?ie=t[119]:(ie=(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:M,"data-testid":`share-branch-switch-cancel`,children:re}),t[118]=M,t[119]=ie);let ae;t[120]!==s.phase||t[121]!==O||t[122]!==A||t[123]!==E||t[124]!==I||t[125]!==L||t[126]!==R||t[127]!==q?(ae=s.phase===`branch-in-other-worktree`?(0,Z.jsx)(X,{onClick:A,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(Y,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[q?.openCurrentEnabled?(0,Z.jsxs)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:O,disabled:R,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(Gd,{className:`size-3.5`,"aria-hidden":!0}),I]}):null,(0,Z.jsx)(X,{onClick:E,disabled:!q?.switchEnabled||R,"aria-disabled":!q?.switchEnabled||R,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:R?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fo,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),L]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(St,{className:`size-3.5`,"aria-hidden":!0}),L]})})]}),t[120]=s.phase,t[121]=O,t[122]=A,t[123]=E,t[124]=I,t[125]=L,t[126]=R,t[127]=q,t[128]=ae):ae=t[128];let oe;t[129]!==ie||t[130]!==ae?(oe=(0,Z.jsxs)(qa,{className:`sm:justify-between`,children:[ie,ae]}),t[129]=ie,t[130]=ae,t[131]=oe):oe=t[131];let se;t[132]!==P||t[133]!==H||t[134]!==U||t[135]!==W||t[136]!==G||t[137]!==K||t[138]!==ne||t[139]!==oe?(se=(0,Z.jsxs)(P,{className:H,"data-testid":U,onInteractOutside:W,onPointerDownOutside:G,children:[K,ne,oe]}),t[132]=P,t[133]=H,t[134]=U,t[135]=W,t[136]=G,t[137]=K,t[138]=ne,t[139]=oe,t[140]=se):se=t[140];let ce;return t[141]!==F||t[142]!==ee||t[143]!==te||t[144]!==se?(ce=(0,Z.jsx)(F,{open:ee,onOpenChange:te,children:se}),t[141]=F,t[142]=ee,t[143]=te,t[144]=se,t[145]=ce):ce=t[145],ce}function NQ(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function PQ(e){e.preventDefault()}function FQ(e){e.preventDefault()}function IQ(e){return AQ(e,null).state}function LQ(e){return OQ(e,null)}function RQ(){return null}function zQ(){let e=(0,$.c)(17),t=Mn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=pt(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new v,i=new be({url:n,name:ai,document:e,onStateless:e=>{let{payload:t}=e;_e(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:GQ,onConfigValidationRejected:WQ,onConfigIgnoreNestedError:UQ,onUnknown:HQ})},onClose:VQ,onDisconnect:BQ}),a=ks(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=ve(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Os([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function BQ(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function VQ(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function HQ(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function UQ(e){ga(e)}function WQ(e){ba(e)}function GQ(e){Os([e.ch])}function KQ(e){let t=b(e);if(t)return{scope:`project`,name:t};let n=ni(e);return n?.kind===`skill`?{scope:n.scope,name:n.name}:null}function qQ(e,t){let n=new Set(t.map(e=>`${e.scope}\u0000${e.name}`)),r=[];for(let t of e){let e=KQ(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`;n.has(`${i}\u0000${e.name}`)?r.push({kind:`retarget`,fromDocName:t,toDocName:Ar(i,e.name)}):r.push({kind:`close`,docName:t})}return r}function JQ(){let e=(0,$.c)(13),{openTabs:t,closeDocument:n}=pt(),r;e[0]===t?r=e[1]:(r=t.some(XQ),e[0]=t,e[1]=r);let i=r,a;e[2]===i?a=e[3]:(a={enabled:i},e[2]=i,e[3]=a);let o=yo(a),s=(0,Q.useRef)(null),c;e[4]!==n||e[5]!==t||e[6]!==o.data||e[7]!==o.status?(c=()=>{if(o.status!==`ready`)return;let e=o.data,r=`${t.join(``)}\u0002${e.map(YQ).sort().join(``)}`;if(s.current===r)return;s.current=r;let i=qQ(t,e);for(let e of i)e.kind===`retarget`?(ns(e.toDocName),n(e.fromDocName)):n(e.docName)},e[4]=n,e[5]=t,e[6]=o.data,e[7]=o.status,e[8]=c):c=e[8];let l;e[9]!==n||e[10]!==t||e[11]!==o?(l=[o,t,n],e[9]=n,e[10]=t,e[11]=o,e[12]=l):l=e[12],(0,Q.useEffect)(c,l)}function YQ(e){return`${e.scope}\u0000${e.name}`}function XQ(e){return KQ(e)!==null}var ZQ=1e3,QQ=3e4;function $Q(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??ZQ,r=e.maxBackoffMs??QQ,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function e$(e){if(e)return e.replace(/\/collab\/?$/,``)}function t$(){return M(window)!==null}function n$(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??$Q;if((i.current?.isElectronHost??t$)())return;let t=e({resolveWsUrl:async()=>e$(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var r$=`#install-claude-desktop`;function i$(e){return e===`#settings`||e===r$}function a$(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function o$(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=pt(),{openTargetTransition:i}=Dt();JQ();let{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=to(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=a$(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(i$(window.location.hash))return;let e=ml(window.location.hash);if(e){let t=qn(e.split(`.`).pop()??``);vl(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=Zc(window.location.hash);if(n){vl(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),i({kind:`skill-file`,target:`${n.scope}/${n.name}/${n.path}`,scope:n.scope,name:n.name,path:n.path});return}if(Xc(window.location.hash)){vl(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let r=_l(window.location.hash);if(!r){vl(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){vl(`ok/nav/hash-change`,{docName:r,kind:`deferred-loading`});return}let a=tl(r,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(a.kind===`missing`&&/\/+$/.test(r.trim())){vl(`ok/nav/hash-change`,{docName:r,kind:`deferred-missing-folder`});return}let f=ul(fl(a),c);vl(`ok/nav/hash-change`,{docName:r,kind:f.kind}),i(f)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function s$(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(c$,t),null}function c$(){let e=d$;if(!e(window.location.hash))return;let t=new AbortController;return he(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(u$))}).catch(l$),()=>t.abort()}function l$(){}function u$(){}function d$(e){return!i$(e)&&!ml(e)&&!_l(e)&&(e===``||e===`#`||e===`#/`)}function f$(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(p$,t),null}function p$(){let e=function(e){let t=e.target;qi({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Gi))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function m$(){let e=(0,$.c)(4),{activeTarget:t}=pt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function h$(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=pt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:pl(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Sv({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(wv,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function g$(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=pt();n$(r);let i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(N,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function _$(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(yl,{name:`app`,children:(0,Z.jsx)(Ft,{children:(0,Z.jsx)(g$,{children:(0,Z.jsx)(sy,{children:(0,Z.jsx)(v$,{})})})})}),e[0]=t):t=e[0],t}function v$(){let e=(0,$.c)(25),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=uy(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:y$}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Ny,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(zQ,{}),u=(0,Z.jsx)(o$,{}),d=(0,Z.jsx)(s$,{}),f=(0,Z.jsx)(m$,{}),p=(0,Z.jsx)(h$,{}),e[2]=l,e[3]=u,e[4]=d,e[5]=f,e[6]=p):(l=e[2],u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(f$,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(Py,{bridge:t}):null,h=(0,Z.jsx)(Vm,{}),g=t?(0,Z.jsx)(MQ,{bridge:t}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v):(h=e[9],g=e[10],_=e[11],v=e[12]);let y;e[13]===r?y=e[14]:(y=(0,Z.jsx)(Sy,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=y);let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=b):b=e[15];let x;e[16]===a?x=e[17]:(x=!a&&(0,Z.jsx)(gQ,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(IN,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(AL,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(xo,{value:s,children:(0,Z.jsxs)(AN,{className:`h-screen overflow-hidden`,children:[x,S]})}),e[19]=x,e[20]=C);let w;return e[21]!==y||e[22]!==C||e[23]!==m?(w=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(ro,{children:[l,u,d,f,p,m,_,v,h,g,y,b,C]})]}),e[21]=y,e[22]=C,e[23]=m,e[24]=w):w=e[24],w}function y$(e,t){aL(jo(e,t),t)}Uu(),n(()=>import(`./telemetry-startup-Pz1ro4a2.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([84,0,1,2,3,4,45,7]),import.meta.url),Th({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Rh(),bg()&&Eg(),O_(),sg(),Xg(),Fg(),typeof window<`u`&&Bh({bridge:window.okDesktop}),typeof window<`u`&&Zh({bridge:window.okDesktop}),typeof window<`u`&&qc({bridge:window.okDesktop}),typeof window<`u`&&Hc({bridge:window.okDesktop}),typeof window<`u`&&Uh({bridge:window.okDesktop}),typeof window<`u`&&ih({bridge:window.okDesktop}),zg();var b$=new Qu({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),x$=document.getElementById(`root`);if(!x$)throw Error(`Root element not found`);var S$=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,ud.createRoot)(x$).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(on,{i18n:Ms,children:(0,Z.jsx)(wn,{client:b$,children:(0,Z.jsxs)(Zn,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Us,{children:S$&&window.okDesktop?(0,Z.jsx)(vh,{bridge:window.okDesktop}):(0,Z.jsx)(_$,{})}),(0,Z.jsx)(Ch,{richColors:!0,closeButton:!0})]})})})}));
|
|
2004
|
+
`}\n${cJ}\n${lJ}`;function aX(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&UY.has(t)}function oX(e){return e===`darwin`?Ms._({id:`LtSYdi`}):e===`win32`?Ms._({id:`qi1F96`}):Ms._({id:`e1Rn_k`})}function sX(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:i}=e,{_:a}=an(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let s=o.platform,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=oX(s),t[0]=c):c=t[0];let l=c,u,d;t[1]!==a||t[2]!==r?(u=r?null:a({id:`wTcjov`}),d=a(s===`darwin`?u?{id:`FvpFSZ`,values:{hint:u}}:{id:`LtSYdi`}:s===`win32`?u?{id:`o4dcAf`,values:{hint:u}}:{id:`qi1F96`}:u?{id:`zUhPuR`,values:{hint:u}}:{id:`e1Rn_k`}),t[1]=a,t[2]=r,t[3]=u,t[4]=d):(u=t[3],d=t[4]);let f=d,p=!r,m;t[5]!==n||t[6]!==i||t[7]!==r?(m=()=>{if(!r)return;i();let e=co(r.contentDir,bu(n),r.pathSeparator);o.shell.showItemInFolder(e)},t[5]=n,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h,g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Io,{"aria-hidden":`true`}),g=(0,Z.jsx)(`span`,{className:`flex-1`,children:l}),t[9]=h,t[10]=g):(h=t[9],g=t[10]);let _;t[11]===u?_=t[12]:(_=u?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:u}):null,t[11]=u,t[12]=_);let v;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(Cc,{disabled:p,onSelect:m,"aria-label":f,children:[h,g,_]}),t[13]=f,t[14]=p,t[15]=m,t[16]=_,t[17]=v):v=t[17],v}function cX(e,t){return Vu({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function lX(e,t){return e!==t&&e.startsWith(t)}function uX(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>lX(e,t))).map(e=>cX(e,t))}function dX(e,t){return e===t||e.startsWith(`${t}/`)}function fX(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function pX(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)dl(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):il(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=Hu(e);dX(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function mX(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:dX(t.createdPath,e.path)}function hX(e){let t=(0,$.c)(69),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,projectLocalBinding:l,mergedConfig:u,onStartCreating:d,onCreateFromTemplate:f,onDuplicate:p,onDelete:m,onExpandSubtree:h,onCollapseSubtree:g,folderTreePaths:_,isAsset:v,documents:y}=e,{_:b}=an(),x=Vu(n,y),S=n.kind===`directory`,C=x.kind===`asset`?null:x,w=C!==null&&c!==null,T;t[0]!==b||t[1]!==S?(T=b(S?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=b,t[1]=S,t[2]=T):T=t[2];let E=T,D=u?.appearance?.sidebar?.showHiddenFiles??!1,O=l!==null,k;t[3]!==S||t[4]!==n.path?(k=S?Hu(n.path):null,t[3]=S,t[4]=n.path,t[5]=k):k=t[5];let A=ya(k),j=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,M=s.getSelectedPaths(),N=M.includes(x.treePath)?uX(M,y):[],P=N.length>1?N:[x],F=P.length,I=Ms._({id:`djjdjr`,values:{deleteCount:F}}),L;t[6]!==v||t[7]!==S||t[8]!==n||t[9]!==a?(L=v?null:S?po({folderRelativePath:bu(n),workspace:a}):ko({docName:Su(n.path),workspace:a}),t[6]=v,t[7]=S,t[8]=n,t[9]=a,t[10]=L):L=t[10];let R=L,z;t[11]===r?z=t[12]:(z=()=>r.close({restoreFocus:!1}),t[11]=r,t[12]=z);let B=z,V;t[13]===r?V=t[14]:(V=()=>r.close(),t[13]=r,t[14]=V);let H=V,{status:U}=Ki(),W=U?.hasRemote===!0,G;t[15]!==v||t[16]!==S||t[17]!==n.path||t[18]!==x?(G=v||x.kind===`asset`?null:S?Bi(Hu(n.path)):Ri(Su(n.path)),t[15]=v,t[16]=S,t[17]=n.path,t[18]=x,t[19]=G):G=t[19];let K=G,ee=W&&K!==null,te;t[20]!==b||t[21]!==W||t[22]!==K?(te=()=>{K&&Mi({...K,hasRemote:W,onClickWhenNoRemote:()=>{Ss.error(b({id:`WyQxwa`}))}},{clipboardWrite:To,toastSuccess:vX,toastError:_X,logEvent:gX})},t[20]=b,t[21]=W,t[22]=K,t[23]=te):te=t[23];let q=te,J;t[24]!==ee||t[25]!==H||t[26]!==q?(J=ee?(0,Z.jsxs)(Cc,{"data-testid":`file-tree-menu-share`,onSelect:()=>{H(),q()},children:[(0,Z.jsx)(df,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Z8lGw6`})]}):null,t[24]=ee,t[25]=H,t[26]=q,t[27]=J):J=t[27];let ne=J,re;t[28]!==b||t[29]!==l?(re=e=>{if(l===null)return;let t=l.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,rr(t.error)),Ss.error(b({id:`P47EWZ`}),{description:rr(t.error)}))},t[28]=b,t[29]=l,t[30]=re):re=t[30];let ie=re,ae=0,oe=0;if(S){let e=Pu(n.path);for(let t of _)(t===e||t.startsWith(e))&&(ae++,tY(s.getItem(t))?.isExpanded()&&oe++)}let se=S&&oe<ae,ce=S&&oe>0,le;t[31]===H?le=t[32]:(le=e=>{e||H()},t[31]=H,t[32]=le);let ue;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[33]=ue):ue=t[33];let de;t[34]!==b||t[35]!==i||t[36]!==w||t[37]!==O||t[38]!==H||t[39]!==B||t[40]!==I||t[41]!==P||t[42]!==j||t[43]!==ie||t[44]!==o||t[45]!==R||t[46]!==E||t[47]!==v||t[48]!==S||t[49]!==n||t[50]!==s||t[51]!==c||t[52]!==C||t[53]!==g||t[54]!==f||t[55]!==m||t[56]!==p||t[57]!==h||t[58]!==d||t[59]!==ne||t[60]!==D||t[61]!==ce||t[62]!==se||t[63]!==x||t[64]!==a?(de=(0,Z.jsx)(Tc,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{B(),d(`file`,Hu(n.path))},children:[(0,Z.jsx)(hf,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`HdkSiO`})]}),j?(0,Z.jsxs)(bc,{children:[(0,Z.jsxs)(Fc,{disabled:i,children:[(0,Z.jsx)(ia,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Uuj_R4`})]}),(0,Z.jsx)(cc,{children:(0,Z.jsx)(eY,{parentDir:Hu(n.path),onSelectTemplate:e=>{B(),f(Hu(n.path),e)},ItemComponent:Cc})})]}):null,(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{B(),d(`folder`,Hu(n.path))},children:[(0,Z.jsx)(Ad,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`96G6Re`})]}),(0,Z.jsx)(Ic,{}),(0,Z.jsx)(sX,{item:n,workspace:a,onClose:H}),(0,Z.jsx)(mo,{input:R,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),ne,(0,Z.jsxs)(bc,{children:[(0,Z.jsxs)(Fc,{children:[(0,Z.jsx)(Ho,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`oCZkaG`})]}),(0,Z.jsxs)(cc,{children:[(0,Z.jsx)(Cc,{disabled:!a,onSelect:()=>{a&&(H(),HY(co(a.contentDir,bu(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(Y,{id:`oQA-cA`})}),(0,Z.jsx)(Cc,{onSelect:()=>{H(),HY(bu(n),`relative`)},children:(0,Z.jsx)(Y,{id:`s061i4`})})]})]}),(0,Z.jsx)(Ic,{}),(0,Z.jsx)(kc,{checked:D,onCheckedChange:ie,disabled:!O,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(Y,{id:`XcGbim`})}),se||ce?(0,Z.jsx)(Ic,{}):null,se?(0,Z.jsxs)(Cc,{onSelect:()=>{H(),h(n.path)},children:[(0,Z.jsx)(kf,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,ce?(0,Z.jsxs)(Cc,{onSelect:()=>{H(),g(n.path)},children:[(0,Z.jsx)(Od,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,(0,Z.jsx)(Ic,{}),(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{x.kind!==`asset`&&(H(),p(x))},children:[(0,Z.jsx)(zo,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`euc6Ns`})]}),(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{B(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Wo,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`2wxgft`})]}),(0,Z.jsxs)(Cc,{"data-testid":`file-tree-menu-hide`,disabled:!w,onSelect:()=>{if(!c||!C)return;H();let e=EJ(C),t=ta(c.current()),n=Zi(t,e);if(n===t)return;c.patch(aa(n));let r=C.path.split(`/`).pop()||C.path;Ss.success(b({id:`4xtLTl`,values:{basename:r}}),{description:b({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Gt,{"aria-hidden":`true`}),E]}),(0,Z.jsxs)(Cc,{variant:`destructive`,disabled:i,onSelect:()=>{H(),m(P)},children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`}),I]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sX,{item:n,workspace:a,onClose:H}),!v&&(0,Z.jsx)(mo,{input:R,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),ne,(0,Z.jsxs)(bc,{children:[(0,Z.jsxs)(Fc,{children:[(0,Z.jsx)(Ho,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`oCZkaG`})]}),(0,Z.jsxs)(cc,{children:[(0,Z.jsx)(Cc,{disabled:!a,onSelect:()=>{a&&(H(),HY(co(a.contentDir,bu(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(Y,{id:`oQA-cA`})}),(0,Z.jsx)(Cc,{onSelect:()=>{H(),HY(bu(n),`relative`)},children:(0,Z.jsx)(Y,{id:`s061i4`})})]})]}),(0,Z.jsx)(Ic,{}),v?null:(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{H(),p(x)},children:[(0,Z.jsx)(zo,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`euc6Ns`})]}),(0,Z.jsxs)(Cc,{disabled:i,onSelect:()=>{B(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Wo,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`2wxgft`})]}),C?(0,Z.jsxs)(Cc,{"data-testid":`file-tree-menu-hide`,disabled:!w,onSelect:()=>{if(!c)return;H();let e=EJ(C),t=ta(c.current()),n=Zi(t,e);if(n===t)return;c.patch(aa(n));let r=C.path.split(`/`).pop()||C.path;Ss.success(b({id:`OD0FCX`,values:{basename:r}}),{description:b({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Gt,{"aria-hidden":`true`}),E]}):null,(0,Z.jsxs)(Cc,{variant:`destructive`,disabled:i,onSelect:()=>{H(),m(P)},children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`}),I]})]})}),t[34]=b,t[35]=i,t[36]=w,t[37]=O,t[38]=H,t[39]=B,t[40]=I,t[41]=P,t[42]=j,t[43]=ie,t[44]=o,t[45]=R,t[46]=E,t[47]=v,t[48]=S,t[49]=n,t[50]=s,t[51]=c,t[52]=C,t[53]=g,t[54]=f,t[55]=m,t[56]=p,t[57]=h,t[58]=d,t[59]=ne,t[60]=D,t[61]=ce,t[62]=se,t[63]=x,t[64]=a,t[65]=de):de=t[65];let fe;return t[66]!==le||t[67]!==de?(fe=(0,Z.jsxs)(jc,{open:!0,modal:!1,onOpenChange:le,children:[ue,de]}),t[66]=le,t[67]=de,t[68]=fe):fe=t[68],fe}function gX(e){return console.log(e)}function _X(e){return Ss.error(e)}function vX(e){return Ss.success(e)}async function yX(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:mY});if(hY(i)){let e=await vY(i);return{kind:`entries`,entries:al(e.entries),truncated:e.truncated}}let a=await s(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=Hn.safeParse(a.body);return o.success?{kind:`entries`,entries:al(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof gY?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function bX(e){let t=(0,$.c)(356),{ref:n,onContentHeightChange:r}=e,{_:i,i18n:a}=an(),{activeDocName:o,activeTarget:c,closeTabs:l,closeDocument:u,closeAndClearForRename:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:h,openTarget:g,prewarm:_,remapTabsForRename:v}=pt(),{notifySidebarFileSelected:y}=jN(),{resolvedTheme:b}=tr(),{addPage:x,pageMeta:S}=to(),C;t[0]===S?C=t[1]:(C=function(e,t){return sl(e,t??S.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=S,t[1]=C);let w=C,T;t[2]!==w||t[3]!==y||t[4]!==g?(T=function(e,t){g(w(e,t),{tabBehavior:`replace-active`}),Yc(Jc(e)),y()},t[2]=w,t[3]=y,t[4]=g,t[5]=T):T=t[5];let E=T,D;t[6]!==y||t[7]!==g?(D=function(e){let t=hl(e);g({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),Yc(t),y()},t[6]=y,t[7]=g,t[8]=D):D=t[8];let O=D,k;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=[],t[9]=k):k=t[9];let[A,j]=(0,Q.useState)(k),[M,N]=(0,Q.useState)(!0),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=Ig(),z=(0,Q.useRef)(null),[B,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),[K,ee]=(0,Q.useState)(null),{conflicts:te}=Li(),[q,J]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(null),[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(ie),se;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(se=new Set,t[10]=se):se=t[10];let ce=(0,Q.useRef)(se),le=(0,Q.useRef)(A),ue=(0,Q.useRef)(S),de;t[11]!==A||t[12]!==O||t[13]!==E||t[14]!==y||t[15]!==g?(de=function(e,t){let n=t===void 0?A:t,r=VJ(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,mu(e));return}if(r.kind===`asset`){g({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),Yc(r.hash),y();return}if(r.kind===`folder`){O(r.path);return}let i=n.find(e=>dl(e)&&e.docName===r.path);E(r.path,i?.size)},t[11]=A,t[12]=O,t[13]=E,t[14]=y,t[15]=g,t[16]=de):de=t[16];let fe=de,pe;t[17]!==y||t[18]!==g?(pe=function(e,t){g({kind:`asset`,target:e,assetPath:e,mediaKind:(t??le.current).find(t=>il(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),Yc(Qc(e)),y()},t[17]=y,t[18]=g,t[19]=pe):pe=t[19];let me=pe,he=(0,Q.useRef)(o),ge;t[20]===A?ge=t[21]:(ge=new Set(A.filter(il).map(qX)),t[20]=A,t[21]=ge);let _e=ge,ve=(0,Q.useRef)(_e),ye;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ye=[],t[22]=ye):ye=t[22];let be=(0,Q.useRef)(ye),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(KX),Ce=(0,Q.useRef)(null),we=(0,Q.useRef)(null),Te=(0,Q.useRef)(!1),Ee=(0,Q.useRef)(!1),De=(0,Q.useRef)(null),Oe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Oe={row:null,root:null},t[23]=Oe):Oe=t[23];let ke=(0,Q.useRef)(Oe),Ae=(0,Q.useRef)(GX),je=(0,Q.useRef)(null),Me;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Me=new Map,t[24]=Me):Me=t[24];let Ne=(0,Q.useRef)(Me),Pe;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=new Set,t[25]=Pe):Pe=t[25];let Fe=(0,Q.useRef)(Pe),Le;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Le=new Map,t[26]=Le):Le=t[26];let Re=(0,Q.useRef)(Le),ze=(0,Q.useRef)(0),Ve;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=new Set,t[27]=Ve):Ve=t[27];let He=(0,Q.useRef)(Ve),Ue=(0,Q.useRef)(WX),We=(0,Q.useRef)(UX),Ge=(0,Q.useRef)(!1),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(null),Je=(0,Q.useRef)(HX),Ye=(0,Q.useRef)(VX),Xe=(0,Q.useRef)(BX),Ze=(0,Q.useRef)(zX),Qe=(0,Q.useRef)(c),[$e,et]=(0,Q.useState)(!1),tt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(tt=function(){z.current!==null&&(clearTimeout(z.current),z.current=null)},t[28]=tt):tt=t[28];let nt=tt,rt;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(rt=function(){nt(),L(!1)},t[29]=rt):rt=t[29];let at=rt,ot;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ot=function(e){at(),F(e)},t[30]=ot):ot=t[30];let st=ot,ct;t[31]===i?ct=t[32]:(ct=function(){if(nt(),Mg()){F(null),L(!0),z.current=setTimeout(()=>{z.current=null,Ke.current?.()},tX);return}L(!1),F(i({id:`34qyH5`}))},t[31]=i,t[32]=ct);let lt=ct,ut=(0,Q.useRef)(!0),dt;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(dt=()=>{if(ut.current){ut.current=!1;return}Ke.current?.()},t[33]=dt):dt=t[33];let ft;t[34]===R?ft=t[35]:(ft=[R],t[34]=R,t[35]=ft),(0,Q.useEffect)(dt,ft);let mt,ht;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(mt=()=>nt,ht=[],t[36]=mt,t[37]=ht):(mt=t[36],ht=t[37]),(0,Q.useEffect)(mt,ht);let gt,_t;t[38]!==A.length||t[39]!==M?(gt=()=>{if(M||A.length===0)return;let e=qe.current?.querySelector(QR)?.shadowRoot;if(!e)return;let t=e,n=function(){De.current!==null&&clearTimeout(De.current),De.current=setTimeout(()=>{Ee.current=!1,De.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=YX(e),n=t?.dataset.itemPath;if(!n)return;let r=KJ(t.dataset.itemType===`folder`?Pu(n):n,le.current,ue.current);r&&(De.current!==null&&(clearTimeout(De.current),De.current=null),Ee.current=!0,e.dataTransfer?.setData(gu,ku(r)))},i=function(e){if(!(e instanceof DragEvent)||!ju(e))return;let t=ZX(e);if(!t){BY(ke);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),VY(ke,t)},a=function(e){if(!(e instanceof DragEvent)||!ju(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||BY(ke)},o=function(e){if(!(e instanceof DragEvent)||!ju(e))return;let t=ZX(e),n=Tu(e);if(!t||n.length===0){BY(ke);return}e.preventDefault(),e.stopPropagation(),BY(ke),Ae.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),BY(ke),De.current!==null&&(clearTimeout(De.current),De.current=null),Ee.current=!1}},_t=[A.length,M],t[38]=A.length,t[39]=M,t[40]=gt,t[41]=_t):(gt=t[40],_t=t[41]),(0,Q.useEffect)(gt,_t);let{selectedFilePath:vt,selectedFolderPath:yt,navigationPath:bt}=BJ(c,h?null:o),xt=vt?Iu(vt,A.find(e=>dl(e)&&e.docName===vt)?.docExt):yt?Pu(yt):c?.kind===`asset`?c.assetPath:null,St=ie?null:xt,Ct=So().states,{dispatch:wt}=Ao(),Tt;t[42]!==wt||t[43]!==Ct?(Tt={installStates:Ct,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:wt},t[42]=wt,t[43]=Ct,t[44]=Tt):Tt=t[44];let Et=Tt,{okignoreBinding:Dt,projectLocalBinding:Ot,merged:kt}=Bo(),At=kt?.appearance?.sidebar?.showHiddenFiles??!1,jt;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>je.current===null,t[45]=jt):jt=t[45];let Mt=jt,Nt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=[],t[46]=Nt):Nt=t[46];let Pt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Pt={set:`complete`,spriteSheet:XY,byFileExtension:{md:{name:KY,viewBox:Be},mdx:{name:KY,viewBox:Be}}},t[47]=Pt):Pt=t[47];let Ft;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ft={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[48]=Ft):Ft=t[48];let It;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(It={canDrag:Mt,canDrop:Mt,onDropComplete:e=>Ze.current(e),onDropError:RX},t[49]=It):It=t[49];let Lt,Rt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Lt={canRename:Mt,onRename:e=>Ye.current(e),onError:e=>Xe.current(e)},Rt=e=>Je.current(e),t[50]=Lt,t[51]=Rt):(Lt=t[50],Rt=t[51]);let zt;t[52]===i?zt=t[53]:(zt={paths:Nt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...oJ,icons:Pt,unsafeCSS:iX,composition:Ft,dragAndDrop:It,renaming:Lt,onSelectionChange:Rt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=le.current.find(e=>dl(e)&&Iu(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:WY,title:i(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return aX(t.path)?{icon:GY,title:i({id:`i9toLO`})}:null}let n=le.current.find(e=>cl(e)&&Pu(e.path)===Pu(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:WY,title:i(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[52]=i,t[53]=zt);let{model:Bt}=aJ(zt),Vt;t[54]===Bt?Vt=t[55]:(Vt=function(e){let t=Bt.getItem(e)??Bt.getItem(Pu(e));return t?.isDirectory()?Pu(Hu(t.getPath())):e},t[54]=Bt,t[55]=Vt);let Ht=Vt,Ut,Wt;t[56]===A?(Ut=t[57],Wt=t[58]):(Wt=Cu(A),Ut=vu(Wt),t[56]=A,t[57]=Ut,t[58]=Wt);let Gt=Ut,Kt=(0,Q.useRef)(Wt),qt;t[59]===A?qt=t[60]:(qt=Mu(A),t[59]=A,t[60]=qt);let Jt=qt,Yt=(0,Q.useRef)(Jt),Xt=yt?Fu(Pu(yt)).slice(0,-1):Fu(St??bt),Qt=Xt.join(`\0`),$t;t[61]===Bt?$t=t[62]:($t=()=>{let e=new Set;for(let t of Yt.current)tY(Bt.getItem(t))?.isExpanded()&&e.add(t);return e},t[61]=Bt,t[62]=$t);let en=$t,tn;t[63]===en?tn=t[64]:(tn=e=>{let t=new Set(Mu(e??le.current)),n=en();for(let e of be.current)n.add(e);return[...n].filter(e=>t.has(e))},t[63]=en,t[64]=tn);let nn=tn,rn;t[65]!==nn||t[66]!==Bt?(rn=e=>{let t=Cu(e??le.current);Bt.resetPaths(t,{initialExpandedPaths:nn(e)})},t[65]=nn,t[66]=Bt,t[67]=rn):rn=t[67];let on=rn,sn;t[68]!==i||t[69]!==lt?(sn=async function(e){let t=ze.current,n=new AbortController;Re.current.set(e,n);let r=await yX(Hu(e),n.signal,i({id:`8RtNI0`}),i({id:`HlmZBk`}));if(Re.current.get(e)===n&&Re.current.delete(e),n.signal.aborted||t!==ze.current)return;if(r.kind===`network-error`){lt(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,r.cause);return}if(r.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,r.title),st(r.title);return}let a=Ge.current,o=rl(r.entries,a);Fe.current.add(e),j(t=>xY(t,e,o,Ne.current)),F(null),at(),r.truncated&&V(r.entries.length)},t[68]=i,t[69]=lt,t[70]=sn):sn=t[70];let cn=sn,ln;t[71]!==en||t[72]!==cn?(ln=()=>{let e=en(),t=He.current;He.current=e;for(let n of e){if(t.has(n)||Fe.current.has(n)||Re.current.has(n))continue;let e=Hu(n);le.current.find(t=>cl(t)&&t.path===e)?.hasChildren!==!1&&cn(n)}},t[71]=en,t[72]=cn,t[73]=ln):ln=t[73];let un=ln,dn;t[74]!==en||t[75]!==cn?(dn=()=>{for(let e of en())Fe.current.has(e)||Re.current.has(e)||cn(e)},t[74]=en,t[75]=cn,t[76]=dn):dn=t[76];let fn=dn,pn;t[77]!==Bt||t[78]!==on?(pn=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>dl(e)&&e.docName===r);if(n==null||Bt.getItem(i)==null)continue;let s=Iu(i,t.find(e=>dl(e)&&e.docName===i)?.docExt??n.docExt);Bt.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=Cl(e);if(t===``)continue;let n=e.slice(0,-t.length);Bt.getItem(n)!=null&&(Bt.getItem(e)??Bt.move(n,e),o=e,a+=1)}a!==0&&(on(t),o!=null&&Bt.focusPath(o))},t[77]=Bt,t[78]=on,t[79]=pn):pn=t[79];let mn=pn,hn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(hn=e=>{Ce.current=Au(e)},t[80]=hn):hn=t[80];let gn=hn,_n;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(_n=e=>ve.current.has(e),t[81]=_n):_n=t[81];let vn=_n,yn;t[82]!==i||t[83]!==x||t[84]!==O||t[85]!==E||t[86]!==on?(yn=async function(e){if(e.kind===`asset`||je.current!==null)return;let t=()=>{U(null),je.current=null};je.current=e.path,U(e.path),F(null);try{let n=await s(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),i({id:`dw_dUJ`}));if(!n.ok){Ss.error(n.title),on(),t();return}let r=Ie(ar,n.body,`duplicate-path`,null);if(r===null){let e=i({id:`67f-3g`});Ss.error(e),F(e),Os([`files`,`backlinks`,`graph`]),on(),t();return}for(let e of r.duplicatedDocNames)x(e);j(t=>{let n=OF(t,e,r);return on(n),gn(n),n}),Os([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?O(r.path):E(r.path)),Ss.success(r.kind===`folder`?i({id:`iilQXA`}):i({id:`A6h5b-`}),{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),Ss.error(i({id:`EBVbtP`}),{description:r}),on(),t()}},t[82]=i,t[83]=x,t[84]=O,t[85]=E,t[86]=on,t[87]=yn):yn=t[87];let bn=yn,xn=(0,Q.useRef)(bn),Sn;t[88]===bn?Sn=t[89]:(Sn=()=>{xn.current=bn},t[88]=bn,t[89]=Sn),(0,Q.useEffect)(Sn);let Cn=function(e){let t=LY(e);if(!t||RY(t))return!1;let n=Bt.getFocusedPath()??Bt.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||vn(n))return!1;let r=RY(n);if(!r)return!1;let i=Pu(t);if(!Yt.current.includes(i))return!1;let a=`${t}${r}`;return Kt.current.includes(a)?!1:(ir({sourcePath:n,destinationPath:a,isFolder:!1}),Bt.move(n,a),!0)},wn;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(wn=e=>{let t=e??xe.current;!t||xe.current!==t||(t.disposeCommitListener(),xe.current=null)},t[90]=wn):wn=t[90];let Tn=wn,En;t[91]!==i||t[92]!==Tn||t[93]!==u||t[94]!==l||t[95]!==on?(En=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,a=n.restoreLocation??r;Tn(e),r&&U(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await s(t,i({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let c=o.title,l=i({id:`YPFBfr`,values:{detail:c,kind:n,createdPath:a}});r?Ss.error(l):console.warn(`[FileTree] cleanup pending create failed: ${l}`),r&&(U(null),on());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),r){let t=e.kind,n=e.createdPath;Ss.error(i({id:`_TDESN`,values:{kind:t,createdPath:n}}))}r&&(U(null),on());return}r&&(e.kind===`file`?u(e.createdPath):l([Zt(e.createdPath)],{force:!0})),r&&j(t=>{let n=EF(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return gn(n),n}),Os([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),r&&U(null)},t[91]=i,t[92]=Tn,t[93]=u,t[94]=l,t[95]=on,t[96]=En):En=t[96];let Dn=En,On,kn;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(On=()=>()=>{let e=xe.current;e&&Se.current(e,{restoreLocation:!1,updateUi:!1}).catch(LX)},kn=[],t[97]=On,t[98]=kn):(On=t[97],kn=t[98]),(0,Q.useEffect)(On,kn);let An;t[99]!==i||t[100]!==lt?(An=()=>{let e=!0,t=null,n=pY(async function(){t?.abort();let n=new AbortController;t=n,ze.current+=1;for(let e of Re.current.values())e.abort();Re.current.clear(),Fe.current.clear();try{let t=await fetch(`/api/documents?showAll=true&dir=&depth=1`,{signal:n.signal,headers:mY});if(hY(t)){let r=Ge.current,i=!1,{entries:a,truncated:o}=await vY(t,{onBatch:t=>{if(!e||n.signal.aborted)return;let a=rl(al(t),r);a.length!==0&&(j(e=>bY(e,a)),i||(i=!0,F(null),at(),N(!1)))}});if(!e)return;let s=rl(al(a),r);j(e=>xY(e,``,s,Ne.current)),F(null),at(),V(o?a.length:null),We.current()}else{let n=await s(t,i({id:`8RtNI0`}));if(!e)return;if(!n.ok)st(n.title),V(null);else{let e=Hn.safeParse(n.body);if(!e.success)st(i({id:`HlmZBk`})),V(null);else{let t=Ge.current,n=rl(al(e.data.documents),t);j(e=>xY(e,``,n,Ne.current)),F(null),at(),V(e.data.truncated===!0?e.data.documents.length:null),We.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof gY?st(r.message):lt()),console.warn(`[FileTree] fetch failed:`,r)}e&&N(!1)},()=>t?.abort());Ke.current=()=>n.request(),n.request();let r=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,r),window.addEventListener(`visibilitychange`,r);let a=ks(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Ke.current=null,n.dispose();for(let e of Re.current.values())e.abort();Re.current.clear(),window.removeEventListener(`focus`,r),window.removeEventListener(`visibilitychange`,r),a()}},t[99]=i,t[100]=lt,t[101]=An):An=t[101];let jn;t[102]===i?jn=t[103]:(jn=[i],t[102]=i,t[103]=jn),(0,Q.useEffect)(An,jn);let Mn=(0,Q.useRef)(!0),Nn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Nn=()=>{if(Mn.current){Mn.current=!1;return}Ke.current?.()},t[104]=Nn):Nn=t[104];let Pn;t[105]===At?Pn=t[106]:(Pn=[At],t[105]=At,t[106]=Pn),(0,Q.useEffect)(Nn,Pn);let Fn,In;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Fn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=Ie(Gr,n,`workspace`,null);r&&re({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(IX),()=>{e=!1}},In=[],t[107]=Fn,t[108]=In):(Fn=t[107],In=t[108]),(0,Q.useEffect)(Fn,In);let Ln;t[109]!==nn||t[110]!==Bt||t[111]!==Gt?(Ln=()=>{if(Ce.current===Gt){Ce.current=null;return}Bt.resetPaths(Kt.current,{initialExpandedPaths:nn()})},t[109]=nn,t[110]=Bt,t[111]=Gt,t[112]=Ln):Ln=t[112];let Rn;t[113]!==Bt||t[114]!==Gt?(Rn=[Bt,Gt],t[113]=Bt,t[114]=Gt,t[115]=Rn):Rn=t[115],(0,Q.useEffect)(Ln,Rn),rY(Bt,St,Qt,Te,Gt);let zn,Bn;t[116]!==Bt||t[117]!==r?(zn=()=>{if(!r)return;let e=0,t=0,n=()=>qe.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,i=()=>{let e=n();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&r(t)},a=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(i)},o=new MutationObserver(i),s=()=>{let e=n();e?(o.observe(e,{attributes:!0,attributeFilter:[`style`]}),i()):t=requestAnimationFrame(s)};s();let c=Bt.subscribe(a);return window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),o.disconnect(),c(),window.removeEventListener(`resize`,a)}},Bn=[r,Bt],t[116]=Bt,t[117]=r,t[118]=zn,t[119]=Bn):(zn=t[118],Bn=t[119]),(0,Q.useEffect)(zn,Bn);let Vn;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=()=>{ae(!1)},t[120]=Vn):Vn=t[120];let Wn;t[121]===xt?Wn=t[122]:(Wn=[xt],t[121]=xt,t[122]=Wn),(0,Q.useEffect)(Vn,Wn);let Gn,Kn;t[123]===ie?(Gn=t[124],Kn=t[125]):(Gn=()=>{oe.current=ie;for(let e of ce.current)e()},Kn=[ie],t[123]=ie,t[124]=Gn,t[125]=Kn),(0,Q.useEffect)(Gn,Kn);let qn;t[126]!==St||t[127]!==M||t[128]!==Bt?(qn=()=>{M||!St||RJ(Bt)},t[126]=St,t[127]=M,t[128]=Bt,t[129]=qn):qn=t[129];let Jn;t[130]!==Qt||t[131]!==St||t[132]!==M||t[133]!==Bt||t[134]!==Gt?(Jn=[St,Qt,Gt,M,Bt],t[130]=Qt,t[131]=St,t[132]=M,t[133]=Bt,t[134]=Gt,t[135]=Jn):Jn=t[135],(0,Q.useEffect)(qn,Jn);let Yn,Xn;t[136]===Bt?(Yn=t[137],Xn=t[138]):(Yn=()=>Bt.subscribe(()=>{if(!Bt.isSearchOpen())for(let e of be.current){let t=tY(Bt.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Xn=[Bt],t[136]=Bt,t[137]=Yn,t[138]=Xn),(0,Q.useEffect)(Yn,Xn);let Zn,Qn;t[139]===Bt?(Zn=t[140],Qn=t[141]):(Zn=()=>Bt.subscribe(()=>Ue.current()),Qn=[Bt],t[139]=Bt,t[140]=Zn,t[141]=Qn),(0,Q.useEffect)(Zn,Qn);let $n,er;t[142]===Bt?($n=t[143],er=t[144]):($n=()=>Bt.onMutation(`remove`,e=>{let t=xe.current;!t||e.path!==t.renamePath||Se.current(t)}),er=[Bt],t[142]=Bt,t[143]=$n,t[144]=er),(0,Q.useEffect)($n,er);let nr;t[145]!==x||t[146]!==d||t[147]!==f||t[148]!==me||t[149]!==O||t[150]!==E||t[151]!==p||t[152]!==mn||t[153]!==v?(nr=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??he.current,l=new Map,u=new Map;for(let e of le.current){if(dl(e)){let t=o.find(t=>t.fromPath===Iu(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(il(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&xl(t)&&u.set(e.path,Su(t))}}let h=c?l.get(c)??null:null,g=r?.folderPath??(Qe.current?.kind===`folder`?Qe.current.folderPath:null),_=g?m(g,a):null,y=r?.assetPath??(Qe.current?.kind===`asset`?Qe.current.assetPath:null),b=y?u.get(y)??null:null,S=h?null:b??kF(c,e),C=h??(y?b?null:o.find(e=>e.fromPath===y)?.toPath??m(y,a):null);it(e);let w=[...AF(e,f(),p),...l.keys()];await Promise.all(w.map(e=>d(e)));for(let t of e)x(t.toDocName);for(let e of u.values())x(e);v(e,a,o);let T=null;j(t=>{let n=TF(t,e,a,o,s);return T=n,mn(t,n,e,o),gn(n),n}),g&&_&&_!==g?O(_):S&&S!==c?(E(S),zY(S)):C&&(h||C!==y)&&me(C,T??le.current),Os([`files`,`backlinks`,`graph`])},t[145]=x,t[146]=d,t[147]=f,t[148]=me,t[149]=O,t[150]=E,t[151]=p,t[152]=mn,t[153]=v,t[154]=nr):nr=t[154];let rr=nr;async function ir(e){let t=!e.isFolder&&vn(e.sourcePath),n=t?e.sourcePath:Du(e.sourcePath,e.isFolder);U(n),F(null);try{let r=Sl(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!xl(r.destinationPath),o=t||a?r.destinationPath:Du(r.destinationPath,e.isFolder),c=e.isFolder?{kind:`folder`,fromPath:Hu(n),toPath:Hu(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:Su(n),toPath:o},l={docName:he.current,folderPath:Qe.current?.kind===`folder`?Qe.current.folderPath:null,assetPath:Qe.current?.kind===`asset`?Qe.current.assetPath:null},u=await s(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`gijbne`}));if(!u.ok){Ss.error(u.title),on();let e=xe.current;e&&e.renamePath===n?await Dn(e):Tn(),U(null);return}let d=Ie(Nr,u.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await rr(d.renamed,e.isFolder?[{fromPath:Hu(n),toPath:Hu(o)}]:[],d.renamedAssets,l,!e.isFolder&&!t&&!a?d.renamed.flatMap(e=>{let t=Cl(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:d.renamed.length,renamedAssetCount:d.renamedAssets.length}),Ss.error(i({id:`dDpCOp`}))}Tn(),U(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=i({id:`HIb0vl`});Ss.error(t),F(t),on();let r=xe.current;r&&r.renamePath===n?await Dn(r):Tn(),U(null)}}let sr;t[155]!==i||t[156]!==rr||t[157]!==on?(sr=async function(e){let t=e.draggedPaths.map(t=>{let n=Ou(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(FX);if(t.length!==0){U(t[0]?.sourcePath??null),F(null);try{let e=[],n=[],r=[],a={docName:he.current,folderPath:Qe.current?.kind===`folder`?Qe.current.folderPath:null,assetPath:Qe.current?.kind===`asset`?Qe.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&vn(a.sourcePath),c=t?{kind:`folder`,fromPath:Hu(a.sourcePath),toPath:Hu(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:Su(a.sourcePath),toPath:Su(a.destinationTreePath)},l=await s(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`dOHMA0`}));if(!l.ok){Ss.error(l.title),on(),U(null);return}let u=Ie(Nr,l.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(u.renamed),n=n.concat(u.renamedAssets),t&&r.push({fromPath:Hu(a.sourcePath),toPath:Hu(a.destinationTreePath)})}try{await rr(e,r,n,a)}catch(r){console.warn(`[FileTree] post-move reconciliation failed`,{err:r,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),Ss.error(i({id:`8OxKZy`}))}U(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Ss.error(i({id:`HIb0vl`})),on(),U(null)}}},t[155]=i,t[156]=rr,t[157]=on,t[158]=sr):sr=t[158];let cr=sr,lr;t[159]!==i||t[160]!==x||t[161]!==on?(lr=async function(e,t,n){if(e.length===0||je.current!==null)return;let r=()=>{je.current=null,U(null)};je.current=n,U(n),F(null);let a=[],o=0,c=0;for(let n of e){let e=new FormData;e.append(`file`,n),Lu(e,t,n.name||`upload`);try{let r=await s(await fetch(`/api/upload`,{method:`POST`,body:e}),i({id:`4Gz2wC`}));if(!r.ok){c+=1,Ss.error(r.title,{description:n.name});continue}let l=Ie(or,r.body,`upload:drop`,null);if(l===null){c+=1,Ss.error(i({id:`4Gz2wC`}),{description:n.name});continue}let u=Bu(t,l);if(l.deduped===!0){c+=1,Ss.error(i({id:`4sKwf6`}),{description:u});continue}o+=1;let d=Ru(u,n);d&&a.push(d)}catch(e){let t=e;c+=1,console.warn(`[FileTree] external file upload failed:`,t),Ss.error(t instanceof TypeError?i({id:`HIb0vl`}):i({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)dl(e)&&x(e.docName);j(e=>{let t=new Set(e.map(wu)),n=!1,r=[...e];for(let e of a){let i=wu(e);Ne.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(on(r),gn(r),r):e})}o>0&&(Os([`files`,`backlinks`,`graph`]),Ke.current?.(),Ss.success(Ms._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||i({id:`RSqaSd`})})),c>0&&F(o>0?Ms._({id:`yH7T4q`,values:{failedCount:c}}):i({id:`4Gz2wC`})),r()}catch(e){let t=e,n=i({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),Ss.error(n),F(n),r()}},t[159]=i,t[160]=x,t[161]=on,t[162]=lr):lr=t[162];let ur=lr,fr;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(fr=function(e){J({parentDir:e})},t[163]=fr):fr=t[163];let pr=fr,mr;t[164]!==i||t[165]!==x||t[166]!==Dn||t[167]!==Tn||t[168]!==Bt||t[169]!==O||t[170]!==E||t[171]!==on||t[172]!==Wt?(mr=async function(e,t,n){if(je.current)return;let r=xe.current;r&&Tn(r);try{let r=Nu(e,t,[...Wt,...Yt.current]);U(r.renamePath),je.current=r.renamePath;let a=window.location.hash,o;if(e===`file`){let e=xu(`file`,r.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await s(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i({id:`fJgQHX`}));if(!a.ok){Ss.error(a.title),U(null),je.current=null;return}let c=Su(e),l=Ie(dr,a.body,`create-page`,{docName:c}).docName;o=l;let u={kind:`document`,docName:l,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};x(l),j(e=>{if(e.some(e=>dl(e)&&e.docName===l))return e;let t=[...e,u];return gn(t),Ne.current.set(wu(u),Date.now()),t}),Os([`files`,`backlinks`,`graph`]),E(l)}else{let e=Hu(r.addPath),t=await s(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i({id:`K1ckLX`}));if(!t.ok){Ss.error(t.title),U(null),je.current=null;return}o=Ie(yi,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};j(e=>{if(e.some(e=>cl(e)&&e.path===o))return e;let t=[...e,n];return gn(t),Ne.current.set(wu(n),Date.now()),t}),Os([`files`]),O(o)}let c=!1,l=e=>{if(e.key!==`Enter`)return;let t=xe.current;!t||t.renamePath!==r.renamePath||queueMicrotask(()=>Tn(t))};document.addEventListener(`keydown`,l,!0),xe.current={kind:e,renamePath:r.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{c||(c=!0,document.removeEventListener(`keydown`,l,!0))}},U(null),je.current=null,Bt.add(r.addPath),Bt.startRenaming(r.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Ss.error(i({id:`S6l5dv`}));let t=xe.current;t?await Dn(t):Tn(),U(null),je.current=null,on()}},t[164]=i,t[165]=x,t[166]=Dn,t[167]=Tn,t[168]=Bt,t[169]=O,t[170]=E,t[171]=on,t[172]=Wt,t[173]=mr):mr=t[173];let hr=mr,gr;t[174]===Bt?gr=t[175]:(gr=function(e){let t=Pu(e);(0,Q.startTransition)(()=>{for(let e of Yt.current)if(e===t||e.startsWith(t)){let t=tY(Bt.getItem(e));t&&t.expand()}})},t[174]=Bt,t[175]=gr);let _r=gr,vr;t[176]===Bt?vr=t[177]:(vr=function(e){let t=Pu(e),n=new Set(be.current);(0,Q.startTransition)(()=>{for(let e of[...Yt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=tY(Bt.getItem(e));t&&t.collapse()}})},t[176]=Bt,t[177]=vr);let yr=vr,br;t[178]!==fe||t[179]!==Xt||t[180]!==o||t[181]!==c||t[182]!==_e||t[183]!==H||t[184]!==Dn||t[185]!==un||t[186]!==A||t[187]!==Jt||t[188]!==cr||t[189]!==ir||t[190]!==Ht||t[191]!==S||t[192]!==Cn||t[193]!==fn||t[194]!==At||t[195]!==Wt||t[196]!==ur?(br=()=>{le.current=A,ue.current=S,he.current=o,Qe.current=c,ve.current=_e,je.current=H,Ge.current=At,Kt.current=Wt,Yt.current=Jt,be.current=Xt,Ue.current=un,We.current=fn,Se.current=Dn,Ae.current=(e,t,n)=>{ur(e,t,n)},Je.current=e=>{if(Te.current||Ee.current||e.length!==1)return;let t=e[0];t&&(ae(!1),fe(Ht(t),A))},Xe.current=e=>{Cn(e)||Ss.error(e)},Ye.current=ir,Ze.current=cr},t[178]=fe,t[179]=Xt,t[180]=o,t[181]=c,t[182]=_e,t[183]=H,t[184]=Dn,t[185]=un,t[186]=A,t[187]=Jt,t[188]=cr,t[189]=ir,t[190]=Ht,t[191]=S,t[192]=Cn,t[193]=fn,t[194]=At,t[195]=Wt,t[196]=ur,t[197]=br):br=t[197],(0,Q.useLayoutEffect)(br);let xr,Sr;t[198]===Bt?(xr=t[199],Sr=t[200]):(xr=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||fX(e.target))return;let a=qe.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=Bt.getFocusedPath()??Bt.getSelectedPaths()[0]??null;if(!t)return;let n=Bt.getItem(t)??Bt.getItem(Pu(t)),r=n?.isDirectory()?Pu(Hu(n.getPath())):t;if(ve.current.has(r))return;xn.current(cX(r,le.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Yt.current,...Kt.current]);Te.current=!0;for(let e of u)e&&Bt.getItem(e)?.select();queueMicrotask(()=>{Te.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Sr=[Bt],t[198]=Bt,t[199]=xr,t[200]=Sr),(0,Q.useEffect)(xr,Sr);let Cr,wr;t[201]!==A.length||t[202]!==M?(Cr=()=>{if(M||A.length===0)return;let e=qe.current?.querySelector(QR)?.shadowRoot;if(!e)return;let t=PX,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},wr=[M,A.length],t[201]=A.length,t[202]=M,t[203]=Cr,t[204]=wr):(Cr=t[203],wr=t[204]),(0,Q.useEffect)(Cr,wr);let Tr,Er;t[205]!==A.length||t[206]!==M?(Tr=()=>{if(M||A.length===0)return;let e=qe.current?.querySelector(QR)?.shadowRoot;if(!e)return;let t=()=>hJ(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Er=[M,A.length],t[205]=A.length,t[206]=M,t[207]=Tr,t[208]=Er):(Tr=t[207],Er=t[208]),(0,Q.useEffect)(Tr,Er);let Dr,Or;t[209]!==A.length||t[210]!==M?(Dr=()=>{if(M||A.length===0)return;let e=qe.current?.querySelector(QR)?.shadowRoot;if(!e)return;let t=()=>NJ(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Or=[M,A.length],t[209]=A.length,t[210]=M,t[211]=Dr,t[212]=Or):(Dr=t[211],Or=t[212]),(0,Q.useEffect)(Dr,Or);let kr;t[213]===Symbol.for(`react.memo_cache_sentinel`)?(kr={folderCount:0,expandedCount:0},t[213]=kr):kr=t[213];let Ar=(0,Q.useRef)(kr),jr=(0,Q.useRef)(hr),Mr=(0,Q.useRef)(pr),Pr;t[214]===hr?Pr=t[215]:(Pr=()=>{jr.current=hr,Mr.current=pr},t[214]=hr,t[215]=Pr),(0,Q.useEffect)(Pr);let Fr,Ir;t[216]===Bt?(Fr=t[217],Ir=t[218]):(Fr=()=>({startCreating(e,t){jr.current(e,t)},startCreatingFromTemplate(e){Mr.current(e)},createFromTemplate(e,t){jr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Yt.current){let t=tY(Bt.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(be.current);(0,Q.startTransition)(()=>{for(let t of[...Yt.current].reverse()){if(e.has(t))continue;let n=tY(Bt.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Yt.current,t=0;for(let n of e)tY(Bt.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Ar.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Ar.current=i,i},isCreationTargetCleared(){return oe.current},clearCreationTarget(){ae(!0)},subscribe(e){ce.current.add(e);let t=Bt.subscribe(e);return()=>{ce.current.delete(e),t()}}}),Ir=[Bt],t[216]=Bt,t[217]=Fr,t[218]=Ir),(0,Q.useImperativeHandle)(n,Fr,Ir);let Lr;t[219]!==Tn||t[220]!==d||t[221]!==l||t[222]!==Bt?(Lr=async function(e,t,n){let r=pX(e,le.current,Yt.current),i=xe.current;i&&e.some(e=>mX(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Tn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(NX).map(MX)]);l([...[...a].map(jX),...[...o].map(AX),...[...s].map(kX)],{force:!0}),await Promise.all([...a].map(e=>d(e)));for(let t of e){let e=t.kind===`folder`?Pu(t.path):t.kind===`asset`?t.path:Iu(t.path,t.docExt);Bt.getItem(e)&&Bt.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}j(e=>{let t=EF(e,[...a],void 0,[...s]);for(let e of o)t=EF(t,[],e);return gn(t),t}),Os([`files`,`backlinks`,`graph`])},t[219]=Tn,t[220]=d,t[221]=l,t[222]=Bt,t[223]=Lr):Lr=t[223];let Rr=Lr,zr;t[224]!==i||t[225]!==Rr?(zr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;U(a.path);let o=await s(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`7JtSLi`}));if(!o.ok)return r.length>0&&await Rr(r,t,n),Ss.error(o.title),!1;let c=Ie(gi,o.body,`delete-path`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path),r.push(a)}return await Rr(r,t,n),!0},t[224]=i,t[225]=Rr,t[226]=zr):zr=t[226];let Br=zr,Vr;t[227]===Symbol.for(`react.memo_cache_sentinel`)?(Vr=async function(e,t,n){let r=[],i=[];for(let a of e){U(a.path);let e=jF(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:JJ(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[227]=Vr):Vr=t[227];let Hr=Vr,Ur;t[228]===i?Ur=t[229]:(Ur=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;try{let o=await s(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),r.push({target:a,reason:o.title});continue}let c=Ie(Un,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),r.push({target:a,reason:i({id:`r4R7AZ`})})}}if(r.length>0){let e=r.length;Ss.error(i({id:`IrB5AK`,values:{failedCount:e}}),{description:i({id:`vEJDlt`})})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[228]=i,t[229]=Ur);let Wr=Ur,Kr;t[230]!==i||t[231]!==te||t[232]!==Rr||t[233]!==Br||t[234]!==Wr||t[235]!==on||t[236]!==ne?(Kr=async function(e){let t=e.map(e=>DF(e,le.current)),n=t[0];if(!n)return;let r=te.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(r.length>0){let e=r.slice(0,3).map(OX),t=r.length>e.length?`, +${r.length-e.length} more`:``;Ss.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}U(n.path),G(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&ne){let{trashed:e,failed:n}=await Hr(t,a,ne);if(e.length>0){let t=await Wr(e);t?await Rr(e,t.deletedDocNames,t.deletedFolderPaths):await Rr(e,e.filter(DX).map(EX),e.filter(TX).map(wX))}n.length>0&&ee({failed:n,originalTargets:[...t]}),U(null)}else{let e=await Br(t);U(null),e||on()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),Ss.error(i({id:`0eHrMb`}),{description:n}),U(null),on()}},t[230]=i,t[231]=te,t[232]=Rr,t[233]=Br,t[234]=Wr,t[235]=on,t[236]=ne,t[237]=Kr):Kr=t[237];let qr=Kr,Jr;t[238]!==i||t[239]!==Br||t[240]!==on||t[241]!==K?(Jr=async function(){if(!K)return;let e=new Set(K.failed.map(CX)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(ee(null),t.length!==0){U(t[0]?.path??null);try{let e=await Br(t);U(null),e||on()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),Ss.error(i({id:`0eHrMb`}),{description:n}),U(null),on()}}},t[238]=i,t[239]=Br,t[240]=on,t[241]=K,t[242]=Jr):Jr=t[242];let Yr=Jr,Xr;t[243]!==qr||t[244]!==K?(Xr=async function(){if(!K)return;let e=new Set(K.failed.map(SX)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));ee(null),await qr(t)},t[243]=qr,t[244]=K,t[245]=Xr):Xr=t[245];let Zr=Xr,Qr=(0,Q.useRef)(qr),$r;t[246]===qr?$r=t[247]:($r=()=>{Qr.current=qr},t[246]=qr,t[247]=$r),(0,Q.useEffect)($r);let ei,ti;t[248]===Symbol.for(`react.memo_cache_sentinel`)?(ei=()=>cY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>dl(e)&&e.docName===t);Qr.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Qr.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){Qr.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),ti=[],t[248]=ei,t[249]=ti):(ei=t[248],ti=t[249]),(0,Q.useEffect)(ei,ti);let ni,ri;t[250]===Symbol.for(`react.memo_cache_sentinel`)?(ni=()=>fY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>dl(e)&&e.docName===t);xn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){xn.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),ri=[],t[250]=ni,t[251]=ri):(ni=t[250],ri=t[251]),(0,Q.useEffect)(ni,ri);let ii,ai;t[252]===Bt?(ii=t[253],ai=t[254]):(ii=()=>uY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=Iu(t,le.current.find(e=>dl(e)&&e.docName===t)?.docExt);Bt.startRenaming(n);return}if(e.kind===`folder`){Bt.startRenaming(e.folderPath);return}if(e.kind===`asset`){Bt.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),ai=[Bt],t[252]=Bt,t[253]=ii,t[254]=ai),(0,Q.useEffect)(ii,ai);let oi;t[255]===Symbol.for(`react.memo_cache_sentinel`)?(oi=function(){let e=we.current;e&&FY(e),we.current=null},t[255]=oi):oi=t[255];let si=oi,ci;t[256]===_?ci=t[257]:(ci=function(e){let t=JX(e.nativeEvent);if(!t||t.endsWith(`/`)){si();return}let n=Su(t),r=le.current.find(e=>wu(e)===t);if(r&&il(r)){si();return}if(r&&dl(r)&&xi(r.size)){si();return}we.current!==n&&(si(),we.current=n,PY(n,e=>_(e)))},t[256]=_,t[257]=ci);let li=ci,ui;t[258]!==fe||t[259]!==Bt||t[260]!==O?(ui=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=YX(e.nativeEvent);if(!t){QX(e.nativeEvent)&&ae(!0);return}if(t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?Pu(n):n;if(Bt.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=Hu(r);if(window.location.hash===hl(e))return;queueMicrotask(()=>O(e));return}let i=Su(r);window.location.hash!==Jc(i)&&queueMicrotask(()=>fe(r))},t[258]=fe,t[259]=Bt,t[260]=O,t[261]=ui):ui=t[261];let di=ui,fi;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(fi=function(e){ju(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,et(!0))},t[262]=fi):fi=t[262];let pi=fi,mi;t[263]===Symbol.for(`react.memo_cache_sentinel`)?(mi=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||et(!1)},t[263]=mi):mi=t[263];let hi=mi,_i;t[264]===ur?_i=t[265]:(_i=function(e){if(!ju(e.nativeEvent))return;let t=Tu(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),et(!1),ur(t,``,eX))},t[264]=ur,t[265]=_i);let vi=_i;if(M){let e;return t[266]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(eZ,{}),t[266]=e):e=t[266],e}let bi;t[267]!==i||t[268]!==I||t[269]!==R?(bi=I?i(R?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[267]=i,t[268]=I,t[269]=R,t[270]=bi):bi=t[270];let Si=bi;if(A.length===0){if(Si!==null){let e;return t[271]===Si?e=t[272]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:Si})}),t[271]=Si,t[272]=e),e}if(P){let e;return t[273]===P?e=t[274]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:P})}),t[273]=P,t[274]=e),e}let e;t[275]===i?e=t[276]:(e=i({id:`5ZB7XC`}),t[275]=i,t[276]=e);let n=$e&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,r;t[277]===n?r=t[278]:(r=wi(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[277]=n,t[278]=r);let a;t[279]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(Y,{id:`xiv-dW`})}),t[279]=a):a=t[279];let o;t[280]===hr?o=t[281]:(o=()=>hr(`file`,``),t[280]=hr,t[281]=o);let s;t[282]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`6ibbCg`}),t[282]=s):s=t[282];let c;t[283]===o?c=t[284]:(c=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[283]=o,t[284]=c);let l;return t[285]!==vi||t[286]!==e||t[287]!==r||t[288]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:r,onDragOver:pi,onDragLeave:hi,onDrop:vi,children:[a,c]}),t[285]=vi,t[286]=e,t[287]=r,t[288]=c,t[289]=l):l=t[289],l}let Ci=H!==null,Ti=W?.targets[0]??null,Ei=null;if(B!==null){let e;if(t[290]!==a.locale||t[291]!==B){let n=new Intl.NumberFormat(a.locale).format(B);e=Ms._({id:`LuoJWu`,values:{truncatedShownCount:B,formattedCount:n}}),t[290]=a.locale,t[291]=B,t[292]=e}else e=t[292];Ei=e}let Di;t[293]!==P||t[294]!==Si||t[295]!==Ei?(Di=(P||Si!==null||Ei!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[Si===null?P&&(0,Z.jsx)(nZ,{kind:`error`,children:P}):(0,Z.jsx)(nZ,{kind:`reconnecting`,children:Si}),Ei!==null&&(0,Z.jsx)(nZ,{kind:`info`,children:Ei})]}),t[293]=P,t[294]=Si,t[295]=Ei,t[296]=Di):Di=t[296];let Oi;t[297]===b?Oi=t[298]:(Oi=uJ(b),t[297]=b,t[298]=Oi);let ki=ie?``:void 0,Ai;t[299]===ki?Ai=t[300]:(Ai={[rX]:ki},t[299]=ki,t[300]=Ai);let ji;t[301]!==Ci||t[302]!==_e||t[303]!==yr||t[304]!==A||t[305]!==_r||t[306]!==Jt||t[307]!==bn||t[308]!==Et||t[309]!==kt||t[310]!==Bt||t[311]!==Dt||t[312]!==Ot||t[313]!==hr||t[314]!==ne?(ji=(e,t)=>(0,Z.jsx)(hX,{item:e,context:t,anyActionBusy:Ci,workspace:ne,handoff:Et,model:Bt,okignoreBinding:Dt,projectLocalBinding:Ot,mergedConfig:kt,onStartCreating:hr,onCreateFromTemplate:(e,t)=>hr(`file`,e,{template:t}),onDuplicate:bn,onDelete:e=>G({targets:e}),onExpandSubtree:_r,onCollapseSubtree:yr,folderTreePaths:Jt,isAsset:_e.has(e.path),documents:A}),t[301]=Ci,t[302]=_e,t[303]=yr,t[304]=A,t[305]=_r,t[306]=Jt,t[307]=bn,t[308]=Et,t[309]=kt,t[310]=Bt,t[311]=Dt,t[312]=Ot,t[313]=hr,t[314]=ne,t[315]=ji):ji=t[315];let Mi;t[316]!==di||t[317]!==li||t[318]!==Bt||t[319]!==Di||t[320]!==Oi||t[321]!==Ai||t[322]!==ji?(Mi=(0,Z.jsx)(`div`,{ref:qe,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(iJ,{header:Di,model:Bt,style:Oi,...Ai,onClickCapture:di,onMouseMove:li,onMouseLeave:si,renderContextMenu:ji})}),t[316]=di,t[317]=li,t[318]=Bt,t[319]=Di,t[320]=Oi,t[321]=Ai,t[322]=ji,t[323]=Mi):Mi=t[323];let Ni=!!W,Pi;t[324]===H?Pi=t[325]:(Pi=e=>{!e&&!H&&G(null)},t[324]=H,t[325]=Pi);let Fi;t[326]!==i||t[327]!==H||t[328]!==W||t[329]!==qr||t[330]!==Ti?(Fi=W&&Ti&&(0,Z.jsx)(wo,{...(()=>{let e=WJ(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,W.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(xX)}):null};let t=W.targets.length,n=Ti.name;return{itemName:t===1?Ti.kind===`folder`?`${Ti.name}/`:Ti.kind===`file`?`${Ti.name}${Ti.docExt??`.md`}`:Ti.name:void 0,customTitle:t>1?i({id:`abiHje`}):void 0,customDescription:t>1?i({id:`WMIKXK`,values:{targetCount:t}}):Ti.kind===`folder`?i({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:H!==null,onDelete:()=>qr(W.targets)}),t[326]=i,t[327]=H,t[328]=W,t[329]=qr,t[330]=Ti,t[331]=Fi):Fi=t[331];let Ii;t[332]!==Ni||t[333]!==Pi||t[334]!==Fi?(Ii=(0,Z.jsx)(Ya,{open:Ni,onOpenChange:Pi,children:Fi}),t[332]=Ni,t[333]=Pi,t[334]=Fi,t[335]=Ii):Ii=t[335];let Ri=!!K,zi;t[336]===H?zi=t[337]:(zi=e=>{!e&&!H&&ee(null)},t[336]=H,t[337]=zi);let Bi;t[338]!==H||t[339]!==Yr||t[340]!==Zr||t[341]!==K?(Bi=K&&(0,Z.jsx)(QJ,{failedTargets:K.failed,isSubmitting:H!==null,onDeletePermanently:Yr,onRetry:Zr,onCancel:()=>ee(null)}),t[338]=H,t[339]=Yr,t[340]=Zr,t[341]=K,t[342]=Bi):Bi=t[342];let Vi;t[343]!==Ri||t[344]!==zi||t[345]!==Bi?(Vi=(0,Z.jsx)(Ya,{open:Ri,onOpenChange:zi,children:Bi}),t[343]=Ri,t[344]=zi,t[345]=Bi,t[346]=Vi):Vi=t[346];let Hi=q!==null,Ui;t[347]===Symbol.for(`react.memo_cache_sentinel`)?(Ui=e=>{e||J(null)},t[347]=Ui):Ui=t[347];let Wi=q?.parentDir??``,Gi;t[348]!==Hi||t[349]!==Wi?(Gi=(0,Z.jsx)(wv,{open:Hi,onOpenChange:Ui,kind:`file`,initialDir:Wi,defaultToTemplate:!0}),t[348]=Hi,t[349]=Wi,t[350]=Gi):Gi=t[350];let Ki;return t[351]!==Mi||t[352]!==Ii||t[353]!==Vi||t[354]!==Gi?(Ki=(0,Z.jsxs)(Z.Fragment,{children:[Mi,Ii,Vi,Gi]}),t[351]=Mi,t[352]=Ii,t[353]=Vi,t[354]=Gi,t[355]=Ki):Ki=t[355],Ki}function xX(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:GJ(e)},`${e.kind}:${e.path}`)}function SX(e){return`${e.kind}:${e.path}`}function CX(e){return`${e.kind}:${e.path}`}function wX(e){return e.path}function TX(e){return e.kind===`folder`}function EX(e){return e.path}function DX(e){return e.kind===`file`}function OX(e){return e.file}function kX(e){return Kt(e)}function AX(e){return Zt(e)}function jX(e){return en(e)}function MX(e){return e.path}function NX(e){return e.kind===`asset`}function PX(e){return e.endsWith(`/`)?e.slice(0,-1):e}function FX(e){return!!e}function IX(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function LX(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function RX(e){Ss.error(e)}function zX(){}function BX(e){return Ss.error(e)}function VX(){}function HX(){}function UX(){}function WX(){}function GX(){}async function KX(){}function qX(e){return wu(e)}function JX(e){return YX(e)?.dataset.itemPath??null}function YX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function XX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function ZX(e){let t=YX(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=Eu(e,n);return{parentDir:r,row:t,root:null,busyPath:n?Pu(r):e}}return QX(e)?{parentDir:``,row:null,root:XX(e),busyPath:eX}:null}function QX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var $X=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function eZ(){let e=(0,$.c)(5),{_:t}=an(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=$X.map(tZ),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function tZ(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Qi,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Qi,{className:`h-3 ${e}`})]},t)}function nZ(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?eo:n===`reconnecting`?ao:os,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=wi(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=wi(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function rZ(e){return e?Ms._({id:`wTcjov`}):null}function iZ(e){let t=(0,$.c)(23),{_:n}=an(),r=bo(),i=Oo();if(r)return null;let{input:a,installStates:o,dispatch:s}=e,c=a===null,l,u,d,f,p,m;if(t[0]!==n||t[1]!==s||t[2]!==a||t[3]!==c||t[4]!==o||t[5]!==i){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=rZ(c),r;t[12]===o?r=t[13]:(r=e=>o[e.id]?.installed===!0,t[12]=o,t[13]=r);let h=lo.filter(r),g=h.length>0,_=i!==null;if(!g&&!_){m=null;break bb0}u=BF,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(UF,{children:[(0,Z.jsx)(us,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`O7_W_a`})]}),t[14]=p):p=t[14],l=WF,d=_?(0,Z.jsxs)(zF,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(KF,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),Do.map(t=>{let{displayName:r}=Vn[t];return(0,Z.jsxs)(HF,{onSelect:()=>{a!==null&&i.launchInTerminal(a,t)},disabled:c,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(go,{id:ho(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,f=g?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(qF,{}):null,(0,Z.jsxs)(zF,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(KF,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),h.map(t=>{let r=!c,{displayName:i}=t,o=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(HF,{disabled:!r,onSelect:()=>{a&&s(t.id,a)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":o,children:[(0,Z.jsx)(go,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null}t[0]=n,t[1]=s,t[2]=a,t[3]=c,t[4]=o,t[5]=i,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[15]!==l||t[16]!==d||t[17]!==f?(h=(0,Z.jsxs)(l,{children:[d,f]}),t[15]=l,t[16]=d,t[17]=f,t[18]=h):h=t[18];let g;return t[19]!==u||t[20]!==p||t[21]!==h?(g=(0,Z.jsxs)(u,{children:[p,h]}),t[19]=u,t[20]=p,t[21]=h,t[22]=g):g=t[22],g}async function aZ(e){try{let t=await e.project.listRecent(),n=e.config.projectPath;return t.some(e=>e.path!==n)?!1:await RD()===0}catch(e){return console.warn(`[onboarding-card-visible] fresh-project probe failed; suppressing card`,e),!1}}function oZ(e){let t=(0,$.c)(4),n=e===void 0?ag:e,{initialized:r,dismissed:i,completed:a}=(0,Q.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),o=i||a,s=!r&&!o,c,l;return t[0]!==s||t[1]!==n?(c=()=>{if(!s)return;let e=window.okDesktop;if(e==null)return;let t=!1;return aZ(e).then(e=>{!t&&e&&n.activate()}),()=>{t=!0}},l=[s,n],t[0]=s,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),(0,Q.useEffect)(c,l),r&&!o}function sZ(e){let t=(0,$.c)(3),n=e===void 0?ag:e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{if(n.getSnapshot().steps.file)return;let e=ks(e=>{e.includes(`files`)&&zD(n)});return zD(n),e},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i)}var cZ=3,lZ=5200,uZ=1500,dZ=220;function fZ(e){let t=(0,$.c)(14),{complete:n,label:r,shortcutId:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(nc,{checked:n,disabled:!0,"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none opacity-100 disabled:opacity-100`}),t[0]=n,t[1]=a);let o=n?`flex-1 text-muted-foreground/60`:`flex-1`,s;t[2]===n?s=t[3]:(s=n?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[(0,Z.jsx)(Y,{id:`Qj4RL5`}),` `]}):null,t[2]=n,t[3]=s);let c;t[4]!==r||t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(`span`,{className:o,children:[s,r]}),t[4]=r,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===i?l=t[9]:(l=i?(0,Z.jsx)(wt,{children:Tl(i)}):null,t[8]=i,t[9]=l);let u;return t[10]!==a||t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`li`,{className:`flex items-center gap-2 py-0.5 text-sm`,children:[a,c,l]}),t[10]=a,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function pZ(e){let t=(0,$.c)(24),{store:n,lingerMs:r}=e,i=n===void 0?ag:n,a=r===void 0?lZ:r,{_:o}=an(),{steps:s}=og(i);sZ(i);let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(!1),f=1+ +!!s.file+ +!!s.askedAi,p=f===cZ,m,h;t[0]!==p||t[1]!==a?(m=()=>{if(!p)return;l(hZ);let e=setInterval(()=>l(mZ),uZ),t=setTimeout(()=>{clearInterval(e),d(!0)},a);return()=>{clearInterval(e),clearTimeout(t)}},h=[p,a],t[0]=p,t[1]=a,t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g,_;t[4]!==u||t[5]!==i?(g=()=>{if(!u)return;let e=setTimeout(()=>i.markCompleted(),dZ);return()=>clearTimeout(e)},_=[u,i],t[4]=u,t[5]=i,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v;t[8]!==o||t[9]!==p?(v=p?o({id:`7jIIFX`}):``,t[8]=o,t[9]=p,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==p||t[14]!==c||t[15]!==f||t[16]!==u||t[17]!==s.askedAi||t[18]!==s.file||t[19]!==i?(b=p?(0,Z.jsxs)(`section`,{"aria-hidden":!0,className:wi(`mx-2 mb-1 flex items-center gap-3 rounded-lg border bg-card px-4 py-3 text-card-foreground`,`motion-reduce:animate-none motion-reduce:duration-0`,u?`animate-out fade-out-0 zoom-out-95 fill-mode-forwards duration-200`:`animate-in fade-in-0 zoom-in-95 duration-300`),children:[(0,Z.jsx)(pT,{size:36,celebrateSignal:c}),(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`7jIIFX`})})]}):(0,Z.jsxs)(`section`,{"aria-labelledby":`onboarding-card-heading`,className:`mx-2 mb-1 rounded-lg border bg-card px-4 py-3 text-card-foreground`,children:[(0,Z.jsxs)(`header`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsx)(`h2`,{id:`onboarding-card-heading`,className:`font-medium text-sm`,children:(0,Z.jsx)(Y,{id:`Y1QMlM`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/60 text-xs tabular-nums`,children:`${f} / ${cZ}`})]}),(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(fZ,{complete:!0,label:(0,Z.jsx)(Y,{id:`4E9jPa`})}),(0,Z.jsx)(fZ,{complete:s.file,label:(0,Z.jsx)(Y,{id:`6ibbCg`}),shortcutId:`new-item`}),(0,Z.jsx)(fZ,{complete:s.askedAi,label:(0,Z.jsx)(Y,{id:`xWEvuo`}),shortcutId:`open-ask-ai`})]}),(0,Z.jsx)(`footer`,{className:`-mb-1 mt-2 flex justify-end`,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto px-2 py-1 text-muted-foreground text-xs`,onClick:()=>i.dismiss(),children:(0,Z.jsx)(Y,{id:`1QfxQT`})})})]}),t[13]=p,t[14]=c,t[15]=f,t[16]=u,t[17]=s.askedAi,t[18]=s.file,t[19]=i,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function mZ(e){return e+1}function hZ(e){return e+1}function gZ(){let e=(0,$.c)(1);if(!oZ())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(pZ,{}),e[0]=t):t=e[0],t}function _Z(e){return e===null?null:e.kind===`local`?e.name:e.ref}function vZ(e,t){if(e.length===0)return null;let n=`origin/${e}`;return t.includes(n)?n:t.find(t=>pr(t)===e)??null}function yZ(e){switch(e){case`branch-exists`:return{id:`wzq9Rv`};case`already-checked-out`:return{id:`ljHjfg`};case`path-exists`:return{id:`mYzDD_`};case`invalid-branch`:return{id:`r-OJYm`};case`no-git`:return{id:`CFnavk`};default:return{id:`-zA2E7`}}}function bZ(e){let t=(0,$.c)(71),{open:n,onOpenChange:r,bridge:i,currentBranch:a,branches:s,existingWorktreeBranches:c,remoteBranches:l,behindByBranch:u,initialBranchName:d}=e,f=s===void 0?[]:s,p=l===void 0?[]:l,m=d===void 0?``:d,{_:h}=an(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useId)(),y=(0,Q.useId)(),b=(0,Q.useId)(),x=(0,Q.useId)(),[S,C]=(0,Q.useState)(``),T;t[0]===a?T=t[1]:(T=a===null?null:{kind:`local`,name:a},t[0]=a,t[1]=T);let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(!1),[A,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(null),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[2]!==a||t[3]!==m||t[4]!==n?(z=()=>{if(!n)return;C(m),D(a===null?null:{kind:`local`,name:a}),k(!1),M(``),P(!1),I(null);let e=requestAnimationFrame(()=>L.current?.focus());return()=>cancelAnimationFrame(e)},B=[n,a,m],t[2]=a,t[3]=m,t[4]=n,t[5]=z,t[6]=B):(z=t[5],B=t[6]),(0,Q.useEffect)(z,B);let V=S.trim(),H=!N&&V.length>0,U=V.length>0&&f.includes(V),W=U?null:vZ(V,p),G=W!==null,K=U||G,ee=U&&(c?.has(V)??!1),te=f.filter(e=>e.toLowerCase().startsWith(V.toLowerCase())),q=!N&&te.length>0&&!K,J=(a!==null&&!f.includes(a)?[a,...f]:f).map(TZ),ne=p.map(wZ),re=_Z(E),ie=A.trim().toLowerCase(),ae=ie===``?J:J.filter(e=>e.name.toLowerCase().includes(ie)),oe=ie===``?ne:ne.filter(e=>e.ref.toLowerCase().includes(ie)),se=ie!==``&&ae.length===0&&oe.length===0,ce=async function(e){if(e.preventDefault(),H){P(!0),I(null);try{let e=G?{branch:V,createBranch:!0,remoteRef:W}:U?{branch:V,createBranch:!1}:{branch:V,createBranch:!0,baseBranch:E?.kind===`local`?E.name:void 0,baseRef:E?.kind===`remote`?E.ref:void 0},t=await i.worktree.create(e);if(!t.ok){I(yZ(t.reason)),P(!1);return}iy(),r(!1),await i.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[NewWorktreeDialog] worktree create/open failed:`,e),Ss.error(h({id:`vAYoCZ`})),P(!1)}}},le=Ya,ue;t[7]!==N||t[8]!==r?(ue=e=>{N||r(e)},t[7]=N,t[8]=r,t[9]=ue):ue=t[9];let de=Ga,fe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(Y,{id:`DXd9LM`})}),t[10]=fe):fe=t[10];let pe;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsxs)(Ja,{children:[fe,(0,Z.jsx)(Ua,{children:(0,Z.jsx)(Y,{id:`NEzPEh`})})]}),t[11]=pe):pe=t[11];let me=Ka,he;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(Y,{id:`ng2Ibo`}),t[12]=he):he=t[12];let ge;t[13]===_?ge=t[14]:(ge=(0,Z.jsx)(Rc,{htmlFor:_,children:he}),t[13]=_,t[14]=ge);let _e;t[15]===h?_e=t[16]:(_e=h({id:`IX_uXB`}),t[15]=h,t[16]=_e);let ve;t[17]===F?ve=t[18]:(ve=e=>{C(e.target.value),F!==null&&I(null)},t[17]=F,t[18]=ve);let ye=F!==null,be=F===null?b:`${b} ${x}`,xe;t[19]!==S||t[20]!==N||t[21]!==_||t[22]!==_e||t[23]!==ve||t[24]!==ye||t[25]!==be?(xe=(0,Z.jsx)(Vc,{id:_,ref:L,value:S,placeholder:_e,onChange:ve,disabled:N,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-invalid":ye,"aria-describedby":be,"data-testid":`new-worktree-branch`}),t[19]=S,t[20]=N,t[21]=_,t[22]=_e,t[23]=ve,t[24]=ye,t[25]=be,t[26]=xe):xe=t[26];let Se=V.length>0?(0,Z.jsxs)(`p`,{id:b,className:`flex items-start gap-1.5 text-1sm text-muted-foreground`,"data-testid":ee?`new-worktree-mode-existing-worktree`:G?`new-worktree-mode-remote-checkout`:U?`new-worktree-mode-checkout`:`new-worktree-mode-create`,children:[ee?(0,Z.jsx)(Io,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):G?(0,Z.jsx)(Ea,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-400`}):U?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-blue-600 dark:text-blue-400`}):(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:ee?(0,Z.jsx)(Y,{id:`QAi7Q9`,values:{trimmed:V},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`})}}):G?(0,Z.jsx)(Y,{id:`oAGN8p`,values:{remoteCheckoutRef:W,trimmed:V},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}}):U?(0,Z.jsx)(Y,{id:`b4VvP-`,values:{trimmed:V},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):re===null?(0,Z.jsx)(Y,{id:`t4sFKC`,values:{trimmed:V},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(Y,{id:`dGAdpH`,values:{trimmed:V,currentBaseLabel:re},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}})})]}):null,Ce=q?(0,Z.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border bg-popover p-1 shadow-xs`,"data-testid":`new-worktree-branch-list`,children:te.map(e=>(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,onClick:()=>{C(e),F!==null&&I(null),L.current?.focus()},"data-testid":`new-worktree-branch-option-${e}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e})]},e))}):null,we=K?null:(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2`,children:[(0,Z.jsx)(Rc,{id:y,htmlFor:v,children:(0,Z.jsx)(Y,{id:`ZWwYwM`})}),(0,Z.jsxs)(w,{open:O,onOpenChange:e=>{k(e),e||M(``)},children:[(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{id:v,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":O,"aria-haspopup":`listbox`,"aria-labelledby":`${y} ${v}`,"aria-label":h({id:`ZWwYwM`}),disabled:N,"data-testid":`new-worktree-base-trigger`,className:`w-full justify-between font-normal`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[E?.kind===`remote`?(0,Z.jsx)(Ea,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:re===null?(0,Z.jsx)(Y,{id:`EbjWsS`}):re})]}),(0,Z.jsx)(md,{"aria-hidden":`true`,className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,Z.jsxs)(Tt,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,onWheel:CZ,onTouchMove:SZ,onOpenAutoFocus:e=>{e.preventDefault(),R.current?.focus()},children:[(0,Z.jsxs)(IE,{className:`mb-1 h-8`,children:[(0,Z.jsx)(VE,{ref:R,"aria-label":h({id:`fuJZKk`}),placeholder:h({id:`hQXiDc`}),value:A,onChange:e=>M(e.target.value),onKeyDown:xZ,"data-testid":`new-worktree-base-search`}),(0,Z.jsx)(RE,{children:(0,Z.jsx)(o,{"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{role:`listbox`,"aria-label":h({id:`ZWwYwM`}),className:`max-h-56 overflow-y-auto`,"data-testid":`new-worktree-base-list`,children:[se?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Sh3Qkg`})}):null,ae.map(e=>{let t=e.name,n=u?.get(t);return(0,Z.jsxs)(X,{type:`button`,role:`option`,"aria-selected":E?.kind===`local`&&E.name===t,variant:`ghost`,size:`sm`,onClick:()=>{D(e),k(!1),M(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),n!==void 0&&n>0?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,"data-testid":`new-worktree-base-behind-${t}`,children:(0,Z.jsx)(Y,{id:`6-wLTJ`,values:{behind:n}})}):null]},`local:${t}`)}),oe.map(e=>{let t=e.ref;return(0,Z.jsxs)(X,{type:`button`,role:`option`,"aria-selected":E?.kind===`remote`&&E.ref===t,variant:`ghost`,size:`sm`,onClick:()=>{D(e),k(!1),M(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Ea,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`dIYSqk`})})]},`remote:${t}`)})]})]})]})]}),Te;t[27]!==h||t[28]!==F||t[29]!==x?(Te=F===null?null:(0,Z.jsx)(`p`,{id:x,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`new-worktree-error`,children:h(F)}),t[27]=h,t[28]=F,t[29]=x,t[30]=Te):Te=t[30];let Ee;t[31]!==g||t[32]!==ce||t[33]!==ge||t[34]!==xe||t[35]!==Se||t[36]!==Ce||t[37]!==we||t[38]!==Te?(Ee=(0,Z.jsxs)(`form`,{id:g,onSubmit:ce,className:`flex flex-col gap-2`,children:[ge,xe,Se,Ce,we,Te]}),t[31]=g,t[32]=ce,t[33]=ge,t[34]=xe,t[35]=Se,t[36]=Ce,t[37]=we,t[38]=Te,t[39]=Ee):Ee=t[39];let De;t[40]!==me||t[41]!==Ee?(De=(0,Z.jsx)(me,{children:Ee}),t[40]=me,t[41]=Ee,t[42]=De):De=t[42];let Oe;t[43]===r?Oe=t[44]:(Oe=()=>r(!1),t[43]=r,t[44]=Oe);let ke;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[45]=ke):ke=t[45];let Ae;t[46]!==N||t[47]!==Oe?(Ae=(0,Z.jsx)(X,{type:`button`,variant:`outline`,onClick:Oe,disabled:N,"data-testid":`new-worktree-cancel`,children:ke}),t[46]=N,t[47]=Oe,t[48]=Ae):Ae=t[48];let je=!H,Me;t[49]!==N||t[50]!==ee||t[51]!==U||t[52]!==G?(Me=N?(0,Z.jsx)(Y,{id:`b4itZn`}):ee?(0,Z.jsx)(Y,{id:`XV5sC0`}):G?(0,Z.jsx)(Y,{id:`XAyxsa`}):U?(0,Z.jsx)(Y,{id:`uGaIIS`}):(0,Z.jsx)(Y,{id:`iO8V-7`}),t[49]=N,t[50]=ee,t[51]=U,t[52]=G,t[53]=Me):Me=t[53];let Ne;t[54]!==g||t[55]!==je||t[56]!==Me?(Ne=(0,Z.jsx)(X,{type:`submit`,form:g,disabled:je,"data-testid":`new-worktree-create`,children:Me}),t[54]=g,t[55]=je,t[56]=Me,t[57]=Ne):Ne=t[57];let Pe;t[58]!==Ae||t[59]!==Ne?(Pe=(0,Z.jsxs)(qa,{children:[Ae,Ne]}),t[58]=Ae,t[59]=Ne,t[60]=Pe):Pe=t[60];let Fe;t[61]!==de||t[62]!==pe||t[63]!==De||t[64]!==Pe?(Fe=(0,Z.jsxs)(de,{className:`sm:max-w-md`,"data-testid":`new-worktree-dialog`,children:[pe,De,Pe]}),t[61]=de,t[62]=pe,t[63]=De,t[64]=Pe,t[65]=Fe):Fe=t[65];let Ie;return t[66]!==le||t[67]!==n||t[68]!==Fe||t[69]!==ue?(Ie=(0,Z.jsx)(le,{open:n,onOpenChange:ue,children:Fe}),t[66]=le,t[67]=n,t[68]=Fe,t[69]=ue,t[70]=Ie):Ie=t[70],Ie}function xZ(e){return e.stopPropagation()}function SZ(e){e.stopPropagation()}function CZ(e){e.stopPropagation()}function wZ(e){return{kind:`remote`,ref:e}}function TZ(e){return{kind:`local`,name:e}}function EZ(e){let t=(0,$.c)(51),{bridge:n,recents:r,currentPath:i,query:a,worktreeModel:o,closeMenu:s,guardStaleSelect:c,flyoutPath:l,setFlyoutPath:u,openNewWorktreeWith:d}=e,{_:f}=an(),p;t[0]!==f||t[1]!==n.project||t[2]!==s?(p=function(e,t){s(),n.project.open({path:e,target:`new-window`,entryPoint:t}).catch(e=>{console.warn(`[RecentProjectsMenu] project.open failed:`,e),Ss.error(f({id:`6HCOwA`}))})},t[0]=f,t[1]=n.project,t[2]=s,t[3]=p):p=t[3];let m=p,h;t[4]!==f||t[5]!==n.project||t[6]!==n.worktree?(h=async function(e){try{let t=await n.worktree.create({branch:e,createBranch:!1});if(!t.ok){Ss.error(f({id:`teD0H9`}));return}iy(),await n.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[RecentProjectsMenu] create/open branch failed:`,e),Ss.error(f({id:`LwMxXg`}))}},t[4]=f,t[5]=n.project,t[6]=n.worktree,t[7]=h):h=t[7];let g=h,_;t[8]!==s||t[9]!==i||t[10]!==m?(_=function(e){if(e.path===i){s();return}m(e.path,e.isLinkedWorktree?`worktree`:`recents`)},t[8]=s,t[9]=i,t[10]=m,t[11]=_):_=t[11];let v=_,y;t[12]!==s||t[13]!==g||t[14]!==i||t[15]!==m?(y=function(e){if(e.path!==null){if(e.path===i){s();return}m(e.path,e.isMain?`recents`:`worktree`);return}e.branch!==null&&(s(),g(e.branch))},t[12]=s,t[13]=g,t[14]=i,t[15]=m,t[16]=y):y=t[16];let b=y;if(a!==``){let e;t[17]!==s||t[18]!==g?(e=e=>{s(),g(e)},t[17]=s,t[18]=g,t[19]=e):e=t[19];let n;return t[20]!==i||t[21]!==c||t[22]!==v||t[23]!==a||t[24]!==r||t[25]!==e||t[26]!==o?(n=(0,Z.jsx)(PZ,{recents:r,currentPath:i,query:a,worktreeModel:o,onPickEntry:v,onPickBranch:e,guardStaleSelect:c}),t[20]=i,t[21]=c,t[22]=v,t[23]=a,t[24]=r,t[25]=e,t[26]=o,t[27]=n):n=t[27],n}let x;if(t[28]!==s||t[29]!==i||t[30]!==l||t[31]!==c||t[32]!==b||t[33]!==d||t[34]!==m||t[35]!==r||t[36]!==u||t[37]!==o){let e=qm(r),n;t[39]!==s||t[40]!==i||t[41]!==l||t[42]!==c||t[43]!==b||t[44]!==d||t[45]!==m||t[46]!==u||t[47]!==o?(n=e=>(0,Z.jsx)(DZ,{group:e,currentPath:i,worktreeModel:o,flyoutOpen:l===e.project.path,setFlyoutOpen:t=>u(t?e.project.path:null),onPickProject:()=>{if(e.project.path===i){s();return}m(e.project.path,`recents`)},onPickFlyoutEntry:b,guardStaleSelect:c,openNewWorktreeWith:d},e.project.path),t[39]=s,t[40]=i,t[41]=l,t[42]=c,t[43]=b,t[44]=d,t[45]=m,t[46]=u,t[47]=o,t[48]=n):n=t[48],x=e.map(n),t[28]=s,t[29]=i,t[30]=l,t[31]=c,t[32]=b,t[33]=d,t[34]=m,t[35]=r,t[36]=u,t[37]=o,t[38]=x}else x=t[38];let S;return t[49]===x?S=t[50]:(S=(0,Z.jsx)(Z.Fragment,{children:x}),t[49]=x,t[50]=S),S}function DZ(e){let t=(0,$.c)(27),{group:n,currentPath:r,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}=e,d=n.project.path===r;if(n.worktrees.length===0){let e;t[0]!==l||t[1]!==s?(e=e=>{l(e)||s()},t[0]=l,t[1]=s,t[2]=e):e=t[2];let r=`project-switcher-recent-${n.project.path}`,i=d?`true`:void 0,a;t[3]!==n.project.name||t[4]!==n.project.path||t[5]!==d?(a=(0,Z.jsx)(LZ,{name:n.project.name,path:n.project.path,current:d}),t[3]=n.project.name,t[4]=n.project.path,t[5]=d,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==r||t[9]!==i||t[10]!==a?(o=(0,Z.jsx)(Cc,{onSelect:e,className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":r,"data-current":i,children:a}),t[7]=e,t[8]=r,t[9]=i,t[10]=a,t[11]=o):o=t[11],o}let f;t[12]!==r||t[13]!==n.worktrees||t[14]!==d?(f=d||n.worktrees.some(e=>e.path===r),t[12]=r,t[13]=n.worktrees,t[14]=d,t[15]=f):f=t[15];let p=f,m;return t[16]!==p||t[17]!==r||t[18]!==a||t[19]!==n||t[20]!==l||t[21]!==c||t[22]!==s||t[23]!==u||t[24]!==o||t[25]!==i?(m=(0,Z.jsx)(OZ,{group:n,currentPath:r,containsCurrent:p,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}),t[16]=p,t[17]=r,t[18]=a,t[19]=n,t[20]=l,t[21]=c,t[22]=s,t[23]=u,t[24]=o,t[25]=i,t[26]=m):m=t[26],m}function OZ(e){let t=(0,$.c)(56),{group:n,currentPath:r,containsCurrent:i,worktreeModel:a,flyoutOpen:o,setFlyoutOpen:s,onPickProject:c,onPickFlyoutEntry:l,guardStaleSelect:u,openNewWorktreeWith:d}=e,{_:f}=an(),p=n.project.path===r,m;t[0]!==u||t[1]!==c?(m=e=>{u(e)||c()},t[0]=u,t[1]=c,t[2]=m):m=t[2];let h;t[3]!==o||t[4]!==s?(h=e=>{e.key===`ArrowRight`?(e.preventDefault(),s(!0)):(e.key===`ArrowLeft`||e.key===`Escape`)&&o&&(e.preventDefault(),e.stopPropagation(),s(!1))},t[3]=o,t[4]=s,t[5]=h):h=t[5];let g=`project-switcher-group-${n.project.path}`,_=o?`true`:void 0,v=i?`true`:void 0,y;t[6]===n.project.name?y=t[7]:(y=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n.project.name,children:n.project.name}),t[6]=n.project.name,t[7]=y);let b;t[8]===n.project.path?b=t[9]:(b=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:n.project.path,children:n.project.path}),t[8]=n.project.path,t[9]=b);let x;t[10]!==y||t[11]!==b?(x=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[y,b]}),t[10]=y,t[11]=b,t[12]=x):x=t[12];let S;t[13]!==f||t[14]!==p?(S=p?(0,Z.jsx)(Ha,{"aria-label":f({id:`Hp1l6f`}),className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}):null,t[13]=f,t[14]=p,t[15]=S):S=t[15];let C;t[16]!==f||t[17]!==o?(C=f(o?{id:`Aj1D9r`}:{id:`UaRsDu`}),t[16]=f,t[17]=o,t[18]=C):C=t[18];let T;t[19]===s?T=t[20]:(T=()=>{s(!0)},t[19]=s,t[20]=T);let E=`project-switcher-toggle-${n.project.path}`,D;t[21]===n.worktrees.length?D=t[22]:(D=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:n.worktrees.length}),t[21]=n.worktrees.length,t[22]=D);let O;t[23]===n.worktrees.length?O=t[24]:(O=(0,Z.jsx)(Y,{id:`ij5sBu`,values:{0:n.worktrees.length}}),t[23]=n.worktrees.length,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsxs)(`span`,{className:`text-xs`,children:[D,` `,O]}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Qa,{"aria-hidden":`true`,className:`size-3.5`}),t[28]=A):A=t[28];let M;t[29]!==o||t[30]!==C||t[31]!==T||t[32]!==E||t[33]!==k?(M=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,"aria-label":C,"aria-expanded":o,onMouseDown:AZ,onClick:kZ,onMouseEnter:T,"data-testid":E,className:`-my-1 -mr-1 h-auto shrink-0 gap-1 rounded-md px-1.5 py-1 text-muted-foreground hover:bg-accent-foreground/15 hover:text-foreground hover:ring-1 hover:ring-border hover:ring-inset`,children:[k,A]})}),t[29]=o,t[30]=C,t[31]=T,t[32]=E,t[33]=k,t[34]=M):M=t[34];let N;t[35]!==m||t[36]!==M||t[37]!==h||t[38]!==g||t[39]!==_||t[40]!==v||t[41]!==x||t[42]!==S?(N=(0,Z.jsxs)(Cc,{onSelect:m,onKeyDown:h,className:`flex w-full min-w-0 items-start gap-2`,"data-testid":g,"data-flyout-open":_,"data-current":v,children:[x,S,M]}),t[35]=m,t[36]=M,t[37]=h,t[38]=g,t[39]=_,t[40]=v,t[41]=x,t[42]=S,t[43]=N):N=t[43];let P;t[44]!==r||t[45]!==n||t[46]!==u||t[47]!==l||t[48]!==d||t[49]!==a?(P=(0,Z.jsx)(jZ,{group:n,currentPath:r,worktreeModel:a,onPickFlyoutEntry:l,guardStaleSelect:u,openNewWorktreeWith:d}),t[44]=r,t[45]=n,t[46]=u,t[47]=l,t[48]=d,t[49]=a,t[50]=P):P=t[50];let F;return t[51]!==o||t[52]!==s||t[53]!==N||t[54]!==P?(F=(0,Z.jsxs)(w,{open:o,onOpenChange:s,children:[N,P]}),t[51]=o,t[52]=s,t[53]=N,t[54]=P,t[55]=F):F=t[55],F}function kZ(e){e.stopPropagation()}function AZ(e){e.stopPropagation()}function jZ(e){let t=(0,$.c)(11),{group:n,currentPath:r,worktreeModel:i,onPickFlyoutEntry:a,guardStaleSelect:s,openNewWorktreeWith:c}=e,{_:l}=an(),[u,d]=(0,Q.useState)(``),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=function(){let e=p.current;return e===null?[]:[...e.querySelectorAll(`[role="menuitem"]`)]},h=function(e){m()[e]?.focus()},g=function(e,t){if(e.key===`ArrowDown`){e.preventDefault();let t=m(),n=t.indexOf(e.currentTarget);h(Math.min(n+1,t.length-1))}else if(e.key===`ArrowUp`){e.preventDefault();let t=m().indexOf(e.currentTarget);t<=0?f.current?.focus():h(t-1)}else e.key===`Enter`&&(e.preventDefault(),t())},_=Wm(n,i,r),v=u.trim().toLowerCase(),y=v===``?_:_.filter(e=>(e.branch??``).toLowerCase().includes(v)),b=i!==null&&i.mainRoot===n.project.mainRoot,x=u.trim(),S=b&&x.length>0,C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e.preventDefault(),f.current?.focus()},t[0]=C):C=t[0];let w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(RE,{align:`inline-start`,children:(0,Z.jsx)(o,{"aria-hidden":`true`})}),t[1]=w):w=t[1];let T;t[2]===l?T=t[3]:(T=l({id:`bSD4im`}),t[2]=l,t[3]=T);let E;t[4]===l?E=t[5]:(E=l({id:`Skr_7L`}),t[4]=l,t[5]=E);let D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>d(e.target.value),t[6]=D):D=t[6];let O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(RE,{align:`inline-end`,children:(0,Z.jsx)(St,{"aria-hidden":`true`})}),t[7]=O):O=t[7];let k=y.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pc,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:l({id:`-uaQnI`})}),S?(0,Z.jsxs)(Cc,{onSelect:e=>{s(e)||c(x)},onKeyDown:e=>g(e,()=>c(x)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-create`,children:[(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:x,children:(0,Z.jsx)(Y,{id:`gHSAWT`,values:{typedName:x},components:{0:(0,Z.jsx)(`span`,{className:`font-medium`}),1:(0,Z.jsx)(`span`,{className:`font-mono`})}})})]}):null]}):y.map(e=>{let t=e.path??`branch:${e.branch}`,n=e.branch??l({id:`D12vtS`});return(0,Z.jsxs)(Cc,{onSelect:t=>{s(t)||a(e)},onKeyDown:t=>g(t,()=>a(e)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-entry-${t}`,"data-current":e.isCurrent?`true`:void 0,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:n,children:n}),e.isMain?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:l({id:`Bn9-El`})}):e.opened?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,title:l({id:`Dvwa0U`}),children:l({id:`nfoduq`})}),e.isCurrent?(0,Z.jsx)(RZ,{}):null]},t)}),A;return t[8]!==p||t[9]!==k?(A=(0,Z.jsx)(`div`,{ref:p,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar`,children:k}),t[8]=p,t[9]=k,t[10]=A):A=t[10],(0,Z.jsxs)(Tt,{side:`right`,align:`start`,sideOffset:4,className:`flex max-h-80 w-96 flex-col gap-1 overflow-hidden p-1`,onPointerDownOutside:NZ,onFocusOutside:MZ,onOpenAutoFocus:C,"data-testid":`project-switcher-flyout-${n.project.path}`,children:[(0,Z.jsxs)(IE,{className:`mb-1 h-8 shrink-0`,children:[w,(0,Z.jsx)(VE,{ref:f,"aria-label":T,placeholder:E,value:u,onChange:D,onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),h(0)),e.stopPropagation()},"data-testid":`project-switcher-flyout-search-${n.project.path}`}),O]}),A]})}function MZ(e){return e.preventDefault()}function NZ(e){return e.preventDefault()}function PZ(e){let t=(0,$.c)(41),{recents:n,currentPath:r,query:i,worktreeModel:a,onPickEntry:o,onPickBranch:s,guardStaleSelect:c}=e,{_:l}=an(),u;t[0]===i?u=t[1]:(u=e=>e.toLowerCase().includes(i),t[0]=i,t[1]=u);let d=u,f,p,m,h;if(t[2]!==l||t[3]!==r||t[4]!==c||t[5]!==d||t[6]!==s||t[7]!==o||t[8]!==n||t[9]!==a){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[14]===d?e=t[15]:(e=e=>!e.isLinkedWorktree&&(d(e.name)||d(e.path)),t[14]=d,t[15]=e);let i=n.filter(e),u;t[16]===d?u=t[17]:(u=e=>e.isLinkedWorktree===!0&&(d(e.branch??``)||d(e.path)),t[16]=d,t[17]=u);let g=n.filter(u),_=new Set(g.map(FZ)),v;t[18]===a?.entries?v=t[19]:(v=a?.entries??[],t[18]=a?.entries,t[19]=v);let y=v.filter(e=>e.branch!==null&&d(e.branch)&&(e.worktreePath===null||!_.has(e.worktreePath))&&e.worktreePath!==r);if(i.length===0&&g.length===0&&y.length===0){let e;t[20]===l?e=t[21]:(e=l({id:`pEQFsW`}),t[20]=l,t[21]=e);let n;t[22]===e?n=t[23]:(n=(0,Z.jsx)(Pc,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:e}),t[22]=e,t[23]=n),h=n;break bb0}let b;t[24]!==r||t[25]!==c||t[26]!==o?(b=e=>(0,Z.jsx)(Cc,{onSelect:t=>{c(t)||o(e)},className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:(0,Z.jsx)(LZ,{name:e.name,path:e.path,current:e.path===r})},e.path),t[24]=r,t[25]=c,t[26]=o,t[27]=b):b=t[27],f=i.map(b);let x;t[28]!==r||t[29]!==c||t[30]!==o?(x=e=>(0,Z.jsxs)(Cc,{onSelect:t=>{c(t)||o(e)},className:`flex items-start gap-2`,"data-testid":`project-switcher-worktree-${e.path}`,"data-current":e.path===r?`true`:void 0,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsx)(IZ,{branch:e.branch??e.name,project:e.mainRoot===void 0?null:Km(e.mainRoot)})]},e.path),t[28]=r,t[29]=c,t[30]=o,t[31]=x):x=t[31],p=g.map(x);let S;t[32]!==l||t[33]!==c||t[34]!==s||t[35]!==a?(S=e=>(0,Z.jsxs)(Cc,{onSelect:t=>{c(t)||e.branch!==null&&s(e.branch)},className:`flex items-start gap-2`,"data-testid":`project-switcher-branch-${e.branch}`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 opacity-40`}),(0,Z.jsx)(IZ,{branch:e.branch??``,project:a===null?null:Km(a.mainRoot),hint:l({id:`nfoduq`})})]},`branch:${e.branch}`),t[32]=l,t[33]=c,t[34]=s,t[35]=a,t[36]=S):S=t[36],m=y.map(S)}t[2]=l,t[3]=r,t[4]=c,t[5]=d,t[6]=s,t[7]=o,t[8]=n,t[9]=a,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;return t[37]!==f||t[38]!==p||t[39]!==m?(g=(0,Z.jsxs)(Z.Fragment,{children:[f,p,m]}),t[37]=f,t[38]=p,t[39]=m,t[40]=g):g=t[40],g}function FZ(e){return e.path}function IZ(e){let t=(0,$.c)(12),{branch:n,project:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:i}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:r,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function LZ(e){let t=(0,$.c)(15),{name:n,path:r,current:i}=e,a=i&&`font-medium`,o;t[0]===a?o=t[1]:(o=wi(`flex w-full items-center gap-1.5`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,Z.jsx)(Ha,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):null,t[4]=i,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(`span`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=(0,Z.jsx)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:r,children:r}),t[10]=r,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function RZ(){let e=(0,$.c)(4),{_:t}=an(),n;e[0]===t?n=e[1]:(n=t({id:`Hp1l6f`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Z.jsx)(Ha,{"aria-label":n,className:`size-3.5 shrink-0 text-muted-foreground`}),e[2]=n,e[3]=r),r}var zZ=(e,t,n)=>Pf(e,t,n,`ProjectSwitcher`),BZ=350;function VZ(e){let t=(0,$.c)(108),{bridge:n}=e,{_:r}=an(),[i,a]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(null),y=aP(),b=ay(),x=typeof window<`u`&&window.okDesktop!=null,S=(0,Q.useRef)(!1),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e&&(C.current=!0,w.current!==null&&clearTimeout(w.current),w.current=setTimeout(()=>{C.current=!1},BZ)),c(e),e||(u(``),v(null))},t[0]=T):T=t[0];let E=T,D;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>!x||!C.current?!1:(e.preventDefault(),!0),t[1]=D):D=t[1];let O=D,k;t[2]!==r||t[3]!==n.project||t[4]!==s?(k=()=>{if(!s)return;let e=!1;return zZ(async()=>{let t=await n.project.listRecent();e||a(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=s,t[5]=k):k=t[5];let A;t[6]!==r||t[7]!==n||t[8]!==s?(A=[s,n,r],t[6]=r,t[7]=n,t[8]=s,t[9]=A):A=t[9],(0,Q.useEffect)(k,A);let j,M;t[10]===n?(j=t[11],M=t[12]):(j=()=>n.onMenuAction(e=>{e===`new-worktree`?(c(!1),v(null),g(``),m(!0)):e===`switch-worktree`&&c(!0)}),M=[n],t[10]=n,t[11]=j,t[12]=M),(0,Q.useEffect)(j,M);let N;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(N=()=>{E(!1),zZ(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=N):N=t[16];let P=N,F;t[17]!==r||t[18]!==n.navigator?(F=()=>{E(!1),zZ(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=F):F=t[19];let I=F,L;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{E(!1),f(!0)},t[20]=L):L=t[20];let R=L,z;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{E(!1),g(e),m(!0)},t[21]=z):z=t[21];let B=z,V=n.config.projectPath,H;t[22]===l?H=t[23]:(H=l.trim().toLowerCase(),t[22]=l,t[23]=H);let U=H,W=U!==``,G;t[24]===i?G=t[25]:(G=i??[],t[24]=i,t[25]=G);let K=G,ee;t[26]!==W||t[27]!==K?(ee=W?K.filter(YZ):K,t[26]=W,t[27]=K,t[28]=ee):ee=t[28];let te=ee,q=W?null:b,J=y!==null&&`h-auto py-1.5`,ne;t[29]===J?ne=t[30]:(ne=wi(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,J),t[29]=J,t[30]=ne);let re;t[31]===r?re=t[32]:(re=r({id:`zZ_I5K`}),t[31]=r,t[32]=re);let ie;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ie=x?()=>{S.current=!0}:void 0,t[33]=ie):ie=t[33];let ae;t[34]===s?ae=t[35]:(ae=x?()=>{if(S.current){S.current=!1;return}E(!s)}:void 0,t[34]=s,t[35]=ae);let oe;t[36]===n.config.projectName?oe=t[37]:(oe=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[36]=n.config.projectName,t[37]=oe);let se;t[38]===y?se=t[39]:(se=y===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:y})]}),t[38]=y,t[39]=se);let ce;t[40]!==oe||t[41]!==se?(ce=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[oe,se]}),t[40]=oe,t[41]=se,t[42]=ce):ce=t[42];let le;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(md,{"aria-hidden":`true`,className:`opacity-60`}),t[43]=le):le=t[43];let ue;t[44]!==n.config.projectPath||t[45]!==ne||t[46]!==re||t[47]!==ae||t[48]!==ce?(ue=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsxs)(YN,{className:ne,"data-testid":`project-switcher-trigger`,"aria-label":re,title:n.config.projectPath,onPointerDown:ie,onClick:ae,children:[ce,le]})}),t[44]=n.config.projectPath,t[45]=ne,t[46]=re,t[47]=ae,t[48]=ce,t[49]=ue):ue=t[49];let de;t[50]!==r||t[51]!==n||t[52]!==V||t[53]!==_||t[54]!==te||t[55]!==q||t[56]!==U||t[57]!==i||t[58]!==l?(de=i===null?null:i.length===0?(0,Z.jsx)(Pc,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`MUrVEo`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(IE,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(VE,{"aria-label":r({id:`blFttG`}),placeholder:r({id:`RVZJWQ`}),value:l,onChange:e=>{e.target.value!==``&&v(null),u(e.target.value)},onKeyDown:JZ,"data-testid":`project-switcher-search`}),(0,Z.jsx)(RE,{children:(0,Z.jsx)(o,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Ic,{}),(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:(0,Z.jsx)(EZ,{bridge:n,recents:te,currentPath:V,query:U,worktreeModel:q,closeMenu:()=>E(!1),guardStaleSelect:O,flyoutPath:_,setFlyoutPath:v,openNewWorktreeWith:B})})]}),t[50]=r,t[51]=n,t[52]=V,t[53]=_,t[54]=te,t[55]=q,t[56]=U,t[57]=i,t[58]=l,t[59]=de):de=t[59];let fe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(Ic,{}),t[60]=fe):fe=t[60];let pe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>{O(e)||R()},t[61]=pe):pe=t[61];let me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsxs)(Cc,{onSelect:pe,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(Lt,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(Y,{id:`gKi-a_`})]}),t[62]=me):me=t[62];let he;t[63]===I?he=t[64]:(he=e=>{O(e)||I()},t[63]=I,t[64]=he);let ge,_e;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Ae,{"aria-hidden":`true`,className:`text-muted-foreground`}),_e=(0,Z.jsx)(Y,{id:`xaDWAI`}),t[65]=ge,t[66]=_e):(ge=t[65],_e=t[66]);let ve;t[67]===he?ve=t[68]:(ve=(0,Z.jsxs)(Cc,{onSelect:he,"data-testid":`project-switcher-switch-project`,children:[ge,_e]}),t[67]=he,t[68]=ve);let ye;t[69]===P?ye=t[70]:(ye=e=>{O(e)||P()},t[69]=P,t[70]=ye);let be,xe;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(Io,{"aria-hidden":`true`,className:`text-muted-foreground`}),xe=(0,Z.jsx)(Y,{id:`PVUn_c`}),t[71]=be,t[72]=xe):(be=t[71],xe=t[72]);let Se;t[73]===ye?Se=t[74]:(Se=(0,Z.jsxs)(Cc,{onSelect:ye,"data-testid":`project-switcher-open-folder`,children:[be,xe]}),t[73]=ye,t[74]=Se);let Ce;t[75]===y?Ce=t[76]:(Ce=y===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ic,{}),(0,Z.jsxs)(Cc,{onSelect:e=>{O(e)||(E(!1),g(``),m(!0))},"data-testid":`project-switcher-new-worktree`,children:[(0,Z.jsx)(St,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(Y,{id:`DXd9LM`})]})]}),t[75]=y,t[76]=Ce);let we;t[77]!==de||t[78]!==ve||t[79]!==Se||t[80]!==Ce?(we=(0,Z.jsxs)(Tc,{align:`start`,side:`top`,className:`min-w-[260px]`,"data-testid":`project-switcher-menu`,children:[de,fe,me,ve,Se,Ce]}),t[77]=de,t[78]=ve,t[79]=Se,t[80]=Ce,t[81]=we):we=t[81];let Te;t[82]!==s||t[83]!==ue||t[84]!==we?(Te=(0,Z.jsxs)(jc,{open:s,onOpenChange:E,modal:!1,children:[ue,we]}),t[82]=s,t[83]=ue,t[84]=we,t[85]=Te):Te=t[85];let Ee;t[86]!==n||t[87]!==d?(Ee=(0,Z.jsx)(km,{open:d,onOpenChange:f,bridge:n}),t[86]=n,t[87]=d,t[88]=Ee):Ee=t[88];let De;t[89]===b?.entries?De=t[90]:(De=b?.entries.map(qZ).filter(KZ),t[89]=b?.entries,t[90]=De);let Oe;t[91]===b?.entries?Oe=t[92]:(Oe=new Set(b?.entries.filter(GZ).map(WZ)),t[91]=b?.entries,t[92]=Oe);let ke=b?.remoteBranches,je;t[93]===b?.entries?je=t[94]:(je=new Map(b?.entries.filter(UZ).map(HZ)),t[93]=b?.entries,t[94]=je);let Me;t[95]!==y||t[96]!==n||t[97]!==h||t[98]!==p||t[99]!==De||t[100]!==Oe||t[101]!==ke||t[102]!==je?(Me=(0,Z.jsx)(bZ,{open:p,onOpenChange:m,bridge:n,currentBranch:y,initialBranchName:h,branches:De,existingWorktreeBranches:Oe,remoteBranches:ke,behindByBranch:je}),t[95]=y,t[96]=n,t[97]=h,t[98]=p,t[99]=De,t[100]=Oe,t[101]=ke,t[102]=je,t[103]=Me):Me=t[103];let Ne;return t[104]!==Te||t[105]!==Ee||t[106]!==Me?(Ne=(0,Z.jsxs)(Z.Fragment,{children:[Te,Ee,Me]}),t[104]=Te,t[105]=Ee,t[106]=Me,t[107]=Ne):Ne=t[107],Ne}function HZ(e){return[e.branch,e.behind]}function UZ(e){return e.branch!==null&&e.behind!==void 0}function WZ(e){return e.branch}function GZ(e){return e.branch!==null&&e.worktreePath!==null}function KZ(e){return e!==null}function qZ(e){return e.branch}function JZ(e){return e.stopPropagation()}function YZ(e){return!e.isLinkedWorktree}function XZ(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Jn(`sidebarSearchPill`)}function ZZ(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=wi(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(o,{"aria-hidden":`true`}),t[2]=a):a=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(Y,{id:`A1taO8`})}),t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(wt,{className:`text-foreground/70`,children:Tl(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(X,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,s,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function QZ(){let e=(0,$.c)(31),{_:t}=an(),n=yo(),{activeDocName:r}=pt(),[i,a]=(0,Q.useState)(!1),o=Eo(),s;e[0]!==n.data||e[1]!==n.status?(s=n.status===`ready`?n.data:[],e[0]=n.data,e[1]=n.status,e[2]=s):s=e[2];let c=s,l;e[3]===c?l=e[4]:(l=No(c),e[3]=c,e[4]=l);let u=l,d=Vo(),f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={},e[5]=f):f=e[5];let[p,m]=(0,Q.useState)(f),h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(UN,{asChild:!0,children:(0,Z.jsxs)(cs,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(Pd,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(Y,{id:`PCSkw2`}),(0,Z.jsx)(Qa,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skills:rotate-90`})]})}),e[6]=h):h=e[6];let g;e[7]===t?g=e[8]:(g=t({id:`MdpSC1`}),e[7]=t,e[8]=g);let _,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>a(!0),v=(0,Z.jsx)(Lt,{}),e[9]=_,e[10]=v):(_=e[9],v=e[10]);let y;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`MdpSC1`})}),e[11]=y):y=e[11];let b;e[12]===g?b=e[13]:(b=(0,Z.jsxs)(WN,{title:g,onClick:_,children:[v,y]}),e[12]=g,e[13]=b);let x;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(aQ,{}),e[14]=x):x=e[14];let S;e[15]!==o||e[16]!==r||e[17]!==u||e[18]!==p||e[19]!==d||e[20]!==c?(S=c.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`PdJZ5p`})}):Uo.filter(e=>c.some(t=>t.scope===e)).map(e=>(0,Z.jsxs)(ls,{className:`group/scope`,open:c.some(t=>t.scope===e&&Ar(t.scope,t.name)===r)||(p[e]??!1),onOpenChange:t=>m(n=>({...n,[e]:t})),children:[(0,Z.jsxs)(cs,{className:`flex w-full items-center gap-1 px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground/70 hover:text-muted-foreground`,children:[(0,Z.jsx)(Qa,{className:`size-3 shrink-0 transition-transform group-data-[state=open]/scope:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate`,children:d[e]})]}),(0,Z.jsx)(ss,{children:(0,Z.jsx)(KN,{className:`pl-2`,children:c.filter(t=>t.scope===e).map(e=>(0,Z.jsx)(eQ,{skill:e,activeDocName:r,actions:o,existingNames:u[e.scope]},`${e.scope}::${e.name}`))})})]},e)),e[15]=o,e[16]=r,e[17]=u,e[18]=p,e[19]=d,e[20]=c,e[21]=S):S=e[21];let C;e[22]===S?C=e[23]:(C=(0,Z.jsx)(ss,{children:(0,Z.jsxs)(GN,{children:[x,S]})}),e[22]=S,e[23]=C);let w;e[24]===i?w=e[25]:(w=(0,Z.jsx)(va,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:$Z}),e[24]=i,e[25]=w);let T;return e[26]!==o.dialogs||e[27]!==C||e[28]!==w||e[29]!==b?(T=(0,Z.jsx)(ls,{className:`group/skills shrink-0`,children:(0,Z.jsxs)(HN,{className:`px-0`,children:[h,b,C,o.dialogs,w]})}),e[26]=o.dialogs,e[27]=C,e[28]=w,e[29]=b,e[30]=T):T=e[30],T}function $Z(e){let{scope:t,name:n}=e;return ns(Ar(t,n))}function eQ(e){let t=(0,$.c)(50),{skill:n,activeDocName:r,actions:i,existingNames:a}=e,{_:o}=an(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d;t[0]!==n.name||t[1]!==n.scope?(d=Ar(n.scope,n.name),t[0]=n.name,t[1]=n.scope,t[2]=d):d=t[2];let f=r===d,p,m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.preventDefault(),u(!0)},m=(0,Z.jsx)(Qa,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skill:rotate-90`}),h=(0,Z.jsx)(Pd,{className:`size-3 shrink-0 text-muted-foreground`}),t[3]=p,t[4]=m,t[5]=h):(p=t[3],m=t[4],h=t[5]);let g=n.name,_;t[6]===n.name?_=t[7]:(_=Lo(n.name),t[6]=n.name,t[7]=_);let v;t[8]!==n.name||t[9]!==_?(v=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:g,children:_}),t[8]=n.name,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==n.bundledVersion||t[13]!==n.updateAvailable?(y=n.updateAvailable?(0,Z.jsx)(`span`,{title:o({id:`1YJ4Yg`,values:{0:n.bundledVersion?` (${n.bundledVersion})`:``}}),className:`flex items-center`,children:(0,Z.jsx)(ao,{className:`size-3 text-primary`,"aria-label":o({id:`CifUuG`})})}):null,t[11]=o,t[12]=n.bundledVersion,t[13]=n.updateAvailable,t[14]=y):y=t[14];let b;t[15]===n.installed?b=t[16]:(b=(0,Z.jsx)(fa,{installed:n.installed,subtle:!0,className:`shrink-0`}),t[15]=n.installed,t[16]=b);let x;t[17]!==y||t[18]!==b?(x=(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19];let S;t[20]!==f||t[21]!==x||t[22]!==v?(S=(0,Z.jsx)(cs,{asChild:!0,children:(0,Z.jsxs)(YN,{size:`sm`,isActive:f,className:`h-6 text-[11px]`,onContextMenu:p,children:[m,h,v,x]})}),t[20]=f,t[21]=x,t[22]=v,t[23]=S):S=t[23];let C;t[24]!==o||t[25]!==n.name?(C=o({id:`RlLl3G`,values:{0:n.name}}),t[24]=o,t[25]=n.name,t[26]=C):C=t[26];let w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Sd,{}),t[27]=w):w=t[27];let T;t[28]===C?T=t[29]:(T=(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(XN,{showOnHover:!0,"aria-label":C,children:w})}),t[28]=C,t[29]=T);let E;t[30]!==i||t[31]!==a||t[32]!==n?(E=(0,Z.jsx)(Tc,{side:`right`,align:`start`,className:`min-w-52`,children:(0,Z.jsx)(Co,{skill:n,actions:i,existingNames:a})}),t[30]=i,t[31]=a,t[32]=n,t[33]=E):E=t[33];let D;t[34]!==l||t[35]!==T||t[36]!==E?(D=(0,Z.jsxs)(jc,{open:l,onOpenChange:u,children:[T,E]}),t[34]=l,t[35]=T,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==s||t[39]!==n?(O=s?(0,Z.jsx)(rQ,{skill:n}):null,t[38]=s,t[39]=n,t[40]=O):O=t[40];let k;t[41]===O?k=t[42]:(k=(0,Z.jsx)(ss,{children:O}),t[41]=O,t[42]=k);let A;t[43]!==S||t[44]!==D||t[45]!==k?(A=(0,Z.jsxs)(qN,{children:[S,D,k]}),t[43]=S,t[44]=D,t[45]=k,t[46]=A):A=t[46];let j;return t[47]!==s||t[48]!==A?(j=(0,Z.jsx)(ls,{open:s,onOpenChange:c,className:`group/skill`,children:A}),t[47]=s,t[48]=A,t[49]=j):j=t[49],j}function tQ(e){let t=[];for(let n of e){let e=n.path.split(`/`),r=t;e.forEach((t,i)=>{let a=i===e.length-1,o=r.find(e=>e.name===t);o||(o=a?{name:t,path:n.path,text:n.text}:{name:t,path:e.slice(0,i+1).join(`/`),children:[]},r.push(o)),!a&&o.children&&(r=o.children)})}return nQ(t),t}function nQ(e){e.sort((e,t)=>{let n=+!e.children,r=+!t.children;return n===r?e.name.localeCompare(t.name):n-r});for(let t of e)t.children&&nQ(t.children)}function rQ(e){let t=(0,$.c)(27),{skill:n}=e,{_:r}=an(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),{openTarget:c}=pt(),l;t[0]===c?l=t[1]:(l=function(e){c({kind:`doc`,target:e,docName:e},{tabBehavior:`append`}),Yc(Jc(e))},t[0]=c,t[1]=l);let u=l,d;t[2]!==u||t[3]!==c||t[4]!==n.name||t[5]!==n.scope?(d=function(e){let t=e.lastIndexOf(`.`),r=t>=0?e.slice(t+1).toLowerCase():``;if(n.scope===`project`&&(r===`md`||r===`mdx`)){u(_(n.name,e.replace(/\.mdx?$/i,``)));return}c({kind:`skill-file`,target:`${n.scope}/${n.name}/${e}`,scope:n.scope,name:n.name,path:e},{tabBehavior:`replace-active`}),Yc($c({scope:n.scope,name:n.name,path:e}))},t[2]=u,t[3]=c,t[4]=n.name,t[5]=n.scope,t[6]=d):d=t[6];let f=d,p,m;t[7]!==n.name||t[8]!==n.scope?(p=()=>{let e=!0,t=()=>{Mc(n.scope,n.name).then(t=>{e&&(t.ok?(a(t.files),s(!1)):(a([]),s(!0)))})};t();let r=js(t);return()=>{e=!1,r()}},m=[n.scope,n.name],t[7]=n.name,t[8]=n.scope,t[9]=p,t[10]=m):(p=t[9],m=t[10]),(0,Q.useEffect)(p,m);let h;if(t[11]!==r||t[12]!==i||t[13]!==o||t[14]!==f||t[15]!==u||t[16]!==n.name||t[17]!==n.scope){let e=i?tQ(i):[],a;t[19]!==u||t[20]!==n.name||t[21]!==n.scope?(a=()=>n.scope===`project`?u(Ir(n.name)):ns(Ar(n.scope,n.name)),t[19]=u,t[20]=n.name,t[21]=n.scope,t[22]=a):a=t[22];let s,c;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Ye,{className:`size-3 shrink-0 text-muted-foreground`}),c=(0,Z.jsx)(`span`,{className:`truncate`,children:`SKILL.md`}),t[23]=s,t[24]=c):(s=t[23],c=t[24]);let l;t[25]===a?l=t[26]:(l=(0,Z.jsx)(QN,{children:(0,Z.jsxs)($N,{size:`sm`,onClick:a,className:`text-[11px]`,children:[s,c]})}),t[25]=a,t[26]=l),h=(0,Z.jsxs)(ZN,{className:`mr-0 pr-0`,children:[l,i===null?(0,Z.jsx)(QN,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,children:(0,Z.jsx)(Y,{id:`yQE2r9`})})}):o?(0,Z.jsx)(QN,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,title:r({id:`3Ijjy1`}),children:(0,Z.jsx)(Y,{id:`ZARuZJ`})})}):e.map(e=>(0,Z.jsx)(iQ,{node:e,depth:0,onOpenFile:f},e.path))]}),t[11]=r,t[12]=i,t[13]=o,t[14]=f,t[15]=u,t[16]=n.name,t[17]=n.scope,t[18]=h}else h=t[18];return h}function iQ(e){let t=(0,$.c)(34),{node:n,depth:r,onOpenFile:i}=e,[a,o]=(0,Q.useState)(!1),s=`${r*.6}rem`,c;t[0]===s?c=t[1]:(c={paddingLeft:s},t[0]=s,t[1]=c);let l=c;if(n.children){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Qa,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/dir:rotate-90`}),t[2]=e):e=t[2];let s;t[3]===n.name?s=t[4]:(s=(0,Z.jsxs)(`span`,{className:`truncate`,children:[n.name,`/`]}),t[3]=n.name,t[4]=s);let c;t[5]!==l||t[6]!==s?(c=(0,Z.jsx)(cs,{asChild:!0,children:(0,Z.jsxs)($N,{size:`sm`,className:`text-[11px]`,style:l,children:[e,s]})}),t[5]=l,t[6]=s,t[7]=c):c=t[7];let u;if(t[8]!==r||t[9]!==n.children||t[10]!==i){let e;t[12]!==r||t[13]!==i?(e=e=>(0,Z.jsx)(iQ,{node:e,depth:r+1,onOpenFile:i},e.path),t[12]=r,t[13]=i,t[14]=e):e=t[14],u=n.children.map(e),t[8]=r,t[9]=n.children,t[10]=i,t[11]=u}else u=t[11];let d;t[15]===u?d=t[16]:(d=(0,Z.jsx)(ss,{children:u}),t[15]=u,t[16]=d);let f;t[17]!==c||t[18]!==d?(f=(0,Z.jsxs)(QN,{children:[c,d]}),t[17]=c,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==a||t[21]!==f?(p=(0,Z.jsx)(ls,{open:a,onOpenChange:o,className:`group/dir`,children:f}),t[20]=a,t[21]=f,t[22]=p):p=t[22],p}let u=`skill-file-${n.path}`,d;t[23]!==n.path||t[24]!==i?(d=()=>i(n.path),t[23]=n.path,t[24]=i,t[25]=d):d=t[25];let f;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Td,{className:`size-3 shrink-0 text-muted-foreground`}),t[26]=f):f=t[26];let p;t[27]===n.name?p=t[28]:(p=(0,Z.jsx)(`span`,{className:`truncate`,children:n.name}),t[27]=n.name,t[28]=p);let m;return t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(m=(0,Z.jsx)(QN,{children:(0,Z.jsxs)($N,{size:`sm`,className:`text-[11px]`,style:l,"data-testid":u,onClick:d,children:[f,p]})}),t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=m):m=t[33],m}function aQ(){let e=(0,$.c)(19),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=!1;return Ec().then(t=>{e||n(t)}),()=>{e=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o),!t||t.managed!==null||t.importable===0)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=async e=>{if(i(!0),!await Nc(e)){i(!1);return}n({managed:e,importable:0})},e[2]=s):s=e[2];let c=s,l;e[3]===t.importable?l=e[4]:(l=(0,Z.jsx)(`p`,{className:`mb-2 text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`mu1O0q`,values:{0:t.importable}})}),e[3]=t.importable,e[4]=l);let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>c(!0),d=(0,Z.jsx)(Y,{id:`l3s5ri`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===r?f=e[8]:(f=(0,Z.jsx)(X,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:u,children:d}),e[7]=r,e[8]=f);let p,m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>c(!1),m=(0,Z.jsx)(Y,{id:`PBxg_E`}),e[9]=p,e[10]=m):(p=e[9],m=e[10]);let h;e[11]===r?h=e[12]:(h=(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,disabled:r,onClick:p,children:m}),e[11]=r,e[12]=h);let g;e[13]!==f||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,h]}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let _;return e[16]!==g||e[17]!==l?(_=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-border/60 bg-muted/40 p-2 text-xs`,children:[l,g]}),e[16]=g,e[17]=l,e[18]=_):_=e[18],_}var oQ=6e4,sQ=e=>{let t=(0,$.c)(11),{href:n,label:r,icon:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=e=>Ns(e,n),o=e=>Ns(e,n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=i,t[4]=s);let c;return t[5]!==n||t[6]!==r||t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:a,onAuxClick:o,"aria-label":r,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:s}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c};function cQ(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?Yg:a,c=o===void 0?oQ:o,{_:l}=an(),[u,d]=(0,Q.useState)(!1),f,p;t[0]!==c||t[1]!==i||t[2]!==u?(f=()=>{if(!u)return;let e=setTimeout(i,c);return()=>clearTimeout(e)},p=[u,i,c],t[0]=c,t[1]=i,t[2]=u,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]===l?m=t[6]:(m=l({id:`GzPQ2f`}),t[5]=l,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Y,{id:`yLEyuq`}),t[7]=h):h=t[7];let g;t[8]===s?g=t[9]:(g=()=>{s.markSubscribed(),d(!0)},t[8]=s,t[9]=g);let _;t[10]!==i||t[11]!==s?(_=()=>{s.dismiss(),i()},t[10]=i,t[11]=s,t[12]=_):_=t[12];let v;t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(MI,{source:`post_update_card`,compactSubmit:!0,description:h,onSuccess:g,onDismiss:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==l||t[17]!==u?(y=u?null:(0,Z.jsxs)(`nav`,{"aria-label":l({id:`dbapvC`}),className:`mt-3 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,Z.jsx)(`span`,{className:`mr-0.5`,children:(0,Z.jsx)(Y,{id:`9sBe85`})}),(0,Z.jsx)(sQ,{href:FI,label:l({id:`I7Exsw`}),icon:LI}),(0,Z.jsx)(sQ,{href:NI,label:l({id:`zyKa-I`}),icon:Rm}),(0,Z.jsx)(sQ,{href:PI,label:l({id:`36aWJD`}),icon:II})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(`div`,{className:`px-3 py-2.5`,children:[v,y]}),t[19]=y,t[20]=v,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hLy8b1`,values:{version:n}})}),t[22]=n,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Y,{id:`_PACVa`}),t[24]=S):S=t[24];let C;t[25]===r?C=t[26]:(C=(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto p-0 text-muted-foreground text-xs hover:text-foreground`,onClick:r,children:S}),t[25]=r,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-t bg-muted/30 px-3 py-2.5 space-x-2`,children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==b||t[31]!==w||t[32]!==m?(T=(0,Z.jsxs)(`section`,{"aria-label":m,className:`mx-1 mb-1 overflow-hidden rounded-lg border bg-card text-card-foreground`,children:[b,w]}),t[30]=b,t[31]=w,t[32]=m,t[33]=T):T=t[33],T}function lQ(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=an(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(Cs,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function uQ(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function dQ(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(D_,E_,E_),n;e[0]===t?n=e[1]:(n=uQ(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;if(r.combinedSubscribe&&r.whatsNew){let t;e[2]===r.action?t=e[3]:(t=()=>r.action?.onClick(),e[2]=r.action,e[3]=t);let n;e[4]===r.id?n=e[5]:(n=()=>T_(r.id),e[4]=r.id,e[5]=n);let i;return e[6]!==r.whatsNew.version||e[7]!==t||e[8]!==n?(i=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(cQ,{version:r.whatsNew.version,onOpenReleaseNotes:t,onClose:n})}),e[6]=r.whatsNew.version,e[7]=t,e[8]=n,e[9]=i):i=e[9],i}let i;e[10]===r?i=e[11]:(i=()=>{r.onDismiss?.(),T_(r.id)},e[10]=r,e[11]=i);let a;return e[12]!==r||e[13]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(lQ,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}function fQ(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?co(n.contentDir,fo(t),n.pathSeparator):e?.kind===`folder`?co(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?co(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function pQ(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?fo(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function mQ(e,t,n){return e===null?Mo({workspace:n}):e.kind===`folder`?n?po({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?ko({docName:t,workspace:n}):null}var hQ={folderCount:0,expandedCount:0},gQ=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function _Q(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(gQ)!==null}function vQ(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(yl,{name:`file-sidebar`,children:(0,Z.jsx)(bQ,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var yQ=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Hs,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Ws,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function bQ(e){let t=(0,$.c)(209),{onOpenSearch:n}=e,{_:r}=an(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=pt(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:pl(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,g=typeof window<`u`&&window.okDesktop!=null,{state:_,toggleSidebar:v}=jN(),y=bo(),b=_===`expanded`,x=g&&_===`collapsed`,[S,C]=(0,Q.useState)(hQ),w,T;t[3]===i?(w=t[4],T=t[5]):(w=()=>{if(i===null)return;let e=()=>{C(i.getFolderState()),p(i.isCreationTargetCleared())};return e(),i.subscribe(e)},T=[i],t[3]=i,t[4]=w,t[5]=T),(0,Q.useEffect)(w,T);let E,D;t[6]===i?(E=t[7],D=t[8]):(E=()=>{if(i!==null)return ST(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(`file`,t)})},D=[i],t[6]=i,t[7]=E,t[8]=D),(0,Q.useEffect)(E,D);let O=S.folderCount>0,k=O&&S.expandedCount===S.folderCount,A=S.expandedCount===0,j=ya(``),M=ya(m===``?null:m),N=m===``?j:M,P=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,F=N.state.status===`ready`?(N.state.data.folder.templates_available?.length??0)>0:!0,I=typeof window<`u`?window.okDesktop:void 0,L=so(),{status:R}=Ki(),z=R?.hasRemote===!0,B;t[9]!==r||t[10]!==L?.contentDir?(B=I?.config?.projectName||L?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[9]=r,t[10]=L?.contentDir,t[11]=B):B=t[11];let V=B,H=So().states,{dispatch:U}=Ao(),W;t[12]===L?W=t[13]:(W=Mo({workspace:L}),t[12]=L,t[13]=W);let G=W,{projectLocalBinding:K,merged:ee}=Bo(),te=ee?.appearance?.sidebar?.showHiddenFiles??!1,q=O&&!k,J=O&&!A,ne=q||J,re=TQ,ie;t[14]!==i||t[15]!==L?(ie=()=>{L&&i?.startCreating(`file`,``)},t[14]=i,t[15]=L,t[16]=ie):ie=t[16];let ae=ie,oe;t[17]!==i||t[18]!==L?(oe=e=>{L&&i?.createFromTemplate(``,e)},t[17]=i,t[18]=L,t[19]=oe):oe=t[19];let se=oe,ce;t[20]!==i||t[21]!==L?(ce=()=>{L&&i?.startCreating(`folder`,``)},t[20]=i,t[21]=L,t[22]=ce):ce=t[22];let le=ce,ue;t[23]===L?ue=t[24]:(ue=()=>{!L||!I||I.shell.showItemInFolder(L.contentDir)},t[23]=L,t[24]=ue);let de=ue,fe;t[25]!==r||t[26]!==L?(fe=async()=>{if(L)try{await navigator.clipboard.writeText(L.contentDir),Ss.success(r({id:`6_ZOw4`}),{description:L.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),Ss.error(r({id:`vfRlCI`}))}},t[25]=r,t[26]=L,t[27]=fe):fe=t[27];let pe=fe,me;t[28]!==r||t[29]!==z?(me=()=>{Mi({...Bi(``),hasRemote:z,onClickWhenNoRemote:()=>{Ss.error(r({id:`WyQxwa`}))}},{clipboardWrite:To,toastSuccess:wQ,toastError:CQ,logEvent:SQ})},t[28]=r,t[29]=z,t[30]=me):me=t[30];let he=me,ge;t[31]!==r||t[32]!==K?(ge=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,rr(t.error)),Ss.error(r({id:`P47EWZ`}),{description:rr(t.error)}))},t[31]=r,t[32]=K,t[33]=ge):ge=t[33];let _e=ge,ve;t[34]===i?ve=t[35]:(ve=()=>{i?.expandAll()},t[34]=i,t[35]=ve);let ye=ve,be;t[36]===i?be=t[37]:(be=()=>{i?.collapseAll()},t[36]=i,t[37]=be);let xe=be,Se,Ce;t[38]!==J||t[39]!==q||t[40]!==te||t[41]!==_?(Se=()=>{I&&I.editor.notifyViewMenuStateChanged({showHiddenFiles:te,canExpandAll:q,canCollapseAll:J,sidebarVisible:_===`expanded`})},Ce=[I,te,q,J,_],t[38]=J,t[39]=q,t[40]=te,t[41]=_,t[42]=Se,t[43]=Ce):(Se=t[42],Ce=t[43]),(0,Q.useEffect)(Se,Ce);let we,Te;t[44]!==r||t[45]!==c||t[46]!==l||t[47]!==U||t[48]!==H||t[49]!==m||t[50]!==K||t[51]!==te||t[52]!==v||t[53]!==i||t[54]!==L?(we=()=>{if(I)return I.onMenuAction(e=>{switch(e){case`new-doc`:if(!L||!i)return;i.startCreating(`file`,m);return;case`new-folder`:if(!L||!i)return;i.startCreating(`folder`,m);return;case`new-from-template`:if(!L||!i)return;i.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;lY(l);return;case`duplicate`:if(!l)return;dY(l);return;case`move-to-trash`:if(!l)return;sY(l);return;case`reveal-in-finder`:{if(!I||!L)return;let e=fQ(l,c,L);I.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=lo.filter(e=>H[e.id]?.installed===!0);if(e.length===0){Ss.error(r({id:`LKOLNn`}));return}let t=mQ(l,c,L);if(!t)return;let[n]=e;if(!n)return;U(n.id,t);return}case`copy-full-path`:{if(!L)return;let e=fQ(l,c,L);navigator.clipboard.writeText(e).then(()=>Ss.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ss.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=pQ(l,c);if(e===``){Ss.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>Ss.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ss.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(K===null)return;let e=K.patch({appearance:{sidebar:{showHiddenFiles:!te}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,rr(e.error)),Ss.error(r({id:`P47EWZ`}),{description:rr(e.error)}));return}case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:v();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},Te=[I,i,L,l,c,m,K,te,H,U,v,r],t[44]=r,t[45]=c,t[46]=l,t[47]=U,t[48]=H,t[49]=m,t[50]=K,t[51]=te,t[52]=v,t[53]=i,t[54]=L,t[55]=we,t[56]=Te):(we=t[55],Te=t[56]),(0,Q.useEffect)(we,Te);let Ee=g&&b&&`motion-safe:delay-100`,De=x&&`opacity-0`,Oe;t[57]!==Ee||t[58]!==De?(Oe=wi(`flex-row h-12 items-center py-0 px-3`,`justify-between`,g&&`overflow-x-clip`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ee,De,g&&`[-webkit-app-region:drag]`),t[57]=Ee,t[58]=De,t[59]=Oe):Oe=t[59];let ke;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ke=g?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[60]=ke):ke=t[60];let Ae;t[61]===b?Ae=t[62]:(Ae=b&&!g?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(Y,{id:`sER-bs`})}):null,t[61]=b,t[62]=Ae);let je;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(je=wi(`flex items-center gap-1`,g&&`[&>*]:[-webkit-app-region:no-drag]`),t[63]=je):je=t[63];let Me;t[64]!==r||t[65]!==k||t[66]!==O||t[67]!==A||t[68]!==i?(Me=O?(0,Z.jsxs)(jc,{children:[(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(yQ,{icon:Bd,label:r({id:`Rq1vFD`})})}),(0,Z.jsxs)(Tc,{align:`end`,className:`min-w-52`,children:[k?null:(0,Z.jsxs)(Cc,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(kf,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}),A?null:(0,Z.jsxs)(Cc,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(Od,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]})]})]}):null,t[64]=r,t[65]=k,t[66]=O,t[67]=A,t[68]=i,t[69]=Me):Me=t[69];let Ne;t[70]===r?Ne=t[71]:(Ne=r({id:`HdkSiO`}),t[70]=r,t[71]=Ne);let Pe;t[72]!==m||t[73]!==i?(Pe=()=>i?.startCreating(`file`,m),t[72]=m,t[73]=i,t[74]=Pe):Pe=t[74];let Fe;t[75]!==Ne||t[76]!==Pe?(Fe=(0,Z.jsx)(yQ,{icon:hf,label:Ne,onClick:Pe}),t[75]=Ne,t[76]=Pe,t[77]=Fe):Fe=t[77];let Ie;t[78]!==r||t[79]!==F||t[80]!==m||t[81]!==i?(Ie=F?(0,Z.jsxs)(jc,{children:[(0,Z.jsx)(xc,{asChild:!0,children:(0,Z.jsx)(yQ,{icon:ia,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(Tc,{align:`end`,className:`min-w-52`,children:(0,Z.jsx)(eY,{parentDir:m,onSelectTemplate:e=>i?.createFromTemplate(m,e),ItemComponent:Cc})})]}):null,t[78]=r,t[79]=F,t[80]=m,t[81]=i,t[82]=Ie):Ie=t[82];let Le;t[83]===r?Le=t[84]:(Le=r({id:`96G6Re`}),t[83]=r,t[84]=Le);let Re;t[85]!==m||t[86]!==i?(Re=()=>i?.startCreating(`folder`,m),t[85]=m,t[86]=i,t[87]=Re):Re=t[87];let ze;t[88]!==Le||t[89]!==Re?(ze=(0,Z.jsx)(yQ,{icon:Ad,label:Le,onClick:Re}),t[88]=Le,t[89]=Re,t[90]=ze):ze=t[90];let Be;t[91]!==Me||t[92]!==Fe||t[93]!==Ie||t[94]!==ze?(Be=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:je,children:[Me,Fe,Ie,ze]}),t[91]=Me,t[92]=Fe,t[93]=Ie,t[94]=ze,t[95]=Be):Be=t[95];let Ve;t[96]!==Oe||t[97]!==Ae||t[98]!==Be?(Ve=(0,Z.jsxs)(zN,{"data-electron-drag":g?``:void 0,className:Oe,children:[ke,Ae,Be]}),t[96]=Oe,t[97]=Ae,t[98]=Be,t[99]=Ve):Ve=t[99];let He=g&&b&&`motion-safe:delay-100`,Ue=x&&`opacity-0`,We;t[100]!==He||t[101]!==Ue?(We=wi(`px-2 pb-2`,g&&`[-webkit-app-region:no-drag]`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,He,Ue),t[100]=He,t[101]=Ue,t[102]=We):We=t[102];let Ge;t[103]===_?Ge=t[104]:(Ge=[_],t[103]=_,t[104]=Ge);let Ke;t[105]===n?Ke=t[106]:(Ke=(0,Z.jsx)(ZZ,{onClick:n}),t[105]=n,t[106]=Ke);let qe;t[107]!==Ge||t[108]!==Ke?(qe=(0,Z.jsx)(h,{fallbackRender:xQ,onError:XZ,resetKeys:Ge,children:Ke}),t[107]=Ge,t[108]=Ke,t[109]=qe):qe=t[109];let Je;t[110]!==We||t[111]!==qe?(Je=(0,Z.jsx)(`div`,{className:We,children:qe}),t[110]=We,t[111]=qe,t[112]=Je):Je=t[112];let Ye;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(LL,{}),t[113]=Ye):Ye=t[113];let Xe;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,Z.jsx)(Io,{className:`size-3.5 shrink-0`}),t[114]=Xe):Xe=t[114];let Ze;t[115]===V?Ze=t[116]:(Ze=(0,Z.jsx)(`span`,{className:`truncate`,children:V}),t[115]=V,t[116]=Ze);let Qe;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Qa,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90`}),t[117]=Qe):Qe=t[117];let $e;t[118]===Ze?$e=t[119]:($e=(0,Z.jsx)(UN,{asChild:!0,className:`shrink-0`,children:(0,Z.jsxs)(cs,{"data-sidebar-root-context":!0,className:`flex w-full items-center gap-1.5`,children:[Xe,Ze,Qe]})}),t[118]=Ze,t[119]=$e);let et=o==null?`50vh`:`${o}px`,tt;t[120]===et?tt=t[121]:(tt={height:et},t[120]=et,t[121]=tt);let nt;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,Z.jsx)(bX,{ref:a,onContentHeightChange:s}),t[122]=nt):nt=t[122];let rt;t[123]===tt?rt=t[124]:(rt=(0,Z.jsx)(ss,{className:`flex max-h-[70vh] flex-col overflow-hidden`,style:tt,children:nt}),t[123]=tt,t[124]=rt);let it;t[125]!==$e||t[126]!==rt?(it=(0,Z.jsx)(ls,{defaultOpen:!0,className:`group/files flex shrink-0 flex-col`,children:(0,Z.jsxs)(HN,{className:`min-h-0 px-0`,children:[$e,rt]})}),t[125]=$e,t[126]=rt,t[127]=it):it=t[127];let at;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(QZ,{}),t[128]=at):at=t[128];let ot;t[129]===i?ot=t[130]:(ot=(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-sidebar-empty-deselect":!0,className:`min-h-8 flex-1 cursor-default`,onClick:()=>i?.clearCreationTarget()}),t[129]=i,t[130]=ot);let st;t[131]!==it||t[132]!==ot?(st=(0,Z.jsxs)(VN,{children:[Ye,it,at,ot]}),t[131]=it,t[132]=ot,t[133]=st):st=t[133];let ct;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsxs)(BN,{className:`px-0`,children:[(0,Z.jsx)(gZ,{}),(0,Z.jsx)(dQ,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(KN,{children:(0,Z.jsx)(qN,{children:(0,Z.jsx)(VZ,{bridge:window.okDesktop})})}):null]}),t[134]=ct):ct=t[134];let lt=!(y&&_===`collapsed`),ut;t[135]===lt?ut=t[136]:(ut=(0,Z.jsx)(LN,{enableToggle:!1,enableDrag:lt}),t[135]=lt,t[136]=ut);let dt;t[137]!==Ve||t[138]!==Je||t[139]!==st||t[140]!==ut?(dt=(0,Z.jsx)(RF,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:re,children:[Ve,Je,st,ct,ut]})}),t[137]=Ve,t[138]=Je,t[139]=st,t[140]=ut,t[141]=dt):dt=t[141];let ft=!L,mt,ht;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(hf,{"aria-hidden":`true`}),ht=(0,Z.jsx)(Y,{id:`HdkSiO`}),t[142]=mt,t[143]=ht):(mt=t[142],ht=t[143]);let gt;t[144]!==ae||t[145]!==ft?(gt=(0,Z.jsxs)(HF,{disabled:ft,onSelect:ae,"data-testid":`empty-space-menu-new-file`,children:[mt,ht]}),t[144]=ae,t[145]=ft,t[146]=gt):gt=t[146];let _t;t[147]!==se||t[148]!==P||t[149]!==L?(_t=P?(0,Z.jsxs)(BF,{children:[(0,Z.jsxs)(UF,{disabled:!L,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(ia,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Uuj_R4`})]}),(0,Z.jsx)(WF,{children:(0,Z.jsx)(eY,{parentDir:``,onSelectTemplate:se,ItemComponent:HF})})]}):null,t[147]=se,t[148]=P,t[149]=L,t[150]=_t):_t=t[150];let vt=!L,yt,bt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,Z.jsx)(Ad,{"aria-hidden":`true`}),bt=(0,Z.jsx)(Y,{id:`96G6Re`}),t[151]=yt,t[152]=bt):(yt=t[151],bt=t[152]);let xt;t[153]!==le||t[154]!==vt?(xt=(0,Z.jsxs)(HF,{disabled:vt,onSelect:le,"data-testid":`empty-space-menu-new-folder`,children:[yt,bt]}),t[153]=le,t[154]=vt,t[155]=xt):xt=t[155];let St;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(St=(0,Z.jsx)(qF,{}),t[156]=St):St=t[156];let Ct;t[157]!==r||t[158]!==de||t[159]!==L?(Ct=I?(0,Z.jsxs)(HF,{disabled:!L,onSelect:de,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(L?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(Io,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`LtSYdi`})}),L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`wTcjov`})})]}):null,t[157]=r,t[158]=de,t[159]=L,t[160]=Ct):Ct=t[160];let wt;t[161]!==U||t[162]!==G||t[163]!==H?(wt=(0,Z.jsx)(iZ,{input:G,installStates:H,dispatch:U}),t[161]=U,t[162]=G,t[163]=H,t[164]=wt):wt=t[164];let Tt;t[165]!==he||t[166]!==z?(Tt=z?(0,Z.jsxs)(HF,{onSelect:he,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(df,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`Z8lGw6`})]}):null,t[165]=he,t[166]=z,t[167]=Tt):Tt=t[167];let Et=!L,Dt;t[168]!==r||t[169]!==L?(Dt=r(L?{id:`Up2_7p`}:{id:`U8CD-l`}),t[168]=r,t[169]=L,t[170]=Dt):Dt=t[170];let Ot;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=(0,Z.jsx)(Ho,{"aria-hidden":`true`}),t[171]=Ot):Ot=t[171];let kt;t[172]===Symbol.for(`react.memo_cache_sentinel`)?(kt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`Up2_7p`})}),t[172]=kt):kt=t[172];let At;t[173]===L?At=t[174]:(At=L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`wTcjov`})}),t[173]=L,t[174]=At);let jt;t[175]!==pe||t[176]!==Et||t[177]!==Dt||t[178]!==At?(jt=(0,Z.jsxs)(HF,{disabled:Et,onSelect:pe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":Dt,children:[Ot,kt,At]}),t[175]=pe,t[176]=Et,t[177]=Dt,t[178]=At,t[179]=jt):jt=t[179];let Mt;t[180]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=(0,Z.jsx)(qF,{}),t[180]=Mt):Mt=t[180];let Nt=K===null,Pt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=(0,Z.jsx)(Y,{id:`XcGbim`}),t[181]=Pt):Pt=t[181];let Ft;t[182]!==_e||t[183]!==te||t[184]!==Nt?(Ft=(0,Z.jsx)(GF,{checked:te,onCheckedChange:_e,disabled:Nt,"data-testid":`empty-space-menu-show-hidden-files`,children:Pt}),t[182]=_e,t[183]=te,t[184]=Nt,t[185]=Ft):Ft=t[185];let It;t[186]===ne?It=t[187]:(It=ne?(0,Z.jsx)(qF,{}):null,t[186]=ne,t[187]=It);let Lt;t[188]!==ye||t[189]!==q?(Lt=q?(0,Z.jsxs)(HF,{onSelect:ye,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(kf,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`OlAl5i`})]}):null,t[188]=ye,t[189]=q,t[190]=Lt):Lt=t[190];let Rt;t[191]!==xe||t[192]!==J?(Rt=J?(0,Z.jsxs)(HF,{onSelect:xe,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Od,{"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`qvWGzP`})]}):null,t[191]=xe,t[192]=J,t[193]=Rt):Rt=t[193];let zt;t[194]!==gt||t[195]!==_t||t[196]!==xt||t[197]!==Ct||t[198]!==wt||t[199]!==Tt||t[200]!==jt||t[201]!==Ft||t[202]!==It||t[203]!==Lt||t[204]!==Rt?(zt=(0,Z.jsxs)(VF,{className:`min-w-52`,children:[gt,_t,xt,St,Ct,wt,Tt,jt,Mt,Ft,It,Lt,Rt]}),t[194]=gt,t[195]=_t,t[196]=xt,t[197]=Ct,t[198]=wt,t[199]=Tt,t[200]=jt,t[201]=Ft,t[202]=It,t[203]=Lt,t[204]=Rt,t[205]=zt):zt=t[205];let Bt;return t[206]!==dt||t[207]!==zt?(Bt=(0,Z.jsx)(FN,{variant:`inset`,children:(0,Z.jsxs)(LF,{children:[dt,zt]})}),t[206]=dt,t[207]=zt,t[208]=Bt):Bt=t[208],Bt}function xQ(){return null}function SQ(e){return console.log(e)}function CQ(e){return Ss.error(e)}function wQ(e){return Ss.success(e)}function TQ(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)||_Q(e.target)&&(e.preventDefault(),e.stopPropagation())}function EQ(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function DQ(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function OQ(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var kQ={phase:`loading`};function AQ(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function jQ(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function MQ(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=OQ(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function NQ(e){return e!==null&&e.kind===`project-branch-switch`}function PQ(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,i=r===void 0?rh:r,{_:a}=an(),o=(0,Q.useSyncExternalStore)(i.subscribe,i.getSnapshot,BQ),[s,c]=(0,Q.useState)(kQ),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(!1),d;t[0]===o?d=t[1]:(d=NQ(o)?o:null,t[0]=o,t[1]=d);let f=d,p;t[2]!==a||t[3]!==f?.share.target.kind?(p=f?.share.target.kind===`folder`?a({id:`ugoTXs`}):a({id:`XH30C4`}),t[2]=a,t[3]=f?.share.target.kind,t[4]=p):p=t[4];let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{c(kQ),l.current=!1,u.current=!1},t[5]=h):h=t[5];let g;t[6]===o?g=t[7]:(g=[o],t[6]=o,t[7]=g),(0,Q.useEffect)(h,g);let _;t[8]!==f||t[9]!==n?(_=()=>{f&&(l.current||(l.current=!0,n.project.fetchBranchInfo({projectPath:f.projectPath,branch:f.share.branch,kind:f.share.target.kind,path:Po(f.share.target)}).then(e=>{c(t=>AQ(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),c(zQ)})))},t[8]=f,t[9]=n,t[10]=_):_=t[10];let v;t[11]===f?v=t[12]:(v=[f],t[11]=f,t[12]=v),(0,Q.useEffect)(_,v);let y;t[13]!==a||t[14]!==f||t[15]!==s.phase||t[16]!==n||t[17]!==i||t[18]!==m?(y=()=>{if(s.phase!==`awaiting-cc1-recycle`||!f)return;let e=f.share.branch;if(!e){i.dismiss();return}if(u.current)return;u.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:f.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(zf({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:f.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:f.share.target.kind,path:Po(f.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),Ss.error(a({id:`gQV-9w`,values:{targetNoun:m}}))}),i.dismiss();return}console.log(zf({branch_dialog_action:`branch-switch-timeout`,branch:e})),Ss.error(a({id:`LBwUR6`,values:{targetNoun:m}})),i.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),Ss.error(a({id:`Jw6EC4`,values:{targetNoun:m}})),i.dismiss())}),()=>{t=!0}},t[13]=a,t[14]=f,t[15]=s.phase,t[16]=n,t[17]=i,t[18]=m,t[19]=y):y=t[19];let b;if(t[20]!==f||t[21]!==s.phase?(b=[s.phase,f],t[20]=f,t[21]=s.phase,t[22]=b):b=t[22],(0,Q.useEffect)(y,b),!f)return null;let{share:x,projectPath:S,currentBranch:C}=f,w=x.branch,T;t[23]!==a||t[24]!==s.info||t[25]!==s.phase||t[26]!==n.project||t[27]!==S||t[28]!==x.target||t[29]!==w||t[30]!==i?(T=function(){s.phase===`ready`&&EQ(s.info).switchEnabled&&(console.log(zf({branch_dialog_action:`switch`,branch_action:`switch`,branch:w})),c(e=>jQ(e,Po(x.target))),n.project.runCheckout({projectPath:S,branch:w}).then(e=>{let t=null,n=!1;c(r=>{let{state:i,sideEffect:a}=MQ(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?Ss.error(a({id:`NJyQi_`,values:{shareBranch:w}})):t===`fetch-failed`?Ss.error(a({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&Ss.error(a({id:`c863eW`,values:{shareBranch:w}})),n&&i.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),c(RQ),Ss.error(a({id:`c863eW`,values:{shareBranch:w}}))}))},t[23]=a,t[24]=s.info,t[25]=s.phase,t[26]=n.project,t[27]=S,t[28]=x.target,t[29]=w,t[30]=i,t[31]=T):T=t[31];let E=T,D;t[32]!==a||t[33]!==n.project||t[34]!==S||t[35]!==x.target||t[36]!==w||t[37]!==i||t[38]!==m?(D=function(){console.log(zf({branch_dialog_action:`open-current`,branch:w})),n.project.open({path:S,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.target.kind,path:Po(x.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),Ss.error(a({id:`b5aNbi`,values:{targetNoun:m}}))}),i.dismiss()},t[32]=a,t[33]=n.project,t[34]=S,t[35]=x.target,t[36]=w,t[37]=i,t[38]=m,t[39]=D):D=t[39];let O=D,k;t[40]!==a||t[41]!==s.otherWorktreePath||t[42]!==s.phase||t[43]!==n.project||t[44]!==x.target||t[45]!==w||t[46]!==i?(k=function(){if(s.phase!==`branch-in-other-worktree`)return;let e=s.otherWorktreePath;console.log(zf({branch_dialog_action:`pivot-to-other-worktree`,branch:w})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.target.kind,path:Po(x.target)},pendingBranch:w}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),Ss.error(a({id:`LdABLa`,values:{target:e}}))}),i.dismiss()},t[40]=a,t[41]=s.otherWorktreePath,t[42]=s.phase,t[43]=n.project,t[44]=x.target,t[45]=w,t[46]=i,t[47]=k):k=t[47];let A=k,j;t[48]===i?j=t[49]:(j=function(){console.log(zf({branch_dialog_action:`cancel`})),i.dismiss()},t[48]=i,t[49]=j);let M=j,N,P,F,I,L,R,z,B,V,H,U,W,G,K,ee,te,q;if(t[50]!==a||t[51]!==s.info||t[52]!==s.otherWorktreePath||t[53]!==s.phase||t[54]!==M||t[55]!==C||t[56]!==x.branch||t[57]!==x.owner||t[58]!==x.repo||t[59]!==x.target||t[60]!==w||t[61]!==m){q=s.phase===`ready`||s.phase===`switching`?EQ(s.info):null;let e;t[79]!==s.info||t[80]!==s.phase||t[81]!==C?(e=s.phase===`ready`||s.phase===`switching`?DQ(s.info):C??`HEAD`,t[79]=s.info,t[80]=s.phase,t[81]=C,t[82]=e):e=t[82];let n=e;R=s.phase===`switching`||s.phase===`awaiting-cc1-recycle`;let r;t[83]===a?r=t[84]:(r=a({id:`OuY8t9`}),t[83]=a,t[84]=r),I=r;let i;t[85]!==a||t[86]!==w?(i=a({id:`_BthEY`,values:{shareBranch:w}}),t[85]=a,t[86]=w,t[87]=i):i=t[87],L=i;let o=s.phase===`loading`,c=s.phase===`error`;F=Ya,ee=!0,t[88]===M?te=t[89]:(te=e=>{e||M()},t[88]=M,t[89]=te),P=Ga,H=`sm:max-w-xl`,U=`share-branch-switch-dialog`,W=LQ,G=IQ;let l;t[90]===m?l=t[91]:(l=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(Y,{id:`RY6Bq1`,values:{targetNoun:m}})}),t[90]=m,t[91]=l);let u=x.owner,d=x.repo,f;t[92]===x.target?f=t[93]:(f=Po(x.target),t[92]=x.target,t[93]=f);let p;t[94]!==x.owner||t[95]!==x.repo||t[96]!==f?(p=(0,Z.jsx)(Ua,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`f8jU-L`,values:{0:u,1:d,2:f}})}),t[94]=x.owner,t[95]=x.repo,t[96]=f,t[97]=p):p=t[97],t[98]!==l||t[99]!==p?(K=(0,Z.jsxs)(Ja,{children:[l,p]}),t[98]=l,t[99]=p,t[100]=K):K=t[100],N=Ka;let h=x.owner,g=x.repo,_;t[101]===x.target?_=t[102]:(_=Po(x.target),t[101]=x.target,t[102]=_),t[103]!==x.branch||t[104]!==x.owner||t[105]!==x.repo||t[106]!==x.target.kind||t[107]!==_?(z=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(Ym,{owner:h,repo:g,path:_,kind:x.target.kind,branch:x.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=x.branch,t[104]=x.owner,t[105]=x.repo,t[106]=x.target.kind,t[107]=_,t[108]=z):z=t[108],B=s.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(Y,{id:`yjExfe`,values:{shareBranch:w},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:s.otherWorktreePath})]}):o?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Fo,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`w4hMYl`})}):q?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`XnoA1k`,values:{targetNoun:m,shareBranch:w},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):q?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`sZ2IOu`,values:{targetNoun:m,shareBranch:w,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`_902BE`,values:{targetNoun:m,shareBranch:w,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),V=q&&!q.switchEnabled&&q.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(Y,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:q.conflictingFiles.map(FQ)})]}):null,t[50]=a,t[51]=s.info,t[52]=s.otherWorktreePath,t[53]=s.phase,t[54]=M,t[55]=C,t[56]=x.branch,t[57]=x.owner,t[58]=x.repo,t[59]=x.target,t[60]=w,t[61]=m,t[62]=N,t[63]=P,t[64]=F,t[65]=I,t[66]=L,t[67]=R,t[68]=z,t[69]=B,t[70]=V,t[71]=H,t[72]=U,t[73]=W,t[74]=G,t[75]=K,t[76]=ee,t[77]=te,t[78]=q}else N=t[62],P=t[63],F=t[64],I=t[65],L=t[66],R=t[67],z=t[68],B=t[69],V=t[70],H=t[71],U=t[72],W=t[73],G=t[74],K=t[75],ee=t[76],te=t[77],q=t[78];let J;t[109]===R?J=t[110]:(J=R?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Fo,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`CU3AiE`})]}):null,t[109]=R,t[110]=J);let ne;t[111]!==N||t[112]!==z||t[113]!==B||t[114]!==V||t[115]!==J?(ne=(0,Z.jsxs)(N,{children:[z,B,V,J]}),t[111]=N,t[112]=z,t[113]=B,t[114]=V,t[115]=J,t[116]=ne):ne=t[116];let re;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[117]=re):re=t[117];let ie;t[118]===M?ie=t[119]:(ie=(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:M,"data-testid":`share-branch-switch-cancel`,children:re}),t[118]=M,t[119]=ie);let ae;t[120]!==s.phase||t[121]!==O||t[122]!==A||t[123]!==E||t[124]!==I||t[125]!==L||t[126]!==R||t[127]!==q?(ae=s.phase===`branch-in-other-worktree`?(0,Z.jsx)(X,{onClick:A,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(Y,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[q?.openCurrentEnabled?(0,Z.jsxs)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:O,disabled:R,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(Gd,{className:`size-3.5`,"aria-hidden":!0}),I]}):null,(0,Z.jsx)(X,{onClick:E,disabled:!q?.switchEnabled||R,"aria-disabled":!q?.switchEnabled||R,"aria-describedby":q&&!q.switchEnabled&&q.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:R?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fo,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),L]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(St,{className:`size-3.5`,"aria-hidden":!0}),L]})})]}),t[120]=s.phase,t[121]=O,t[122]=A,t[123]=E,t[124]=I,t[125]=L,t[126]=R,t[127]=q,t[128]=ae):ae=t[128];let oe;t[129]!==ie||t[130]!==ae?(oe=(0,Z.jsxs)(qa,{className:`sm:justify-between`,children:[ie,ae]}),t[129]=ie,t[130]=ae,t[131]=oe):oe=t[131];let se;t[132]!==P||t[133]!==H||t[134]!==U||t[135]!==W||t[136]!==G||t[137]!==K||t[138]!==ne||t[139]!==oe?(se=(0,Z.jsxs)(P,{className:H,"data-testid":U,onInteractOutside:W,onPointerDownOutside:G,children:[K,ne,oe]}),t[132]=P,t[133]=H,t[134]=U,t[135]=W,t[136]=G,t[137]=K,t[138]=ne,t[139]=oe,t[140]=se):se=t[140];let ce;return t[141]!==F||t[142]!==ee||t[143]!==te||t[144]!==se?(ce=(0,Z.jsx)(F,{open:ee,onOpenChange:te,children:se}),t[141]=F,t[142]=ee,t[143]=te,t[144]=se,t[145]=ce):ce=t[145],ce}function FQ(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function IQ(e){e.preventDefault()}function LQ(e){e.preventDefault()}function RQ(e){return MQ(e,null).state}function zQ(e){return AQ(e,null)}function BQ(){return null}function VQ(){let e=(0,$.c)(17),t=Mn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=pt(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new v,i=new be({url:n,name:ai,document:e,onStateless:e=>{let{payload:t}=e;_e(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:qQ,onConfigValidationRejected:KQ,onConfigIgnoreNestedError:GQ,onUnknown:WQ})},onClose:UQ,onDisconnect:HQ}),a=ks(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=ve(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Os([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function HQ(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function UQ(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function WQ(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function GQ(e){ga(e)}function KQ(e){ba(e)}function qQ(e){Os([e.ch])}function JQ(e){let t=b(e);if(t)return{scope:`project`,name:t};let n=ni(e);return n?.kind===`skill`?{scope:n.scope,name:n.name}:null}function YQ(e,t){let n=new Set(t.map(e=>`${e.scope}\u0000${e.name}`)),r=[];for(let t of e){let e=JQ(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`;n.has(`${i}\u0000${e.name}`)?r.push({kind:`retarget`,fromDocName:t,toDocName:Ar(i,e.name)}):r.push({kind:`close`,docName:t})}return r}function XQ(){let e=(0,$.c)(13),{openTabs:t,closeDocument:n}=pt(),r;e[0]===t?r=e[1]:(r=t.some(QQ),e[0]=t,e[1]=r);let i=r,a;e[2]===i?a=e[3]:(a={enabled:i},e[2]=i,e[3]=a);let o=yo(a),s=(0,Q.useRef)(null),c;e[4]!==n||e[5]!==t||e[6]!==o.data||e[7]!==o.status?(c=()=>{if(o.status!==`ready`)return;let e=o.data,r=`${t.join(``)}\u0002${e.map(ZQ).sort().join(``)}`;if(s.current===r)return;s.current=r;let i=YQ(t,e);for(let e of i)e.kind===`retarget`?(ns(e.toDocName),n(e.fromDocName)):n(e.docName)},e[4]=n,e[5]=t,e[6]=o.data,e[7]=o.status,e[8]=c):c=e[8];let l;e[9]!==n||e[10]!==t||e[11]!==o?(l=[o,t,n],e[9]=n,e[10]=t,e[11]=o,e[12]=l):l=e[12],(0,Q.useEffect)(c,l)}function ZQ(e){return`${e.scope}\u0000${e.name}`}function QQ(e){return JQ(e)!==null}var $Q=1e3,e$=3e4;function t$(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??$Q,r=e.maxBackoffMs??e$,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function n$(e){if(e)return e.replace(/\/collab\/?$/,``)}function r$(){return M(window)!==null}function i$(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??t$;if((i.current?.isElectronHost??r$)())return;let t=e({resolveWsUrl:async()=>n$(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var a$=`#install-claude-desktop`;function o$(e){return e===`#settings`||e===a$}function s$(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function c$(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=pt(),{openTargetTransition:i}=Dt();XQ();let{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=to(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=s$(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(o$(window.location.hash))return;let e=ml(window.location.hash);if(e){let t=qn(e.split(`.`).pop()??``);vl(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=Zc(window.location.hash);if(n){vl(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),i({kind:`skill-file`,target:`${n.scope}/${n.name}/${n.path}`,scope:n.scope,name:n.name,path:n.path});return}if(Xc(window.location.hash)){vl(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let r=_l(window.location.hash);if(!r){vl(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){vl(`ok/nav/hash-change`,{docName:r,kind:`deferred-loading`});return}let a=tl(r,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(a.kind===`missing`&&/\/+$/.test(r.trim())){vl(`ok/nav/hash-change`,{docName:r,kind:`deferred-missing-folder`});return}let f=ul(fl(a),c);vl(`ok/nav/hash-change`,{docName:r,kind:f.kind}),i(f)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function l$(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(u$,t),null}function u$(){let e=p$;if(!e(window.location.hash))return;let t=new AbortController;return he(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(f$))}).catch(d$),()=>t.abort()}function d$(){}function f$(){}function p$(e){return!o$(e)&&!ml(e)&&!_l(e)&&(e===``||e===`#`||e===`#/`)}function m$(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(h$,t),null}function h$(){let e=function(e){let t=e.target;qi({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Gi))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function g$(){let e=(0,$.c)(4),{activeTarget:t}=pt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function _$(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=pt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:pl(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Sv({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(wv,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function v$(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=pt();i$(r);let i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(N,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function y$(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(yl,{name:`app`,children:(0,Z.jsx)(Ft,{children:(0,Z.jsx)(v$,{children:(0,Z.jsx)(sy,{children:(0,Z.jsx)(b$,{})})})})}),e[0]=t):t=e[0],t}function b$(){let e=(0,$.c)(25),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=uy(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:x$}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Ny,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(VQ,{}),u=(0,Z.jsx)(c$,{}),d=(0,Z.jsx)(l$,{}),f=(0,Z.jsx)(g$,{}),p=(0,Z.jsx)(_$,{}),e[2]=l,e[3]=u,e[4]=d,e[5]=f,e[6]=p):(l=e[2],u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(m$,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(Py,{bridge:t}):null,h=(0,Z.jsx)(Vm,{}),g=t?(0,Z.jsx)(PQ,{bridge:t}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v):(h=e[9],g=e[10],_=e[11],v=e[12]);let y;e[13]===r?y=e[14]:(y=(0,Z.jsx)(Sy,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=y);let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=b):b=e[15];let x;e[16]===a?x=e[17]:(x=!a&&(0,Z.jsx)(vQ,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(RN,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(ML,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(xo,{value:s,children:(0,Z.jsxs)(MN,{className:`h-screen overflow-hidden`,children:[x,S]})}),e[19]=x,e[20]=C);let w;return e[21]!==y||e[22]!==C||e[23]!==m?(w=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(ro,{children:[l,u,d,f,p,m,_,v,h,g,y,b,C]})]}),e[21]=y,e[22]=C,e[23]=m,e[24]=w):w=e[24],w}function x$(e,t){sL(jo(e,t),t)}Uu(),n(()=>import(`./telemetry-startup-Pz1ro4a2.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([84,0,1,2,3,4,45,7]),import.meta.url),Th({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Rh(),bg()&&Eg(),O_(),sg(),Xg(),Fg(),typeof window<`u`&&Bh({bridge:window.okDesktop}),typeof window<`u`&&Zh({bridge:window.okDesktop}),typeof window<`u`&&qc({bridge:window.okDesktop}),typeof window<`u`&&Hc({bridge:window.okDesktop}),typeof window<`u`&&Uh({bridge:window.okDesktop}),typeof window<`u`&&ih({bridge:window.okDesktop}),zg();var S$=new Qu({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),C$=document.getElementById(`root`);if(!C$)throw Error(`Root element not found`);var w$=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,ud.createRoot)(C$).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(on,{i18n:Ms,children:(0,Z.jsx)(wn,{client:S$,children:(0,Z.jsxs)(Zn,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Us,{children:w$&&window.okDesktop?(0,Z.jsx)(vh,{bridge:window.okDesktop}):(0,Z.jsx)(y$,{})}),(0,Z.jsx)(Ch,{richColors:!0,closeButton:!0})]})})})}));
|