@inkeep/open-knowledge 0.18.1-beta.2 → 0.18.1-beta.3
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-Cwvr3I1e.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-CghDGA5I.mjs +1 -0
- package/dist/{init-B0pgp-zZ.mjs → init-qaqPnPcn.mjs} +3 -3
- package/dist/loader-CPapmvbE.mjs +1 -0
- package/dist/{loader-a95Vr1Hw.mjs → loader-PQTCb-uB.mjs} +2 -2
- package/dist/preview-BSnwKQY7.mjs +1 -0
- package/dist/{preview-tmZMxYLF.mjs → preview-Bsl5Bplc.mjs} +2 -2
- package/dist/public/assets/{index-D5C9dD8O.js → index-CGUYP6jp.js} +86 -86
- package/dist/public/index.html +1 -1
- package/dist/{repair-launch-json-DZtVDfVY.mjs → repair-launch-json-C1PlLzUa.mjs} +2 -2
- package/dist/{repair-mcp-configs-D3vL4U4q.mjs → repair-mcp-configs-nx_E4G38.mjs} +2 -2
- package/dist/{src-D4rHgIHV.mjs → src-TE18wIfh.mjs} +2 -2
- package/dist/{start-CPCHuP1E.mjs → start-CNE7kpA5.mjs} +2 -2
- package/dist/start-DlHLdhLA.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-Bhg6F9bJ.mjs +0 -2
- package/dist/init-DzgJuxnu.mjs +0 -1
- package/dist/loader-bNsnApSK.mjs +0 -1
- package/dist/preview-JQfEsO-t.mjs +0 -1
- package/dist/start-BCJus5ao.mjs +0 -1
|
@@ -28,7 +28,7 @@ Error generating stack: `+e.message+`
|
|
|
28
28
|
`).trim();return i.length===0||i.length>MT||i.includes(`
|
|
29
29
|
`)?null:i}function LT(e){let t=$e(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function RT(e,t){return e.current===t.current&&e.total===t.total}function zT(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(jT)}function BT(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=m(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 VT(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=PT(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)(jT),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(UT))},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(HT)},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(jT);return}if(!u.open||r){i.commands.clearFindMatches(),p(jT);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=LT(i);p(t=>RT(t,e)?t:e)},NT);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=$e(i.state),t=LT(i);p(e=>RT(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=IT(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(Cc(t,`find`)){t.preventDefault(),u.open?zT(i,d,p):e(!1);return}if(Cc(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=Cc(t,`find-next`),n=Cc(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&BT(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),zT(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=$e(i.state),t=LT(i);p(e=>RT(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(){zT(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()&&BT(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()&&BT(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)&&BT(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)&&BT(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,q,J;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),q=e=>d(t=>({...t,caseSensitive:e})),J=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=J):(W=t[63],G=t[64],K=t[65],q=t[66],J=t[67]);let ee;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(ee=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(AT,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:q,onWholeWordChange:J,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=ee):ee=t[80],ee}function HT(e){return{...e,open:!1,activeIndex:0}}function UT(e){return{...e,activeIndex:0}}var WT=300;function GT(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Jc),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Jc);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(ll(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,WT)};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 KT(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function qT(e){let t=(0,$.c)(8),{poolEntries:n}=yt(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>KT(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(KT(i));let t=()=>s(KT(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 JT(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Zc(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Qc,r)}var YT=`ok-doc-panel-width-v1`;function XT(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function ZT(e){try{let t=(e??localStorage).getItem(YT);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?XT(n):320}catch{return 320}}function QT(e,t){try{(t??localStorage).setItem(YT,String(XT(e)))}catch{}}function $T(){try{return typeof localStorage>`u`?320:ZT()}catch{return 320}}var eE=1024,tE=1280,nE={left:eE,right:tE};function rE(e,t,n){return e==null?t>=nE[n]?`above`:`below`:`embedded`}function iE(e){return e===`above`?`open`:`collapsed`}var aE=`ok-sidebar-pins-v2`;function oE(e){return e===`open`||e===`collapsed`}function sE(e){return e===`above`||e===`below`||e===`embedded`}function cE(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!sE(e)||!oE(t[e]))return!1;return!0}function lE(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return cE(n.left)&&(r.left=n.left),cE(n.right)&&(r.right=n.right),r}function uE(e){try{let t=(e??localStorage).getItem(aE);return t==null?{}:lE(t)}catch{return{}}}function dE(e,t){try{t.setItem(aE,JSON.stringify(e))}catch{}}function fE(e,t,n){return n[e]?.[t]??iE(t)}function pE(e,t,n,r){let i=r??localStorage,a=uE(i);return a[e]={...a[e],[t]:n},dE(a,i),a}function mE(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`?hE: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 hE(e){return e===`synced`?`synced`:`connected`}function gE(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function _E(e){let t=(0,$.c)(23),{path:n,onRemove:r}=e,{_:a}=i(),o,s;t[0]!==a||t[1]!==n?(o=gE(n),s=a({id:`hnq8fP`,values:{label:o}}),t[0]=a,t[1]=n,t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c=s,l;t[4]===n?l=t[5]:(l=W(q(n)),t[4]=n,t[5]=l);let u=l,d=`composer-context-chip-file-${n}`,f;t[6]===r?f=t[7]:(f=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r())},t[6]=r,t[7]=f);let p;t[8]===u?p=t[9]:(p=(0,Z.jsx)(u,{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}),t[8]=u,t[9]=p);let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Rs,{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[10]=m):m=t[10];let h;t[11]!==r||t[12]!==c||t[13]!==f||t[14]!==p?(h=(0,Z.jsxs)(Ai,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":c,onClick:r,onKeyDown:f,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[p,m]}),t[11]=r,t[12]=c,t[13]=f,t[14]=p,t[15]=h):h=t[15];let g;t[16]===o?g=t[17]:(g=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:o}),t[16]=o,t[17]=g);let _;return t[18]!==n||t[19]!==d||t[20]!==h||t[21]!==g?(_=(0,Z.jsxs)(`span`,{"data-testid":d,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:[h,g]}),t[18]=n,t[19]=d,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}function vE(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=Oi(`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)(_E,{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 yE(e){let t=(0,$.c)(35),{primary:n,onPrimary:r,primaryDisabled:a,installedTargets:o,selectedTargetId:c,onSelectTarget:l,terminal:u,terminals:d,menuEmptyState:f,onMenuOpenChange:p,menuAlign:m,triggerAriaLabel:h,testIds:g}=e,_=a===void 0?!1:a,v=m===void 0?`end`:m,{_:y}=i(),b=o.length>0,x=d&&d.length>0?d:null,S=x!=null||u!=null,C=b||S,w;t[0]===g?w=t[1]:(w=e=>typeof g.terminal==`function`?g.terminal(e):g.terminal,t[0]=g,t[1]=w);let T=w,E;t[2]!==r||t[3]!==n||t[4]!==_||t[5]!==g.primary?(E=(0,Z.jsx)(Ai,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:_,onClick:r,"data-testid":g.primary,children:n}),t[2]=r,t[3]=n,t[4]=_,t[5]=g.primary,t[6]=E):E=t[6];let D;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)($t,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=D):D=t[7];let O;t[8]!==g.trigger||t[9]!==h?(O=(0,Z.jsx)(eo,{asChild:!0,children:(0,Z.jsx)(Ai,{type:`button`,variant:`outline`,size:`icon`,"aria-label":h,"data-testid":g.trigger,children:D})}),t[8]=g.trigger,t[9]=h,t[10]=O):O=t[10];let k;t[11]!==y||t[12]!==x||t[13]!==C||t[14]!==o||t[15]!==f||t[16]!==l||t[17]!==c||t[18]!==b||t[19]!==S||t[20]!==u||t[21]!==T||t[22]!==g?(k=C?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsxs)(qa,{"aria-label":y({id:`BBqGS9`}),children:[(0,Z.jsx)(To,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),o.map(e=>(0,Z.jsxs)(go,{onSelect:()=>l(e),"data-testid":g.option(e.id),children:[(0,Z.jsx)(FS,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),c===e.id?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,S?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsx)(Xa,{}):null,(0,Z.jsxs)(qa,{"aria-label":y({id:`ALhMYW`}),children:[(0,Z.jsx)(To,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),x?x.map(e=>(0,Z.jsxs)(go,{onSelect:e.onSelect,"data-testid":T(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(Nu,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):u?(0,Z.jsxs)(go,{onSelect:u.onSelect,"data-testid":T(`claude`),"aria-label":y({id:`AcK_r0`}),children:[(0,Z.jsx)(Nu,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),u.selected?(0,Z.jsx)(Zo,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]})]}):null]}):f,t[11]=y,t[12]=x,t[13]=C,t[14]=o,t[15]=f,t[16]=l,t[17]=c,t[18]=b,t[19]=S,t[20]=u,t[21]=T,t[22]=g,t[23]=k):k=t[23];let A;t[24]!==v||t[25]!==k||t[26]!==g.menu?(A=(0,Z.jsx)(ro,{align:v,className:`min-w-[200px]`,"data-testid":g.menu,children:k}),t[24]=v,t[25]=k,t[26]=g.menu,t[27]=A):A=t[27];let j;t[28]!==p||t[29]!==O||t[30]!==A?(j=(0,Z.jsxs)(po,{onOpenChange:p,children:[O,A]}),t[28]=p,t[29]=O,t[30]=A,t[31]=j):j=t[31];let M;return t[32]!==E||t[33]!==j?(M=(0,Z.jsxs)(HS,{children:[E,j]}),t[32]=E,t[33]=j,t[34]=M):M=t[34],M}function bE(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>al(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Xc,r)}function xE(e){let t=document.activeElement;if(t&&e.contains(t)&&typeof t.value==`string`){let{selectionStart:e,selectionEnd:n,value:r}=t;if(e!=null&&n!=null&&n>e&&typeof r==`string`)return r.slice(e,n)}let n=typeof window<`u`?window.getSelection():null;if(!n||n.isCollapsed||n.rangeCount===0)return``;let r=n.getRangeAt(0),i=r.commonAncestorContainer.nodeType===Node.ELEMENT_NODE?r.commonAncestorContainer:r.commonAncestorContainer.parentElement;return!i||!e.contains(i)?``:n.toString()}function SE(e,t){let n=(0,$.c)(4),r,i;n[0]!==e||n[1]!==t?(r=()=>{if(typeof document>`u`||t===``)return;let n=()=>{let n=e.current;if(!n)return;let r=xE(n);Yc(t,`frontmatter`,r===``?null:ol(r,t))};return document.addEventListener(`selectionchange`,n),()=>{document.removeEventListener(`selectionchange`,n),Yc(t,`frontmatter`,null)}},i=[e,t],n[0]=e,n[1]=t,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,Q.useEffect)(r,i)}var CE=5200,wE=500;function TE(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function EE(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(DE),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 DE(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function OE(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),CE);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(kE),o(!0)},wE);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 kE(e){return e+1}function AE(e){let t=(0,$.c)(119),{docName:n,surface:r,dismissed:a,onDismiss:o,onReopen:c}=e,l=a===void 0?!1:a,{_:u}=i(),d=EE(),f=ja(),{states:p}=ov(),{dispatch:m}=Y_(),h=RS(),[g]=(0,Q.useState)(BE),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!0),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),w=(0,Q.useRef)(null),[T]=(0,Q.useState)(zE),E,D;t[0]!==l||t[1]!==n||t[2]!==r?(E=()=>{let e=document.documentElement,t=LE,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=U(n),t=w.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=w.current;if(l||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+24}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},D=[l,r,n],t[0]=l,t[1]=n,t[2]=r,t[3]=E,t[4]=D):(E=t[3],D=t[4]),(0,Q.useEffect)(E,D);let O=(0,Q.useRef)(l),k=(0,Q.useRef)(c),A;t[5]!==l||t[6]!==c?(A=()=>{O.current=l,k.current=c},t[5]=l,t[6]=c,t[7]=A):A=t[7],(0,Q.useEffect)(A);let j,M;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>nl(()=>{O.current?k.current?.():C.current?.focus()}),M=[],t[8]=j,t[9]=M):(j=t[8],M=t[9]),(0,Q.useEffect)(j,M);let N;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],t[10]=N):N=t[10],(0,Q.useEffect)(FE,N);let P=(0,Q.useRef)(!1),F,I;t[11]===l?(F=t[12],I=t[13]):(F=()=>{if(!P.current){P.current=!0;return}l||C.current?.focus()},I=[l],t[11]=l,t[12]=F,t[13]=I),(0,Q.useEffect)(F,I);let L;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(L=[],t[14]=L):L=t[14];let[R,z]=(0,Q.useState)(L),[B,V]=(0,Q.useState)(PE),H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=[],t[15]=H):H=t[15];let[W,G]=(0,Q.useState)(H),K;t[16]===n?K=t[17]:(K=j_(n),t[16]=n,t[17]=K);let q=K,J,ee;t[18]!==q||t[19]!==B||t[20]!==y?(J=()=>{y||z(e=>e.includes(q)||B.has(q)?e:[...e,q])},ee=[y,q,B],t[18]=q,t[19]=B,t[20]=y,t[21]=J,t[22]=ee):(J=t[21],ee=t[22]),(0,Q.useEffect)(J,ee);let Y;if(t[23]!==B||t[24]!==W||t[25]!==R){let e;t[27]!==B||t[28]!==W?(e=e=>!B.has(e)&&!W.includes(e),t[27]=B,t[28]=W,t[29]=e):e=t[29],Y=R.filter(e),t[23]=B,t[24]=W,t[25]=R,t[26]=Y}else Y=t[26];let te=Y,X=bE(n,r),ne=bE(n,`frontmatter`),[re,ie]=(0,Q.useState)(null),[ae,oe]=(0,Q.useState)(!1),se,ce;t[30]===X?(se=t[31],ce=t[32]):(se=()=>{X&&ie(X)},ce=[X],t[30]=X,t[31]=se,t[32]=ce),(0,Q.useEffect)(se,ce);let le,ue;t[33]===ne?(le=t[34],ue=t[35]):(le=()=>{ne&&ie(ne)},ue=[ne],t[33]=ne,t[34]=le,t[35]=ue),(0,Q.useEffect)(le,ue);let de=_??g,fe;t[36]!==de||t[37]!==h?(fe=h===null?null:vC(de),t[36]=de,t[37]=h,t[38]=fe):fe=t[38];let pe=fe,me=pe!==null,he;t[39]!==de||t[40]!==me||t[41]!==p?(he=me?null:SC(p,de),t[39]=de,t[40]=me,t[41]=p,t[42]=he):he=t[42];let ge=he,_e=!x&&(!y||re!==null)&&(me||ge!==null),ve;t[43]===p?ve=t[44]:(ve=Yg.filter(e=>p[e.id]?.installed===!0),t[43]=p,t[44]=ve);let ye=ve,be;t[45]===p?be=t[46]:(be=Yg.some(e=>p[e.id]?.installed==null),t[45]=p,t[46]=be);let xe=be,Se={claude:u({id:`YoLi1r`}),codex:u({id:`cio8--`}),cursor:u({id:`0HYJGg`})},Ce={claude:u({id:`AcK_r0`}),codex:u({id:`OUcBW4`}),cursor:u({id:`oh55a-`})},we=h===null?void 0:Mr.map(e=>({cli:e,label:Se[e],ariaLabel:Ce[e],selected:pe===e,onSelect:()=>Pe(e)})),Ee;t[47]===u?Ee=t[48]:(Ee=u({id:`KYSocE`}),t[47]=u,t[48]=Ee);let De;t[49]===u?De=t[50]:(De=u({id:`7Ongq0`}),t[49]=u,t[50]=De);let Oe;t[51]===u?Oe=t[52]:(Oe=u({id:`HPTPGr`}),t[51]=u,t[52]=Oe);let ke;t[53]===u?ke=t[54]:(ke=u({id:`qiRoLb`}),t[53]=u,t[54]=ke);let Ae;t[55]!==Ee||t[56]!==De||t[57]!==Oe||t[58]!==ke?(Ae=[Ee,De,Oe,ke],t[55]=Ee,t[56]=De,t[57]=Oe,t[58]=ke,t[59]=Ae):Ae=t[59];let je=OE(Ae,!d&&y&&!l),Me;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Me=e=>{v(e.id),xC(e.id)},t[60]=Me):Me=t[60];let Ne=Me,Pe=e=>{let t=_C(e);v(t),xC(t)},Fe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=()=>{C.current?.clear(),ie(null),oe(!1),z([]),V(new Set),NS()},t[61]=Fe):Fe=t[61];let Ie=Fe,Le;t[62]!==u||t[63]!==q||t[64]!==_e||t[65]!==m||t[66]!==n||t[67]!==te||t[68]!==re||t[69]!==ge||t[70]!==pe||t[71]!==h||t[72]!==f?(Le=()=>{if(!_e)return;let{instruction:e,mentions:t}=C.current?.getContent()??{instruction:``,mentions:[]},r=re?cl(re):void 0,i=re?.docName??null,a=re?i:te.includes(q)?n:null,o=a===null?null:j_(a),s=L_({docName:a,workspace:f,instruction:e,mentions:[...new Set([...te,...t])].filter(e=>e!==o),selection:r});if(s===null){Ls.error(u({id:`y8B54M`}));return}if(pe!==null&&h!==null){try{h.launchInTerminal(s,pe)}catch{Ls.error(u({id:`jBVUXo`}));return}Ie();return}ge!==null&&(S(!0),m(ge.id,s).finally(()=>{S(!1),Ie()}))},t[62]=u,t[63]=q,t[64]=_e,t[65]=m,t[66]=n,t[67]=te,t[68]=re,t[69]=ge,t[70]=pe,t[71]=h,t[72]=f,t[73]=Le):Le=t[73];let Re=Le;if(l)return null;let ze=``,Be=``;if(re){let e;t[74]===re?e=t[75]:(e=rl(re,j_(re.docName).split(`/`).pop()??``),t[74]=re,t[75]=e),ze=e;let n;t[76]===re.markdown?n=t[77]:(n=el(re.markdown),t[76]=re.markdown,t[77]=n),Be=n}let Ve;t[78]===u?Ve=t[79]:(Ve=u({id:`EWX92Z`}),t[78]=u,t[79]=Ve);let He;t[80]===o?He=t[81]:(He=()=>o?.(),t[80]=o,t[81]=He);let Ue;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsx)($t,{className:`size-3.5`,"aria-hidden":!0}),t[82]=Ue):Ue=t[82];let We;t[83]!==Ve||t[84]!==He?(We=(0,Z.jsx)(Ai,{type:`button`,variant:`outline`,"aria-label":Ve,onClick:He,"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:Ue}),t[83]=Ve,t[84]=He,t[85]=We):We=t[85];let Ge;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=e=>V(t=>{let n=new Set(t);return n.add(e),n}),t[86]=Ge):Ge=t[86];let Ke;t[87]!==u||t[88]!==ze||t[89]!==Be||t[90]!==re||t[91]!==ae?(Ke=re?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,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)(Ai,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":u({id:`irrm_E`}),onClick:()=>{ie(null),oe(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Hu,{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)(Rs,{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)(Ai,{type:`button`,variant:`ghost`,"aria-expanded":ae,"aria-label":u(ae?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>oe(NE),"data-testid":`composer-selection-peek`,className:`h-auto min-h-0 min-w-0 justify-start truncate px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground`,children:ze})]}),ae&&Be!==``?(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:Be}):null]}):null,t[87]=u,t[88]=ze,t[89]=Be,t[90]=re,t[91]=ae,t[92]=Ke):Ke=t[92];let qe;t[93]!==te||t[94]!==Ke?(qe=(0,Z.jsx)(vE,{files:te,onRemoveFile:Ge,children:Ke}),t[93]=te,t[94]=Ke,t[95]=qe):qe=t[95];let Je;t[96]===u?Je=t[97]:(Je=u({id:`xWEvuo`}),t[96]=u,t[97]=Je);let Ye;t[98]!==T||t[99]!==Re||t[100]!==Je?(Ye=(0,Z.jsx)(dC,{ref:C,ariaLabel:Je,onEmptyChange:b,onContentChange:MS,onMentionsChange:G,onSubmit:Re,initialDoc:T,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),t[98]=T,t[99]=Re,t[100]=Je,t[101]=Ye):Ye=t[101];let Xe;t[102]!==y||t[103]!==d||t[104]!==je?(Xe=y?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:Oi(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!d&&`transition-opacity duration-500 ease-in-out`,je.visible?`opacity-100`:`opacity-0`),children:je.text}):null,t[102]=y,t[103]=d,t[104]=je,t[105]=Xe):Xe=t[105];let Ze;t[106]!==Ye||t[107]!==Xe?(Ze=(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[Ye,Xe]}),t[106]=Ye,t[107]=Xe,t[108]=Ze):Ze=t[108];let Qe;t[109]!==ge||t[110]!==pe?(Qe=pe===null?ge?(0,Z.jsx)(FS,{id:ge.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(Nu,{className:`size-4`,"aria-hidden":!0}),t[109]=ge,t[110]=pe,t[111]=Qe):Qe=t[111];let $e;t[112]===x?$e=t[113]:($e=x?(0,Z.jsx)(Te,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[112]=x,t[113]=$e);let et;t[114]===xe?et=t[115]:(et=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:xe?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}),t[114]=xe,t[115]=et);let tt;t[116]===u?tt=t[117]:(tt=u({id:`nskygk`}),t[116]=u,t[117]=tt);let nt;return t[118]===Symbol.for(`react.memo_cache_sentinel`)?(nt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:ME,terminal:jE},t[118]=nt):nt=t[118],(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:(0,Z.jsxs)(`div`,{ref:w,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:[We,qe,(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[Ze,(0,Z.jsx)(yE,{primary:(0,Z.jsxs)(Z.Fragment,{children:[Qe,(0,Z.jsx)(`span`,{children:pe===null?ge?(0,Z.jsx)(s,{id:`nUNZL4`,values:{0:ge.displayName}}):(0,Z.jsx)(s,{id:`F-vBv0`}):(0,Z.jsx)(s,{id:`nUNZL4`,values:{0:Ce[pe]}})}),$e]}),onPrimary:Re,primaryDisabled:!_e,installedTargets:ye,selectedTargetId:me?null:ge?.id??null,onSelectTarget:Ne,terminals:we,menuEmptyState:et,triggerAriaLabel:tt,testIds:nt})]})]})})}function jE(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function ME(e){return`ask-ai-agent-option-${e}`}function NE(e){return!e}function PE(){return new Set}function FE(){let e=IE;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function IE(e){Cc(e,`open-ask-ai`)&&(TE(e.target)||(e.preventDefault(),sl()))}function LE(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(RE);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 RE(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function zE(){return jS().doc??void 0}function BE(){return bC()}function VE(e){return!e.terminalVisible&&!e.isEmbedded&&e.isDesktop&&e.activeDocName!==null}function HE(e,t={}){let n=St(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var UE=200,WE=`Outside any block`;function GE(e){let t=(0,$.c)(5),{editor:n}=e,r=nn(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?KE(n,r):o.current?WE:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},UE),()=>{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 KE(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=HE(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=HE(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 qE(){let[e]=(0,Q.useState)(Si);return e}function JE({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Br(e.display_name),color:Cr(e.id,Un),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Cr(e.id,Un),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function YE(e,t){return e>t}function XE(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 ZE=3,QE=6e4;function $E(e,t){let n=0;for(let r of e)t-r<QE&&(n+=1);return n<ZE}var eD=new Map;function tD(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 nD(e){let t=Gt.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function rD(e){let{fragment:t,docName:n,onWedged:r}=e,i=0,a=0,o=!1,s=!1,c=!1,l=null,u=new WeakSet,d=e=>{let t=Gt.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){lt.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=>{YE(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!YE(i,a)||l!==null&&nD(l.state))return;o=!0;let e=Date.now();for(let[t,n]of eD)n.every(t=>e-t>=QE)&&eD.delete(t);let t=(eD.get(n)??[]).filter(t=>e-t<QE);if(!$E(t,e)){eD.set(n,t),lt.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),eD.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,lt.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==Gt&&tD(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new li({state:{init:()=>null,apply:e=>(XE(e.getMeta(Gt))&&(a=i,o&<.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!YE(i,a)||nD(t)?!0:e.getMeta(Gt)!==void 0,view:e=>{let r=t.doc;return r==null?(lt.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 iD(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 aD=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&&vr(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(ec(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(oc(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(qs(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(ac(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(sc(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ys(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Qs(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Zs(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=ir(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Lr){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 _i){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():iD(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&nc(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()}},oD=e=>new li({key:typeof e.pluginKey==`string`?new $r(e.pluginKey):e.pluginKey,view:t=>new aD({view:t,...e})});Vn.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[oD({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 sD=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 Ti(e,{textSerializers:Wn(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(ec(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(oc(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(qs(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(ac(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(sc(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ys(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Qs(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Zs(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=ir(this.view,e.from,e.to);nc({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()}},cD=e=>new li({key:typeof e.pluginKey==`string`?new $r(e.pluginKey):e.pluginKey,view:t=>new sD({view:t,...e})});Vn.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?[cD({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 lD(e,t){return e??new $r(t)}var uD=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,dD=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),fD=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(`.`)),pD=new Set([`children`,`className`,`style`]),mD=new Set([`tabIndex`]),hD=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),gD={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function _D(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function vD(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function yD(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||hD.has(e)}function bD(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function xD(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:gD[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function SD(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 CD(e){return mD.has(e)}function wD(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function TD(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 ED(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||fD.has(e)?String(t):`${t}px`}function DD(e,t){dD.has(t)||e.style.removeProperty(bD(t))}function OD(e,t,n){dD.has(t)||e.style.setProperty(bD(t),ED(t,n))}function kD(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(pD.has(r)||!yD(r)||_D(r,t[r])||_D(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=vD(r);if(a==null||a===!1){CD(r)&&TD(e,r),e.removeAttribute(o);return}if(a===!0){CD(r)&&wD(e,r,!0),e.setAttribute(o,``);return}if(CD(r)){wD(e,r,a);return}e.setAttribute(o,String(a))})}function AD(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function jD(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){DD(e,t);return}OD(e,t,a)}})}function MD(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(!_D(t,n))return;let{eventName:i,options:a}=xD(t),o=t=>{n(SD(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function ND(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);uD(()=>{let i=n.current;return AD(e,i.className,t.className),jD(e,i.style,t.style),kD(e,i,t),r.current=MD(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 PD=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)(lD(e,`bubbleMenu`)).current;ND(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=b(),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=oD({...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,Pl.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)(lD(e,`floatingMenu`)).current;ND(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=b(),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=cD({...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,Pl.createPortal)(s,u.current)});var FD=[{name:`paragraph`,label:`Text`,icon:bu,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Tt,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Le,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:je,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:l,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:oe,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:z,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:ju,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function ID(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:LD},t[0]=n,t[1]=r);let{current:i,activeStates:a}=dt(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)($t,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(eo,{asChild:!0,children:(0,Z.jsxs)(Ai,{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=FD.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(go,{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)(ro,{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)(po,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function LD(e){let t=Object.fromEntries(FD.map(t=>[t.name,t.isActive(e.editor)]));return{current:FD.find(e=>t[e.name])??FD[0],activeStates:t}}function RD(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function zD(e){let t=(0,$.c)(2),{shortcutEnabled:n}=e,r=n===void 0?!1:n,i=_r(),a=Kg();if(!i||a)return null;let o;return t[0]===r?o=t[1]:(o=(0,Z.jsx)(BD,{shortcutEnabled:r}),t[0]=r,t[1]=o),o}function BD(e){let t=(0,$.c)(5),{shortcutEnabled:n}=e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{let e=e=>{n&&Cc(e,`edit-with-ai`)&&(RD(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),sl()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(so,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[3]=a):a=t[3];let o;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(Z.Fragment,{children:[a,(0,Z.jsxs)(Ai,{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:VD,children:[(0,Z.jsx)(Vi,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`xWEvuo`})})]})]}),t[4]=o):o=t[4],o}function VD(){return sl()}function HD(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 UD(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:Et(typeof n.src==`string`?n.src:``)}function WD(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 GD(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:KD},t[0]=n,t[1]=a),dt(a)===null)return null;let o;t[2]===r?o=t[3]:(o=r({id:`WcWS__`}),t[2]=r,t[3]=o);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault();let t=HD(n);t&&WD(t,UD(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Ya,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon-xs`,"aria-label":o,className:`text-accent-foreground`,onMouseDown:c,children:l})}),t[7]=o,t[8]=c,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`WcWS__`})}),t[10]=d):d=t[10];let f;return t[11]===u?f=t[12]:(f=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(ic,{children:[u,d]})}),t[11]=u,t[12]=f),f}function KD(e){return HD(e.editor)}function qD(e){return HD(e)!==null}function JD(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function YD(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 XD(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function ZD(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=i(),a;t[0]===n?a=t[1]:(a={editor:n,selector:QD},t[0]=n,t[1]=a);let o=dt(a),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!JD(n)||n.state.selection.empty||XD(n)||YD(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=br(rr(n.state.doc)),a=Yr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(a,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=r({id:`sIGbBZ`}),t[5]=r,t[6]=l);let u;t[7]===c?u=t[8]:(u=e=>{e.preventDefault(),c()},t[7]=c,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ce,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d):d=t[9];let f;t[10]!==o||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":l,onMouseDown:u,disabled:o,children:d})}),t[10]=o,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===r?p=t[15]:(p=r({id:`sIGbBZ`}),t[14]=r,t[15]=p);let m;t[16]===p?m=t[17]:(m=(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:p}),t[16]=p,t[17]=m);let h;return t[18]!==f||t[19]!==m?(h=(0,Z.jsxs)(ic,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function QD(e){let t=e.editor;return!!(!JD(t)||t.state.selection.empty||XD(t)||YD(t))}var $D=`img, .ok-embed, .ok-video`,eO=220,tO=`cubic-bezier(0.23, 1, 0.32, 1)`,nO=`ok-image-align-flip`,rO=.5;function iO(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function aO(){return typeof requestAnimationFrame==`function`}function oO(e){return e?e.querySelector($D):null}function sO(e,t){if(iO()||!aO()){t();return}let n=oO(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=oO(e);if(!t)return;for(let e of t.getAnimations())e.id===nO&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<rO)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:eO,easing:tO,fill:`none`});i.id=nO})}var cO=[{value:`left`,label:`Align left`,icon:Vu},{value:`center`,label:`Align center`,icon:zu},{value:`right`,label:`Align right`,icon:Bu}];function lO(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Jt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function uO(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:dO},t[0]=n,t[1]=r);let i=dt(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=cO.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(ic,{children:[(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{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(!Jt.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(Lr.create(u.doc,s)),sO(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(tc,{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 dO(e){return lO(e.editor)}function fO(e){return lO(e)!==null}var pO=[{name:`bold`,icon:Ml,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:au,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Wu,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:Iu,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:rn,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:ru,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function mO(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:hO},t[0]=n,t[1]=r);let i=dt(r),a;t[2]!==i||t[3]!==n?(a=pO.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(ic,{children:[(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{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)(tc,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Se,{"aria-label":wc(e.shortcutId),children:Sc(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 hO(e){return Object.fromEntries(pO.map(t=>[t.name,t.isActive(e.editor)]))}function gO(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:f,pages:p}=Ts(),m;t[0]===n?m=t[1]:(m=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=m);let h=m,g;t[2]===n?g=t[3]:(g=n.getAttributes(`link`).href??``,t[2]=n,t[3]=g);let _=g,v;t[4]===n?v=t[5]:(v=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=v);let y=v,b,x;t[6]===n?(b=t[7],x=t[8]):(b=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},x=[n],t[6]=n,t[7]=b,t[8]=x),(0,Q.useEffect)(b,x);let S,C;t[9]===a?(S=t[10],C=t[11]):(S=()=>{a&&requestAnimationFrame(()=>u.current?.focus())},C=[a],t[9]=a,t[10]=S,t[11]=C),(0,Q.useEffect)(S,C);let w;t[12]!==n||t[13]!==h||t[14]!==c?(w=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():h&&n.chain().focus().unsetLink().run(),o(!1)},t[12]=n,t[13]=h,t[14]=c,t[15]=w):w=t[15];let T=w,E;t[16]===n?E=t[17]:(E=function(){n.chain().focus().unsetLink().run(),o(!1)},t[16]=n,t[17]=E);let O=E,k;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(e){l(ne(e.path,null))},t[18]=k):k=t[18];let A=k,j;t[19]!==T||t[20]!==n?(j=function(e){e.key===`Enter`&&(e.preventDefault(),T()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[19]=T,t[20]=n,t[21]=j):j=t[21];let M=j;if(a){let e;t[22]===r?e=t[23]:(e=r({id:`ZsGpr_`}),t[22]=r,t[23]=e);let n;t[24]===r?n=t[25]:(n=r({id:`roAe2K`}),t[24]=r,t[25]=n);let i;t[26]!==d||t[27]!==M||t[28]!==f||t[29]!==p||t[30]!==e||t[31]!==n||t[32]!==c?(i=(0,Z.jsx)(Zt,{ref:u,type:`text`,placeholder:e,value:c,pages:p,folderPaths:d,loading:f,onValueChange:l,onSuggestionSelect:A,onKeyDown:M,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[26]=d,t[27]=M,t[28]=f,t[29]=p,t[30]=e,t[31]=n,t[32]=c,t[33]=i):i=t[33];let a;t[34]===r?a=t[35]:(a=r({id:`tP5DDk`}),t[34]=r,t[35]=a);let o;t[36]===T?o=t[37]:(o=()=>{T()},t[36]=T,t[37]=o);let m;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Wl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=m):m=t[38];let g;t[39]!==a||t[40]!==o?(g=(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:m}),t[39]=a,t[40]=o,t[41]=g):g=t[41];let v;t[42]!==i||t[43]!==g?(v=(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]=v):v=t[44];let y;t[45]!==r||t[46]!==_||t[47]!==h||t[48]!==O?(y=h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ic,{children:[(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),D(_)},children:(0,Z.jsx)(Bo,{className:`size-3.5`})})}),(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(ic,{children:[(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),O()},children:(0,Z.jsx)(_e,{className:`size-3.5`})})}),(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[45]=r,t[46]=_,t[47]=h,t[48]=O,t[49]=y):y=t[49];let b;return t[50]!==v||t[51]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[v,y]}),t[50]=v,t[51]=y,t[52]=b):b=t[52],b}let N;t[53]===r?N=t[54]:(N=r({id:`p0Iq25`}),t[53]=r,t[54]=N);let P=h?`bg-accent text-primary`:`text-accent-foreground`,F;t[55]===y?F=t[56]:(F=e=>{e.preventDefault(),l(y()),o(!0)},t[55]=y,t[56]=F);let I;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(su,{className:`size-3.5`}),t[57]=I):I=t[57];let L;t[58]!==N||t[59]!==P||t[60]!==F?(L=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon-xs`,"aria-label":N,className:P,onMouseDown:F,children:I})}),t[58]=N,t[59]=P,t[60]=F,t[61]=L):L=t[61];let R;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(s,{id:`yzF66j`}),t[62]=R):R=t[62];let z;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsxs)(tc,{side:`bottom`,sideOffset:8,children:[R,(0,Z.jsx)(Se,{children:Sc(`command-palette`)})]}),t[63]=z):z=t[63];let B;return t[64]===L?B=t[65]:(B=(0,Z.jsxs)(ic,{children:[L,z]}),t[64]=L,t[65]=B),B}function _O({editor:e}){if($e(e.state).query||e.isActive(`codeBlock`))return!1;if(fO(e)||qD(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 vO(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:CO},t[0]=n,t[1]=l);let u=dt(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:SO},t[2]=n,t[3]=d);let f=dt(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return ir(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=Xs(e,t,()=>{nc(e,t,{placement:`top`,strategy:`fixed`,middleware:[qs(8),ec(),oc({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(xO)}))},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(bO)},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)(uO,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(GD,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ID,{editor:n}),(0,Z.jsx)(so,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(mO,{editor:n},o),(0,Z.jsx)(so,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(gO,{editor:n},`${o}-link`),(0,Z.jsx)(ZD,{editor:n},`${o}-footnote`),(0,Z.jsx)(zD,{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)(PD,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:yO,shouldShow:_O,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 yO(){return document.body}function bO(e){return e+1}function xO(){}function SO(e){return qD(e.editor)}function CO(e){return fO(e.editor)}var wO=56,TO=`0 2px 4px rgba(0, 0, 0, 0.08)`,EO=150,DO=globalThis.ScrollTimeline;function OO(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+wO);return{startOffset:o,endOffset:o+a,maxShift:a}}var kO=new WeakMap;function AO(e){let t=kO.get(e);if(t){for(let e of t.animations)e.cancel();kO.delete(e)}}function jO(e){for(let t of Array.from(e.cells))AO(t)}var MO=e=>e.cellIndex===0?`3`:`2`;function NO(e,t){return PO(e,t,e=>({transform:`translateY(${e}px)`}))}function PO(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 FO(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 IO(e,t,n){return FO(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:TO})}function LO(e,t){return FO(e,t,{opacity:`0`},{opacity:`1`})}function RO(e,t,n,r){let i=MO(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=kO.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(NO(n,r),s),l=e.animate(IO(n,r,i),s),u=e.animate(LO(n,r),{...s,pseudoElement:`::before`});kO.set(e,{key:a,animations:[c,l,u]})}function zO(e,t){let n=MO(e),r=`in|${t}|${n}`,i=kO.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:TO}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});kO.set(e,{key:r,animations:[a,o]})}function BO(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=OO(a,i,c.top,c.height,l.height);if(!u){jO(s);continue}if(n){if(o<=0){jO(s);continue}for(let e of Array.from(s.cells))RO(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+wO){jO(s);continue}for(let e of Array.from(s.cells))zO(e,d)}}var VO=Vn.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new li({key:new $r(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||BO(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()},EO);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&DO)try{n=new DO({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`))jO(t)}}}})]}}),HO=`application/x-open-knowledge-sidebar-item+json`,UO={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function WO(e){return JSON.stringify(e)}function GO(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:ds(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:gs(e.assetPath)}:{target:Ms(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:ls(e.docName)}}function KO(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(HO);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!qO(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!JO(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function qO(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function JO(e){return typeof e==`string`&&Object.hasOwn(UO,e)}function YO(e,t){return(n,r)=>{let i=r,a=KO(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function XO(e,t){let n=GO(e);t(n.target,{tabBehavior:`append`}),_s(n.hash)}function ZO(e){return[...e?[{label:`Toggle header column`,icon:Hl,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:Ri,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:co,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:_e,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:tu,run:e=>e.chain().focus().deleteTable().run()}]}function QO(e){return[...e?[{label:`Toggle header row`,icon:Lu,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:x,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:te,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:_e,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:tu,run:e=>e.chain().focus().deleteTable().run()}]}function $O(e){if(!e.isEditable||$e(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 ek(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 Xs(r,e,()=>{nc(r,e,{strategy:`absolute`,placement:t,middleware:[qs(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(tk)})},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`?Kl:wo,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)(eo,{asChild:!0,children:(0,Z.jsx)(Ai,{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)(Xa,{}),(0,Z.jsxs)(go,{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)(ro,{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)(po,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function tk(){}function nk(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=$O(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=ZO(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)(ek,{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=QO(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)(ek,{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 rk(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=Gt.getState(e.state)?.binding;if(!t){lt.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){lt.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}lt.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return Vn.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new li({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var ik=new WeakMap;function ak(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=Pr(e.color),n.textContent=e.name,t.append(n),t}var ok={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},sk=100,ck=100,lk=3,uk=250;function dk(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function fk(e,t){let n=m(e);if(!n||t.contains(n.dom))return!1;if(!dk(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 pk(){let e=new yr({extensions:pi});return{mdManager:e,text:ae({mdManager:e}),html:Ae({mdManager:e}),paste:Ut({mdManager:e}),drop:Ye({mdManager:e})}}function mk(e,t){return t?{collaboration:C.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[rk({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:C.configure({document:e.document}),guard:[]}}function hk(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=mk(t,r);return[...Dt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),US.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,Vn.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[gt]}}),Vn.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[mt(e,{cursorBuilder:ak})]}}),Vn.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[rD({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,VO]}function gk(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{ik.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=ik.get(e);if(ik.delete(e),r==null)return;let i=performance.now();lt(`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:YO(n.drop,e.onSidebarDrop)},extensions:Om(hk(e))}}function _k(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=gk({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}=Ve(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var vk=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(ok),c=qE(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=yt(),p=n.configuration.name??``,[m]=(0,Q.useState)(pk),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new Gr(_k({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;lt(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{XO(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=k(p)??crypto.randomUUID();_=Q.use,v=K({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=()=>()=>{E(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)(yk,{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},yk=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),[p,h]=(0,Q.useState)(0),_,v;t[0]===d?(_=t[1],v=t[2]):(_=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},v=[d],t[0]=d,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v);let b,x;t[3]!==c||t[4]!==d?(b=()=>{fk(c,d)&&h(bk)},x=[c,d],t[3]=c,t[4]=d,t[5]=b,t[6]=x):(b=t[5],x=t[6]),(0,Q.useEffect)(b,x);let C;t[7]!==c||t[8]!==n.configuration.name?(C=()=>(Ke(c,n.configuration.name??null),()=>{Ke(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=C):C=t[9];let w;t[10]!==c||t[11]!==n?(w=[c,n],t[10]=c,t[11]=n,t[12]=w):w=t[12],(0,Q.useEffect)(C,w);let T;t[13]!==c||t[14]!==n.configuration.name?(T=()=>{let e=n.configuration.name;if(e)return ue(e,c),()=>g(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=T):T=t[15];let E;t[16]!==c||t[17]!==n?(E=[c,n],t[16]=c,t[17]=n,t[18]=E):E=t[18],(0,Q.useEffect)(T,E);let D;t[19]!==c||t[20]!==n.configuration.name?(D=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,il(e,`wysiwyg`,$c(c)),Yc(e,`wysiwyg`,tl(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),il(e,`wysiwyg`,null),Yc(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=D):D=t[21];let O;t[22]!==c||t[23]!==n?(O=[c,n],t[22]=c,t[23]=n,t[24]=O):O=t[24],(0,Q.useEffect)(D,O);let k;t[25]!==c||t[26]!==n.configuration.name?(k=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=k):k=t[27];let A;t[28]!==c||t[29]!==n?(A=[c,n],t[28]=c,t[29]=n,t[30]=A):A=t[30],(0,Q.useEffect)(k,A);let j,M;t[31]===c?(j=t[32],M=t[33]):(j=()=>{let e=xk,t=null,n=()=>{if(t||c.isDestroyed)return;let n=m(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 m(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},M=[c],t[31]=c,t[32]=j,t[33]=M),(0,Q.useEffect)(j,M);let N,P;t[34]!==i||t[35]!==c?(N=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!m(c))return;e=!0;let t=S(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})),lt(`ok/editor/selection-restore-failed`,{docName:i,message:n})}y(i)};if(m(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},P=[c,i],t[34]=i,t[35]=c,t[36]=N,t[37]=P):(N=t[36],P=t[37]),(0,Q.useEffect)(N,P);let F,I;t[38]!==u||t[39]!==n.document||t[40]!==l?(F=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},Xn)};c(ok);let f=()=>{if(fi(e),!yi(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?yi(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},I=[n.document,u,l],t[38]=u,t[39]=n.document,t[40]=l,t[41]=F,t[42]=I):(F=t[41],I=t[42]),(0,Q.useEffect)(F,I);let L,R;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(L=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<sk){e+=1,t=window.setTimeout(p,ck);return}r=null,o=null,e=0},u=function(e){let t=m(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=lk,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,uk)))};t=window.setTimeout(o,uk)};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 h=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=Ds(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},g=function(){if(i===a){if(r){p();return}h()}};return h(),n.on(`synced`,g),c.on(`transaction`,g),window.addEventListener(`hashchange`,h),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,g),c.off(`transaction`,g),window.removeEventListener(`hashchange`,h)}},R=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=L,t[48]=R):(L=t[47],R=t[48]),(0,Q.useEffect)(L,R);let z,B;t[49]===c?(z=t[50],B=t[51]):(z=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=m(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(ul,e),()=>window.removeEventListener(ul,e)},B=[c],t[49]=c,t[50]=z,t[51]=B),(0,Q.useEffect)(z,B);let V;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(V=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:JE({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[52]=a,t[53]=i,t[54]=o,t[55]=r,t[56]=s,t[57]=n.awareness,t[58]=V):V=t[58];let H;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(H=[n,i,a,o,s,r],t[59]=a,t[60]=i,t[61]=o,t[62]=r,t[63]=s,t[64]=n,t[65]=H):H=t[65],(0,Q.useEffect)(V,H);let U,W;t[66]!==c||t[67]!==r?(U=()=>(Ie(c,r),()=>{Ie(c,!1)}),W=[c,r],t[66]=c,t[67]=r,t[68]=U,t[69]=W):(U=t[68],W=t[69]),(0,Q.useEffect)(U,W);let G;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(G=!r&&(0,Z.jsx)(vO,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=G):G=t[74];let K;t[75]!==c||t[76]!==r?(K=!r&&(0,Z.jsx)(nk,{editor:c}),t[75]=c,t[76]=r,t[77]=K):K=t[77];let q;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[78]=q):q=t[78];let J;t[79]!==c||t[80]!==p?(J=(0,Z.jsx)(Qt,{editor:c,className:`tiptap-editor-portal-content h-full`},p),t[79]=c,t[80]=p,t[81]=J):J=t[81];let ee;t[82]!==d||t[83]!==J?(ee=(0,Pl.createPortal)(J,d),t[82]=d,t[83]=J,t[84]=ee):ee=t[84];let Y;t[85]===c?Y=t[86]:(Y=(0,Z.jsx)(GE,{editor:c}),t[85]=c,t[86]=Y);let te;t[87]===c?te=t[88]:(te=zt(c),t[87]=c,t[88]=te);let X;t[89]===te.store?X=t[90]:(X=(0,Z.jsx)(Ue,{store:te.store}),t[89]=te.store,t[90]=X);let ne;return t[91]!==G||t[92]!==K||t[93]!==ee||t[94]!==Y||t[95]!==X||t[96]!==l?(ne=(0,Z.jsxs)(`div`,{ref:l,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[G,K,q,ee,Y,X]}),t[91]=G,t[92]=K,t[93]=ee,t[94]=Y,t[95]=X,t[96]=l,t[97]=ne):ne=t[97],ne};function bk(e){return e+1}function xk(){return ye()}var Sk=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 Ck(e,t,n,r,i,a){if(e==r)return[];let o=Nk(e,t,n,r,i,a),s=Pk(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 Sk(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new Sk(t,t+o,i,i),new Sk(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 Sk(t,t,i,i+o),new Sk(n,n,i+o+c,a)]}if(c==1||l==1)return[new Sk(t,n,i,a)];let u=Ik(e,t,n,r,i,a);if(u){let[o,s,c]=u;return Ck(e,t,o,r,i,s).concat(Ck(e,o+c,n,r,s+c,a))}return Dk(e,t,n,r,i,a)}var wk=1e9,Tk=0,Ek=!1;function Dk(e,t,n,r,i,a){let o=n-t,s=a-i;if(wk<1e9&&Math.min(o,s)>wk*16||Tk>0&&Date.now()>Tk)return Math.min(o,s)>wk*64?[new Sk(t,n,i,a)]:Lk(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);kk.reset(c),Ak.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:Ak,f=d?null:kk;for(let p=0;p<c;p++){if(p>wk||Tk>0&&!(p&63)&&Date.now()>Tk)return Lk(e,t,n,r,i,a);let m=kk.advance(p,o,s,c,d,!1,l)||Ak.advance(p,o,s,c,f,!0,u);if(m)return jk(e,t,n,t+m[0],r,i,a,i+m[1])}return[new Sk(t,n,i,a)]}var Ok=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}},kk=new Ok,Ak=new Ok;function jk(e,t,n,r,i,a,o,s){let c=!1;return!Qk(e,r)&&++r==n&&(c=!0),!Qk(i,s)&&++s==o&&(c=!0),c?[new Sk(t,n,a,o)]:Ck(e,t,r,i,a,s).concat(Ck(e,r,n,i,s,o))}function Mk(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function Nk(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=Mk(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-+!Qk(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function Pk(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=Mk(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-+!Qk(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function Fk(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;;){Qk(e,s)||s++;let u=s+o;if(Qk(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=Nk(e,u,n,r,i+f+d.length,a),c=Pk(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 Ik(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=Ik(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:Fk(e,t,n,r,i,a,Math.floor(o/4),-1)}function Lk(e,t,n,r,i,a){Ek=!0;let o=n-t,s=a-i,c;if(o<s){let s=Fk(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=Fk(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new Sk(t,n,i,a)];let[l,u,d]=c;return Ck(e,t,l,r,i,u).concat(Ck(e,l+d,n,r,u+d,a))}function Rk(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 Sk(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function zk(e,t,n){for(;;){Rk(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=Nk(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Sk(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=Pk(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Sk(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 Sk(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 Sk(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function Bk(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=qk(t,a.fromA,l),f=Kk(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 Sk(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Kk(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new Sk(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=qk(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new Sk(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Yk(n,a.fromB,a.toB),r,o=t<0?-1:Jk(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=Yk(t,a.fromA,a.toA),r,o=n<0?-1:Jk(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 Rk(e,3),e}var Vk;try{Vk=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function Hk(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Uk(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!Hk(n):Vk?!Xk(n)||t==e.length-1?+!!Vk.test(String.fromCharCode(n)):Vk.test(e.slice(t,t+2))?2:0:0}function Wk(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!Hk(n):Vk?!Zk(n)||t==1?+!!Vk.test(String.fromCharCode(n)):Vk.test(e.slice(t-2,t))?2:0:0}var Gk=8;function Kk(e,t,n){if(t==e.length||!Wk(e,t))return t;for(let r=t,i=t+n,a=0;a<Gk;a++){let t=Uk(e,r);if(!t||r+t>i)return r;r+=t}return t}function qk(e,t,n){if(!t||!Uk(e,t))return t;for(let r=t,i=t-n,a=0;a<Gk;a++){let t=Wk(e,r);if(!t||r-t<i)return r;r-=t}return t}function Jk(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Yk(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var Xk=e=>e>=55296&&e<=56319,Zk=e=>e>=56320&&e<=57343;function Qk(e,t){return!t||t==e.length||!Xk(e.charCodeAt(t-1))||!Zk(e.charCodeAt(t))}function $k(e,t,n){let r=n?.override;return r?r(e,t):(wk=(n?.scanLimit??1e9)>>1,Tk=n?.timeout?Date.now()+n.timeout:0,Ek=!1,zk(e,t,Ck(e,0,e.length,t,0,t.length)))}function eA(){return!Ek}function tA(e,t,n){return Bk($k(e,t,n),e,t)}var nA=Pc.define({combine:e=>e[0]}),rA=Fc.define(),iA=Pc.define(),aA=kc.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(rA)&&(e=n.value);for(let n of t.state.facet(iA))e=n(e,t);return e}});function oA(e){let t=e.field(aA,!1);if(!t)return null;let n=e.facet(nA);return{chunks:t,side:n?n.side:null}}var sA=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 uA(tA(e.toString(),t.toString(),n),e,t,0,0,eA())}static updateA(e,t,n,r,i){return mA(pA(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return mA(pA(e,r,!1,t.length),e,t,n,i)}};function cA(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 lA(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 uA(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=cA(c.fromA+r,c.fromB+i,t,n),[d,f]=lA(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]=cA(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]=lA(a.toA+r,a.toB+i,t,n),s++}o.push(new sA(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var dA=1e3;function fA(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 pA(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>dA&&([l,d]=fA(e,a-dA,n,!0)),o<t.length-dA&&([u,f]=fA(e,o+dA,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 mA(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=tA(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of uA(h,n,r,d,f,eA()))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 hA={scanLimit:500},gA=Ic.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=EA(e))}update(e){(e.docChanged||e.viewportChanged||vA(e.startState,e.state)||yA(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=EA(e.view))}},{decorations:e=>e.deco}),_A=Ec.low(Bc({class:`cm-changeGutter`,markers:e=>e.plugin(gA)?.gutter||Hc.empty}));function vA(e,t){return e.field(aA,!1)!=t.field(aA,!1)}function yA(e,t){return e.facet(nA)!=t.facet(nA)}var bA=Mc.line({class:`cm-changedLine`}),xA=Mc.mark({class:`cm-changedText`}),SA=Mc.mark({tagName:`ins`,class:`cm-insertedLine`}),CA=Mc.mark({tagName:`del`,class:`cm-deletedLine`}),wA=new class extends zc{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function TA(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,bA),i.add(o,s,n?CA:SA),a&&a.add(o,o,wA);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,bA),a&&a.add(u,u,wA);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,xA),s<t)c++;else break}u=t}}}function EA(e){let t=e.state.field(aA),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(nA),o=n==`a`,s=new Nc,c=i?new Nc: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))&&TA(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var DA=class extends Tc{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}},OA=Fc.define({map:(e,t)=>e.map(t)}),kA=kc.define({create:()=>Mc.none,update:(e,t)=>{for(let e of t.effects)if(e.is(OA))return e.value;return e.map(t.changes)},provide:e=>Rc.decorations.from(e)}),AA=.01;function jA(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 MA(e,t,n){let r=new Nc,i=new Nc,a=e.state.field(kA).iter(),o=t.state.field(kA).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<-AA?(l-=n,r.add(s,s,Mc.widget({widget:new DA(-n),block:!0,side:-1}))):n>AA&&(u+=n,i.add(c,c,Mc.widget({widget:new DA(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<AA?r.add(e.state.doc.length,e.state.doc.length,Mc.widget({widget:new DA(-p),block:!0,side:1})):p>AA&&i.add(t.state.doc.length,t.state.doc.length,Mc.widget({widget:new DA(p),block:!0,side:1}));let m=r.finish(),h=i.finish();jA(m,e.state.field(kA))||e.dispatch({effects:OA.of(m)}),jA(h,t.state.field(kA))||t.dispatch({effects:OA.of(h)})}var NA=Fc.define({map:(e,t)=>t.mapPos(e)}),PA=class extends Tc{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:NA.of(n)});let{side:r,sibling:i}=e.state.facet(nA);i&&i().dispatch({effects:NA.of(FA(n,e.state.field(aA),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function FA(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 IA=kc.define({create(e){return Mc.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(NA)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Rc.decorations.from(e)});function LA({margin:e=3,minSize:t=4}){return IA.init(n=>RA(n,e,t))}function RA(e,t,n){let r=new Nc,i=e.facet(nA).side==`a`,a=e.field(aA),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,Mc.replace({widget:new PA(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var zA=Rc.styleModule.of(new Vc({".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`}})),BA=Rc.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`}}),VA=new Lc,HA=new Lc,UA=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||hA;let t=[Ec.low(gA),BA,zA,kA,Rc.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(OA)))&&this.measure()})],n=[nA.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(_A);let r=Oc.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Rc.editorAttributes.of({class:`cm-merge-a`}),HA.of(n),t]}),i=[nA.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(_A);let a=Oc.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Rc.editorAttributes.of({class:`cm-merge-b`}),HA.of(i),t]});this.chunks=sA.build(r.doc,a.doc,this.diffConf);let o=[aA.init(()=>this.chunks),VA.of(e.collapseUnchanged?LA(e.collapseUnchanged):[])];r=r.update({effects:Fc.appendConfig.of(o)}).state,a=a.update({effects:Fc.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 Rc({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Rc({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),Dc.empty(e[0].startState.doc.length));this.chunks=t==this.a?sA.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):sA.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:rA.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:rA.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(nA),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(HA.reconfigure([nA.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?_A:[]])),a.push(HA.reconfigure([nA.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?_A:[]]))}if(r){let t=VA.reconfigure(e.collapseUnchanged?LA(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(){MA(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=WA(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=WA(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 WA(e){let t=e.nextSibling;return e.remove(),t}var GA=new class extends zc{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},KA=Ec.low(Bc({class:`cm-changeGutter`,markers:e=>e.plugin(gA)?.gutter||Hc.empty,widgetMarker:(e,t)=>t instanceof ZA?GA:null}));function qA(e){let t=typeof e.original==`string`?jc.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||hA;return[Ec.low(gA),nj,BA,Rc.editorAttributes.of({class:`cm-merge-b`}),iA.of((e,t)=>{let r=t.effects.find(e=>e.is(JA));return r&&(e=sA.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=sA.updateB(e,t.state.field(YA),t.newDoc,t.changes,n)),e}),nA.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?cj:void 0,side:`b`}),YA.init(()=>t),e.gutter===!1?[]:KA,e.collapseUnchanged?LA(e.collapseUnchanged):[],aA.init(e=>sA.build(t,e.doc,n))]}var JA=Fc.define(),YA=kc.define({create:()=>jc.empty,update(e,t){for(let n of t.effects)n.is(JA)&&(e=n.value.doc);return e}}),XA=new WeakMap,ZA=class extends Tc{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 QA(e,t,n){let r=XA.get(t.changes);if(r)return r;let i=Mc.widget({block:!0,side:-1,widget:new ZA(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(nA),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(),$A(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),ej(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(YA).sliceString(t.fromA,t.endA),u=a&&e.facet(Uc),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;Ac(t,{style:t=>Wc(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 XA.set(t.changes,i),i}function $A(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(aA).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(YA);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Dc.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:JA.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function ej(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(aA).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(YA).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 tj(e){let t=new Nc;for(let n of e.field(aA)){let r=e.facet(nA).overrideChunk&&ij(e,n);t.add(n.fromB,n.fromB,QA(e,n,!!r))}return t.finish()}var nj=kc.define({create:e=>tj(e),update(e,t){return t.state.field(aA,!1)==t.startState.field(aA,!1)?e:tj(t.state)},provide:e=>Rc.decorations.from(e)}),rj=new WeakMap;function ij(e,t){let n=rj.get(t);if(n!==void 0)return n;n=null;let r=e.field(YA),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(Mc.widget({widget:new aj(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(xA.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return rj.set(t,n),n}var aj=class extends Tc{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}},oj=new class extends zc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},sj=Mc.line({class:`cm-inlineChangedLine`});function cj(e,t,n,r){let i=ij(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,oj),n.add(o.from,o.from,sj);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 lj=on({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),uj=ce({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),dj=Rc.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 fj({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 pj(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Ar(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?lj:uj,u=[Rc.editable.of(!1),Oc.readOnly.of(!0)],d=[dl,Gc(),...u,l,Rc.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new Rc({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=fj({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new Rc({doc:p,extensions:[dl,Gc(),Rc.editable.of(!1),l,dj,Rc.lineWrapping,qA({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),Rc.updateListener.of(e=>{let t=oA(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=oA(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new UA({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new Rc({doc:p,extensions:[...d,qA({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof Rc)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof Rc)||De(e)},t[13]=A):A=t[13];let j=A,M=b===0,N;t[14]!==f||t[15]!==b?(N=b===null?``:b===0?f({id:`lPzyrU`}):Is._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=N):N=t[16];let P=N,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=F):F=t[17];let I;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,Pl.createPortal)((0,Z.jsx)(Ai,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),I=C.map(e),t[18]=f,t[19]=C,t[20]=I}else I=t[20];let L;t[23]!==M||t[24]!==o||t[25]!==P||t[26]!==d||t[27]!==u?(L=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${M?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:P}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(Ai,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(Ai,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(Ai,{variant:`default`,size:`sm`,disabled:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,t[24]=o,t[25]=P,t[26]=d,t[27]=u,t[28]=L):L=t[28];let R;return t[29]!==L||t[30]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=R):R=t[31],R}async function mj(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 hj(e,t){return mj(e,`content`,t)}async function gj(e){return mj(e,`mine`)}async function _j(e){return mj(e,`theirs`)}async function vj(e){return mj(e,`delete`)}async function yj(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 bj(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=ea(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>ms(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),yj(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await hj(u,e);t.ok||Ls.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),Ls.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(pj,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(vj),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(Ai,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(_j),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(Ai,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(pj,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(gj),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(Ai,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(vj),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(Ai,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)(pj,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function xj(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Wt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var Sj=`__back-nav__`;function Cj(e){return e instanceof Be||e instanceof Ct||e instanceof Fe||e instanceof at||e instanceof It||e instanceof ft?e.docName:null}function wj(e){if(e instanceof Be){let t=e.docName;return{title:Is._({id:`Jejur6`}),summary:Is._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Ct){let t=e.docName;return{title:Is._({id:`V7QxyT`}),summary:Is._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Fe){let t=e.docName;return{title:Is._({id:`1di5fu`}),summary:Is._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof at){let t=e.docName;return{title:Is._({id:`wvbc1r`}),summary:Is._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof It)return{title:Is._({id:`Gfr4fu`}),summary:Is._({id:`j6LB7S`})};if(e instanceof ft){let t=e.docName;return{title:Is._({id:`vv7kpg`}),summary:Is._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Is._({id:`W5A0Ly`});return{title:Is._({id:`29VNqC`}),summary:t}}function Tj(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=wj(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(tw,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(Ai,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(Ai,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(pt(Cj(n)??i),o(a),r(Sj))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function Ej(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)(Tj,{...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]===Sj){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}: ${wj(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)(de,{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 Dj(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Dr(t);return{map:n,keys:Ur(t),parseError:r}}function Oj(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>Dj(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=ur(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=nt(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=_t(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)(kj,{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)(Aj,{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 kj(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 Aj(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function jj(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Dr(t);return{map:n,keys:Ur(t),parseError:r}}function Mj(e){let t=(0,$.c)(127),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>jj(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=ur(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M=(0,Q.useRef)(null);SE(M,j);let N;t[8]!==r||t[9]!==a?(N=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=ri(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=N):N=t[10];let P=N,F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=F):F=t[11];let I=F,L;t[12]===r?L=t[13]:(L=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=L);let R=L,z;t[14]!==P||t[15]!==R?(z=function(e,t){I(e),R(P({[e]:t}),[e])},t[14]=P,t[15]=R,t[16]=z):z=t[16];let B=z,V;t[17]!==P||t[18]!==R?(V=function(e){I(e),R(P({[e]:null}),[e])},t[17]=P,t[18]=R,t[19]=V):V=t[19];let H=V,U;t[20]!==r||t[21]!==a?(U=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=ri(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=U):U=t[22];let W=U,G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e,t){return`${e} ${t}`},t[23]=G):G=t[23];let K=G,q;t[24]!==a||t[25]!==m?(q=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>K(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=q):q=t[26];let J=q,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={activationConstraint:{distance:4}},t[27]=ee):ee=t[27];let Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y={coordinateGetter:oa},t[28]=Y):Y=t[28];let te=$a(Ki(Wa,ee),Ki(Ba,Y)),X;t[29]!==B||t[30]!==p?(X=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=Ro(n,t);(!Object.hasOwn(p,e)||!Tr(n,r))&&B(e,r)},t[29]=B,t[30]=p,t[31]=X):X=t[31];let ne=X,re;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=re):re=t[32];let ie=re,{addPropertySignal:ae,clearAddProperty:oe}=sT(),se;t[33]!==ae||t[34]!==j?(se=ae.get(j)??0,t[33]=ae,t[34]=j,t[35]=se):se=t[35];let ce=se,le,ue;t[36]===ce?(le=t[37],ue=t[38]):(le=()=>{ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},ue=[ce],t[36]=ce,t[37]=le,t[38]=ue),(0,Q.useEffect)(le,ue);let de,fe;t[39]!==oe||t[40]!==j?(de=()=>()=>oe(j),fe=[j,oe],t[39]=oe,t[40]=j,t[41]=de,t[42]=fe):(de=t[41],fe=t[42]),(0,Q.useEffect)(de,fe);let pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Oa[e];return{...t,type:e,value:n,error:null}})},t[43]=pe):pe=t[43];let me=pe,he;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){S(t=>t&&{...t,value:e})},t[44]=he):he=t[44];let ge=he,_e;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=_e):_e=t[45];let ve=_e,ye;t[46]!==r||t[47]!==x||t[48]!==P||t[49]!==p?(ye=function(e){if(!x)return;let t=e??x.value,n=x.name.trim();if(!n){S({...x,value:t,error:r({id:`8_brI5`})});return}if(mr(t)){S({...x,value:t,error:r({id:`hXUWyd`})});return}if(n===`frontmatter`){S({...x,value:t,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,n)){S({...x,value:t,error:r({id:`njU86j`,values:{trimmed:n}})});return}let i=P({[n]:t});if(i.ok){S(null);return}let a=i.fieldErrors?.[n],o=i.error??r({id:`OJeiSH`});S({...x,value:t,error:a??o})},t[46]=r,t[47]=x,t[48]=P,t[49]=p,t[50]=ye):ye=t[50];let be=ye,xe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){S(null)},t[51]=xe):xe=t[51];let Se=xe,Ce;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){w({key:e,draft:e,error:null})},t[52]=Ce):Ce=t[52];let we=Ce,Te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Te):Te=t[53];let Ee=Te,De;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(){w(null)},t[54]=De):De=t[54];let Oe=De,ke;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(ke=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=W(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),I(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=W,t[58]=C,t[59]=ke):ke=t[59];let Ae=ke,je;t[60]!==p||t[61]!==m?(je=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=je):je=t[62];let Me=je,Ne;if(t[63]!==Me){Ne=new Map;for(let e of Me)Ne.set(e,(Ne.get(e)??0)+1);t[63]=Me,t[64]=Ne}else Ne=t[64];if(Me.length===0&&!x&&!h)return null;let Pe=!g,Fe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=e=>_(!e),t[65]=Fe):Fe=t[65];let Ie=!g,Le;t[66]===Ie?Le=t[67]:(Le=(0,Z.jsx)(ts,{"data-expanded":Ie,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Ie,t[67]=Le);let Re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=Re):Re=t[68];let ze;t[69]===Le?ze=t[70]:(ze=(0,Z.jsx)(ns,{asChild:!0,children:(0,Z.jsxs)(Ai,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[Le,Re]})}),t[69]=Le,t[70]=ze);let Be;t[71]===h?Be=t[72]:(Be=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(as,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=Be);let Ve;if(t[73]!==Me){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],Ve=Me.map(e),t[73]=Me,t[74]=Ve}else Ve=t[74];let He;if(t[76]!==B||t[77]!==Ae||t[78]!==Ne||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Me||t[85]!==k||t[86]!==ne){let e;t[88]!==B||t[89]!==Ae||t[90]!==Ne||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==ne?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??Zn(n),i=C?.key===e?C:null,a=(Ne.get(e)??0)>1;return(0,Z.jsx)(ua,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>we(e),onChangeDraft:Ee,onCommit:Ae,onCancel:Oe},onCommit:t=>B(e,t),onChangeType:t=>ne(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=B,t[89]=Ae,t[90]=Ne,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=ne,t[98]=e):e=t[98],He=Me.map(e),t[76]=B,t[77]=Ae,t[78]=Ne,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Me,t[85]=k,t[86]=ne,t[87]=He}else He=t[87];let Ue;t[99]!==Ve||t[100]!==He?(Ue=(0,Z.jsx)(ca,{items:Ve,strategy:yo,children:He}),t[99]=Ve,t[100]=He,t[101]=Ue):Ue=t[101];let We;t[102]!==J||t[103]!==te||t[104]!==Ue?(We=(0,Z.jsx)(fa,{sensors:te,collisionDetection:Ea,onDragEnd:J,children:Ue}),t[102]=J,t[103]=te,t[104]=Ue,t[105]=We):We=t[105];let Ge;t[106]!==B||t[107]!==E||t[108]!==p||t[109]!==k?(Ge=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(ua,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>B(`tags`,e),onChangeType:Nj},`virtual-tags`),t[106]=B,t[107]=E,t[108]=p,t[109]=k,t[110]=Ge):Ge=t[110];let Ke;t[111]!==r||t[112]!==x||t[113]!==be?(Ke=x?(0,Z.jsx)(ia,{draft:x,onChangeName:ve,onChangeType:me,onChangeValue:ge,onCommit:be,onCancel:Se}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(Ai,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ie,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(At,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=be,t[114]=Ke):Ke=t[114];let qe;t[115]!==Be||t[116]!==We||t[117]!==Ge||t[118]!==Ke?(qe=(0,Z.jsxs)(es,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Be,We,Ge,Ke]}),t[115]=Be,t[116]=We,t[117]=Ge,t[118]=Ke,t[119]=qe):qe=t[119];let Je;t[120]!==Pe||t[121]!==ze||t[122]!==qe?(Je=(0,Z.jsx)(`div`,{ref:M,className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(rs,{open:Pe,onOpenChange:Fe,children:[ze,qe]})}),t[120]=Pe,t[121]=ze,t[122]=qe,t[123]=Je):Je=t[123];let Ye;return t[124]!==a||t[125]!==Je?(Ye=(0,Z.jsx)(Ia,{binding:a,children:Je}),t[124]=a,t[125]=Je,t[126]=Ye):Ye=t[126],Ye}function Nj(){}var Pj=G(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Fj(e){let t=e.threshold??Pj;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Ij(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var Lj=G(`ACTIVITY_MOUNT_LIMIT`,3);function Rj(){return n(()=>import(`./SourceEditor-BY_IgcRM.js`),__vite__mapDeps([55,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,56,26,54]),import.meta.url)}var zj=(0,Q.lazy)(async()=>({default:(await Rj()).SourceEditor}));function Bj(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Xe(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function Vj(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Is._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Is._({id:`Sc1bKE`,values:{docName:e}}):Is._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Is._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Is._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Is._({id:`bmC18N`,values:{docName:e}}):Is._({id:`pAgkuZ`,values:{docName:e}})}:null}function Hj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(f,{name:`activity-pool`,children:(0,Z.jsx)(Uj,{...e})}),t[0]=e,t[1]=n),n}function Uj(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=yt(),{pages:u,loading:d}=Ts(),f=Bj(c,n,Lj),p=(0,Q.useRef)(``),m=f.map(Wj).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)ie(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;I(e,t&&t.length>0?t:crypto.randomUUID())}lt(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,X(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)(Xj,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function Wj(e){return e.docName}function Gj(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&<(`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&&(lt(`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&<(`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 Kj(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)(_S,{}),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)(zj,{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 qj(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)(no,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Te,{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)(Ai,{type:`button`,onClick:Jj,children:[(0,Z.jsx)(no,{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 Jj(){return window.location.reload()}function Yj(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 Xj(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=Vj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=qT(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,b]=(0,Q.useState)(!i),x,C;t[5]!==i||t[6]!==_||t[7]!==y?(x=()=>{i&&!_?v(!0):!i&&!y&&b(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=x,t[9]=C):(x=t[8],C=t[9]),(0,Q.useEffect)(x,C);let w=Fj({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&<(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let A;t[19]===n.docName?A=t[20]:(A=()=>S(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=()=>{Ij({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:N})&&(lt(`ok/cold/first-toggle`,{docName:n.docName,mountId:k(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)(qj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Ej,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(Yj,{html:M}):(0,Z.jsx)(_S,{}),children:(0,Z.jsx)(xj,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(bj,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Oj,{provider:n.provider}),!i&&(0,Z.jsx)(Mj,{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)(Kj,{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)(vk,{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)(Gj,{isActive:r,initialScrollTop:z,children:B}),t[45]=r,t[46]=z,t[47]=B,t[48]=V):V=t[48];let H;return t[49]!==L||t[50]!==R||t[51]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[49]=L,t[50]=R,t[51]=V,t[52]=H):H=t[52],H}function Zj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function Qj(e){let{value:t,unit:n}=Zj(e);return n===`rem`?t*16:t}function $j(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var eM=3600*24*7;function tM(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?nM:m,O=g===void 0?eM:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=Qj(b),J;t[6]===x?J=t[7]:(J=Qj(x),t[6]=x,t[7]=J);let ee=J,Y;t[8]!==E||t[9]!==k?(Y=function(e){E&&(P.current=!0,j.current=H.current?0:Qj(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]=Y):Y=t[10];let te=Y,X,ne;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(X=()=>{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}=Zj(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=$j(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(ee,u)),f=$j(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)}},ne=[i,a,D,q,ee,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=X,t[25]=ne):(X=t[24],ne=t[25]),(0,Q.useEffect)(X,ne);let re;return t[26]===te?re=t[27]:(re={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=re),re}function nM(){}var rM=3600*24*7,iM=`18rem`,aM=`3rem`,oM=`app-file-sidebar`,sM=`14.625rem`,cM=`32rem`,lM=`sidebar_width`,uM=/^\d+(?:\.\d+)?(?:rem|px)$/,dM=Q.createContext(null);function fM(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${lM}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return uM.test(n)?n:e}function pM(){let e=Q.use(dM);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function mM(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?iM:c,[u]=Q.useState(gM),d;t[8]===u?d=t[9]:(d=()=>rE(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>fM(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=uE();return fE(`left`,rE(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),pE(`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(hM)},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: ${eE}px)`),t=()=>{let e=rE(u,window.innerWidth,`left`);p(e),C(fE(`left`,e,uE())===`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(oM)?.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=>{Cc(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":aM,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Oi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(dM.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function hM(e){return!e}function gM(){return qr()}function _M(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=pM();if(d===`none`){let e;t[7]===r?e=t[8]:(e=Oi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=Oi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,x;t[20]!==r||t[21]!==b?(x=Oi(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:oM,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function vM(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=pM(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=wc(`toggle-files-sidebar`);l=Ai,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=oM,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=Oi(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(Oe,{}):(0,Z.jsx)(gu,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function yM(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=pM(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:sM,maxResizeWidth:cM,setIsDraggingRail:h,widthCookieName:lM,widthCookieMaxAge:rM},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=tM(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=Oi(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function bM(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}=pM(),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=Oi(`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 xM(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=Oi(`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 SM(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=Oi(`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 CM(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=Oi(`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 wM(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=Oi(`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 TM(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=Oi(`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 EM=Ei(`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 DM(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?ki:`button`,{state:m}=pM(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Oi(EM({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)($s,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(tc,{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)(ic,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function OM(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 kM(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Zr.safeParse(t);return n.success?n.data.currentBranch??null:null}var AM=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:OM({fetchBranch:kM,subscribeToEvent:ws}),jM=AM.subscribe,MM=AM.getSnapshot;function NM(){return(0,Q.useSyncExternalStore)(jM,MM,MM)}function PM(){let e=(0,$.c)(6),t=NM(),n=ja(),{state:r}=pM(),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&&na(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 FM(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:a,composerBadge:o}=e,c=a===void 0?!0:a,{_:l}=i(),u=PM();if(!c&&u===null&&o==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]!==c?(g=l(c?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=c,t[3]=g):g=t[3];let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=_):_=t[4];let y;t[5]!==l||t[6]!==o?(y=o?(0,Z.jsxs)(Ai,{type:`button`,variant:`outline`,onClick:o.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)(Vi,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(v,{className:`size-3`,"aria-hidden":!0})]}):null,t[5]=l,t[6]=o,t[7]=y):y=t[7];let b;t[8]===u?b=t[9]:(b=u===null?null:(0,Z.jsx)(IM,{identity:u}),t[8]=u,t[9]=b);let x;t[10]===b?x=t[11]:(x=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:b}),t[10]=b,t[11]=x);let S;t[12]!==l||t[13]!==d.chars||t[14]!==d.tokens||t[15]!==d.words||t[16]!==m||t[17]!==f||t[18]!==c||t[19]!==h||t[20]!==p?(S=c?(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)(s,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{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)(s,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[12]=l,t[13]=d.chars,t[14]=d.tokens,t[15]=d.words,t[16]=m,t[17]=f,t[18]=c,t[19]=h,t[20]=p,t[21]=S):S=t[21];let C;return t[22]!==g||t[23]!==y||t[24]!==x||t[25]!==S?(C=(0,Z.jsxs)(`section`,{"aria-label":g,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[_,y,x,S]}),t[22]=g,t[23]=y,t[24]=x,t[25]=S,t[26]=C):C=t[26],C}function IM(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)(ic,{children:[(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(tc,{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)(He,{"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 LM(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=Oi(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function RM(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=Oi(`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 zM(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=Oi(`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 BM(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=Oi(`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 VM(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=Oi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(ts,{}),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 HM=1,UM=2,WM=4;function GM(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=tn(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>WM?[...u.slice(0,HM).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(HM,-UM)},...u.slice(-UM).map((e,t)=>d(e,u.length-UM+t))]:u.map((e,t)=>d(e,t));a=LM,t[8]===r?c=t[9]:(c=Oi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=RM,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(KM)}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 KM(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(VM,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(zM,{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)(Kl,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(zM,{className:`min-w-0`,children:(0,Z.jsx)(BM,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var qM={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`},JM=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`,...qM,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},YM=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)(JM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},XM=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)(JM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function ZM(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Sc(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=wc(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(GM,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)($s,{children:(0,Z.jsx)(XM,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(Vo,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(tc,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(ic,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(YM,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Vo,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(tc,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(ic,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(Uo,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(ic,{children:[(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)($s,{children:(0,Z.jsx)(lu,{})})}),(0,Z.jsx)(tc,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=ic,h=Ai,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)($s,{children:u?(0,Z.jsx)(vu,{}):(0,Z.jsx)(_u,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(tc,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function QM(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function $M(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=Oi(`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)(yf,{"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 eN=Ei(`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 tN(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=Oi(eN({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)(bf,{"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 nN(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=Oi(`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)(xf,{"data-slot":`tabs-trigger`,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=Oi(`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)(Sf,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var iN=`ok-terminal-height-v1`,aN=.5;function oN(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*aN))}function sN(e,t){let n=oN(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function cN(){return typeof window>`u`?0:window.innerHeight}function lN(e,t){try{let n=e??localStorage,r=t??cN(),i=n.getItem(iN);if(i==null)return sN(240,r);let a=Number.parseInt(i,10);return sN(Number.isFinite(a)?a:240,r)}catch{return 240}}function uN(e,t,n){try{let r=t??localStorage,i=n??cN();r.setItem(iN,String(sN(e,i)))}catch{}}function dN(){try{return typeof localStorage>`u`?240:lN()}catch{return 240}}var fN=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-TPw9e24X.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([57,1,22,6,3,23,9,11,58,59]),import.meta.url));function pN(e){let t=(0,$.c)(11),{bridge:n,onClose:r,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=Mo(),l=Ma(),{_:u}=i(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){Ls.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||Ls.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let i;return t[4]!==n||t[5]!==o||t[6]!==r?(i=(0,Z.jsx)(de,{fallbackRender:hN,onError:mN,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(fN,{bridge:n,className:`h-full`,onClose:r,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i):i=t[7],i}let m;return t[8]!==p||t[9]!==d?(m=d?(0,Z.jsx)(vN,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[8]=p,t[9]=d,t[10]=m):m=t[10],m}function mN(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function hN(e){return(0,Z.jsx)(gN,{...e})}function gN(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(Ai,{onClick:_N,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function _N(){return window.location.reload()}function vN(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=i(),a;t[0]===r?a=t[1]:(a=r({id:`_XWY2J`}),t[0]=r,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(Ai,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let f;return t[15]!==a||t[16]!==s||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{"aria-label":a,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=a,t[16]=s,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function yN(e){let t=(0,$.c)(36),{sessions:n,activeSessionId:r,onSelect:a,onTabActivate:o,onNew:c,onClose:l,children:u,className:d}=e,{_:f}=i(),p;t[0]===d?p=t[1]:(p=Oi(`flex min-h-0 min-w-0 flex-1 flex-col`,d),t[0]=d,t[1]=p);let m;t[2]===f?m=t[3]:(m=f({id:`1MGRQl`}),t[2]=f,t[3]=m);let h;if(t[4]!==f||t[5]!==r||t[6]!==l||t[7]!==o||t[8]!==n){let e;t[10]!==f||t[11]!==r||t[12]!==l||t[13]!==o?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:Oi(`group flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(nN,{value:e.id,onClick:()=>o?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(Ai,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":f({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:Oi(`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(),l(e.id)},children:(0,Z.jsx)(Rs,{"aria-hidden":`true`})})]},e.id)},t[10]=f,t[11]=r,t[12]=l,t[13]=o,t[14]=e):e=t[14],h=n.map(e),t[4]=f,t[5]=r,t[6]=l,t[7]=o,t[8]=n,t[9]=h}else h=t[9];let g;t[15]!==m||t[16]!==h?(g=(0,Z.jsx)(tN,{variant:`line`,"aria-label":m,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:h}),t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;t[18]===f?_=t[19]:(_=f({id:`AB4qw9`}),t[18]=f,t[19]=_);let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(At,{"aria-hidden":`true`}),t[20]=v):v=t[20];let y;t[21]!==c||t[22]!==_?(y=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:c,children:v})}),t[21]=c,t[22]=_,t[23]=y):y=t[23];let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`AB4qw9`})}),t[24]=b):b=t[24];let x;t[25]===y?x=t[26]:(x=(0,Z.jsxs)(ic,{children:[y,b]}),t[25]=y,t[26]=x);let S;t[27]!==g||t[28]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[g,x]}),t[27]=g,t[28]=x,t[29]=S):S=t[29];let C;return t[30]!==r||t[31]!==u||t[32]!==a||t[33]!==p||t[34]!==S?(C=(0,Z.jsxs)($M,{value:r,onValueChange:a,className:p,children:[S,u]}),t[30]=r,t[31]=u,t[32]=a,t[33]=p,t[34]=S,t[35]=C):C=t[35],C}var bN=`terminal-dock-panel`;function xN(e){return`terminal-session-${e}`}function SN(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function CN(e){let t=(0,$.c)(77),{bridge:n,children:r,visible:a,onVisibleChange:o,launch:s}=e,c=s===void 0?null:s,{_:l}=i(),{resolvedTheme:u}=Ar(),d=rS(),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!a),h;t[0]!==c||t[1]!==a?(h=()=>a?[{id:xN(1),launch:c}]:[],t[0]=c,t[1]=a,t[2]=h):h=t[2];let[g,_]=(0,Q.useState)(h),v;t[3]===a?v=t[4]:(v=()=>a?xN(1):``,t[3]=a,t[4]=v);let[y,b]=(0,Q.useState)(v),x=(0,Q.useRef)(y),S=(0,Q.useRef)(g),C=(0,Q.useRef)(+!!a),w=(0,Q.useRef)(a&&c?c.nonce:null),T=(0,Q.useRef)(a),E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C.current+=1;let t=xN(C.current);_(n=>[...n,{id:t,launch:e}]),b(t)},t[5]=E):E=t[5];let D=E,O=(0,Q.useRef)(D),k;t[6]!==y||t[7]!==o?(k=function(e){let t=S.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>SN(e))}_(r),r.length===0&&(o(!1),f.current?.focus())},t[6]=y,t[7]=o,t[8]=k):k=t[8];let A=k,j=(0,Q.useRef)(EN),M;t[9]!==y||t[10]!==A||t[11]!==g?(M=()=>{O.current=D,x.current=y,S.current=g,j.current=()=>{y!==``&&A(y)}},t[9]=y,t[10]=A,t[11]=g,t[12]=M):M=t[12],(0,Q.useEffect)(M);let[N]=(0,Q.useState)(TN),P=(0,Q.useRef)(N),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){R.current!=null&&clearTimeout(R.current),R.current=setTimeout(()=>{uN(e),R.current=null},100)},t[13]=z):z=t[13];let B=z,V=(0,Q.useRef)(null),H,U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>()=>{R.current!=null&&clearTimeout(R.current),V.current!=null&&(window.removeEventListener(`pointerup`,V.current),V.current=null)},U=[],t[14]=H,t[15]=U):(H=t[14],U=t[15]),(0,Q.useEffect)(H,U);let W,G;t[16]!==c||t[17]!==g.length||t[18]!==a?(W=()=>{let e=T.current;if(T.current=a,c!=null&&c.nonce!==w.current){w.current=c.nonce,O.current(c);return}a&&!e&&g.length===0&&O.current(null)},G=[a,c,g.length],t[16]=c,t[17]=g.length,t[18]=a,t[19]=W,t[20]=G):(W=t[19],G=t[20]),(0,Q.useEffect)(W,G);let K,q;t[21]===n?(K=t[22],q=t[23]):(K=()=>n.onMenuAction(e=>{e===`new-terminal`?O.current(null):e===`kill-terminal`&&j.current()}),q=[n],t[21]=n,t[22]=K,t[23]=q),(0,Q.useEffect)(K,q);let J,ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(bN)?.contains(document.activeElement))return;let t=S.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>SN(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[24]=J,t[25]=ee):(J=t[24],ee=t[25]),(0,Q.useEffect)(J,ee);let Y;t[26]!==n.editor||t[27]!==g.length?(Y=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[26]=n.editor,t[27]=g.length,t[28]=Y):Y=t[28];let te;t[29]!==n||t[30]!==g.length?(te=[n,g.length],t[29]=n,t[30]=g.length,t[31]=te):te=t[31],(0,Q.useEffect)(Y,te);let X,ne;t[32]!==d||t[33]!==a?(X=()=>{let e=d.current;e!=null&&(a?e.resize(`${P.current}px`):e.collapse())},ne=[a,d],t[32]=d,t[33]=a,t[34]=X,t[35]=ne):(X=t[34],ne=t[35]),(0,Q.useEffect)(X,ne);let re,ie;t[36]===p?(re=t[37],ie=t[38]):(re=()=>{p&&document.getElementById(bN)?.contains(document.activeElement)&&f.current?.focus()},ie=[p],t[36]=p,t[37]=re,t[38]=ie),(0,Q.useLayoutEffect)(re,ie);let ae,oe;t[39]===p?(ae=t[40],oe=t[41]):(ae=()=>{p||SN(x.current)},oe=[p],t[39]=p,t[40]=ae,t[41]=oe),(0,Q.useEffect)(ae,oe);let se;if(t[42]!==l||t[43]!==g){let e;t[45]===l?e=t[46]:(e=(e,t)=>({id:e.id,label:l({id:`OVjNeX`,values:{0:t+1}})}),t[45]=l,t[46]=e),se=g.map(e),t[42]=l,t[43]=g,t[44]=se}else se=t[44];let ce=se,le=F||void 0,ue;t[47]===r?ue=t[48]:(ue=(0,Z.jsx)(ST,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:f,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[47]=r,t[48]=ue);let de;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(CT,{withHandle:!0,onPointerDown:()=>{I(!0),L.current=!0;let e=()=>{I(!1),L.current=!1,window.removeEventListener(`pointerup`,e),V.current=null};V.current=e,window.addEventListener(`pointerup`,e)}}),t[49]=de):de=t[49];let fe;t[50]===u?fe=t[51]:(fe=pl(u),t[50]=u,t[51]=fe);let pe;t[52]===fe.background?pe=t[53]:(pe={backgroundColor:fe.background},t[52]=fe.background,t[53]=pe);let me=a?`${N}px`:0,he;t[54]!==o||t[55]!==a?(he=e=>{let t=e.asPercentage===0;m(t),L.current&&(t&&a?o(!1):!t&&!a&&o(!0),e.inPixels>0&&(P.current=e.inPixels,B(e.inPixels)))},t[54]=o,t[55]=a,t[56]=he):he=t[56];let ge=!F&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,_e;t[57]===ge?_e=t[58]:(_e=Oi(`flex flex-col`,ge),t[57]=ge,t[58]=_e);let ve;t[59]!==y||t[60]!==n||t[61]!==A||t[62]!==g||t[63]!==ce?(ve=g.length>0?(0,Z.jsx)(yN,{sessions:ce,activeSessionId:y,onSelect:b,onTabActivate:wN,onNew:()=>D(null),onClose:A,className:`h-full`,children:g.map(e=>(0,Z.jsx)(rN,{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)(pN,{bridge:n,launch:e.launch,onClose:()=>A(e.id)})},e.id))}):null,t[59]=y,t[60]=n,t[61]=A,t[62]=g,t[63]=ce,t[64]=ve):ve=t[64];let ye;t[65]!==p||t[66]!==d||t[67]!==pe||t[68]!==me||t[69]!==he||t[70]!==_e||t[71]!==ve?(ye=(0,Z.jsx)(ST,{id:bN,style:pe,panelRef:d,defaultSize:me,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:he,inert:p,className:_e,children:ve}),t[65]=p,t[66]=d,t[67]=pe,t[68]=me,t[69]=he,t[70]=_e,t[71]=ve,t[72]=ye):ye=t[72];let be;return t[73]!==le||t[74]!==ue||t[75]!==ye?(be=(0,Z.jsxs)(xT,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":le,children:[ue,de,ye]}),t[73]=le,t[74]=ue,t[75]=ye,t[76]=be):be=t[76],be}function wN(e){return queueMicrotask(()=>SN(e))}function TN(){return dN()}function EN(){}var DN=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-3uhLhLyN.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent})),ON=`300px`,kN=`600px`;function AN(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(MN,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(jN,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(f,{name:`editor-area`,children:(0,Z.jsxs)(aT,{children:[n,r]})}),t[3]=n,t[4]=i),i}function jN(){let e=(0,$.c)(5),t=a_(),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)(gT,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function MN(e){let t=(0,$.c)(172),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,terminalBridge:c,terminalVisible:l,onTerminalVisibleChange:u,terminalLaunch:d}=e,f=l===void 0?!1:l,p=d===void 0?null:d,{_:m}=i(),{activeDocName:h,activeProvider:g,activeTarget:_,recycleDocument:v,docPanelMode:y,docPanelAgentId:b,docPanelExpandSignal:x}=yt(),{openDocumentTransition:S}=Mt(),{requestAddProperty:C}=sT(),w=GT(g,h),T=JT(h,n===`source`?`source`:`wysiwyg`),E=mE(g),D=E===`connected`||E===`synced`,O=qT(h)===`conflict`,[k,A]=(0,Q.useState)(!1),j,M;t[0]!==g||t[1]!==k?(j=()=>{g!=null&&!k&&A(!0)},M=[g,k],t[0]=g,t[1]=k,t[2]=j,t[3]=M):(j=t[2],M=t[3]),(0,Q.useEffect)(j,M);let N=(0,Q.useDeferredValue)(h),P=_?.kind===`missing`,F=!!h&&_?.kind!==`folder`,I;t[4]!==m||t[5]!==P?(I=P?m({id:`K-a33w`}):void 0,t[4]=m,t[5]=P,t[6]=I):I=t[6];let L=I,[R]=(0,Q.useState)(IN),z=R!==null,[B]=(0,Q.useState)(FN),V;t[7]===R?V=t[8]:(V=()=>rE(R,window.innerWidth,`right`),t[7]=R,t[8]=V);let[H,U]=(0,Q.useState)(V),W=(0,Q.useRef)(H),G,K;t[9]===H?(G=t[10],K=t[11]):(G=()=>{W.current=H},K=[H],t[9]=H,t[10]=G,t[11]=K),(0,Q.useEffect)(G,K);let q=rS(),J;t[12]===H?J=t[13]:(J=()=>fE(`right`,H,uE())===`collapsed`,t[12]=H,t[13]=J);let[ee]=(0,Q.useState)(J),[Y,te]=(0,Q.useState)(ee),X=(0,Q.useRef)(Y),ne,re;t[14]===Y?(ne=t[15],re=t[16]):(ne=()=>{X.current=Y},re=[Y],t[14]=Y,t[15]=ne,t[16]=re),(0,Q.useEffect)(ne,re);let[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(!1),[se]=(0,Q.useState)(PN),ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){le.current!=null&&clearTimeout(le.current),le.current=setTimeout(()=>{QT(e),le.current=null},100)},t[17]=ue):ue=t[17];let de=ue,fe,pe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>()=>{le.current!=null&&clearTimeout(le.current)},pe=[],t[18]=fe,t[19]=pe):(fe=t[18],pe=t[19]),(0,Q.useEffect)(fe,pe);let[me,he]=(0,Q.useState)(null),ge;t[20]!==Y||t[21]!==q?(ge=function(){if(q.current==null)return;let e=W.current;Y?(pE(`right`,e,`open`),q.current?.expand()):(pE(`right`,e,`collapsed`),q.current?.collapse())},t[20]=Y,t[21]=q,t[22]=ge):ge=t[22];let _e=ge,ve,ye;t[23]!==R||t[24]!==q?(ve=()=>{let e=window.matchMedia(`(min-width: ${tE}px)`),t=()=>{let e=rE(R,window.innerWidth,`right`);U(e);let t=fE(`right`,e,uE())===`collapsed`;te(t),t?q.current?.collapse():q.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ye=[R,q],t[23]=R,t[24]=q,t[25]=ve,t[26]=ye):(ve=t[25],ye=t[26]),(0,Q.useEffect)(ve,ye);let be,xe;t[27]!==me||t[28]!==z||t[29]!==q?(be=()=>{if(me==null||z)return;let e=new ResizeObserver(()=>{X.current||oe.current||q.current?.resize(`${ce.current}px`)});return e.observe(me),()=>e.disconnect()},xe=[me,z,q],t[27]=me,t[28]=z,t[29]=q,t[30]=be,t[31]=xe):(be=t[30],xe=t[31]),(0,Q.useEffect)(be,xe);let Se,Ce;t[32]!==o||t[33]!==q?(Se=()=>{let e=e=>{o(e),q.current?.expand()},t=ig();return t&&e(t),og(t=>{ig(),e(t)})},Ce=[o,q],t[32]=o,t[33]=q,t[34]=Se,t[35]=Ce):(Se=t[34],Ce=t[35]),(0,Q.useEffect)(Se,Ce);let we,Te;t[36]!==x||t[37]!==q?(we=()=>{x!==0&&q.current?.expand()},Te=[x,q],t[36]=x,t[37]=q,t[38]=we,t[39]=Te):(we=t[38],Te=t[39]),(0,Q.useEffect)(we,Te);let Ee,De;t[40]===Y?(Ee=t[41],De=t[42]):(Ee=()=>{if(!Y||!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()},De=[Y],t[40]=Y,t[41]=Ee,t[42]=De),(0,Q.useLayoutEffect)(Ee,De);let Oe,ke;t[43]===Y?(Oe=t[44],ke=t[45]):(Oe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Y})},ke=[Y],t[43]=Y,t[44]=Oe,t[45]=ke),(0,Q.useEffect)(Oe,ke);let Ae,je;t[46]===_e?(Ae=t[47],je=t[48]):(Ae=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&_e()})},je=[_e],t[46]=_e,t[47]=Ae,t[48]=je),(0,Q.useEffect)(Ae,je);let Me,Ne;t[49]===_e?(Me=t[50],Ne=t[51]):(Me=()=>{if(window.okDesktop!=null)return;let e=e=>{Cc(e,`toggle-document-panel`)&&(e.preventDefault(),_e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ne=[_e],t[49]=_e,t[50]=Me,t[51]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=(0,Q.useRef)(null),[Fe,Ie]=(0,Q.useState)(null),[Le,Re]=(0,Q.useState)(!1),ze=_?.kind===`large-file`?_.docName:h,Be,Ve;t[52]===ze?(Be=t[53],Ve=t[54]):(Be=()=>{if(ze&&ze!==Pe.current){let e=Pe.current;Pe.current=ze,Ie(e)}},Ve=[ze],t[52]=ze,t[53]=Be,t[54]=Ve),(0,Q.useEffect)(Be,Ve);let He;t[55]===S?He=t[56]:(He=function(e){let t=ls(e);window.location.hash===t?S(e):window.location.hash=t},t[55]=S,t[56]=He);let Ue=He,Ge,Ke=null;if(_?.kind===`large-file`){let e;t[57]!==Ue||t[58]!==Fe?(e=Fe?{previousDocName:Fe,onNavigateBack:Ue}:void 0,t[57]=Ue,t[58]=Fe,t[59]=e):e=t[59];let n;t[60]!==_.docName||t[61]!==_.limit||t[62]!==_.size||t[63]!==e?(n=(0,Z.jsx)(tT,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[60]=_.docName,t[61]=_.limit,t[62]=_.size,t[63]=e,t[64]=n):n=t[64],Ge=n}else if(_?.kind===`folder`){let e;if(t[65]===_.folderPath?e=t[66]:(e=(0,Z.jsx)(Zw,{folderPath:_.folderPath}),t[65]=_.folderPath,t[66]=e),Ge=e,y===`agent`&&b!==null){let e;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(CT,{withHandle:!0}),t[67]=e):e=t[67];let n;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(ST,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(DN,{showBackButton:!1})})})]}),t[68]=n):n=t[68],Ke=n}}else if(_?.kind===`asset`){let e;t[69]!==_.assetPath||t[70]!==_.mediaKind?(e=(0,Z.jsx)(gS,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[69]=_.assetPath,t[70]=_.mediaKind,t[71]=e):e=t[71],Ge=e}else if(!g||!h)if((typeof window<`u`?Es(window.location.hash):null)!==null)if(c!=null&&k){let e;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(_S,{}),t[72]=e):e=t[72],Ge=e;let n;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(CT,{withHandle:!0,disabled:!0}),t[73]=n):n=t[73];let r=ee?0:`${se}px`,i;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[74]=i):i=t[74];let a;t[75]===r?a=t[76]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(ST,{id:`doc-panel`,defaultSize:r,minSize:ON,maxSize:kN,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[75]=r,t[76]=a),Ke=a}else{let e;return t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(_S,{}),t[77]=e):e=t[77],e}else{let e;t[78]===f?e=t[79]:(e=(0,Z.jsx)(gw,{terminalVisible:f}),t[78]=f,t[79]=e),Ge=e}else{let e=n===`source`,i=!D,s=Y,c;t[80]!==h||t[81]!==C?(c=function(){h&&C(h)},t[80]=h,t[81]=C,t[82]=c):c=t[82];let l=c,u;t[83]!==h||t[84]!==B||t[85]!==z||t[86]!==f?(u=VE({terminalVisible:f,isEmbedded:z,isDesktop:B,activeDocName:h}),t[83]=h,t[84]=B,t[85]=z,t[86]=f,t[87]=u):u=t[87];let d=u,p=N??h,m=Fe??void 0,g;t[88]!==L||t[89]!==e||t[90]!==Ue||t[91]!==v||t[92]!==p||t[93]!==m?(g=(0,Z.jsx)(Hj,{activeDocName:p,isSourceMode:e,editorPlaceholder:L,previousDocName:m,onNavigateBack:Ue,onRecycle:v}),t[88]=L,t[89]=e,t[90]=Ue,t[91]=v,t[92]=p,t[93]=m,t[94]=g):g=t[94];let _;t[95]!==h||t[96]!==e?(_=(0,Z.jsx)(VT,{activeDocName:h,isSourceMode:e}),t[95]=h,t[96]=e,t[97]=_):_=t[97];let b;t[98]!==h||t[99]!==N?(b=QM({activeDocName:h,deferredActiveDocName:N,mountResolved:h!==null&&ut(h),syncResolved:h!==null&&We(h)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(_S,{}),h===null?null:(0,Z.jsx)(nT,{docName:h})]}):null,t[98]=h,t[99]=N,t[100]=b):b=t[100];let x;t[101]!==g||t[102]!==_||t[103]!==b?(x=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[g,_,b]}),t[101]=g,t[102]=_,t[103]=b,t[104]=x):x=t[104];let S;t[105]!==h||t[106]!==O||t[107]!==s||t[108]!==e||t[109]!==r||t[110]!==l||t[111]!==i||t[112]!==_e?(S=!O&&(0,Z.jsx)(ZM,{activeDocName:h,isSourceMode:e,sourceDisabled:i,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:_e}),t[105]=h,t[106]=O,t[107]=s,t[108]=e,t[109]=r,t[110]=l,t[111]=i,t[112]=_e,t[113]=S):S=t[113];let E;t[114]!==h||t[115]!==Le||t[116]!==e||t[117]!==d?(E=d?(0,Z.jsx)(AE,{docName:h,surface:e?`source`:`wysiwyg`,dismissed:Le,onDismiss:()=>Re(!0),onReopen:()=>Re(!1)}):null,t[114]=h,t[115]=Le,t[116]=e,t[117]=d,t[118]=E):E=t[118];let k;t[119]!==x||t[120]!==S||t[121]!==E?(k=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[x,S,E]}),t[119]=x,t[120]=S,t[121]=E,t[122]=k):k=t[122];let A;t[123]!==Le||t[124]!==d?(A=d&&Le?{onReopen:()=>Re(!1)}:null,t[123]=Le,t[124]=d,t[125]=A):A=t[125];let j;t[126]!==T||t[127]!==F||t[128]!==w||t[129]!==A?(j=(0,Z.jsx)(FM,{stats:w,selectionStats:T,showStats:F,composerBadge:A}),t[126]=T,t[127]=F,t[128]=w,t[129]=A,t[130]=j):j=t[130];let M;t[131]!==k||t[132]!==j?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[k,j]}),t[131]=k,t[132]=j,t[133]=M):M=t[133],Ge=M;let P=z&&Y,I;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{ae(!0),oe.current=!0;let e=()=>{ae(!1),oe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[134]=I):I=t[134];let R;t[135]===P?R=t[136]:(R=(0,Z.jsx)(CT,{withHandle:!0,disabled:P,onPointerDown:I}),t[135]=P,t[136]=R);let V=ee?0:`${se}px`,H;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{te(e.asPercentage===0),e.inPixels>0&&oe.current&&(ce.current=e.inPixels,de(e.inPixels))},t[137]=H):H=t[137];let U=!ie&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,W;t[138]===U?W=t[139]:(W=Oi(`flex flex-col bg-muted/20`,U),t[138]=U,t[139]=W);let G;t[140]!==h||t[141]!==a||t[142]!==y||t[143]!==e||t[144]!==o?(G=(0,Z.jsx)(lb,{docName:h,isSourceMode:e,activeTab:a,onActiveTabChange:o,mode:y}),t[140]=h,t[141]=a,t[142]=y,t[143]=e,t[144]=o,t[145]=G):G=t[145];let K;t[146]!==Y||t[147]!==q||t[148]!==V||t[149]!==W||t[150]!==G?(K=(0,Z.jsx)(ST,{id:`doc-panel`,panelRef:q,defaultSize:V,minSize:ON,maxSize:kN,collapsible:!0,collapsedSize:0,onResize:H,inert:Y,className:W,children:G}),t[146]=Y,t[147]=q,t[148]=V,t[149]=W,t[150]=G,t[151]=K):K=t[151];let J;t[152]!==R||t[153]!==K?(J=(0,Z.jsxs)(Z.Fragment,{children:[R,K]}),t[152]=R,t[153]=K,t[154]=J):J=t[154],Ke=J}let qe;t[155]!==u||t[156]!==c||t[157]!==p||t[158]!==f||t[159]!==Ge?(qe=c==null?Ge:(0,Z.jsx)(CN,{bridge:c,visible:f,onVisibleChange:u??NN,launch:p,children:Ge}),t[155]=u,t[156]=c,t[157]=p,t[158]=f,t[159]=Ge,t[160]=qe):qe=t[160];let Je=qe,Ye=ie||void 0,Xe;t[161]!==ee||t[162]!==Ke?(Xe=Ke!=null&&!ee?{}:{defaultSize:`100%`},t[161]=ee,t[162]=Ke,t[163]=Xe):Xe=t[163];let Ze=ie?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Qe;t[164]!==Je||t[165]!==Xe||t[166]!==Ze?(Qe=(0,Z.jsx)(ST,{minSize:`30%`,...Xe,className:Ze,children:Je}),t[164]=Je,t[165]=Xe,t[166]=Ze,t[167]=Qe):Qe=t[167];let $e;return t[168]!==Ke||t[169]!==Ye||t[170]!==Qe?($e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:he,children:(0,Z.jsxs)(xT,{orientation:`horizontal`,"data-dragging":Ye,children:[Qe,Ke]})}),t[168]=Ke,t[169]=Ye,t[170]=Qe,t[171]=$e):$e=t[171],$e}function NN(){}function PN(){return $T()}function FN(){return typeof window<`u`&&window.okDesktop!=null}function IN(){return qr()}function LN(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 RN(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 zN=1e3,BN=!1;function VN(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function HN(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:Wi(i)?a=i:(a=void 0,BN||(BN=!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`&&(VN({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=RN(i),{current:c,crossDoc:l}=a?zi(a,n,Date.now()):{current:[],crossDoc:[]},u=UN,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>LN(e.current,p)&&LN(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,zN);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 UN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var WN=`sync-status`;function GN(e,t){let n=(0,$.c)(6),{_:r}=i(),a=zm(),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(t),l,u;n[0]!==r||n[1]!==t||n[2]!==a||n[3]!==e?(l=()=>{if(c.current!==t&&(c.current=t,o.current=!1,s.current=!1),t)if(e===`synced`&&(o.current=!0),e===`disconnected`&&o.current){if(a){Ls.dismiss(WN);return}s.current=!0,Ls.warning(r({id:`HGNCsl`}),{id:WN,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,Ls.success(r({id:`GhjUB_`}),{id:WN,duration:3e3}))},u=[e,t,r,a],n[0]=r,n[1]=t,n[2]=a,n[3]=e,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,Q.useEffect)(l,u)}var KN=4,qN=3,JN={Bird:jl,Cat:Rl,Dog:Gl,Fish:Xl,Mouse:Cu,Rabbit:Su,Shrimp:ku,Snail:Au,Squirrel:Pu,Turtle:Uu};Object.freeze(Object.keys(JN));function YN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(JN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var XN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function ZN(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=YN(n),c=s.kind===`animal`?JN[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=oi(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Pr(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(tc,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(ic,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function QN(e){let t=XN[e.icon];return e.displayName||t||Is._({id:`iEQQyu`})}function $N(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 eP(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=yt(),{presence:u,agentId:d}=n,f=QN(u),p=$N(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(Hi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(Hi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)($s,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(tc,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(ic,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function tP(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?Is._({id:`9euN0m`,values:{count:n}}):Is._({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)(H,{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)(ZN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(eP,{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)(F,{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)(re,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function nP(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(ZN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(eP,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function rP(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=yt(),{current:s,crossDoc:c}=HN(t,r,n);if(GN(mE(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,KN),n;e[6]===s?n=e[7]:(n=s.slice(KN),e[6]=s,e[7]=n);let r=n,u=c.slice(0,qN),d;e[8]===c?d=e[9]:(d=c.slice(qN),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=>nP(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)(tP,{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=>nP(e,p,!0,m)),f.length>0?(0,Z.jsx)(tP,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var iP=new Set([`.md`,`.mdx`]);function aP(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function oP(e,t){let n=e.lastIndexOf(`/`),r=n<0?``:e.slice(0,n+1),i=n<0?e:e.slice(n+1),a=i.lastIndexOf(`.`);return`${r}${a<=0?i:i.slice(0,a)}${t}`}function sP(e){return iP.has(aP(e).toLowerCase())}function cP(e,t,n){if(n)return{kind:`allow`,destinationPath:t};let r=aP(e);return r===``?{kind:`allow`,destinationPath:t}:{kind:`allow`,destinationPath:aP(t)?t:oP(t,r)}}var lP=`.md`,uP=/\.(md|mdx)$/i;function dP(e,t=lP){return`${e}${t}`}function fP(e){return zP(e).replace(uP,``)}function pP(e){return ys(e)?gP(e.path):os(e)?e.path:dP(e.docName,e.docExt)}function mP(e){let t=zP(e).match(uP);return t?`.${t[1].toLowerCase()}`:void 0}function hP(e){return zP(e)}function gP(e){let t=zP(e.trim());return t?`${t}/`:``}function _P(e){return e.endsWith(`/`)?hP(e):fP(e)}function vP(e){return e.map(pP)}function yP(e){return[...e].sort().join(`\0`)}function bP(e){return yP(vP(e))}function xP(e){let t=new Set;for(let n of e){if(ys(n)){let e=gP(n.path);e&&t.add(e)}let e=(ys(n)||os(n)?n.path:n.docName).split(`/`).filter(Boolean),r=ys(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function SP(e){if(!e)return[];let t=zP(e.replace(uP,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function CP(e,t,n){let r=mP(e);if(r)return r;let i=n.find(e=>Ps(e)&&e.docName===t);return i?i.docExt??lP:RP(e).includes(`.`)?void 0:lP}function wP(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!os(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function TP(e,t,n){if(mP(e))return null;let r=n.find(e=>os(e)&&e.path===t);return r?r.path:RP(e).includes(`.`)?t:wP(t,n)}function EP(e,t){let n=e.kind===`directory`,r=n?hP(e.path):fP(e.path);if(n)return{kind:`folder`,name:zP(RP(e.path)).replace(uP,``),path:r,treePath:OP(e.path,!0)};let i=TP(e.path,r,t);if(i)return{kind:`asset`,name:zP(RP(i)),path:i,treePath:i};let a=CP(e.path,r,t);return{kind:`file`,name:zP(RP(e.path)).replace(uP,``),path:r,treePath:OP(e.path,!1),docExt:a}}function DP(e){return e.kind===`directory`?hP(e.path):e.path}function OP(e,t){return t?gP(e):uP.test(e)?e:`${e}${lP}`}function kP(e,t,n){let r=gP(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${lP}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function AP(e,t){return e===`file`?OP(t,!1):`${hP(t)}/index${lP}`}function jP(e,t){return t.kind===`root`||t.directoryPath==null?RP(e):`${t.directoryPath}${RP(e)}`}function MP(e,t){if(t)return hP(gP(e));let n=fP(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function NP(e,t){let n=hP(gP(e));return n?`${n}/${t}`:t}function PP(e,t){return(t.path??NP(e,t.src)).replace(/^\/+/,``)}function FP(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function IP(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function LP(e,t){let n=aP(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:fP(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:nr(i),modified:r,size:t.size}}function RP(e){let t=zP(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function zP(e){return e.endsWith(`/`)?e.slice(0,-1):e}function BP(e,t){return t.trim()}function VP(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function HP(e,t){let n=BP(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function UP(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(Ps(e)){let t=s.get(dP(e.docName,e.docExt));if(t){let n=cs(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:nr(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(ys(e))return{...e,path:XP(e.path,n)};if(os(e)){let t=s.get(e.path);return t&&sP(t)?{kind:`document`,docName:fP(t),docExt:aP(t),size:e.size,modified:e.modified}:{...e,path:t??XP(e.path,n)}}return e})}function WP(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>Ps(e)?!i.has(e.docName)&&!eF(e.docName,n):ys(e)?!eF(e.path,n):os(e)?!a.has(e.path)&&!eF(e.path,n):!0)}function GP(e,t){if(e.kind!==`asset`||t.some(t=>os(t)&&t.path===e.path))return e;let n=wP(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function KP(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>ZP(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Ps(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>ys(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(Ps(i)){let e=$P(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(ys(i)){let e=QP(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function qP(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function JP(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function YP(e,t){let n=e.kind===`file`?dP(e.path,e.docExt):e.path;return A_(t.contentDir,n,t.pathSeparator)}function XP(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 ZP(e,t){return Ps(e)&&Ps(t)?e.docName===t.docName:ys(e)&&ys(t)||os(e)&&os(t)?e.path===t.path:!1}function QP(e,t,n){return e===t?n:$P(e,t,n)}function $P(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function eF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function tF(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)(Wd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function nF(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=Oi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Gd,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}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)(Jd,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function iF(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)(ef,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function aF(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=Oi(`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)(Kd,{children:(0,Z.jsx)(qd,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oF(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=Oi(`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)(Xd,{"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 sF(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=Oi(`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)(ts,{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)(tf,{"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 cF(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=Oi(`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)(nf,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function lF(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=Oi(`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)(Qd,{children:(0,Z.jsx)(Zo,{})})}),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)(Zd,{"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 uF(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=Oi(`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)(Yd,{"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 dF(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=Oi(`-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)($d,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var fF=`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`,pF=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,mF={start:[Ha.Space],cancel:[Ha.Esc],end:[Ha.Space,Ha.Enter]};function hF(e){return Oi(fF,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function gF(e){return e?void 0:-1}function _F({className:e,isDragging:t}){return Oi(e,t&&pF)}function vF(e){return e.code===Ha.Enter&&e.target===e.currentTarget}function yF({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&vF(e)?`activate-tab`:`delegate-sortable`}function bF({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Oo.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 xF(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 SF(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 CF=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 Ea(e)},wF=[`.md`,`.mdx`],TF=`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`,EF=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,DF=Oi(EF,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),OF=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function kF(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function AF(e){let t=ls(e);window.location.hash!==t&&(window.location.hash=t)}function jF(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function MF(e,t){let n=[t,...wF].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 NF(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:_}=ma(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=bF({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=yF({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 PF(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=tt(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=tt(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(nF,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(oF,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(oF,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(oF,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dF,{}),(0,Z.jsx)(oF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(aF,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(tF,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function FF(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:a,isPinned:o,tabId:s,unpinTab:c}=e,{_:l}=i();if(o){let e;t[0]!==l||t[1]!==n?(e=l({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=l,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s||t[4]!==c?(r=e=>{e.stopPropagation(),c(s)},t[3]=s,t[4]=c,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(xu,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let u;t[10]!==l||t[11]!==n?(u=l({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=l,t[11]=n,t[12]=u):u=t[12];let d;t[13]===a?d=t[14]:(d=hF(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=gF(a),t[15]=a,t[16]=f);let p;t[17]!==r||t[18]!==s?(p=e=>{e.stopPropagation(),r(s)},t[17]=r,t[18]=s,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Rs,{"aria-hidden":`true`}),t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p?(h=(0,Z.jsx)(Ai,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u,"data-testid":`editor-tab-close-button`,className:d,tabIndex:f,onClick:p,children:m}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=h):h=t[25],h}function IF(e){let t=(0,$.c)(1),{docName:n}=e;if(qT(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(as,{"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 LF(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=yt(),{_:T}=i(),{pageMeta:E}=Ts(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?ze(a):t?it(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=G):G=e[3];let K=G,q;e[4]!==r||e[5]!==K||e[6]!==h||e[7]!==g||e[8]!==v?(q=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:K?`${K}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=K,e[6]=h,e[7]=g,e[8]=v,e[9]=q):q=e[9];let J=q,ee,Y;e[10]===t?(ee=e[11],Y=e[12]):(ee=()=>{W.current=t},Y=[t],e[10]=t,e[11]=ee,e[12]=Y),(0,Q.useEffect)(ee,Y);let te,X;e[13]===J?(te=e[14],X=e[15]):(te=()=>{J&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},X=[J],e[13]=J,e[14]=te,e[15]=X),(0,Q.useEffect)(te,X);let ne,re;e[16]===A?(ne=e[17],re=e[18]):(ne=()=>{A&&(z.current?.focus(),z.current?.select())},re=[A],e[16]=A,e[17]=ne,e[18]=re),(0,Q.useEffect)(ne,re);let ie,ae;e[19]!==v||e[20]!==A?(ie=()=>{!A||v.includes(A.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),R(!1))},ae=[v,A],e[19]=v,e[20]=A,e[21]=ie,e[22]=ae):(ie=e[21],ae=e[22]),(0,Q.useEffect)(ie,ae);let oe=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},se=function(){H.current=!0,U.current=null,M(null),P(``),I(null),R(!1)},ce=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=A?.docName;if(!e){se();return}let t=BP(`file`,MF(N,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===U.current){z.current?.focus();return}if(!VP(t)){I(T({id:`P8yDjG`})),z.current?.focus();return}let i=HP({kind:`file`,path:e,name:r},t);V.current=!0,R(!0),I(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){R(!1),V.current=!1;return}let r=await j(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),V.current=!1,U.current=t,z.current?.focus();return}let a=B(mi,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=qP(o,a);fe(a);let c=!0;try{let e=JP(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),ks([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),Ls.error(T({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),R(!1),V.current=!1,U.current=null,c&&s&&s!==o&&AF(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(T({id:`HIb0vl`})),R(!1),V.current=!1,U.current=t,z.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===g?ue=e[24]:(ue=new Set(g),e[23]=g,e[24]=ue);let de=ue,pe;e[25]===O?pe=e[26]:(pe=SF(O),e[25]=O,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==u||e[30]!==f||e[31]!==de?(ge=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=de,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:oa,keyboardCodes:mF},e[34]=ye):ye=e[34];let be=$a(Ki(Wa,ve),Ki(Ba,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){k(xF(D.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){k(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==S||e[39]!==w?(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=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Pa([...w],r,i),t)},e[37]=we,e[38]=S,e[39]=w,e[40]=Te):Te=e[40];let Ee=Te,De=le?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=Oi(`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]`,le&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=jF,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=Oi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let je=fa,Me=CF,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=ca,Fe;e[44]===w?Fe=e[45]:(Fe=[...w],e[44]=w,e[45]=Fe);let Ie=Ra,Le=w.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(PF,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(NF,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Oi(TF,t?EF:DF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:OF,onClick:()=>c(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:hF(t),tabIndex:gF(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(Rs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=Xt(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=tn(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(PF,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(NF,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Oi(TF,n?EF:DF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:OF,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:Oi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Oi(`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)(FF,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=tn(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(PF,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(NF,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Oi(TF,n?EF:DF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:OF,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:Oi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Oi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(FF,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=tn(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=A?.tabId===e,x=`editor-tab-rename-error-${kF(a)}`;return(0,Z.jsx)(PF,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(NF,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Oi(TF,n?EF:DF,v&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(wT,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(kT,{ref:z,value:N,disabled:L,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?x:void 0,"aria-busy":L||void 0,title:F??a,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{P(MF(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(ET,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(OT,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:OF,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,a)},tabIndex:-1,children:[(0,Z.jsx)(IF,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(FF,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),Re;e[46]!==Pe||e[47]!==Fe||e[48]!==Ie||e[49]!==Le?(Re=(0,Z.jsx)(Pe,{items:Fe,strategy:Ie,children:Le}),e[46]=Pe,e[47]=Fe,e[48]=Ie,e[49]=Le,e[50]=Re):Re=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]!==Re||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:Re}),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]=Re,e[60]=he,e[61]=Be):Be=e[61];let Ve;e[62]===T?Ve=e[63]:(Ve=T({id:`3YvS-c`}),e[62]=T,e[63]=Ve);let He;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(At,{"aria-hidden":`true`}),e[64]=He):He=e[64];let Ue;e[65]!==_||e[66]!==Ve?(Ue=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:He})}),e[65]=_,e[66]=Ve,e[67]=Ue):Ue=e[67];let We;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(tc,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=We):We=e[68];let Ge;e[69]===Ue?Ge=e[70]:(Ge=(0,Z.jsxs)(ic,{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:D,"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}function RF(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 zF(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 BF=[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:T},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:tp},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:RF},{label:`X`,href:`https://x.com/OpenKnowledgeAI`,icon:zF},{label:`Open Knowledge`,href:`https://openknowledge.ai/`,icon:np,iconClassName:`scale-125 grayscale transition-[filter] group-hover:grayscale-0`}],VF=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(en,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(H,{asChild:!0,children:(0,Z.jsxs)(Ai,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(ic,{children:[o,(0,Z.jsx)(tc,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=BF.map(e=>{let{label:n,href:r,icon:i,iconClassName:a}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>qi(e,r),onAuxClick:e=>qi(e,r),className:`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`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:Oi(`size-4 shrink-0`,a)}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(F,{align:`end`,className:`w-48 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(re,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m},HF=50,UF=()=>{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,lT.preload()},HF))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=t_)},u=(0,Z.jsx)(Du,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsxs)(Ai,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(ic,{children:[d,(0,Z.jsx)(tc,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f},WF=`https://openknowledge.ai/docs/features/share`;function GF(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=Fo(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),p;t[0]===u?.autoCopyFailed?p=t[1]:(p=()=>{!u?.autoCopyFailed||!f.current||(f.current.focus(),f.current.select())},t[0]=u?.autoCopyFailed,t[1]=p);let m;t[2]===u?m=t[3]:(m=[u],t[2]=u,t[3]=m),(0,Q.useEffect)(p,m);let h=o?.hasRemote===!0,g=n===null,v;t[4]!==a||t[5]!==c||t[6]!==h||t[7]!==n||t[8]!==r?(v=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await Qi({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:vo,toastSuccess:$F,toastError:QF,logEvent:ZF});e.kind===`copied`?d({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&d({url:e.shareUrl,autoCopyFailed:!0})}catch{Ls.error(a({id:`u3YnKw`}))}l(!1)}},t[4]=a,t[5]=c,t[6]=h,t[7]=n,t[8]=r,t[9]=v):v=t[9];let y=v,b=u!==null,x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[10]=x):x=t[10];let S;t[11]!==a||t[12]!==n?.kind?(S=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[11]=a,t[12]=n?.kind,t[13]=S):S=t[13];let C=c||g,w,T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Ou,{className:`size-3.5`,"aria-hidden":!0}),T=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[14]=w,t[15]=T):(w=t[14],T=t[15]);let E;t[16]!==y||t[17]!==S||t[18]!==C?(E=(0,Z.jsx)(O,{asChild:!0,children:(0,Z.jsxs)(Ai,{variant:`ghost`,size:`sm`,"aria-label":S,onClick:y,disabled:C,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[w,T]})}),t[16]=y,t[17]=S,t[18]=C,t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`Z8lGw6`})}),t[20]=D):D=t[20];let k;t[21]===u?.autoCopyFailed?k=t[22]:(k=u?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}):null,t[21]=u?.autoCopyFailed,t[22]=k);let A=u?.url??``,j;t[23]===a?j=t[24]:(j=a({id:`5-FeN2`}),t[23]=a,t[24]=j);let M;t[25]!==A||t[26]!==j?(M=(0,Z.jsx)($o,{ref:f,readOnly:!0,value:A,onFocus:XF,onClick:YF,onContextMenu:JF,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":j}),t[25]=A,t[26]=j,t[27]=M):M=t[27];let N=u?.url??``,P=u?.autoCopyFailed===!1,I;t[28]!==N||t[29]!==P?(I=(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)(_,{copyContent:N,clipboardWrite:vo,initialCopied:P})})}),t[28]=N,t[29]=P,t[30]=I):I=t[30];let L;t[31]!==M||t[32]!==I?(L=(0,Z.jsxs)(`div`,{className:`relative`,children:[M,I]}),t[31]=M,t[32]=I,t[33]=L):L=t[33];let R;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(`a`,{href:WF,target:`_blank`,rel:`noopener noreferrer`,onClick:qF,onAuxClick:KF,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)(en,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(s,{id:`aByJ8j`})]}),t[34]=R):R=t[34];let z;t[35]!==k||t[36]!==L?(z=(0,Z.jsxs)(F,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[D,k,L,R]}),t[35]=k,t[36]=L,t[37]=z):z=t[37];let B;return t[38]!==E||t[39]!==z||t[40]!==b?(B=(0,Z.jsxs)(re,{open:b,onOpenChange:x,children:[E,z]}),t[38]=E,t[39]=z,t[40]=b,t[41]=B):B=t[41],B}function KF(e){return qi(e,WF)}function qF(e){return qi(e,WF)}function JF(e){return e.currentTarget.select()}function YF(e){return e.currentTarget.select()}function XF(e){return e.currentTarget.select()}function ZF(e){return console.log(e)}function QF(e){e!==`Link ready but could not copy to clipboard.`&&Ls.error(e)}function $F(e){return Ls.success(e)}function eI(e){let t=(0,$.c)(34),{onSignIn:n,onSetIdentity:r,onOpenSearch:a}=e,{_:o}=i(),{activeDocName:c,activeTarget:l}=yt(),{state:u,isDraggingRail:d}=pM(),f=e_(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Sc(`toggle-files-sidebar`),t[0]=p):p=t[0];let m=p,h=Sc(`command-palette`),[g,_]=(0,Q.useState)(!1),v;bb0:{if(l?.kind===`folder`){let e;t[1]===l.folderPath?e=t[2]:(e=Aa(l.folderPath),t[1]=l.folderPath,t[2]=e),v=e;break bb0}if(c){let e;t[3]===c?e=t[4]:(e=Po(c),t[3]=c,t[4]=e),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[5]!==C||t[6]!==w?(T=Oi(`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[5]=C,t[6]=w,t[7]=T):T=t[7];let E=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ic,{children:[(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(vM,{className:Oi(`-ml-1 shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(tc,{children:u===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:m}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:m}})})]}),x&&a&&(0,Z.jsxs)(ic,{children:[(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":o({id:`IN4UX8`,values:{searchShortcut:h}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Oi(`shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(A,{"aria-hidden":`true`})})}),(0,Z.jsx)(tc,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:h}})})]}),(0,Z.jsx)(so,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(LF,{})]}),D;t[8]===E?D=t[9]:(D=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:E}),t[8]=E,t[9]=D);let O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=Oi(`flex shrink-0 items-center justify-end gap-2 px-3`,b&&`[&>*]:[-webkit-app-region:no-drag]`),t[10]=O):O=t[10];let k;t[11]!==g||t[12]!==_||t[13]!==y||t[14]!==f?(k=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(GF,{input:y,onClickWhenNoRemote:()=>_(!0)}),(0,Z.jsx)(Io,{open:g,onOpenChange:_})]}),t[11]=g,t[12]=_,t[13]=y,t[14]=f,t[15]=k):k=t[15];let j;t[16]!==r||t[17]!==n?(j=(0,Z.jsx)(uo,{onSignIn:n,onSetIdentity:r}),t[16]=r,t[17]=n,t[18]=j):j=t[18];let M,N,P;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(rP,{}),N=(0,Z.jsx)(so,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),P=(0,Z.jsx)(Tf,{}),t[19]=M,t[20]=N,t[21]=P):(M=t[19],N=t[20],P=t[21]);let F;t[22]===f?F=t[23]:(F=!f&&(0,Z.jsx)(UF,{}),t[22]=f,t[23]=F);let I;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(VF,{}),t[24]=I):I=t[24];let L;t[25]!==k||t[26]!==j||t[27]!==F?(L=(0,Z.jsxs)(`div`,{className:O,children:[k,j,M,N,P,F,I]}),t[25]=k,t[26]=j,t[27]=F,t[28]=L):L=t[28];let R;return t[29]!==L||t[30]!==S||t[31]!==T||t[32]!==D?(R=(0,Z.jsxs)(`header`,{"data-electron-drag":S,className:T,children:[D,L]}),t[29]=L,t[30]=S,t[31]=T,t[32]=D,t[33]=R):R=t[33],R}var tI=`open-knowledge:terminal-launch`;function nI(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(tI,{detail:{prompt:e,cli:t}}))}function rI(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(tI,n),()=>t.removeEventListener(tI,n)}function iI(e){let t=(0,$.c)(53),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=Vv(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(ib[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),x=(0,Q.useRef)(0),S=Ja(),{projectConfig:C,projectLocalConfig:w,projectLocalSynced:T,projectSynced:E}=ge(),{activeDocName:D}=yt(),O=S?.hasRemote,k=S?.pushPermission?.checkStatus,A;t[2]!==m||t[3]!==C||t[4]!==w||t[5]!==T||t[6]!==E||t[7]!==O||t[8]!==k?(A=Gv({autoSyncOnboardingDismissed:m,hasRemote:O,projectLocalSynced:T,projectSynced:E,projectLocalConfig:w,projectConfig:C,pushPermissionCheckStatus:k}),t[2]=m,t[3]=C,t[4]=w,t[5]=T,t[6]=E,t[7]=O,t[8]=k,t[9]=A):A=t[9];let j=A,M,N;t[10]===D?(M=t[11],N=t[12]):(M=()=>{let e=function(e){let t=e.detail;t&&D&&qc(D,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Nv,e),()=>window.removeEventListener(Nv,e)},N=[D],t[10]=D,t[11]=M,t[12]=N),(0,Q.useEffect)(M,N);let P,F;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?v(oI):e===`new-terminal`&&v(!0)})},F=[],t[13]=P,t[14]=F):(P=t[13],F=t[14]),(0,Q.useEffect)(P,F);let I,L;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{if(window.okDesktop!=null)return;let e=function(e){Cc(e,`toggle-terminal-panel`)&&(e.preventDefault(),v(aI))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},I=[],t[15]=I,t[16]=L):(I=t[15],L=t[16]),(0,Q.useEffect)(L,I);let R,z;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>rI((e,t)=>{v(!0),x.current+=1,b({prompt:e,cli:t,nonce:x.current})}),z=[],t[17]=R,t[18]=z):(R=t[17],z=t[18]),(0,Q.useEffect)(R,z);let B,V;t[19]===_?(B=t[20],V=t[21]):(B=()=>{_||b(null)},V=[_],t[19]=_,t[20]=B,t[21]=V),(0,Q.useEffect)(B,V);let H,U;t[22]===_?(H=t[23],U=t[24]):(H=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:_})},U=[_],t[22]=_,t[23]=H,t[24]=U),(0,Q.useEffect)(H,U);let W,G;t[25]===_?(W=t[26],G=t[27]):(W=()=>{window.okDesktop!=null&&_&&Lo()},G=[_],t[25]=_,t[26]=W,t[27]=G),(0,Q.useEffect)(W,G),Hv(S?.pausedReason);let K;t[28]===a?K=t[29]:(K=function(e){s(e),a(e)},t[28]=a,t[29]=K);let q=K,J,ee;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{d(`auth`),l(!0)},ee=()=>{d(`identity`),l(!0)},t[30]=J,t[31]=ee):(J=t[30],ee=t[31]);let Y;t[32]===r?Y=t[33]:(Y=(0,Z.jsx)(eI,{onSignIn:J,onSetIdentity:ee,onOpenSearch:r}),t[32]=r,t[33]=Y);let te;t[34]!==f||t[35]!==o||t[36]!==q||t[37]!==y||t[38]!==_?(te=(0,Z.jsx)(AN,{editorMode:o,onModeChange:q,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:_,onTerminalVisibleChange:v,terminalLaunch:y}),t[34]=f,t[35]=o,t[36]=q,t[37]=y,t[38]=_,t[39]=te):te=t[39];let X=u===`identity`,ne;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ne=()=>{l(!1)},t[40]=ne):ne=t[40];let re;t[41]!==c||t[42]!==X?(re=(0,Z.jsx)(aa,{open:c,onOpenChange:l,identityPrompt:X,onSuccess:ne}),t[41]=c,t[42]=X,t[43]=re):re=t[43];let ie;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>h(!0),t[44]=ie):ie=t[44];let ae;t[45]===j?ae=t[46]:(ae=(0,Z.jsx)(Uv,{open:j,onResolved:ie}),t[45]=j,t[46]=ae);let oe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Av,{}),t[47]=oe):oe=t[47];let se;return t[48]!==Y||t[49]!==te||t[50]!==re||t[51]!==ae?(se=(0,Z.jsxs)(Z.Fragment,{children:[Y,te,re,ae,oe]}),t[48]=Y,t[49]=te,t[50]=re,t[51]=ae,t[52]=se):se=t[52],se}function aI(e){return!e}function oI(e){return!e}function sI(e){let t=ls(ms(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function cI(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=ea();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)(as,{"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)(as,{"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(lI),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 lI(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Ai,{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:()=>sI(e.file),children:[(0,Z.jsx)(as,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var uI=`<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;Ac(t,{style:t=>Wc(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 XA.set(t.changes,i),i}function $A(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(aA).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(YA);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Dc.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:JA.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function ej(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(aA).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(YA).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 tj(e){let t=new Nc;for(let n of e.field(aA)){let r=e.facet(nA).overrideChunk&&ij(e,n);t.add(n.fromB,n.fromB,QA(e,n,!!r))}return t.finish()}var nj=kc.define({create:e=>tj(e),update(e,t){return t.state.field(aA,!1)==t.startState.field(aA,!1)?e:tj(t.state)},provide:e=>Rc.decorations.from(e)}),rj=new WeakMap;function ij(e,t){let n=rj.get(t);if(n!==void 0)return n;n=null;let r=e.field(YA),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(Mc.widget({widget:new aj(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(xA.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return rj.set(t,n),n}var aj=class extends Tc{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}},oj=new class extends zc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},sj=Mc.line({class:`cm-inlineChangedLine`});function cj(e,t,n,r){let i=ij(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,oj),n.add(o.from,o.from,sj);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 lj=on({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),uj=ce({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),dj=Rc.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 fj({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 pj(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Ar(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?lj:uj,u=[Rc.editable.of(!1),Oc.readOnly.of(!0)],d=[dl,Gc(),...u,l,Rc.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new Rc({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=fj({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new Rc({doc:p,extensions:[dl,Gc(),Rc.editable.of(!1),l,dj,Rc.lineWrapping,qA({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),Rc.updateListener.of(e=>{let t=oA(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=oA(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new UA({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new Rc({doc:p,extensions:[...d,qA({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof Rc)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof Rc)||De(e)},t[13]=A):A=t[13];let j=A,M=b===0,N;t[14]!==f||t[15]!==b?(N=b===null?``:b===0?f({id:`lPzyrU`}):Is._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=N):N=t[16];let P=N,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=F):F=t[17];let I;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,Pl.createPortal)((0,Z.jsx)(Ai,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),I=C.map(e),t[18]=f,t[19]=C,t[20]=I}else I=t[20];let L;t[23]!==M||t[24]!==o||t[25]!==P||t[26]!==d||t[27]!==u?(L=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${M?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:P}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(Ai,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(Ai,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(Ai,{variant:`default`,size:`sm`,disabled:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,t[24]=o,t[25]=P,t[26]=d,t[27]=u,t[28]=L):L=t[28];let R;return t[29]!==L||t[30]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=R):R=t[31],R}async function mj(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 hj(e,t){return mj(e,`content`,t)}async function gj(e){return mj(e,`mine`)}async function _j(e){return mj(e,`theirs`)}async function vj(e){return mj(e,`delete`)}async function yj(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 bj(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=ea(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>ms(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),yj(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await hj(u,e);t.ok||Ls.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),Ls.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(pj,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(vj),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(Ai,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(_j),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(Ai,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(pj,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(gj),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(Ai,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(vj),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(Ai,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)(pj,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function xj(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Wt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var Sj=`__back-nav__`;function Cj(e){return e instanceof Be||e instanceof Ct||e instanceof Fe||e instanceof at||e instanceof It||e instanceof ft?e.docName:null}function wj(e){if(e instanceof Be){let t=e.docName;return{title:Is._({id:`Jejur6`}),summary:Is._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Ct){let t=e.docName;return{title:Is._({id:`V7QxyT`}),summary:Is._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Fe){let t=e.docName;return{title:Is._({id:`1di5fu`}),summary:Is._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof at){let t=e.docName;return{title:Is._({id:`wvbc1r`}),summary:Is._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof It)return{title:Is._({id:`Gfr4fu`}),summary:Is._({id:`j6LB7S`})};if(e instanceof ft){let t=e.docName;return{title:Is._({id:`vv7kpg`}),summary:Is._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Is._({id:`W5A0Ly`});return{title:Is._({id:`29VNqC`}),summary:t}}function Tj(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=wj(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(tw,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(Ai,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(Ai,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(pt(Cj(n)??i),o(a),r(Sj))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function Ej(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)(Tj,{...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]===Sj){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}: ${wj(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)(de,{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 Dj(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Dr(t);return{map:n,keys:Ur(t),parseError:r}}function Oj(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>Dj(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=ur(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=nt(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=_t(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)(kj,{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)(Aj,{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 kj(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 Aj(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function jj(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Dr(t);return{map:n,keys:Ur(t),parseError:r}}function Mj(e){let t=(0,$.c)(127),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>jj(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=ur(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M=(0,Q.useRef)(null);SE(M,j);let N;t[8]!==r||t[9]!==a?(N=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=ri(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=N):N=t[10];let P=N,F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=F):F=t[11];let I=F,L;t[12]===r?L=t[13]:(L=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=L);let R=L,z;t[14]!==P||t[15]!==R?(z=function(e,t){I(e),R(P({[e]:t}),[e])},t[14]=P,t[15]=R,t[16]=z):z=t[16];let B=z,V;t[17]!==P||t[18]!==R?(V=function(e){I(e),R(P({[e]:null}),[e])},t[17]=P,t[18]=R,t[19]=V):V=t[19];let H=V,U;t[20]!==r||t[21]!==a?(U=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=ri(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=U):U=t[22];let W=U,G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e,t){return`${e} ${t}`},t[23]=G):G=t[23];let K=G,q;t[24]!==a||t[25]!==m?(q=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>K(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=q):q=t[26];let J=q,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={activationConstraint:{distance:4}},t[27]=ee):ee=t[27];let Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y={coordinateGetter:oa},t[28]=Y):Y=t[28];let te=$a(Ki(Wa,ee),Ki(Ba,Y)),X;t[29]!==B||t[30]!==p?(X=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=Ro(n,t);(!Object.hasOwn(p,e)||!Tr(n,r))&&B(e,r)},t[29]=B,t[30]=p,t[31]=X):X=t[31];let ne=X,re;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=re):re=t[32];let ie=re,{addPropertySignal:ae,clearAddProperty:oe}=sT(),se;t[33]!==ae||t[34]!==j?(se=ae.get(j)??0,t[33]=ae,t[34]=j,t[35]=se):se=t[35];let ce=se,le,ue;t[36]===ce?(le=t[37],ue=t[38]):(le=()=>{ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},ue=[ce],t[36]=ce,t[37]=le,t[38]=ue),(0,Q.useEffect)(le,ue);let de,fe;t[39]!==oe||t[40]!==j?(de=()=>()=>oe(j),fe=[j,oe],t[39]=oe,t[40]=j,t[41]=de,t[42]=fe):(de=t[41],fe=t[42]),(0,Q.useEffect)(de,fe);let pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Oa[e];return{...t,type:e,value:n,error:null}})},t[43]=pe):pe=t[43];let me=pe,he;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){S(t=>t&&{...t,value:e})},t[44]=he):he=t[44];let ge=he,_e;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=_e):_e=t[45];let ve=_e,ye;t[46]!==r||t[47]!==x||t[48]!==P||t[49]!==p?(ye=function(e){if(!x)return;let t=e??x.value,n=x.name.trim();if(!n){S({...x,value:t,error:r({id:`8_brI5`})});return}if(mr(t)){S({...x,value:t,error:r({id:`hXUWyd`})});return}if(n===`frontmatter`){S({...x,value:t,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,n)){S({...x,value:t,error:r({id:`njU86j`,values:{trimmed:n}})});return}let i=P({[n]:t});if(i.ok){S(null);return}let a=i.fieldErrors?.[n],o=i.error??r({id:`OJeiSH`});S({...x,value:t,error:a??o})},t[46]=r,t[47]=x,t[48]=P,t[49]=p,t[50]=ye):ye=t[50];let be=ye,xe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){S(null)},t[51]=xe):xe=t[51];let Se=xe,Ce;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){w({key:e,draft:e,error:null})},t[52]=Ce):Ce=t[52];let we=Ce,Te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Te):Te=t[53];let Ee=Te,De;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(){w(null)},t[54]=De):De=t[54];let Oe=De,ke;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(ke=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=W(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),I(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=W,t[58]=C,t[59]=ke):ke=t[59];let Ae=ke,je;t[60]!==p||t[61]!==m?(je=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=je):je=t[62];let Me=je,Ne;if(t[63]!==Me){Ne=new Map;for(let e of Me)Ne.set(e,(Ne.get(e)??0)+1);t[63]=Me,t[64]=Ne}else Ne=t[64];if(Me.length===0&&!x&&!h)return null;let Pe=!g,Fe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=e=>_(!e),t[65]=Fe):Fe=t[65];let Ie=!g,Le;t[66]===Ie?Le=t[67]:(Le=(0,Z.jsx)(ts,{"data-expanded":Ie,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Ie,t[67]=Le);let Re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=Re):Re=t[68];let ze;t[69]===Le?ze=t[70]:(ze=(0,Z.jsx)(ns,{asChild:!0,children:(0,Z.jsxs)(Ai,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[Le,Re]})}),t[69]=Le,t[70]=ze);let Be;t[71]===h?Be=t[72]:(Be=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(as,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=Be);let Ve;if(t[73]!==Me){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],Ve=Me.map(e),t[73]=Me,t[74]=Ve}else Ve=t[74];let He;if(t[76]!==B||t[77]!==Ae||t[78]!==Ne||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Me||t[85]!==k||t[86]!==ne){let e;t[88]!==B||t[89]!==Ae||t[90]!==Ne||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==ne?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??Zn(n),i=C?.key===e?C:null,a=(Ne.get(e)??0)>1;return(0,Z.jsx)(ua,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>we(e),onChangeDraft:Ee,onCommit:Ae,onCancel:Oe},onCommit:t=>B(e,t),onChangeType:t=>ne(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=B,t[89]=Ae,t[90]=Ne,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=ne,t[98]=e):e=t[98],He=Me.map(e),t[76]=B,t[77]=Ae,t[78]=Ne,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Me,t[85]=k,t[86]=ne,t[87]=He}else He=t[87];let Ue;t[99]!==Ve||t[100]!==He?(Ue=(0,Z.jsx)(ca,{items:Ve,strategy:yo,children:He}),t[99]=Ve,t[100]=He,t[101]=Ue):Ue=t[101];let We;t[102]!==J||t[103]!==te||t[104]!==Ue?(We=(0,Z.jsx)(fa,{sensors:te,collisionDetection:Ea,onDragEnd:J,children:Ue}),t[102]=J,t[103]=te,t[104]=Ue,t[105]=We):We=t[105];let Ge;t[106]!==B||t[107]!==E||t[108]!==p||t[109]!==k?(Ge=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(ua,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>B(`tags`,e),onChangeType:Nj},`virtual-tags`),t[106]=B,t[107]=E,t[108]=p,t[109]=k,t[110]=Ge):Ge=t[110];let Ke;t[111]!==r||t[112]!==x||t[113]!==be?(Ke=x?(0,Z.jsx)(ia,{draft:x,onChangeName:ve,onChangeType:me,onChangeValue:ge,onCommit:be,onCancel:Se}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(Ai,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ie,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(At,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=be,t[114]=Ke):Ke=t[114];let qe;t[115]!==Be||t[116]!==We||t[117]!==Ge||t[118]!==Ke?(qe=(0,Z.jsxs)(es,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Be,We,Ge,Ke]}),t[115]=Be,t[116]=We,t[117]=Ge,t[118]=Ke,t[119]=qe):qe=t[119];let Je;t[120]!==Pe||t[121]!==ze||t[122]!==qe?(Je=(0,Z.jsx)(`div`,{ref:M,className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(rs,{open:Pe,onOpenChange:Fe,children:[ze,qe]})}),t[120]=Pe,t[121]=ze,t[122]=qe,t[123]=Je):Je=t[123];let Ye;return t[124]!==a||t[125]!==Je?(Ye=(0,Z.jsx)(Ia,{binding:a,children:Je}),t[124]=a,t[125]=Je,t[126]=Ye):Ye=t[126],Ye}function Nj(){}var Pj=G(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Fj(e){let t=e.threshold??Pj;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Ij(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var Lj=G(`ACTIVITY_MOUNT_LIMIT`,3);function Rj(){return n(()=>import(`./SourceEditor-BY_IgcRM.js`),__vite__mapDeps([55,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,56,26,54]),import.meta.url)}var zj=(0,Q.lazy)(async()=>({default:(await Rj()).SourceEditor}));function Bj(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Xe(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function Vj(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Is._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Is._({id:`Sc1bKE`,values:{docName:e}}):Is._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Is._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Is._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Is._({id:`bmC18N`,values:{docName:e}}):Is._({id:`pAgkuZ`,values:{docName:e}})}:null}function Hj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(f,{name:`activity-pool`,children:(0,Z.jsx)(Uj,{...e})}),t[0]=e,t[1]=n),n}function Uj(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=yt(),{pages:u,loading:d}=Ts(),f=Bj(c,n,Lj),p=(0,Q.useRef)(``),m=f.map(Wj).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)ie(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;I(e,t&&t.length>0?t:crypto.randomUUID())}lt(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,X(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)(Xj,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function Wj(e){return e.docName}function Gj(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&<(`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&&(lt(`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&<(`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 Kj(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)(_S,{}),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)(zj,{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 qj(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)(no,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Te,{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)(Ai,{type:`button`,onClick:Jj,children:[(0,Z.jsx)(no,{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 Jj(){return window.location.reload()}function Yj(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 Xj(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=Vj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=qT(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,b]=(0,Q.useState)(!i),x,C;t[5]!==i||t[6]!==_||t[7]!==y?(x=()=>{i&&!_?v(!0):!i&&!y&&b(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=x,t[9]=C):(x=t[8],C=t[9]),(0,Q.useEffect)(x,C);let w=Fj({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&<(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let A;t[19]===n.docName?A=t[20]:(A=()=>S(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=()=>{Ij({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:N})&&(lt(`ok/cold/first-toggle`,{docName:n.docName,mountId:k(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)(qj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Ej,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(Yj,{html:M}):(0,Z.jsx)(_S,{}),children:(0,Z.jsx)(xj,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(bj,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Oj,{provider:n.provider}),!i&&(0,Z.jsx)(Mj,{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)(Kj,{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)(vk,{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)(Gj,{isActive:r,initialScrollTop:z,children:B}),t[45]=r,t[46]=z,t[47]=B,t[48]=V):V=t[48];let H;return t[49]!==L||t[50]!==R||t[51]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[49]=L,t[50]=R,t[51]=V,t[52]=H):H=t[52],H}function Zj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function Qj(e){let{value:t,unit:n}=Zj(e);return n===`rem`?t*16:t}function $j(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var eM=3600*24*7;function tM(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?nM:m,O=g===void 0?eM:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=Qj(b),J;t[6]===x?J=t[7]:(J=Qj(x),t[6]=x,t[7]=J);let ee=J,Y;t[8]!==E||t[9]!==k?(Y=function(e){E&&(P.current=!0,j.current=H.current?0:Qj(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]=Y):Y=t[10];let te=Y,X,ne;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(X=()=>{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}=Zj(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=$j(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(ee,u)),f=$j(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)}},ne=[i,a,D,q,ee,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=X,t[25]=ne):(X=t[24],ne=t[25]),(0,Q.useEffect)(X,ne);let re;return t[26]===te?re=t[27]:(re={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=re),re}function nM(){}var rM=3600*24*7,iM=`18rem`,aM=`3rem`,oM=`app-file-sidebar`,sM=`14.625rem`,cM=`32rem`,lM=`sidebar_width`,uM=/^\d+(?:\.\d+)?(?:rem|px)$/,dM=Q.createContext(null);function fM(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${lM}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return uM.test(n)?n:e}function pM(){let e=Q.use(dM);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function mM(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?iM:c,[u]=Q.useState(gM),d;t[8]===u?d=t[9]:(d=()=>rE(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>fM(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=uE();return fE(`left`,rE(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),pE(`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(hM)},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: ${eE}px)`),t=()=>{let e=rE(u,window.innerWidth,`left`);p(e),C(fE(`left`,e,uE())===`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(oM)?.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=>{Cc(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":aM,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Oi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(dM.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function hM(e){return!e}function gM(){return qr()}function _M(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=pM();if(d===`none`){let e;t[7]===r?e=t[8]:(e=Oi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=Oi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,x;t[20]!==r||t[21]!==b?(x=Oi(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:oM,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function vM(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=pM(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=wc(`toggle-files-sidebar`);l=Ai,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=oM,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=Oi(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(Oe,{}):(0,Z.jsx)(gu,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function yM(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=pM(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:sM,maxResizeWidth:cM,setIsDraggingRail:h,widthCookieName:lM,widthCookieMaxAge:rM},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=tM(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=Oi(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function bM(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}=pM(),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=Oi(`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 xM(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=Oi(`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 SM(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=Oi(`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 CM(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=Oi(`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 wM(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=Oi(`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 TM(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=Oi(`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 EM=Ei(`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 DM(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?ki:`button`,{state:m}=pM(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Oi(EM({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)($s,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(tc,{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)(ic,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function OM(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 kM(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Zr.safeParse(t);return n.success?n.data.currentBranch??null:null}var AM=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:OM({fetchBranch:kM,subscribeToEvent:ws}),jM=AM.subscribe,MM=AM.getSnapshot;function NM(){return(0,Q.useSyncExternalStore)(jM,MM,MM)}function PM(){let e=(0,$.c)(6),t=NM(),n=ja(),{state:r}=pM(),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&&na(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 FM(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:a,composerBadge:o}=e,c=a===void 0?!0:a,{_:l}=i(),u=PM();if(!c&&u===null&&o==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]!==c?(g=l(c?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=c,t[3]=g):g=t[3];let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=_):_=t[4];let y;t[5]!==l||t[6]!==o?(y=o?(0,Z.jsxs)(Ai,{type:`button`,variant:`outline`,onClick:o.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)(Vi,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(v,{className:`size-3`,"aria-hidden":!0})]}):null,t[5]=l,t[6]=o,t[7]=y):y=t[7];let b;t[8]===u?b=t[9]:(b=u===null?null:(0,Z.jsx)(IM,{identity:u}),t[8]=u,t[9]=b);let x;t[10]===b?x=t[11]:(x=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:b}),t[10]=b,t[11]=x);let S;t[12]!==l||t[13]!==d.chars||t[14]!==d.tokens||t[15]!==d.words||t[16]!==m||t[17]!==f||t[18]!==c||t[19]!==h||t[20]!==p?(S=c?(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)(s,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{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)(s,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[12]=l,t[13]=d.chars,t[14]=d.tokens,t[15]=d.words,t[16]=m,t[17]=f,t[18]=c,t[19]=h,t[20]=p,t[21]=S):S=t[21];let C;return t[22]!==g||t[23]!==y||t[24]!==x||t[25]!==S?(C=(0,Z.jsxs)(`section`,{"aria-label":g,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[_,y,x,S]}),t[22]=g,t[23]=y,t[24]=x,t[25]=S,t[26]=C):C=t[26],C}function IM(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)(ic,{children:[(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(tc,{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)(He,{"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 LM(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=Oi(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function RM(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=Oi(`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 zM(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=Oi(`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 BM(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=Oi(`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 VM(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=Oi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(ts,{}),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 HM=1,UM=2,WM=4;function GM(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=tn(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>WM?[...u.slice(0,HM).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(HM,-UM)},...u.slice(-UM).map((e,t)=>d(e,u.length-UM+t))]:u.map((e,t)=>d(e,t));a=LM,t[8]===r?c=t[9]:(c=Oi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=RM,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(KM)}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 KM(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(VM,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(zM,{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)(Kl,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(zM,{className:`min-w-0`,children:(0,Z.jsx)(BM,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var qM={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`},JM=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`,...qM,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},YM=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)(JM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},XM=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)(JM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function ZM(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Sc(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=wc(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(GM,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)($s,{children:(0,Z.jsx)(XM,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(Vo,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(tc,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(ic,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(YM,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Vo,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(tc,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(ic,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(Uo,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(ic,{children:[(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)($s,{children:(0,Z.jsx)(lu,{})})}),(0,Z.jsx)(tc,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=ic,h=Ai,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)($s,{children:u?(0,Z.jsx)(vu,{}):(0,Z.jsx)(_u,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(tc,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function QM(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function $M(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=Oi(`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)(yf,{"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 eN=Ei(`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 tN(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=Oi(eN({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)(bf,{"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 nN(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=Oi(`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)(xf,{"data-slot":`tabs-trigger`,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=Oi(`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)(Sf,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var iN=`ok-terminal-height-v1`,aN=1/3,oN=.5;function sN(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*oN))}function cN(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*aN)}function lN(e,t){let n=sN(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(cN(t),n)}function uN(){return typeof window>`u`?0:window.innerHeight}function dN(e,t){try{let n=e??localStorage,r=t??uN(),i=n.getItem(iN);if(i==null)return lN(cN(r),r);let a=Number.parseInt(i,10);return lN(Number.isFinite(a)?a:cN(r),r)}catch{return 240}}function fN(e,t,n){try{let r=t??localStorage,i=n??uN();r.setItem(iN,String(lN(e,i)))}catch{}}function pN(){try{return typeof localStorage>`u`?240:dN()}catch{return 240}}var mN=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-TPw9e24X.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([57,1,22,6,3,23,9,11,58,59]),import.meta.url));function hN(e){let t=(0,$.c)(11),{bridge:n,onClose:r,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=Mo(),l=Ma(),{_:u}=i(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){Ls.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||Ls.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let i;return t[4]!==n||t[5]!==o||t[6]!==r?(i=(0,Z.jsx)(de,{fallbackRender:_N,onError:gN,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(mN,{bridge:n,className:`h-full`,onClose:r,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i):i=t[7],i}let m;return t[8]!==p||t[9]!==d?(m=d?(0,Z.jsx)(bN,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[8]=p,t[9]=d,t[10]=m):m=t[10],m}function gN(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function _N(e){return(0,Z.jsx)(vN,{...e})}function vN(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(Ai,{onClick:yN,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function yN(){return window.location.reload()}function bN(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=i(),a;t[0]===r?a=t[1]:(a=r({id:`_XWY2J`}),t[0]=r,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(Ai,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let f;return t[15]!==a||t[16]!==s||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{"aria-label":a,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=a,t[16]=s,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function xN(e){let t=(0,$.c)(36),{sessions:n,activeSessionId:r,onSelect:a,onTabActivate:o,onNew:c,onClose:l,children:u,className:d}=e,{_:f}=i(),p;t[0]===d?p=t[1]:(p=Oi(`flex min-h-0 min-w-0 flex-1 flex-col`,d),t[0]=d,t[1]=p);let m;t[2]===f?m=t[3]:(m=f({id:`1MGRQl`}),t[2]=f,t[3]=m);let h;if(t[4]!==f||t[5]!==r||t[6]!==l||t[7]!==o||t[8]!==n){let e;t[10]!==f||t[11]!==r||t[12]!==l||t[13]!==o?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:Oi(`group flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(nN,{value:e.id,onClick:()=>o?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(Ai,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":f({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:Oi(`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(),l(e.id)},children:(0,Z.jsx)(Rs,{"aria-hidden":`true`})})]},e.id)},t[10]=f,t[11]=r,t[12]=l,t[13]=o,t[14]=e):e=t[14],h=n.map(e),t[4]=f,t[5]=r,t[6]=l,t[7]=o,t[8]=n,t[9]=h}else h=t[9];let g;t[15]!==m||t[16]!==h?(g=(0,Z.jsx)(tN,{variant:`line`,"aria-label":m,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:h}),t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;t[18]===f?_=t[19]:(_=f({id:`AB4qw9`}),t[18]=f,t[19]=_);let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(At,{"aria-hidden":`true`}),t[20]=v):v=t[20];let y;t[21]!==c||t[22]!==_?(y=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:c,children:v})}),t[21]=c,t[22]=_,t[23]=y):y=t[23];let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`AB4qw9`})}),t[24]=b):b=t[24];let x;t[25]===y?x=t[26]:(x=(0,Z.jsxs)(ic,{children:[y,b]}),t[25]=y,t[26]=x);let S;t[27]!==g||t[28]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[g,x]}),t[27]=g,t[28]=x,t[29]=S):S=t[29];let C;return t[30]!==r||t[31]!==u||t[32]!==a||t[33]!==p||t[34]!==S?(C=(0,Z.jsxs)($M,{value:r,onValueChange:a,className:p,children:[S,u]}),t[30]=r,t[31]=u,t[32]=a,t[33]=p,t[34]=S,t[35]=C):C=t[35],C}var SN=`terminal-dock-panel`;function CN(e){return`terminal-session-${e}`}function wN(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function TN(e){let t=(0,$.c)(77),{bridge:n,children:r,visible:a,onVisibleChange:o,launch:s}=e,c=s===void 0?null:s,{_:l}=i(),{resolvedTheme:u}=Ar(),d=rS(),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!a),h;t[0]!==c||t[1]!==a?(h=()=>a?[{id:CN(1),launch:c}]:[],t[0]=c,t[1]=a,t[2]=h):h=t[2];let[g,_]=(0,Q.useState)(h),v;t[3]===a?v=t[4]:(v=()=>a?CN(1):``,t[3]=a,t[4]=v);let[y,b]=(0,Q.useState)(v),x=(0,Q.useRef)(y),S=(0,Q.useRef)(g),C=(0,Q.useRef)(+!!a),w=(0,Q.useRef)(a&&c?c.nonce:null),T=(0,Q.useRef)(a),E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C.current+=1;let t=CN(C.current);_(n=>[...n,{id:t,launch:e}]),b(t)},t[5]=E):E=t[5];let D=E,O=(0,Q.useRef)(D),k;t[6]!==y||t[7]!==o?(k=function(e){let t=S.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>wN(e))}_(r),r.length===0&&(o(!1),f.current?.focus())},t[6]=y,t[7]=o,t[8]=k):k=t[8];let A=k,j=(0,Q.useRef)(ON),M;t[9]!==y||t[10]!==A||t[11]!==g?(M=()=>{O.current=D,x.current=y,S.current=g,j.current=()=>{y!==``&&A(y)}},t[9]=y,t[10]=A,t[11]=g,t[12]=M):M=t[12],(0,Q.useEffect)(M);let[N]=(0,Q.useState)(DN),P=(0,Q.useRef)(N),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){R.current!=null&&clearTimeout(R.current),R.current=setTimeout(()=>{fN(e),R.current=null},100)},t[13]=z):z=t[13];let B=z,V=(0,Q.useRef)(null),H,U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>()=>{R.current!=null&&clearTimeout(R.current),V.current!=null&&(window.removeEventListener(`pointerup`,V.current),V.current=null)},U=[],t[14]=H,t[15]=U):(H=t[14],U=t[15]),(0,Q.useEffect)(H,U);let W,G;t[16]!==c||t[17]!==g.length||t[18]!==a?(W=()=>{let e=T.current;if(T.current=a,c!=null&&c.nonce!==w.current){w.current=c.nonce,O.current(c);return}a&&!e&&g.length===0&&O.current(null)},G=[a,c,g.length],t[16]=c,t[17]=g.length,t[18]=a,t[19]=W,t[20]=G):(W=t[19],G=t[20]),(0,Q.useEffect)(W,G);let K,q;t[21]===n?(K=t[22],q=t[23]):(K=()=>n.onMenuAction(e=>{e===`new-terminal`?O.current(null):e===`kill-terminal`&&j.current()}),q=[n],t[21]=n,t[22]=K,t[23]=q),(0,Q.useEffect)(K,q);let J,ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(SN)?.contains(document.activeElement))return;let t=S.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>wN(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[24]=J,t[25]=ee):(J=t[24],ee=t[25]),(0,Q.useEffect)(J,ee);let Y;t[26]!==n.editor||t[27]!==g.length?(Y=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[26]=n.editor,t[27]=g.length,t[28]=Y):Y=t[28];let te;t[29]!==n||t[30]!==g.length?(te=[n,g.length],t[29]=n,t[30]=g.length,t[31]=te):te=t[31],(0,Q.useEffect)(Y,te);let X,ne;t[32]!==d||t[33]!==a?(X=()=>{let e=d.current;e!=null&&(a?e.resize(`${P.current}px`):e.collapse())},ne=[a,d],t[32]=d,t[33]=a,t[34]=X,t[35]=ne):(X=t[34],ne=t[35]),(0,Q.useEffect)(X,ne);let re,ie;t[36]===p?(re=t[37],ie=t[38]):(re=()=>{p&&document.getElementById(SN)?.contains(document.activeElement)&&f.current?.focus()},ie=[p],t[36]=p,t[37]=re,t[38]=ie),(0,Q.useLayoutEffect)(re,ie);let ae,oe;t[39]===p?(ae=t[40],oe=t[41]):(ae=()=>{p||wN(x.current)},oe=[p],t[39]=p,t[40]=ae,t[41]=oe),(0,Q.useEffect)(ae,oe);let se;if(t[42]!==l||t[43]!==g){let e;t[45]===l?e=t[46]:(e=(e,t)=>({id:e.id,label:l({id:`OVjNeX`,values:{0:t+1}})}),t[45]=l,t[46]=e),se=g.map(e),t[42]=l,t[43]=g,t[44]=se}else se=t[44];let ce=se,le=F||void 0,ue;t[47]===r?ue=t[48]:(ue=(0,Z.jsx)(ST,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:f,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[47]=r,t[48]=ue);let de;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(CT,{withHandle:!0,onPointerDown:()=>{I(!0),L.current=!0;let e=()=>{I(!1),L.current=!1,window.removeEventListener(`pointerup`,e),V.current=null};V.current=e,window.addEventListener(`pointerup`,e)}}),t[49]=de):de=t[49];let fe;t[50]===u?fe=t[51]:(fe=pl(u),t[50]=u,t[51]=fe);let pe;t[52]===fe.background?pe=t[53]:(pe={backgroundColor:fe.background},t[52]=fe.background,t[53]=pe);let me=a?`${N}px`:0,he;t[54]!==o||t[55]!==a?(he=e=>{let t=e.asPercentage===0;m(t),L.current&&(t&&a?o(!1):!t&&!a&&o(!0),e.inPixels>0&&(P.current=e.inPixels,B(e.inPixels)))},t[54]=o,t[55]=a,t[56]=he):he=t[56];let ge=!F&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,_e;t[57]===ge?_e=t[58]:(_e=Oi(`flex flex-col`,ge),t[57]=ge,t[58]=_e);let ve;t[59]!==y||t[60]!==n||t[61]!==A||t[62]!==g||t[63]!==ce?(ve=g.length>0?(0,Z.jsx)(xN,{sessions:ce,activeSessionId:y,onSelect:b,onTabActivate:EN,onNew:()=>D(null),onClose:A,className:`h-full`,children:g.map(e=>(0,Z.jsx)(rN,{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)(hN,{bridge:n,launch:e.launch,onClose:()=>A(e.id)})},e.id))}):null,t[59]=y,t[60]=n,t[61]=A,t[62]=g,t[63]=ce,t[64]=ve):ve=t[64];let ye;t[65]!==p||t[66]!==d||t[67]!==pe||t[68]!==me||t[69]!==he||t[70]!==_e||t[71]!==ve?(ye=(0,Z.jsx)(ST,{id:SN,style:pe,panelRef:d,defaultSize:me,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:he,inert:p,className:_e,children:ve}),t[65]=p,t[66]=d,t[67]=pe,t[68]=me,t[69]=he,t[70]=_e,t[71]=ve,t[72]=ye):ye=t[72];let be;return t[73]!==le||t[74]!==ue||t[75]!==ye?(be=(0,Z.jsxs)(xT,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":le,children:[ue,de,ye]}),t[73]=le,t[74]=ue,t[75]=ye,t[76]=be):be=t[76],be}function EN(e){return queueMicrotask(()=>wN(e))}function DN(){return pN()}function ON(){}var kN=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-3uhLhLyN.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent})),AN=`300px`,jN=`600px`;function MN(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(PN,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(NN,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(f,{name:`editor-area`,children:(0,Z.jsxs)(aT,{children:[n,r]})}),t[3]=n,t[4]=i),i}function NN(){let e=(0,$.c)(5),t=a_(),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)(gT,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function PN(e){let t=(0,$.c)(172),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,terminalBridge:c,terminalVisible:l,onTerminalVisibleChange:u,terminalLaunch:d}=e,f=l===void 0?!1:l,p=d===void 0?null:d,{_:m}=i(),{activeDocName:h,activeProvider:g,activeTarget:_,recycleDocument:v,docPanelMode:y,docPanelAgentId:b,docPanelExpandSignal:x}=yt(),{openDocumentTransition:S}=Mt(),{requestAddProperty:C}=sT(),w=GT(g,h),T=JT(h,n===`source`?`source`:`wysiwyg`),E=mE(g),D=E===`connected`||E===`synced`,O=qT(h)===`conflict`,[k,A]=(0,Q.useState)(!1),j,M;t[0]!==g||t[1]!==k?(j=()=>{g!=null&&!k&&A(!0)},M=[g,k],t[0]=g,t[1]=k,t[2]=j,t[3]=M):(j=t[2],M=t[3]),(0,Q.useEffect)(j,M);let N=(0,Q.useDeferredValue)(h),P=_?.kind===`missing`,F=!!h&&_?.kind!==`folder`,I;t[4]!==m||t[5]!==P?(I=P?m({id:`K-a33w`}):void 0,t[4]=m,t[5]=P,t[6]=I):I=t[6];let L=I,[R]=(0,Q.useState)(RN),z=R!==null,[B]=(0,Q.useState)(LN),V;t[7]===R?V=t[8]:(V=()=>rE(R,window.innerWidth,`right`),t[7]=R,t[8]=V);let[H,U]=(0,Q.useState)(V),W=(0,Q.useRef)(H),G,K;t[9]===H?(G=t[10],K=t[11]):(G=()=>{W.current=H},K=[H],t[9]=H,t[10]=G,t[11]=K),(0,Q.useEffect)(G,K);let q=rS(),J;t[12]===H?J=t[13]:(J=()=>fE(`right`,H,uE())===`collapsed`,t[12]=H,t[13]=J);let[ee]=(0,Q.useState)(J),[Y,te]=(0,Q.useState)(ee),X=(0,Q.useRef)(Y),ne,re;t[14]===Y?(ne=t[15],re=t[16]):(ne=()=>{X.current=Y},re=[Y],t[14]=Y,t[15]=ne,t[16]=re),(0,Q.useEffect)(ne,re);let[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(!1),[se]=(0,Q.useState)(IN),ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){le.current!=null&&clearTimeout(le.current),le.current=setTimeout(()=>{QT(e),le.current=null},100)},t[17]=ue):ue=t[17];let de=ue,fe,pe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>()=>{le.current!=null&&clearTimeout(le.current)},pe=[],t[18]=fe,t[19]=pe):(fe=t[18],pe=t[19]),(0,Q.useEffect)(fe,pe);let[me,he]=(0,Q.useState)(null),ge;t[20]!==Y||t[21]!==q?(ge=function(){if(q.current==null)return;let e=W.current;Y?(pE(`right`,e,`open`),q.current?.expand()):(pE(`right`,e,`collapsed`),q.current?.collapse())},t[20]=Y,t[21]=q,t[22]=ge):ge=t[22];let _e=ge,ve,ye;t[23]!==R||t[24]!==q?(ve=()=>{let e=window.matchMedia(`(min-width: ${tE}px)`),t=()=>{let e=rE(R,window.innerWidth,`right`);U(e);let t=fE(`right`,e,uE())===`collapsed`;te(t),t?q.current?.collapse():q.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ye=[R,q],t[23]=R,t[24]=q,t[25]=ve,t[26]=ye):(ve=t[25],ye=t[26]),(0,Q.useEffect)(ve,ye);let be,xe;t[27]!==me||t[28]!==z||t[29]!==q?(be=()=>{if(me==null||z)return;let e=new ResizeObserver(()=>{X.current||oe.current||q.current?.resize(`${ce.current}px`)});return e.observe(me),()=>e.disconnect()},xe=[me,z,q],t[27]=me,t[28]=z,t[29]=q,t[30]=be,t[31]=xe):(be=t[30],xe=t[31]),(0,Q.useEffect)(be,xe);let Se,Ce;t[32]!==o||t[33]!==q?(Se=()=>{let e=e=>{o(e),q.current?.expand()},t=ig();return t&&e(t),og(t=>{ig(),e(t)})},Ce=[o,q],t[32]=o,t[33]=q,t[34]=Se,t[35]=Ce):(Se=t[34],Ce=t[35]),(0,Q.useEffect)(Se,Ce);let we,Te;t[36]!==x||t[37]!==q?(we=()=>{x!==0&&q.current?.expand()},Te=[x,q],t[36]=x,t[37]=q,t[38]=we,t[39]=Te):(we=t[38],Te=t[39]),(0,Q.useEffect)(we,Te);let Ee,De;t[40]===Y?(Ee=t[41],De=t[42]):(Ee=()=>{if(!Y||!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()},De=[Y],t[40]=Y,t[41]=Ee,t[42]=De),(0,Q.useLayoutEffect)(Ee,De);let Oe,ke;t[43]===Y?(Oe=t[44],ke=t[45]):(Oe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Y})},ke=[Y],t[43]=Y,t[44]=Oe,t[45]=ke),(0,Q.useEffect)(Oe,ke);let Ae,je;t[46]===_e?(Ae=t[47],je=t[48]):(Ae=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&_e()})},je=[_e],t[46]=_e,t[47]=Ae,t[48]=je),(0,Q.useEffect)(Ae,je);let Me,Ne;t[49]===_e?(Me=t[50],Ne=t[51]):(Me=()=>{if(window.okDesktop!=null)return;let e=e=>{Cc(e,`toggle-document-panel`)&&(e.preventDefault(),_e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ne=[_e],t[49]=_e,t[50]=Me,t[51]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=(0,Q.useRef)(null),[Fe,Ie]=(0,Q.useState)(null),[Le,Re]=(0,Q.useState)(!1),ze=_?.kind===`large-file`?_.docName:h,Be,Ve;t[52]===ze?(Be=t[53],Ve=t[54]):(Be=()=>{if(ze&&ze!==Pe.current){let e=Pe.current;Pe.current=ze,Ie(e)}},Ve=[ze],t[52]=ze,t[53]=Be,t[54]=Ve),(0,Q.useEffect)(Be,Ve);let He;t[55]===S?He=t[56]:(He=function(e){let t=ls(e);window.location.hash===t?S(e):window.location.hash=t},t[55]=S,t[56]=He);let Ue=He,Ge,Ke=null;if(_?.kind===`large-file`){let e;t[57]!==Ue||t[58]!==Fe?(e=Fe?{previousDocName:Fe,onNavigateBack:Ue}:void 0,t[57]=Ue,t[58]=Fe,t[59]=e):e=t[59];let n;t[60]!==_.docName||t[61]!==_.limit||t[62]!==_.size||t[63]!==e?(n=(0,Z.jsx)(tT,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[60]=_.docName,t[61]=_.limit,t[62]=_.size,t[63]=e,t[64]=n):n=t[64],Ge=n}else if(_?.kind===`folder`){let e;if(t[65]===_.folderPath?e=t[66]:(e=(0,Z.jsx)(Zw,{folderPath:_.folderPath}),t[65]=_.folderPath,t[66]=e),Ge=e,y===`agent`&&b!==null){let e;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(CT,{withHandle:!0}),t[67]=e):e=t[67];let n;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(ST,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(kN,{showBackButton:!1})})})]}),t[68]=n):n=t[68],Ke=n}}else if(_?.kind===`asset`){let e;t[69]!==_.assetPath||t[70]!==_.mediaKind?(e=(0,Z.jsx)(gS,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[69]=_.assetPath,t[70]=_.mediaKind,t[71]=e):e=t[71],Ge=e}else if(!g||!h)if((typeof window<`u`?Es(window.location.hash):null)!==null)if(c!=null&&k){let e;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(_S,{}),t[72]=e):e=t[72],Ge=e;let n;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(CT,{withHandle:!0,disabled:!0}),t[73]=n):n=t[73];let r=ee?0:`${se}px`,i;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[74]=i):i=t[74];let a;t[75]===r?a=t[76]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(ST,{id:`doc-panel`,defaultSize:r,minSize:AN,maxSize:jN,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[75]=r,t[76]=a),Ke=a}else{let e;return t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(_S,{}),t[77]=e):e=t[77],e}else{let e;t[78]===f?e=t[79]:(e=(0,Z.jsx)(gw,{terminalVisible:f}),t[78]=f,t[79]=e),Ge=e}else{let e=n===`source`,i=!D,s=Y,c;t[80]!==h||t[81]!==C?(c=function(){h&&C(h)},t[80]=h,t[81]=C,t[82]=c):c=t[82];let l=c,u;t[83]!==h||t[84]!==B||t[85]!==z||t[86]!==f?(u=VE({terminalVisible:f,isEmbedded:z,isDesktop:B,activeDocName:h}),t[83]=h,t[84]=B,t[85]=z,t[86]=f,t[87]=u):u=t[87];let d=u,p=N??h,m=Fe??void 0,g;t[88]!==L||t[89]!==e||t[90]!==Ue||t[91]!==v||t[92]!==p||t[93]!==m?(g=(0,Z.jsx)(Hj,{activeDocName:p,isSourceMode:e,editorPlaceholder:L,previousDocName:m,onNavigateBack:Ue,onRecycle:v}),t[88]=L,t[89]=e,t[90]=Ue,t[91]=v,t[92]=p,t[93]=m,t[94]=g):g=t[94];let _;t[95]!==h||t[96]!==e?(_=(0,Z.jsx)(VT,{activeDocName:h,isSourceMode:e}),t[95]=h,t[96]=e,t[97]=_):_=t[97];let b;t[98]!==h||t[99]!==N?(b=QM({activeDocName:h,deferredActiveDocName:N,mountResolved:h!==null&&ut(h),syncResolved:h!==null&&We(h)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(_S,{}),h===null?null:(0,Z.jsx)(nT,{docName:h})]}):null,t[98]=h,t[99]=N,t[100]=b):b=t[100];let x;t[101]!==g||t[102]!==_||t[103]!==b?(x=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[g,_,b]}),t[101]=g,t[102]=_,t[103]=b,t[104]=x):x=t[104];let S;t[105]!==h||t[106]!==O||t[107]!==s||t[108]!==e||t[109]!==r||t[110]!==l||t[111]!==i||t[112]!==_e?(S=!O&&(0,Z.jsx)(ZM,{activeDocName:h,isSourceMode:e,sourceDisabled:i,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:_e}),t[105]=h,t[106]=O,t[107]=s,t[108]=e,t[109]=r,t[110]=l,t[111]=i,t[112]=_e,t[113]=S):S=t[113];let E;t[114]!==h||t[115]!==Le||t[116]!==e||t[117]!==d?(E=d?(0,Z.jsx)(AE,{docName:h,surface:e?`source`:`wysiwyg`,dismissed:Le,onDismiss:()=>Re(!0),onReopen:()=>Re(!1)}):null,t[114]=h,t[115]=Le,t[116]=e,t[117]=d,t[118]=E):E=t[118];let k;t[119]!==x||t[120]!==S||t[121]!==E?(k=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[x,S,E]}),t[119]=x,t[120]=S,t[121]=E,t[122]=k):k=t[122];let A;t[123]!==Le||t[124]!==d?(A=d&&Le?{onReopen:()=>Re(!1)}:null,t[123]=Le,t[124]=d,t[125]=A):A=t[125];let j;t[126]!==T||t[127]!==F||t[128]!==w||t[129]!==A?(j=(0,Z.jsx)(FM,{stats:w,selectionStats:T,showStats:F,composerBadge:A}),t[126]=T,t[127]=F,t[128]=w,t[129]=A,t[130]=j):j=t[130];let M;t[131]!==k||t[132]!==j?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[k,j]}),t[131]=k,t[132]=j,t[133]=M):M=t[133],Ge=M;let P=z&&Y,I;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{ae(!0),oe.current=!0;let e=()=>{ae(!1),oe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[134]=I):I=t[134];let R;t[135]===P?R=t[136]:(R=(0,Z.jsx)(CT,{withHandle:!0,disabled:P,onPointerDown:I}),t[135]=P,t[136]=R);let V=ee?0:`${se}px`,H;t[137]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{te(e.asPercentage===0),e.inPixels>0&&oe.current&&(ce.current=e.inPixels,de(e.inPixels))},t[137]=H):H=t[137];let U=!ie&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,W;t[138]===U?W=t[139]:(W=Oi(`flex flex-col bg-muted/20`,U),t[138]=U,t[139]=W);let G;t[140]!==h||t[141]!==a||t[142]!==y||t[143]!==e||t[144]!==o?(G=(0,Z.jsx)(lb,{docName:h,isSourceMode:e,activeTab:a,onActiveTabChange:o,mode:y}),t[140]=h,t[141]=a,t[142]=y,t[143]=e,t[144]=o,t[145]=G):G=t[145];let K;t[146]!==Y||t[147]!==q||t[148]!==V||t[149]!==W||t[150]!==G?(K=(0,Z.jsx)(ST,{id:`doc-panel`,panelRef:q,defaultSize:V,minSize:AN,maxSize:jN,collapsible:!0,collapsedSize:0,onResize:H,inert:Y,className:W,children:G}),t[146]=Y,t[147]=q,t[148]=V,t[149]=W,t[150]=G,t[151]=K):K=t[151];let J;t[152]!==R||t[153]!==K?(J=(0,Z.jsxs)(Z.Fragment,{children:[R,K]}),t[152]=R,t[153]=K,t[154]=J):J=t[154],Ke=J}let qe;t[155]!==u||t[156]!==c||t[157]!==p||t[158]!==f||t[159]!==Ge?(qe=c==null?Ge:(0,Z.jsx)(TN,{bridge:c,visible:f,onVisibleChange:u??FN,launch:p,children:Ge}),t[155]=u,t[156]=c,t[157]=p,t[158]=f,t[159]=Ge,t[160]=qe):qe=t[160];let Je=qe,Ye=ie||void 0,Xe;t[161]!==ee||t[162]!==Ke?(Xe=Ke!=null&&!ee?{}:{defaultSize:`100%`},t[161]=ee,t[162]=Ke,t[163]=Xe):Xe=t[163];let Ze=ie?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Qe;t[164]!==Je||t[165]!==Xe||t[166]!==Ze?(Qe=(0,Z.jsx)(ST,{minSize:`30%`,...Xe,className:Ze,children:Je}),t[164]=Je,t[165]=Xe,t[166]=Ze,t[167]=Qe):Qe=t[167];let $e;return t[168]!==Ke||t[169]!==Ye||t[170]!==Qe?($e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:he,children:(0,Z.jsxs)(xT,{orientation:`horizontal`,"data-dragging":Ye,children:[Qe,Ke]})}),t[168]=Ke,t[169]=Ye,t[170]=Qe,t[171]=$e):$e=t[171],$e}function FN(){}function IN(){return $T()}function LN(){return typeof window<`u`&&window.okDesktop!=null}function RN(){return qr()}function zN(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 BN(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 VN=1e3,HN=!1;function UN(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function WN(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:Wi(i)?a=i:(a=void 0,HN||(HN=!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`&&(UN({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=BN(i),{current:c,crossDoc:l}=a?zi(a,n,Date.now()):{current:[],crossDoc:[]},u=GN,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>zN(e.current,p)&&zN(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,VN);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 GN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var KN=`sync-status`;function qN(e,t){let n=(0,$.c)(6),{_:r}=i(),a=zm(),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(t),l,u;n[0]!==r||n[1]!==t||n[2]!==a||n[3]!==e?(l=()=>{if(c.current!==t&&(c.current=t,o.current=!1,s.current=!1),t)if(e===`synced`&&(o.current=!0),e===`disconnected`&&o.current){if(a){Ls.dismiss(KN);return}s.current=!0,Ls.warning(r({id:`HGNCsl`}),{id:KN,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,Ls.success(r({id:`GhjUB_`}),{id:KN,duration:3e3}))},u=[e,t,r,a],n[0]=r,n[1]=t,n[2]=a,n[3]=e,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,Q.useEffect)(l,u)}var JN=4,YN=3,XN={Bird:jl,Cat:Rl,Dog:Gl,Fish:Xl,Mouse:Cu,Rabbit:Su,Shrimp:ku,Snail:Au,Squirrel:Pu,Turtle:Uu};Object.freeze(Object.keys(XN));function ZN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(XN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var QN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function $N(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=ZN(n),c=s.kind===`animal`?XN[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=oi(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Pr(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(tc,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(ic,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function eP(e){let t=QN[e.icon];return e.displayName||t||Is._({id:`iEQQyu`})}function tP(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 nP(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=yt(),{presence:u,agentId:d}=n,f=eP(u),p=tP(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(Hi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(Hi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)($s,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(tc,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(ic,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function rP(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?Is._({id:`9euN0m`,values:{count:n}}):Is._({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)(H,{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)($N,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(nP,{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)(F,{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)(re,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function iP(e,t,n,r){return e.kind===`human`?(0,Z.jsx)($N,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(nP,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function aP(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=yt(),{current:s,crossDoc:c}=WN(t,r,n);if(qN(mE(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,JN),n;e[6]===s?n=e[7]:(n=s.slice(JN),e[6]=s,e[7]=n);let r=n,u=c.slice(0,YN),d;e[8]===c?d=e[9]:(d=c.slice(YN),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=>iP(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)(rP,{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=>iP(e,p,!0,m)),f.length>0?(0,Z.jsx)(rP,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var oP=new Set([`.md`,`.mdx`]);function sP(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function cP(e,t){let n=e.lastIndexOf(`/`),r=n<0?``:e.slice(0,n+1),i=n<0?e:e.slice(n+1),a=i.lastIndexOf(`.`);return`${r}${a<=0?i:i.slice(0,a)}${t}`}function lP(e){return oP.has(sP(e).toLowerCase())}function uP(e,t,n){if(n)return{kind:`allow`,destinationPath:t};let r=sP(e);return r===``?{kind:`allow`,destinationPath:t}:{kind:`allow`,destinationPath:sP(t)?t:cP(t,r)}}var dP=`.md`,fP=/\.(md|mdx)$/i;function pP(e,t=dP){return`${e}${t}`}function mP(e){return VP(e).replace(fP,``)}function hP(e){return ys(e)?vP(e.path):os(e)?e.path:pP(e.docName,e.docExt)}function gP(e){let t=VP(e).match(fP);return t?`.${t[1].toLowerCase()}`:void 0}function _P(e){return VP(e)}function vP(e){let t=VP(e.trim());return t?`${t}/`:``}function yP(e){return e.endsWith(`/`)?_P(e):mP(e)}function bP(e){return e.map(hP)}function xP(e){return[...e].sort().join(`\0`)}function SP(e){return xP(bP(e))}function CP(e){let t=new Set;for(let n of e){if(ys(n)){let e=vP(n.path);e&&t.add(e)}let e=(ys(n)||os(n)?n.path:n.docName).split(`/`).filter(Boolean),r=ys(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function wP(e){if(!e)return[];let t=VP(e.replace(fP,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function TP(e,t,n){let r=gP(e);if(r)return r;let i=n.find(e=>Ps(e)&&e.docName===t);return i?i.docExt??dP:BP(e).includes(`.`)?void 0:dP}function EP(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!os(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function DP(e,t,n){if(gP(e))return null;let r=n.find(e=>os(e)&&e.path===t);return r?r.path:BP(e).includes(`.`)?t:EP(t,n)}function OP(e,t){let n=e.kind===`directory`,r=n?_P(e.path):mP(e.path);if(n)return{kind:`folder`,name:VP(BP(e.path)).replace(fP,``),path:r,treePath:AP(e.path,!0)};let i=DP(e.path,r,t);if(i)return{kind:`asset`,name:VP(BP(i)),path:i,treePath:i};let a=TP(e.path,r,t);return{kind:`file`,name:VP(BP(e.path)).replace(fP,``),path:r,treePath:AP(e.path,!1),docExt:a}}function kP(e){return e.kind===`directory`?_P(e.path):e.path}function AP(e,t){return t?vP(e):fP.test(e)?e:`${e}${dP}`}function jP(e,t,n){let r=vP(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${dP}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function MP(e,t){return e===`file`?AP(t,!1):`${_P(t)}/index${dP}`}function NP(e,t){return t.kind===`root`||t.directoryPath==null?BP(e):`${t.directoryPath}${BP(e)}`}function PP(e,t){if(t)return _P(vP(e));let n=mP(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function FP(e,t){let n=_P(vP(e));return n?`${n}/${t}`:t}function IP(e,t){return(t.path??FP(e,t.src)).replace(/^\/+/,``)}function LP(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function RP(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function zP(e,t){let n=sP(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:mP(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:nr(i),modified:r,size:t.size}}function BP(e){let t=VP(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function VP(e){return e.endsWith(`/`)?e.slice(0,-1):e}function HP(e,t){return t.trim()}function UP(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function WP(e,t){let n=HP(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function GP(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(Ps(e)){let t=s.get(pP(e.docName,e.docExt));if(t){let n=cs(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:nr(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(ys(e))return{...e,path:QP(e.path,n)};if(os(e)){let t=s.get(e.path);return t&&lP(t)?{kind:`document`,docName:mP(t),docExt:sP(t),size:e.size,modified:e.modified}:{...e,path:t??QP(e.path,n)}}return e})}function KP(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>Ps(e)?!i.has(e.docName)&&!nF(e.docName,n):ys(e)?!nF(e.path,n):os(e)?!a.has(e.path)&&!nF(e.path,n):!0)}function qP(e,t){if(e.kind!==`asset`||t.some(t=>os(t)&&t.path===e.path))return e;let n=EP(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function JP(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>$P(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Ps(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>ys(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(Ps(i)){let e=tF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(ys(i)){let e=eF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function YP(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function XP(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function ZP(e,t){let n=e.kind===`file`?pP(e.path,e.docExt):e.path;return A_(t.contentDir,n,t.pathSeparator)}function QP(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 $P(e,t){return Ps(e)&&Ps(t)?e.docName===t.docName:ys(e)&&ys(t)||os(e)&&os(t)?e.path===t.path:!1}function eF(e,t,n){return e===t?n:tF(e,t,n)}function tF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function nF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}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)(Wd,{"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=Oi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Gd,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aF(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)(Jd,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function oF(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)(ef,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function sF(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=Oi(`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)(Kd,{children:(0,Z.jsx)(qd,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function cF(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=Oi(`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)(Xd,{"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 lF(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=Oi(`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)(ts,{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)(tf,{"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 uF(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=Oi(`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)(nf,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dF(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=Oi(`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)(Qd,{children:(0,Z.jsx)(Zo,{})})}),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)(Zd,{"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 fF(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=Oi(`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)(Yd,{"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 pF(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=Oi(`-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)($d,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var mF=`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`,hF=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,gF={start:[Ha.Space],cancel:[Ha.Esc],end:[Ha.Space,Ha.Enter]};function _F(e){return Oi(mF,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function vF(e){return e?void 0:-1}function yF({className:e,isDragging:t}){return Oi(e,t&&hF)}function bF(e){return e.code===Ha.Enter&&e.target===e.currentTarget}function xF({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&bF(e)?`activate-tab`:`delegate-sortable`}function SF({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Oo.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 CF(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 wF(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 TF=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 Ea(e)},EF=[`.md`,`.mdx`],DF=`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`,OF=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,kF=Oi(OF,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),AF=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function jF(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function MF(e){let t=ls(e);window.location.hash!==t&&(window.location.hash=t)}function NF(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function PF(e,t){let n=[t,...EF].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 FF(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:_}=ma(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=SF({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=xF({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=yF({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 IF(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=tt(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=tt(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(iF,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(cF,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(cF,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(cF,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pF,{}),(0,Z.jsx)(cF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(sF,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(rF,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function LF(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:a,isPinned:o,tabId:s,unpinTab:c}=e,{_:l}=i();if(o){let e;t[0]!==l||t[1]!==n?(e=l({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=l,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s||t[4]!==c?(r=e=>{e.stopPropagation(),c(s)},t[3]=s,t[4]=c,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(xu,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let u;t[10]!==l||t[11]!==n?(u=l({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=l,t[11]=n,t[12]=u):u=t[12];let d;t[13]===a?d=t[14]:(d=_F(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=vF(a),t[15]=a,t[16]=f);let p;t[17]!==r||t[18]!==s?(p=e=>{e.stopPropagation(),r(s)},t[17]=r,t[18]=s,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Rs,{"aria-hidden":`true`}),t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p?(h=(0,Z.jsx)(Ai,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u,"data-testid":`editor-tab-close-button`,className:d,tabIndex:f,onClick:p,children:m}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=h):h=t[25],h}function RF(e){let t=(0,$.c)(1),{docName:n}=e;if(qT(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(as,{"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 zF(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=yt(),{_:T}=i(),{pageMeta:E}=Ts(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?ze(a):t?it(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=G):G=e[3];let K=G,q;e[4]!==r||e[5]!==K||e[6]!==h||e[7]!==g||e[8]!==v?(q=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:K?`${K}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=K,e[6]=h,e[7]=g,e[8]=v,e[9]=q):q=e[9];let J=q,ee,Y;e[10]===t?(ee=e[11],Y=e[12]):(ee=()=>{W.current=t},Y=[t],e[10]=t,e[11]=ee,e[12]=Y),(0,Q.useEffect)(ee,Y);let te,X;e[13]===J?(te=e[14],X=e[15]):(te=()=>{J&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},X=[J],e[13]=J,e[14]=te,e[15]=X),(0,Q.useEffect)(te,X);let ne,re;e[16]===A?(ne=e[17],re=e[18]):(ne=()=>{A&&(z.current?.focus(),z.current?.select())},re=[A],e[16]=A,e[17]=ne,e[18]=re),(0,Q.useEffect)(ne,re);let ie,ae;e[19]!==v||e[20]!==A?(ie=()=>{!A||v.includes(A.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),R(!1))},ae=[v,A],e[19]=v,e[20]=A,e[21]=ie,e[22]=ae):(ie=e[21],ae=e[22]),(0,Q.useEffect)(ie,ae);let oe=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},se=function(){H.current=!0,U.current=null,M(null),P(``),I(null),R(!1)},ce=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=A?.docName;if(!e){se();return}let t=HP(`file`,PF(N,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===U.current){z.current?.focus();return}if(!UP(t)){I(T({id:`P8yDjG`})),z.current?.focus();return}let i=WP({kind:`file`,path:e,name:r},t);V.current=!0,R(!0),I(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){R(!1),V.current=!1;return}let r=await j(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),V.current=!1,U.current=t,z.current?.focus();return}let a=B(mi,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=YP(o,a);fe(a);let c=!0;try{let e=XP(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),ks([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),Ls.error(T({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),R(!1),V.current=!1,U.current=null,c&&s&&s!==o&&MF(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(T({id:`HIb0vl`})),R(!1),V.current=!1,U.current=t,z.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===g?ue=e[24]:(ue=new Set(g),e[23]=g,e[24]=ue);let de=ue,pe;e[25]===O?pe=e[26]:(pe=wF(O),e[25]=O,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==u||e[30]!==f||e[31]!==de?(ge=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=de,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:oa,keyboardCodes:gF},e[34]=ye):ye=e[34];let be=$a(Ki(Wa,ve),Ki(Ba,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){k(CF(D.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){k(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==S||e[39]!==w?(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=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Pa([...w],r,i),t)},e[37]=we,e[38]=S,e[39]=w,e[40]=Te):Te=e[40];let Ee=Te,De=le?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=Oi(`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]`,le&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=NF,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=Oi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let je=fa,Me=TF,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=ca,Fe;e[44]===w?Fe=e[45]:(Fe=[...w],e[44]=w,e[45]=Fe);let Ie=Ra,Le=w.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(IF,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(FF,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Oi(DF,t?OF:kF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:AF,onClick:()=>c(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:_F(t),tabIndex:vF(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(Rs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=Xt(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=tn(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(IF,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(FF,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Oi(DF,n?OF:kF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:AF,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:Oi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Oi(`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)(LF,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=tn(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(IF,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(FF,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Oi(DF,n?OF:kF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:AF,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:Oi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Oi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(LF,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=tn(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=A?.tabId===e,x=`editor-tab-rename-error-${jF(a)}`;return(0,Z.jsx)(IF,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(FF,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Oi(DF,n?OF:kF,v&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(wT,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(kT,{ref:z,value:N,disabled:L,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?x:void 0,"aria-busy":L||void 0,title:F??a,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{P(PF(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(ET,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(OT,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:AF,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,a)},tabIndex:-1,children:[(0,Z.jsx)(RF,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(LF,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),Re;e[46]!==Pe||e[47]!==Fe||e[48]!==Ie||e[49]!==Le?(Re=(0,Z.jsx)(Pe,{items:Fe,strategy:Ie,children:Le}),e[46]=Pe,e[47]=Fe,e[48]=Ie,e[49]=Le,e[50]=Re):Re=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]!==Re||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:Re}),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]=Re,e[60]=he,e[61]=Be):Be=e[61];let Ve;e[62]===T?Ve=e[63]:(Ve=T({id:`3YvS-c`}),e[62]=T,e[63]=Ve);let He;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(At,{"aria-hidden":`true`}),e[64]=He):He=e[64];let Ue;e[65]!==_||e[66]!==Ve?(Ue=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:He})}),e[65]=_,e[66]=Ve,e[67]=Ue):Ue=e[67];let We;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(tc,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=We):We=e[68];let Ge;e[69]===Ue?Ge=e[70]:(Ge=(0,Z.jsxs)(ic,{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:D,"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}function BF(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 VF(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 HF=[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:T},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:tp},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:BF},{label:`X`,href:`https://x.com/OpenKnowledgeAI`,icon:VF},{label:`Open Knowledge`,href:`https://openknowledge.ai/`,icon:np,iconClassName:`scale-125 grayscale transition-[filter] group-hover:grayscale-0`}],UF=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(en,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(H,{asChild:!0,children:(0,Z.jsxs)(Ai,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(ic,{children:[o,(0,Z.jsx)(tc,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=HF.map(e=>{let{label:n,href:r,icon:i,iconClassName:a}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>qi(e,r),onAuxClick:e=>qi(e,r),className:`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`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:Oi(`size-4 shrink-0`,a)}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(F,{align:`end`,className:`w-48 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(re,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m},WF=50,GF=()=>{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,lT.preload()},WF))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=t_)},u=(0,Z.jsx)(Du,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsxs)(Ai,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(ic,{children:[d,(0,Z.jsx)(tc,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f},KF=`https://openknowledge.ai/docs/features/share`;function qF(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=Fo(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),p;t[0]===u?.autoCopyFailed?p=t[1]:(p=()=>{!u?.autoCopyFailed||!f.current||(f.current.focus(),f.current.select())},t[0]=u?.autoCopyFailed,t[1]=p);let m;t[2]===u?m=t[3]:(m=[u],t[2]=u,t[3]=m),(0,Q.useEffect)(p,m);let h=o?.hasRemote===!0,g=n===null,v;t[4]!==a||t[5]!==c||t[6]!==h||t[7]!==n||t[8]!==r?(v=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await Qi({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:vo,toastSuccess:tI,toastError:eI,logEvent:$F});e.kind===`copied`?d({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&d({url:e.shareUrl,autoCopyFailed:!0})}catch{Ls.error(a({id:`u3YnKw`}))}l(!1)}},t[4]=a,t[5]=c,t[6]=h,t[7]=n,t[8]=r,t[9]=v):v=t[9];let y=v,b=u!==null,x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[10]=x):x=t[10];let S;t[11]!==a||t[12]!==n?.kind?(S=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[11]=a,t[12]=n?.kind,t[13]=S):S=t[13];let C=c||g,w,T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Ou,{className:`size-3.5`,"aria-hidden":!0}),T=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[14]=w,t[15]=T):(w=t[14],T=t[15]);let E;t[16]!==y||t[17]!==S||t[18]!==C?(E=(0,Z.jsx)(O,{asChild:!0,children:(0,Z.jsxs)(Ai,{variant:`ghost`,size:`sm`,"aria-label":S,onClick:y,disabled:C,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[w,T]})}),t[16]=y,t[17]=S,t[18]=C,t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`Z8lGw6`})}),t[20]=D):D=t[20];let k;t[21]===u?.autoCopyFailed?k=t[22]:(k=u?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}):null,t[21]=u?.autoCopyFailed,t[22]=k);let A=u?.url??``,j;t[23]===a?j=t[24]:(j=a({id:`5-FeN2`}),t[23]=a,t[24]=j);let M;t[25]!==A||t[26]!==j?(M=(0,Z.jsx)($o,{ref:f,readOnly:!0,value:A,onFocus:QF,onClick:ZF,onContextMenu:XF,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":j}),t[25]=A,t[26]=j,t[27]=M):M=t[27];let N=u?.url??``,P=u?.autoCopyFailed===!1,I;t[28]!==N||t[29]!==P?(I=(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)(_,{copyContent:N,clipboardWrite:vo,initialCopied:P})})}),t[28]=N,t[29]=P,t[30]=I):I=t[30];let L;t[31]!==M||t[32]!==I?(L=(0,Z.jsxs)(`div`,{className:`relative`,children:[M,I]}),t[31]=M,t[32]=I,t[33]=L):L=t[33];let R;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(`a`,{href:KF,target:`_blank`,rel:`noopener noreferrer`,onClick:YF,onAuxClick:JF,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)(en,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(s,{id:`aByJ8j`})]}),t[34]=R):R=t[34];let z;t[35]!==k||t[36]!==L?(z=(0,Z.jsxs)(F,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[D,k,L,R]}),t[35]=k,t[36]=L,t[37]=z):z=t[37];let B;return t[38]!==E||t[39]!==z||t[40]!==b?(B=(0,Z.jsxs)(re,{open:b,onOpenChange:x,children:[E,z]}),t[38]=E,t[39]=z,t[40]=b,t[41]=B):B=t[41],B}function JF(e){return qi(e,KF)}function YF(e){return qi(e,KF)}function XF(e){return e.currentTarget.select()}function ZF(e){return e.currentTarget.select()}function QF(e){return e.currentTarget.select()}function $F(e){return console.log(e)}function eI(e){e!==`Link ready but could not copy to clipboard.`&&Ls.error(e)}function tI(e){return Ls.success(e)}function nI(e){let t=(0,$.c)(34),{onSignIn:n,onSetIdentity:r,onOpenSearch:a}=e,{_:o}=i(),{activeDocName:c,activeTarget:l}=yt(),{state:u,isDraggingRail:d}=pM(),f=e_(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Sc(`toggle-files-sidebar`),t[0]=p):p=t[0];let m=p,h=Sc(`command-palette`),[g,_]=(0,Q.useState)(!1),v;bb0:{if(l?.kind===`folder`){let e;t[1]===l.folderPath?e=t[2]:(e=Aa(l.folderPath),t[1]=l.folderPath,t[2]=e),v=e;break bb0}if(c){let e;t[3]===c?e=t[4]:(e=Po(c),t[3]=c,t[4]=e),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[5]!==C||t[6]!==w?(T=Oi(`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[5]=C,t[6]=w,t[7]=T):T=t[7];let E=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ic,{children:[(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(vM,{className:Oi(`-ml-1 shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(tc,{children:u===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:m}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:m}})})]}),x&&a&&(0,Z.jsxs)(ic,{children:[(0,Z.jsx)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":o({id:`IN4UX8`,values:{searchShortcut:h}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Oi(`shrink-0 text-muted-foreground`,b&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(A,{"aria-hidden":`true`})})}),(0,Z.jsx)(tc,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:h}})})]}),(0,Z.jsx)(so,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(zF,{})]}),D;t[8]===E?D=t[9]:(D=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:E}),t[8]=E,t[9]=D);let O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=Oi(`flex shrink-0 items-center justify-end gap-2 px-3`,b&&`[&>*]:[-webkit-app-region:no-drag]`),t[10]=O):O=t[10];let k;t[11]!==g||t[12]!==_||t[13]!==y||t[14]!==f?(k=!f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qF,{input:y,onClickWhenNoRemote:()=>_(!0)}),(0,Z.jsx)(Io,{open:g,onOpenChange:_})]}),t[11]=g,t[12]=_,t[13]=y,t[14]=f,t[15]=k):k=t[15];let j;t[16]!==r||t[17]!==n?(j=(0,Z.jsx)(uo,{onSignIn:n,onSetIdentity:r}),t[16]=r,t[17]=n,t[18]=j):j=t[18];let M,N,P;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(aP,{}),N=(0,Z.jsx)(so,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),P=(0,Z.jsx)(Tf,{}),t[19]=M,t[20]=N,t[21]=P):(M=t[19],N=t[20],P=t[21]);let F;t[22]===f?F=t[23]:(F=!f&&(0,Z.jsx)(GF,{}),t[22]=f,t[23]=F);let I;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(UF,{}),t[24]=I):I=t[24];let L;t[25]!==k||t[26]!==j||t[27]!==F?(L=(0,Z.jsxs)(`div`,{className:O,children:[k,j,M,N,P,F,I]}),t[25]=k,t[26]=j,t[27]=F,t[28]=L):L=t[28];let R;return t[29]!==L||t[30]!==S||t[31]!==T||t[32]!==D?(R=(0,Z.jsxs)(`header`,{"data-electron-drag":S,className:T,children:[D,L]}),t[29]=L,t[30]=S,t[31]=T,t[32]=D,t[33]=R):R=t[33],R}var rI=`open-knowledge:terminal-launch`;function iI(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(rI,{detail:{prompt:e,cli:t}}))}function aI(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(rI,n),()=>t.removeEventListener(rI,n)}function oI(e){let t=(0,$.c)(53),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=Vv(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(ib[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),x=(0,Q.useRef)(0),S=Ja(),{projectConfig:C,projectLocalConfig:w,projectLocalSynced:T,projectSynced:E}=ge(),{activeDocName:D}=yt(),O=S?.hasRemote,k=S?.pushPermission?.checkStatus,A;t[2]!==m||t[3]!==C||t[4]!==w||t[5]!==T||t[6]!==E||t[7]!==O||t[8]!==k?(A=Gv({autoSyncOnboardingDismissed:m,hasRemote:O,projectLocalSynced:T,projectSynced:E,projectLocalConfig:w,projectConfig:C,pushPermissionCheckStatus:k}),t[2]=m,t[3]=C,t[4]=w,t[5]=T,t[6]=E,t[7]=O,t[8]=k,t[9]=A):A=t[9];let j=A,M,N;t[10]===D?(M=t[11],N=t[12]):(M=()=>{let e=function(e){let t=e.detail;t&&D&&qc(D,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Nv,e),()=>window.removeEventListener(Nv,e)},N=[D],t[10]=D,t[11]=M,t[12]=N),(0,Q.useEffect)(M,N);let P,F;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?v(cI):e===`new-terminal`&&v(!0)})},F=[],t[13]=P,t[14]=F):(P=t[13],F=t[14]),(0,Q.useEffect)(P,F);let I,L;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{if(window.okDesktop!=null)return;let e=function(e){Cc(e,`toggle-terminal-panel`)&&(e.preventDefault(),v(sI))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},I=[],t[15]=I,t[16]=L):(I=t[15],L=t[16]),(0,Q.useEffect)(L,I);let R,z;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>aI((e,t)=>{v(!0),x.current+=1,b({prompt:e,cli:t,nonce:x.current})}),z=[],t[17]=R,t[18]=z):(R=t[17],z=t[18]),(0,Q.useEffect)(R,z);let B,V;t[19]===_?(B=t[20],V=t[21]):(B=()=>{_||b(null)},V=[_],t[19]=_,t[20]=B,t[21]=V),(0,Q.useEffect)(B,V);let H,U;t[22]===_?(H=t[23],U=t[24]):(H=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:_})},U=[_],t[22]=_,t[23]=H,t[24]=U),(0,Q.useEffect)(H,U);let W,G;t[25]===_?(W=t[26],G=t[27]):(W=()=>{window.okDesktop!=null&&_&&Lo()},G=[_],t[25]=_,t[26]=W,t[27]=G),(0,Q.useEffect)(W,G),Hv(S?.pausedReason);let K;t[28]===a?K=t[29]:(K=function(e){s(e),a(e)},t[28]=a,t[29]=K);let q=K,J,ee;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{d(`auth`),l(!0)},ee=()=>{d(`identity`),l(!0)},t[30]=J,t[31]=ee):(J=t[30],ee=t[31]);let Y;t[32]===r?Y=t[33]:(Y=(0,Z.jsx)(nI,{onSignIn:J,onSetIdentity:ee,onOpenSearch:r}),t[32]=r,t[33]=Y);let te;t[34]!==f||t[35]!==o||t[36]!==q||t[37]!==y||t[38]!==_?(te=(0,Z.jsx)(MN,{editorMode:o,onModeChange:q,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:_,onTerminalVisibleChange:v,terminalLaunch:y}),t[34]=f,t[35]=o,t[36]=q,t[37]=y,t[38]=_,t[39]=te):te=t[39];let X=u===`identity`,ne;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ne=()=>{l(!1)},t[40]=ne):ne=t[40];let re;t[41]!==c||t[42]!==X?(re=(0,Z.jsx)(aa,{open:c,onOpenChange:l,identityPrompt:X,onSuccess:ne}),t[41]=c,t[42]=X,t[43]=re):re=t[43];let ie;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>h(!0),t[44]=ie):ie=t[44];let ae;t[45]===j?ae=t[46]:(ae=(0,Z.jsx)(Uv,{open:j,onResolved:ie}),t[45]=j,t[46]=ae);let oe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Av,{}),t[47]=oe):oe=t[47];let se;return t[48]!==Y||t[49]!==te||t[50]!==re||t[51]!==ae?(se=(0,Z.jsxs)(Z.Fragment,{children:[Y,te,re,ae,oe]}),t[48]=Y,t[49]=te,t[50]=re,t[51]=ae,t[52]=se):se=t[52],se}function sI(e){return!e}function cI(e){return!e}function lI(e){let t=ls(ms(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function uI(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=ea();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)(as,{"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)(as,{"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(dI),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 dI(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Ai,{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:()=>lI(e.file),children:[(0,Z.jsx)(as,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var fI=`<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>`,pI=`<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>`,mI=`<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>`,hI=`<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>`,gI=`<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>`,_I=`<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>`,vI=`<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>`,yI=`<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>`,bI=`<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>`,xI=`<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>`,SI=`<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>`,CI=`<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>`,wI=`<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>`,TI=`<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>`,EI=`<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>`,DI=`<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>`,OI=`<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>`,kI=`<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>`,AI=`<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>`,jI=`<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>`,MI=`<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>`,NI=`<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>`,PI=`<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>`,FI=`<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>`,II=`<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>`,LI=`<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>`,RI=`<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>`,zI=`<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>`,BI=`<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>`,VI=`<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>`,HI=`<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>`,UI=`<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>`,WI=`<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>`,GI=`<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>`,KI=`<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>`,qI=`<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>`,JI=`<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>`,YI=`<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>`,XI=`<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>`,ZI=`<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>`,QI=`<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>`,$I=`<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>`,eL=`<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>`,tL=`<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>`,nL=`<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>`,rL=`<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>`,iL=`<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>`,aL=`<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>`,oL=`<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>`,sL=`<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>`,cL=`<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>`,lL=`<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>`,uL=`<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>`,dL=[hI,bI,SI,CI,wI,TI,OI,kI,AI,MI,NI,PI,FI,II,LI,UI,GI,KI,QI,$I,nL,rL,`<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 fL=dL(uI,lL),pL={minimal:uI,standard:fL,complete:dL(fL,uL)},mL={".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`},hL={"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`},gL={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},_L=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`]),vL=new Set([`complete`]);function yL(e){return pL[e===`none`?`minimal`:e]}function bL(e){return`file-tree-builtin-${e}`}function xL(e){return e!==`none`&&vL.has(e)}function SL(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=mL[t.toLowerCase()];if(i!=null&&(r||_L.has(i)))return i;for(let e of n){if(r){let t=gL[e];if(t!=null)return t}let t=hL[e];if(t!=null&&(r||_L.has(t)))return t}return`default`}var CL=`file-tree-container`,wL=`data-file-tree-style`,TL=`data-file-tree-unsafe-css`,EL=`data-file-tree-scrollbar-measure`,DL=`data-file-tree-scrollbar-gutter-measured`,OL=`--trees-scrollbar-gutter-measured`,kL=`header`,AL=`context-menu`,jL=`context-menu-trigger`;function ML(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function NL(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(ML(e)?`none`:`complete`),colored:e.colored??!0}}var PL=e=>e.trim().toLowerCase(),FL=e=>e.split(`/`).at(-1)??e,IL=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 LL(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function RL(e){let t=NL(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(PL(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=FL(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return LL(c,e);for(let[t,n]of a)if(s.includes(t))return LL(n,e);let l=IL(n);for(let t of l){let n=i.get(t);if(n!=null)return LL(n,e)}let u=SL(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:bL(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:LL(s,e)}}}var zL=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,BL=/^0(?:\.0+)?%?$/;function VL(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 HL(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||zL.test(t))return!0;let n=VL(t);return n!=null&&BL.test(n)}function UL(e){return HL(e)?void 0:e}function WL(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=UL(t[`list.focusOutline`])??UL(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 GL=5,KL=1<<GL,qL=KL*4;function JL(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function YL(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function XL(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 ZL(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 QL(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function $L(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 eR(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,iR(e,t)}function tR(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=ZL(e).get(t);if(i===void 0)return;let a=i>>GL;e.childVisibleChunkSums[a]+=r}function nR(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=aR(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=KL}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 rR(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>GL;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<GL}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 iR(e,t){if(t.childIds.length<qL){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/KL),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>>GL]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function aR(e,t,n,r){let i=Math.min(t.childIds.length,n+KL),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 oR=7,sR=3,cR=1<<sR,lR=4;function uR(e,t,n=0){return e<<lR|n<<sR|t}function dR(e){return e.depthAndFlags>>>lR}function fR(e){return(e.depthAndFlags&cR)>>sR}function pR(e){return(e.depthAndFlags&cR)!==0}function mR(e){return e.depthAndFlags&oR}function hR(e,t){return(mR(e)&t)!==0}function gR(e,t){e.depthAndFlags|=t}function _R(e,t){e.depthAndFlags=uR(t,mR(e),fR(e))}var vR=Symbol(`benchmarkInstrumentation`);function yR(e,t){return t==null||Object.defineProperty(e,vR,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function bR(e){return e==null?null:e[vR]??null}function xR(e,t,n){return e==null?n():e.measurePhase(t,n)}function SR(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function CR(e){return e>=48&&e<=57}function wR(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!CR(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&&CR(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 TR(e){let t=e.toLowerCase();return{lowerValue:t,tokens:wR(t)}}function ER(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 DR(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=ER(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function OR(e,t,n){let r=DR(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function kR(e,t){return OR(e,t,TR)}function AR(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function jR(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=AR(e,r);return a===AR(t,r)?kR(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 MR(e,t){return jR(e,t)}function NR(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=TR(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=AR(e,n);return o===AR(t,n)?OR(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 PR(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=TR(r);return e.sortKeyById[t]=i,i}function FR(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function IR(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 LR(e){let{hasTrailingSlash:t,segments:n}=IR(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function RR(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=IR(e);return{requiresDirectory:t,segments:n}}var zR=``;function BR(){let e=new Map;return e.set(zR,0),{idByValue:e,valueById:[zR],sortKeyById:[TR(zR)]}}function VR(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 HR(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var UR=Symbol(`pathStorePreparedInputKind`);function WR(e,t){return e[UR]=t,e}function GR(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function KR(e,t,n){return n===`default`?MR(e,t):n(GR(e),GR(t))}function qR(){return{depthAndFlags:uR(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function JR(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 YR(e){return e.isDirectory?e.segments.length:e.segments.length-1}function XR(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 ZR(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function QR(e,t={}){return iz(e,t).map(e=>e.path)}function $R(e,t={}){let n=iz(e,t);return WR({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function ez(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 WR({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function tz(e){let t=e,n=t.preparedPaths;if(t[UR]===`prepared`&&n!=null)return n;if(!XR(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function nz(e){let t=e;return t[UR]===`presorted`&&t.presortedPaths!=null||ZR(t.presortedPaths)?t.presortedPaths:null}function rz(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function iz(e,t={}){let n=FR(t),r=bR(t);SR(r,`workload.inputFiles`,e.length);let i=xR(r,`store.preparePathEntries.parse`,()=>e.map(e=>LR(e)));return xR(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>KR(e,t,n.sort))),i}var az=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[qR()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=BR();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=bR(e),this.options=FR(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,JL())}appendPaths(e){return xR(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>LR(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,xR(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return xR(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:uR(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:uR(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:uR(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=LR(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:uR(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:uR(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=LR(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(xR(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||xR(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`?NR(this.lastPreparedPath,e,this.segmentSortKeyCache):KR(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=YR(e),i=n==null?0:YR(n),a=n==null?0:JR(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=VR(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:uR(dR(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),QL(i,s),s}createFileChildUnchecked(e,t){let n=VR(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:uR(dR(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),QL(r,a),a}getOrCreateDirectoryChild(e,t){let n=VR(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&&!pR(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:uR(dR(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),QL(r,a),this.directories.set(a,JL()),a}createDirectoryChild(e,t){let n=VR(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:uR(dR(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),QL(r,a),this.directories.set(a,JL()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!pR(n))throw Error(`Path is not a directory: "${t}"`);if(hR(n,1))throw Error(`Duplicate path: "${t}"`);gR(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,YL());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(pR(a)){let t=YL();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;pR(n)&&this.directories.set(t,JL());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),QL(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!pR(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 eR(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function oz(e,t=`closed`,n=null){let r=cz(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 sz(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function cz(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 lz(e,t){return hR(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:dR(t)<=e.defaultExpansion}function uz(e,t,n=e.snapshot.nodes[t]){return n==null||!pR(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:lz(e,n)}function dz(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!pR(r))return;let i=lz(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 fz(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 pz(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function mz(e,t){let n=fz(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 hz(e,t){let n=fz(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function gz(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 _z(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function vz(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 yz(e,t){e.directoryLoadInfoById.delete(t)}function bz(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 xz(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Sz(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Cz(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function wz(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Tz(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Ez(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Dz(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 Oz(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 kz(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 Az(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 jz(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 Mz(e,t,n){return{...n,visibleCountDelta:Uz(e)-t}}function Nz(e,t){let n=Uz(e),r=sz();e.transactionStack.push(r);try{t()}catch(t){throw Iz(e,r,!1),t}Iz(e,r,!0,Uz(e)-n)}function Pz(e,t){let n=e.instrumentation;if(n==null){Fz(e,t);return}xR(n,`store.events.record`,()=>Fz(e,t))}function Fz(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){Vz(e,t);return}n.events.push(t),Bz(n,t)}function Iz(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?zz(i,t):xR(n,`store.events.batch.merge`,()=>zz(i,t));return}let a=Lz(t,r),o=e.instrumentation;if(o==null){Vz(e,a);return}xR(o,`store.events.batch.commit`,()=>Vz(e,a))}function Lz(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 Rz(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function zz(e,t){for(let n of t.events)e.events.push(n);Rz(e,t)}function Bz(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function Vz(e,t){let n=e.instrumentation;if(n==null){Hz(e,t);return}xR(n,`store.events.emit`,()=>Hz(e,t))}function Hz(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function Uz(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Wz(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!pR(n)||hR(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||!pR(a)?null:i}function Gz(e,t){let n=t;for(;;){let t=Wz(e,n);if(t==null)return n;n=t}}function Kz(e,t){let n=[t],r=t;for(;;){let t=Wz(e,r);if(t==null)return n;n.push(t),r=t}}function qz(e,t){let n=t==null?e.snapshot.rootId:rB(e,t);return n==null?[]:sB(e,n)}function Jz(e,t){let n=LR(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=SB(e,xB(e,r)),{createdNodeIds:a,directoryId:o}=cB(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=oB(e,o);if(hR(n,1))throw Error(`Path already exists: "${t}"`);gR(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=uB(e,o,n.basename),s.add(c);eB(e,o);let l=SB(e,o);return xz({affectedAncestorIds:nB(e,c),affectedNodeIds:[...s],path:t,projectionChanged:CB(i,l)})}function Yz(e,t,n){let r=rB(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=oB(e,r);if(hR(i,2))throw Error(`The root node cannot be removed`);if(pR(i)&&aB(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=SB(e,a),s=yB(e,r);pB(e,a,r,i.nameId),bB(e,a),eB(e,a);let c=SB(e,a);return Sz({affectedAncestorIds:nB(e,a),affectedNodeIds:s,path:t,projectionChanged:CB(o,c),recursive:n.recursive===!0})}function Xz(e,t,n,r){let i=rB(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=oB(e,i);if(hR(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=_B(e,i,n),c=SB(e,a.parentId),l=SB(e,s.parentId),u=HR(e.snapshot.segmentTable,a.nameId),d=VR(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(pR(a)&&DB(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=XL(e.snapshot.nodes,aB(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&vB(e,p,o,fR(a))===`skip`)return null;let m=a.parentId;pB(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),EB(e,i),fB(e,s.parentId,i),bB(e,m),e.pathCacheVersion++,eB(e,m),s.parentId!==m&&eB(e,s.parentId);let h=SB(e,m),g=SB(e,s.parentId);return Cz({affectedAncestorIds:[...new Set([...nB(e,m),...nB(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:wB([c,l],[h,g]),to:$z(e,i)})}function Zz(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function Qz(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function $z(e,t){let n=oB(e,t),r=Zz(e,t);if(r!=null)return r;if(hR(n,2))return Qz(e,t,``);let i=$z(e,n.parentId),a=HR(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return Qz(e,t,pR(n)?`${o}/`:o)}function eB(e,t){let n=e.instrumentation;if(n==null){kB(e,t);return}xR(n,`store.recomputeCountsUpwardFrom`,()=>kB(e,t))}function tB(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||!pR(o)){OB(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){OB(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function nB(e,t){let n=[],r=t;for(;r!=null;){let t=oB(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function rB(e,t){if(t.length===0)return e.snapshot.rootId;let n=RR(t);return iB(e,n.segments,n.requiresDirectory)}function iB(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=aB(e,r),a=XL(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=oB(e,r);return n&&!pR(i)?null:r}function aB(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 oB(e,t){let n=e.snapshot.nodes[t];if(n===void 0||hR(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function sB(e,t){let n=e.snapshot.nodes[t];if(n===void 0||hR(n,4))return[];if(!pR(n))return[$z(e,t)];if(aB(e,t).childIds.length===0)return hR(n,1)&&!hR(n,2)?[$z(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||hR(n,4)){i.pop();continue}if(!pR(n)){r.push($z(e,t.nodeId)),i.pop();continue}let a=aB(e,t.nodeId);if(a.childIds.length===0){hR(n,1)&&!hR(n,2)&&r.push($z(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 cB(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=VR(e.snapshot.segmentTable,i),a=aB(e,r),o=XL(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!pR(oB(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=lB(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function lB(e,t,n){let r=oB(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:uR(dR(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,JL()),fB(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function uB(e,t,n){let r=VR(e.snapshot.segmentTable,n),i=aB(e,t);if(XL(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${jB(e,t,n)}"`);let a=oB(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:uR(dR(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),fB(e,t,o),e.activeNodeCount++,o}function dB(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}mB(e,n,o)<0?i=a:r=a+1}return r}function fB(e,t,n){let r=aB(e,t),i=oB(e,n);XL(e.snapshot.nodes,r).set(i.nameId,n),tR(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=dB(e,r,n);r.childIds.splice(a,0,n),$L(r,a),iR(e.snapshot.nodes,r)}function pB(e,t,n,r){let i=aB(e,t),a=ZL(i),o=a.get(n)??-1;XL(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&tR(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),$L(i,o),iR(e.snapshot.nodes,i))}function mB(e,t,n){let r=e.snapshot.options.sort;return r===`default`?hB(e,t,n):r(gB(e,t),gB(e,n))}function hB(e,t,n){let r=oB(e,t),i=oB(e,n),a=pR(r);if(a!==pR(i))return a?-1:1;let o=DR(PR(e.snapshot.segmentTable,r.nameId),PR(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=HR(e.snapshot.segmentTable,r.nameId),c=HR(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function gB(e,t){let n=oB(e,t),r=$z(e,t),i=pR(n),a=i?r.slice(0,-1):r;return{basename:HR(e.snapshot.segmentTable,n.nameId),depth:dR(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function _B(e,t,n){let r=oB(e,t),i=rB(e,n);if(i!=null){let t=oB(e,i);if(pR(t))return{basename:HR(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=RR(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=RR(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:iB(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function vB(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${$z(e,t)}"`);let i=oB(e,t);if(fR(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(pR(i)&&aB(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return yB(e,t),pB(e,a,t,o),bB(e,a),eB(e,a),`handled`}function yB(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=oB(e,t.nodeId);if(t.visitedChildren||!pR(i)){pR(i)&&e.snapshot.directories.delete(t.nodeId),gR(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),yz(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=aB(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 bB(e,t){let n=t;for(;n!=null;){let t=oB(e,n);if(!pR(t)||hR(t,2)||aB(e,n).childIds.length>0)return;gR(t,1),n=t.parentId===n?null:t.parentId}}function xB(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=XL(e.snapshot.nodes,aB(e,n)).get(t);if(i==null||!pR(oB(e,i)))break;n=i}return n}function SB(e,t){let n=TB(e,t);if(n==null)return null;let r=Gz(e,n),i=oB(e,r),a=n===r?null:Kz(e,n).map(t=>$z(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:aB(e,r).childIds.length>0,path:$z(e,r),terminalKind:fR(i)})}function CB(e,t){return wB([e],[t])}function wB(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 TB(e,t){let n=t;for(;n!=null;){let t=oB(e,n);if(!pR(t)||hR(t,2))return null;if(!uz(e,n,t))return n;n=t.parentId}return null}function EB(e,t){let n=oB(e,t);if(_R(n,(t===e.snapshot.rootId?-1:dR(oB(e,n.parentId)))+1),!pR(n))return;let r=aB(e,t);for(let t of r.childIds)EB(e,t)}function DB(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=oB(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function OB(e,t,n=oB(e,t),r=!1){let i=e.instrumentation;if(i==null){AB(e,t,n,r);return}xR(i,`store.recomputeNodeCounts`,()=>AB(e,t,n,r))}function kB(e,t){let n=t;for(;n!=null;){let t=oB(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(OB(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&tR(aB(e,s),n,a,o),n=s}}function AB(e,t,n,r){if(!pR(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=aB(e,t);if(r){let t=e.instrumentation;t==null?eR(e.snapshot.nodes,i):xR(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>eR(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,hR(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=Wz(e,t)==null?uz(e,t,n)?1+o:1:o}function jB(e,t,n){let r=$z(e,t);return r.length===0?n:`${r}${n}`}function MB(e){return e!=null&&!hR(e,4)}function NB(e,t){let n=e.snapshot.nodes[t];return!MB(n)||!pR(n)||hR(n,2)?null:n}function PB(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&MB(e.snapshot.nodes[n])&&(t+=1);return t}function FB(e){return Math.max(0,e.valueById.length-1)}function IB(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:PB(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:FB(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function LB(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 RB(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)NB(e,n)!=null&&t.push($z(e,n));for(let t of e.expandedDirectoryIds)NB(e,t)!=null&&n.push($z(e,t));return{collapsedPaths:t,expandedPaths:n}}function zB(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)NB(e,n)==null||pz(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:$z(e,n)});return t}function BB(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=rB(e,n);t!=null&&dz(e,t,!0,oB(e,t))}for(let n of t.collapsedPaths){let t=rB(e,n);t!=null&&dz(e,t,!1,oB(e,t))}}function VB(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=rB(e,n.path);t!=null&&NB(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function HB(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function UB(e){let t=e.snapshot.segmentTable,n=BR();for(let r of e.snapshot.nodes)if(MB(r)){if(hR(r,2)){r.nameId=0;continue}r.nameId=VR(n,HR(t,r.nameId))}e.snapshot.segmentTable=n}function WB(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!MB(r)||!pR(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return MB(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[oB(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),eR(e.snapshot.nodes,n)}}function GB(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(MB(n))break;--t}e.snapshot.nodes.length=t+1}function KB(e){let t=RB(e),n=zB(e);xR(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>HB(e)),xR(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>UB(e)),xR(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>WB(e)),xR(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>GB(e)),xR(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>BB(e,t)),xR(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>VB(e,n)),xR(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>tB(e,e.snapshot.rootId))}function qB(e){let t=RB(e),n=zB(e),r=xR(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>qz(e)),i=yR({...e.snapshot.options},e.instrumentation),a=xR(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new az(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,xR(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>BB(e,t)),xR(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>VB(e,n)),xR(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>tB(e,e.snapshot.rootId))}function JB(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function YB(e,t){let n=IB(e);t===`stable`?xR(e.instrumentation,`store.cleanup.stable`,()=>KB(e)):xR(e.instrumentation,`store.cleanup.aggressive`,()=>qB(e));let r=IB(e);return LB(t,t===`stable`,n,r)}var XB=64;function ZB(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 QB(e){return oB(e,e.snapshot.rootId).visibleSubtreeCount}function $B(e,t,n,r){let i=oB(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function eV(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:yV(e,t.cursor),setSize:t.setSize,subtreeEndIndex:$B(e,t.cursor,t.index,n)}}function tV(e,t,n,r,i,a){let o=aB(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=nR(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return nV(e,u,l,r+c,i+1,s,o.childIds.length,a)}function nV(e,t,n,r,i,a,o,s){if(!pR(oB(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=pV(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=oB(e,c.terminalNodeId);if(!pR(l)||!uz(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return tV(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function rV(e,t){let n=QB(e);if(t<0||t>=n)return null;let r=tV(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>$z(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=eV(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:yV(e,r.cursor),setSize:r.setSize,subtreeEndIndex:$B(e,r.cursor,r.index,n)}}function iV(e,t,n){let r=e.instrumentation,i=QB(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 vV(e,o+1);let t=[],n=uV(e,a);for(let r=a;r<=o&&n!=null;r++){let r=yV(e,n);t.push(r),n=hV(e,n)}return t}let s=[],c=0,l=0,u=xR(r,`store.getVisibleSlice.selectFirstRow`,()=>uV(e,a));for(let t=a;t<=o&&u!=null;t++){let t=xR(r,`store.getVisibleSlice.materializeRow`,()=>yV(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=xR(r,`store.getVisibleSlice.advanceCursor`,()=>hV(e,u))}return SR(r,`workload.visibleRowsRead`,s.length),SR(r,`workload.flattenedRowsRead`,c),SR(r,`workload.flattenedSegmentsRead`,l),s}function aV(e,t=QB(e)){let n=e.instrumentation;return n==null?_V(e,t):xR(n,`store.getVisibleTreeProjection`,()=>_V(e,t))}function oV(e){return gV(aV(e))}function sV(e,t){let n=rB(e,t);if(n==null||n===e.snapshot.rootId||pR(oB(e,n))&&Gz(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=oB(e,i).parentId,n=aB(e,t),s=ZL(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=rR(a,n,s),t!==o){let n=oB(e,t),a=Wz(e,t);if(!uz(e,t,n)&&a!==i)return null;Gz(e,t)===t&&(r+=1)}i=t}return r}function cV(e,t){let n=rB(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=oB(e,n);if(!pR(r))throw Error(`Path is not a directory: "${t}"`);return uz(e,n,r)?null:(dz(e,n,!0,r),eB(e,n),wz({affectedAncestorIds:nB(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function lV(e,t){let n=rB(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=oB(e,n);if(!pR(r))throw Error(`Path is not a directory: "${t}"`);return uz(e,n,r)?(dz(e,n,!1,r),eB(e,n),Tz({affectedAncestorIds:nB(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function uV(e,t){return t<0||t>=QB(e)?null:dV(e,e.snapshot.rootId,t,-1)}function dV(e,t,n,r){let i=aB(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?nR(e.snapshot.nodes,i,n):xR(a,`store.getVisibleSlice.selectChildIndex`,()=>nR(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return fV(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function fV(e,t,n,r){if(!pR(oB(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=pV(e,t,r);if(n===0)return i;let a=oB(e,i.terminalNodeId);if(!pR(a)||!uz(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return dV(e,i.terminalNodeId,n-1,i.visibleDepth)}function pV(e,t,n){return pR(oB(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:Gz(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:xR(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>Gz(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function mV(e,t){let n=oB(e,t);if(!pR(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:Wz(e,r)!==t}function hV(e,t){let n=oB(e,t.terminalNodeId);if(pR(n)){let r=aB(e,t.terminalNodeId);if(uz(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:fV(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=oB(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=aB(e,n),o=ZL(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 fV(e,s,0,i);mV(e,r)&&i--,r=n}}function gV(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 _V(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(XB);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=ZB(o,y);let x,S=_;if(pR(v))S=f?Gz(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:$z(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&&pR(C)&&uz(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 vV(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(!pR(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:$z(e,f)};continue}let h=l?Gz(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=yV(e,g);let _=i[h];_!=null&&pR(_)&&uz(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function yV(e,t){let n=oB(e,t.terminalNodeId),r=pR(n)?bV(e,t):null,i=$z(e,t.terminalNodeId),a=HR(e.snapshot.segmentTable,n.nameId),o=pR(n)&&aB(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?Kz(e,t.headNodeId).map(n=>{let r=oB(e,n);return{isTerminal:n===t.terminalNodeId,name:HR(e.snapshot.segmentTable,r.nameId),nodeId:n,path:$z(e,n)}}):xR(c,`store.getVisibleSlice.flatten.collectSegments`,()=>Kz(e,t.headNodeId).map(n=>{let r=oB(e,n);return{isTerminal:n===t.terminalNodeId,name:HR(e.snapshot.segmentTable,r.nameId),nodeId:n,path:$z(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:pR(n)&&uz(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:pR(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function bV(e,t){if(t.headNodeId===t.terminalNodeId)return pz(e,t.terminalNodeId);let n=Kz(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=pz(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function xV(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||!pR(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&&iR(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&pR(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,iR(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function SV(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var CV=class e{#e;constructor(e={}){let t=bR(e),n=xR(t,`store.builder.create`,()=>new az(e));if(e.preparedInput!=null){let t=nz(e.preparedInput);t==null?n.appendPreparedPaths(tz(e.preparedInput),!1):n.appendPresortedPaths(t,rz(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(xR(t,`store.preparePathEntries`,()=>iz(r,e)))}let r=xR(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=xR(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=xR(t,`store.state.create`,()=>oz(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:xR(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||SV(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&xR(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?xR(t,`store.state.initializeOpenVisibleCounts`,()=>xV(this.#e)):xR(t,`store.state.recomputeCounts`,()=>tB(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return QR(e,t)}static prepareInput(e,t={}){return $R(e,t)}static preparePresortedInput(e){return ez(e)}list(e){return xR(this.#e.instrumentation,`store.list`,()=>qz(this.#e,e))}add(e){xR(this.#e.instrumentation,`store.add`,()=>{let t=QB(this.#e);Pz(this.#e,Mz(this.#e,t,Jz(this.#e,e)))})}remove(e,t={}){xR(this.#e.instrumentation,`store.remove`,()=>{let n=QB(this.#e);Pz(this.#e,Mz(this.#e,n,Yz(this.#e,e,t)))})}move(e,t,n={}){xR(this.#e.instrumentation,`store.move`,()=>{let r=QB(this.#e),i=Xz(this.#e,e,t,n);i!=null&&Pz(this.#e,Mz(this.#e,r,i))})}batch(e){Nz(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 xR(this.#e.instrumentation,`store.getVisibleCount`,()=>QB(this.#e))}getVisibleSlice(e,t){return xR(this.#e.instrumentation,`store.getVisibleSlice`,()=>iV(this.#e,e,t))}getVisibleRowContext(e){return xR(this.#e.instrumentation,`store.getVisibleRowContext`,()=>rV(this.#e,e))}getVisibleTreeProjection(){return oV(this.#e)}getVisibleTreeProjectionData(e){return aV(this.#e,e)}getVisibleIndex(e){return xR(this.#e.instrumentation,`store.getVisibleIndex`,()=>sV(this.#e,e))}getPathInfo(e){return xR(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=rB(this.#e,e);if(t==null)return null;let n=oB(this.#e,t);return{depth:dR(n),kind:pR(n)?`directory`:`file`,path:$z(this.#e,t)}})}isExpanded(e){return xR(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=oB(this.#e,t);return uz(this.#e,t,n)})}expand(e){xR(this.#e.instrumentation,`store.expand`,()=>{let t=QB(this.#e),n=cV(this.#e,e);n!=null&&Pz(this.#e,Mz(this.#e,t,n))})}collapse(e){xR(this.#e.instrumentation,`store.collapse`,()=>{let t=QB(this.#e),n=lV(this.#e,e);n!=null&&Pz(this.#e,Mz(this.#e,t,n))})}on(e,t){return bz(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return pz(this.#e,t)}markDirectoryUnloaded(e){xR(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(aB(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=QB(this.#e);hz(this.#e,t),Pz(this.#e,Mz(this.#e,n,Ez({affectedAncestorIds:nB(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return xR(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=QB(this.#e),r=mz(this.#e,t);return Pz(this.#e,Mz(this.#e,n,Dz({affectedAncestorIds:nB(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return xR(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||pz(this.#e,n)!==`loading`||!_z(this.#e,n,e.attemptId))return!1;let r=$z(this.#e,n);this.validateChildPatch(r,t);let i=QB(this.#e),a=[];for(let e of t.operations){wV(r,e);let t=QB(this.#e);switch(e.type){case`add`:a.push(Mz(this.#e,t,Jz(this.#e,e.path)));break;case`remove`:a.push(Mz(this.#e,t,Yz(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=Xz(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Mz(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Pz(this.#e,Mz(this.#e,i,Oz({affectedAncestorIds:nB(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:$z(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return xR(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=QB(this.#e),r=gz(this.#e,t,e.attemptId);return Pz(this.#e,Mz(this.#e,n,kz({affectedAncestorIds:nB(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:$z(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return xR(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=QB(this.#e),i=vz(this.#e,n,e.attemptId,t);return Pz(this.#e,Mz(this.#e,r,Az({affectedAncestorIds:nB(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:$z(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return xR(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(JB(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=QB(this.#e),n=YB(this.#e,e.mode??`stable`);return Pz(this.#e,Mz(this.#e,t,jz({...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=aB(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??TR(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=DR(PR(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(!pR(oB(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=oB(this.#e,n);uz(this.#e,n,i)||(dz(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=oB(this.#e,e);if(!uz(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=rB(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!pR(oB(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!pR(oB(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=oB(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=oB(this.#e,e),r=Wz(this.#e,e);if(!uz(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 wV(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 TV={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function EV(e,t){if(typeof e==`number`)return{itemHeight:t??TV.default.itemHeight,factor:e};let n=TV[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var DV=TV.default.itemHeight,OV=`@layer base, theme, unsafe;
|
|
197
|
+
</symbol>`],fL=[pI,mI,gI,_I,vI,yI,xI,EI,DI,jI,RI,zI,BI,VI,HI,WI,qI,JI,YI,XI,ZI,eL,tL,iL,aL,oL,sL,cL,lL,uL];function pL(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
|
|
198
|
+
`)}\n</svg>`)}var mL=pL(fI,dL),hL={minimal:fI,standard:mL,complete:pL(mL,fL)},gL={".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`},_L={"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`},vL={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},yL=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`]),bL=new Set([`complete`]);function xL(e){return hL[e===`none`?`minimal`:e]}function SL(e){return`file-tree-builtin-${e}`}function CL(e){return e!==`none`&&bL.has(e)}function wL(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=gL[t.toLowerCase()];if(i!=null&&(r||yL.has(i)))return i;for(let e of n){if(r){let t=vL[e];if(t!=null)return t}let t=_L[e];if(t!=null&&(r||yL.has(t)))return t}return`default`}var TL=`file-tree-container`,EL=`data-file-tree-style`,DL=`data-file-tree-unsafe-css`,OL=`data-file-tree-scrollbar-measure`,kL=`data-file-tree-scrollbar-gutter-measured`,AL=`--trees-scrollbar-gutter-measured`,jL=`header`,ML=`context-menu`,NL=`context-menu-trigger`;function PL(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function FL(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(PL(e)?`none`:`complete`),colored:e.colored??!0}}var IL=e=>e.trim().toLowerCase(),LL=e=>e.split(`/`).at(-1)??e,RL=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 zL(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function BL(e){let t=FL(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(IL(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=LL(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return zL(c,e);for(let[t,n]of a)if(s.includes(t))return zL(n,e);let l=RL(n);for(let t of l){let n=i.get(t);if(n!=null)return zL(n,e)}let u=wL(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:SL(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:zL(s,e)}}}var VL=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,HL=/^0(?:\.0+)?%?$/;function UL(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 WL(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||VL.test(t))return!0;let n=UL(t);return n!=null&&HL.test(n)}function GL(e){return WL(e)?void 0:e}function KL(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=GL(t[`list.focusOutline`])??GL(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 qL=5,JL=1<<qL,YL=JL*4;function XL(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ZL(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function QL(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 $L(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 eR(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function tR(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 nR(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,oR(e,t)}function rR(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=$L(e).get(t);if(i===void 0)return;let a=i>>qL;e.childVisibleChunkSums[a]+=r}function iR(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=sR(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=JL}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 aR(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>qL;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<qL}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 oR(e,t){if(t.childIds.length<YL){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/JL),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>>qL]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function sR(e,t,n,r){let i=Math.min(t.childIds.length,n+JL),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 cR=7,lR=3,uR=1<<lR,dR=4;function fR(e,t,n=0){return e<<dR|n<<lR|t}function pR(e){return e.depthAndFlags>>>dR}function mR(e){return(e.depthAndFlags&uR)>>lR}function hR(e){return(e.depthAndFlags&uR)!==0}function gR(e){return e.depthAndFlags&cR}function _R(e,t){return(gR(e)&t)!==0}function vR(e,t){e.depthAndFlags|=t}function yR(e,t){e.depthAndFlags=fR(t,gR(e),mR(e))}var bR=Symbol(`benchmarkInstrumentation`);function xR(e,t){return t==null||Object.defineProperty(e,bR,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function SR(e){return e==null?null:e[bR]??null}function CR(e,t,n){return e==null?n():e.measurePhase(t,n)}function wR(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function TR(e){return e>=48&&e<=57}function ER(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!TR(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&&TR(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 DR(e){let t=e.toLowerCase();return{lowerValue:t,tokens:ER(t)}}function OR(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 kR(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=OR(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function AR(e,t,n){let r=kR(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function jR(e,t){return AR(e,t,DR)}function MR(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function NR(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=MR(e,r);return a===MR(t,r)?jR(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 PR(e,t){return NR(e,t)}function FR(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=DR(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=MR(e,n);return o===MR(t,n)?AR(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 IR(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=DR(r);return e.sortKeyById[t]=i,i}function LR(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function RR(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 zR(e){let{hasTrailingSlash:t,segments:n}=RR(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function BR(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=RR(e);return{requiresDirectory:t,segments:n}}var VR=``;function HR(){let e=new Map;return e.set(VR,0),{idByValue:e,valueById:[VR],sortKeyById:[DR(VR)]}}function UR(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 WR(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var GR=Symbol(`pathStorePreparedInputKind`);function KR(e,t){return e[GR]=t,e}function qR(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function JR(e,t,n){return n===`default`?PR(e,t):n(qR(e),qR(t))}function YR(){return{depthAndFlags:fR(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function XR(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 ZR(e){return e.isDirectory?e.segments.length:e.segments.length-1}function QR(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 $R(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function ez(e,t={}){return oz(e,t).map(e=>e.path)}function tz(e,t={}){let n=oz(e,t);return KR({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function nz(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 KR({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function rz(e){let t=e,n=t.preparedPaths;if(t[GR]===`prepared`&&n!=null)return n;if(!QR(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function iz(e){let t=e;return t[GR]===`presorted`&&t.presortedPaths!=null||$R(t.presortedPaths)?t.presortedPaths:null}function az(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function oz(e,t={}){let n=LR(t),r=SR(t);wR(r,`workload.inputFiles`,e.length);let i=CR(r,`store.preparePathEntries.parse`,()=>e.map(e=>zR(e)));return CR(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>JR(e,t,n.sort))),i}var sz=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[YR()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=HR();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=SR(e),this.options=LR(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,XL())}appendPaths(e){return CR(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>zR(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,CR(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return CR(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:fR(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:fR(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:fR(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=zR(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:fR(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:fR(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=zR(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(CR(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||CR(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`?FR(this.lastPreparedPath,e,this.segmentSortKeyCache):JR(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=ZR(e),i=n==null?0:ZR(n),a=n==null?0:XR(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=UR(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:fR(pR(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),eR(i,s),s}createFileChildUnchecked(e,t){let n=UR(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:fR(pR(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),eR(r,a),a}getOrCreateDirectoryChild(e,t){let n=UR(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&&!hR(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:fR(pR(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),eR(r,a),this.directories.set(a,XL()),a}createDirectoryChild(e,t){let n=UR(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:fR(pR(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),eR(r,a),this.directories.set(a,XL()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!hR(n))throw Error(`Path is not a directory: "${t}"`);if(_R(n,1))throw Error(`Duplicate path: "${t}"`);vR(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,ZL());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(hR(a)){let t=ZL();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;hR(n)&&this.directories.set(t,XL());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),eR(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!hR(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 nR(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function cz(e,t=`closed`,n=null){let r=uz(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 lz(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function uz(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 dz(e,t){return _R(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:pR(t)<=e.defaultExpansion}function fz(e,t,n=e.snapshot.nodes[t]){return n==null||!hR(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:dz(e,n)}function pz(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!hR(r))return;let i=dz(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 mz(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 hz(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function gz(e,t){let n=mz(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 _z(e,t){let n=mz(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function vz(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 yz(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function bz(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 xz(e,t){e.directoryLoadInfoById.delete(t)}function Sz(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 Cz(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function wz(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Tz(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Ez(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Dz(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Oz(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function kz(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 Az(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 jz(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 Mz(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 Nz(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 Pz(e,t,n){return{...n,visibleCountDelta:Gz(e)-t}}function Fz(e,t){let n=Gz(e),r=lz();e.transactionStack.push(r);try{t()}catch(t){throw Rz(e,r,!1),t}Rz(e,r,!0,Gz(e)-n)}function Iz(e,t){let n=e.instrumentation;if(n==null){Lz(e,t);return}CR(n,`store.events.record`,()=>Lz(e,t))}function Lz(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){Uz(e,t);return}n.events.push(t),Hz(n,t)}function Rz(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?Vz(i,t):CR(n,`store.events.batch.merge`,()=>Vz(i,t));return}let a=zz(t,r),o=e.instrumentation;if(o==null){Uz(e,a);return}CR(o,`store.events.batch.commit`,()=>Uz(e,a))}function zz(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 Bz(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function Vz(e,t){for(let n of t.events)e.events.push(n);Bz(e,t)}function Hz(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function Uz(e,t){let n=e.instrumentation;if(n==null){Wz(e,t);return}CR(n,`store.events.emit`,()=>Wz(e,t))}function Wz(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function Gz(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Kz(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!hR(n)||_R(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||!hR(a)?null:i}function qz(e,t){let n=t;for(;;){let t=Kz(e,n);if(t==null)return n;n=t}}function Jz(e,t){let n=[t],r=t;for(;;){let t=Kz(e,r);if(t==null)return n;n.push(t),r=t}}function Yz(e,t){let n=t==null?e.snapshot.rootId:aB(e,t);return n==null?[]:lB(e,n)}function Xz(e,t){let n=zR(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=wB(e,CB(e,r)),{createdNodeIds:a,directoryId:o}=uB(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=cB(e,o);if(_R(n,1))throw Error(`Path already exists: "${t}"`);vR(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=fB(e,o,n.basename),s.add(c);nB(e,o);let l=wB(e,o);return Cz({affectedAncestorIds:iB(e,c),affectedNodeIds:[...s],path:t,projectionChanged:TB(i,l)})}function Zz(e,t,n){let r=aB(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=cB(e,r);if(_R(i,2))throw Error(`The root node cannot be removed`);if(hR(i)&&sB(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=wB(e,a),s=xB(e,r);hB(e,a,r,i.nameId),SB(e,a),nB(e,a);let c=wB(e,a);return wz({affectedAncestorIds:iB(e,a),affectedNodeIds:s,path:t,projectionChanged:TB(o,c),recursive:n.recursive===!0})}function Qz(e,t,n,r){let i=aB(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=cB(e,i);if(_R(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=yB(e,i,n),c=wB(e,a.parentId),l=wB(e,s.parentId),u=WR(e.snapshot.segmentTable,a.nameId),d=UR(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(hR(a)&&kB(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=QL(e.snapshot.nodes,sB(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&bB(e,p,o,mR(a))===`skip`)return null;let m=a.parentId;hB(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),OB(e,i),mB(e,s.parentId,i),SB(e,m),e.pathCacheVersion++,nB(e,m),s.parentId!==m&&nB(e,s.parentId);let h=wB(e,m),g=wB(e,s.parentId);return Tz({affectedAncestorIds:[...new Set([...iB(e,m),...iB(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:EB([c,l],[h,g]),to:tB(e,i)})}function $z(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function eB(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function tB(e,t){let n=cB(e,t),r=$z(e,t);if(r!=null)return r;if(_R(n,2))return eB(e,t,``);let i=tB(e,n.parentId),a=WR(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return eB(e,t,hR(n)?`${o}/`:o)}function nB(e,t){let n=e.instrumentation;if(n==null){jB(e,t);return}CR(n,`store.recomputeCountsUpwardFrom`,()=>jB(e,t))}function rB(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||!hR(o)){AB(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){AB(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function iB(e,t){let n=[],r=t;for(;r!=null;){let t=cB(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function aB(e,t){if(t.length===0)return e.snapshot.rootId;let n=BR(t);return oB(e,n.segments,n.requiresDirectory)}function oB(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=sB(e,r),a=QL(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=cB(e,r);return n&&!hR(i)?null:r}function sB(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 cB(e,t){let n=e.snapshot.nodes[t];if(n===void 0||_R(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function lB(e,t){let n=e.snapshot.nodes[t];if(n===void 0||_R(n,4))return[];if(!hR(n))return[tB(e,t)];if(sB(e,t).childIds.length===0)return _R(n,1)&&!_R(n,2)?[tB(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||_R(n,4)){i.pop();continue}if(!hR(n)){r.push(tB(e,t.nodeId)),i.pop();continue}let a=sB(e,t.nodeId);if(a.childIds.length===0){_R(n,1)&&!_R(n,2)&&r.push(tB(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 uB(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=UR(e.snapshot.segmentTable,i),a=sB(e,r),o=QL(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!hR(cB(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=dB(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function dB(e,t,n){let r=cB(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:fR(pR(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,XL()),mB(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function fB(e,t,n){let r=UR(e.snapshot.segmentTable,n),i=sB(e,t);if(QL(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${NB(e,t,n)}"`);let a=cB(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:fR(pR(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),mB(e,t,o),e.activeNodeCount++,o}function pB(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}gB(e,n,o)<0?i=a:r=a+1}return r}function mB(e,t,n){let r=sB(e,t),i=cB(e,n);QL(e.snapshot.nodes,r).set(i.nameId,n),rR(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=pB(e,r,n);r.childIds.splice(a,0,n),tR(r,a),oR(e.snapshot.nodes,r)}function hB(e,t,n,r){let i=sB(e,t),a=$L(i),o=a.get(n)??-1;QL(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&rR(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),tR(i,o),oR(e.snapshot.nodes,i))}function gB(e,t,n){let r=e.snapshot.options.sort;return r===`default`?_B(e,t,n):r(vB(e,t),vB(e,n))}function _B(e,t,n){let r=cB(e,t),i=cB(e,n),a=hR(r);if(a!==hR(i))return a?-1:1;let o=kR(IR(e.snapshot.segmentTable,r.nameId),IR(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=WR(e.snapshot.segmentTable,r.nameId),c=WR(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function vB(e,t){let n=cB(e,t),r=tB(e,t),i=hR(n),a=i?r.slice(0,-1):r;return{basename:WR(e.snapshot.segmentTable,n.nameId),depth:pR(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function yB(e,t,n){let r=cB(e,t),i=aB(e,n);if(i!=null){let t=cB(e,i);if(hR(t))return{basename:WR(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=BR(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=BR(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:oB(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function bB(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${tB(e,t)}"`);let i=cB(e,t);if(mR(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(hR(i)&&sB(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return xB(e,t),hB(e,a,t,o),SB(e,a),nB(e,a),`handled`}function xB(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=cB(e,t.nodeId);if(t.visitedChildren||!hR(i)){hR(i)&&e.snapshot.directories.delete(t.nodeId),vR(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),xz(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=sB(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 SB(e,t){let n=t;for(;n!=null;){let t=cB(e,n);if(!hR(t)||_R(t,2)||sB(e,n).childIds.length>0)return;vR(t,1),n=t.parentId===n?null:t.parentId}}function CB(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=QL(e.snapshot.nodes,sB(e,n)).get(t);if(i==null||!hR(cB(e,i)))break;n=i}return n}function wB(e,t){let n=DB(e,t);if(n==null)return null;let r=qz(e,n),i=cB(e,r),a=n===r?null:Jz(e,n).map(t=>tB(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:sB(e,r).childIds.length>0,path:tB(e,r),terminalKind:mR(i)})}function TB(e,t){return EB([e],[t])}function EB(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 DB(e,t){let n=t;for(;n!=null;){let t=cB(e,n);if(!hR(t)||_R(t,2))return null;if(!fz(e,n,t))return n;n=t.parentId}return null}function OB(e,t){let n=cB(e,t);if(yR(n,(t===e.snapshot.rootId?-1:pR(cB(e,n.parentId)))+1),!hR(n))return;let r=sB(e,t);for(let t of r.childIds)OB(e,t)}function kB(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=cB(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function AB(e,t,n=cB(e,t),r=!1){let i=e.instrumentation;if(i==null){MB(e,t,n,r);return}CR(i,`store.recomputeNodeCounts`,()=>MB(e,t,n,r))}function jB(e,t){let n=t;for(;n!=null;){let t=cB(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(AB(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&rR(sB(e,s),n,a,o),n=s}}function MB(e,t,n,r){if(!hR(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=sB(e,t);if(r){let t=e.instrumentation;t==null?nR(e.snapshot.nodes,i):CR(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>nR(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,_R(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=Kz(e,t)==null?fz(e,t,n)?1+o:1:o}function NB(e,t,n){let r=tB(e,t);return r.length===0?n:`${r}${n}`}function PB(e){return e!=null&&!_R(e,4)}function FB(e,t){let n=e.snapshot.nodes[t];return!PB(n)||!hR(n)||_R(n,2)?null:n}function IB(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&PB(e.snapshot.nodes[n])&&(t+=1);return t}function LB(e){return Math.max(0,e.valueById.length-1)}function RB(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:IB(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:LB(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function zB(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 BB(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)FB(e,n)!=null&&t.push(tB(e,n));for(let t of e.expandedDirectoryIds)FB(e,t)!=null&&n.push(tB(e,t));return{collapsedPaths:t,expandedPaths:n}}function VB(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)FB(e,n)==null||hz(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:tB(e,n)});return t}function HB(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=aB(e,n);t!=null&&pz(e,t,!0,cB(e,t))}for(let n of t.collapsedPaths){let t=aB(e,n);t!=null&&pz(e,t,!1,cB(e,t))}}function UB(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=aB(e,n.path);t!=null&&FB(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function WB(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function GB(e){let t=e.snapshot.segmentTable,n=HR();for(let r of e.snapshot.nodes)if(PB(r)){if(_R(r,2)){r.nameId=0;continue}r.nameId=UR(n,WR(t,r.nameId))}e.snapshot.segmentTable=n}function KB(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!PB(r)||!hR(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return PB(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[cB(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),nR(e.snapshot.nodes,n)}}function qB(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(PB(n))break;--t}e.snapshot.nodes.length=t+1}function JB(e){let t=BB(e),n=VB(e);CR(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>WB(e)),CR(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>GB(e)),CR(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>KB(e)),CR(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>qB(e)),CR(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>HB(e,t)),CR(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>UB(e,n)),CR(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>rB(e,e.snapshot.rootId))}function YB(e){let t=BB(e),n=VB(e),r=CR(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>Yz(e)),i=xR({...e.snapshot.options},e.instrumentation),a=CR(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new sz(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,CR(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>HB(e,t)),CR(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>UB(e,n)),CR(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>rB(e,e.snapshot.rootId))}function XB(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function ZB(e,t){let n=RB(e);t===`stable`?CR(e.instrumentation,`store.cleanup.stable`,()=>JB(e)):CR(e.instrumentation,`store.cleanup.aggressive`,()=>YB(e));let r=RB(e);return zB(t,t===`stable`,n,r)}var QB=64;function $B(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 eV(e){return cB(e,e.snapshot.rootId).visibleSubtreeCount}function tV(e,t,n,r){let i=cB(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function nV(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:xV(e,t.cursor),setSize:t.setSize,subtreeEndIndex:tV(e,t.cursor,t.index,n)}}function rV(e,t,n,r,i,a){let o=sB(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=iR(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return iV(e,u,l,r+c,i+1,s,o.childIds.length,a)}function iV(e,t,n,r,i,a,o,s){if(!hR(cB(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=hV(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=cB(e,c.terminalNodeId);if(!hR(l)||!fz(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return rV(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function aV(e,t){let n=eV(e);if(t<0||t>=n)return null;let r=rV(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>tB(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=nV(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:xV(e,r.cursor),setSize:r.setSize,subtreeEndIndex:tV(e,r.cursor,r.index,n)}}function oV(e,t,n){let r=e.instrumentation,i=eV(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 bV(e,o+1);let t=[],n=fV(e,a);for(let r=a;r<=o&&n!=null;r++){let r=xV(e,n);t.push(r),n=_V(e,n)}return t}let s=[],c=0,l=0,u=CR(r,`store.getVisibleSlice.selectFirstRow`,()=>fV(e,a));for(let t=a;t<=o&&u!=null;t++){let t=CR(r,`store.getVisibleSlice.materializeRow`,()=>xV(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=CR(r,`store.getVisibleSlice.advanceCursor`,()=>_V(e,u))}return wR(r,`workload.visibleRowsRead`,s.length),wR(r,`workload.flattenedRowsRead`,c),wR(r,`workload.flattenedSegmentsRead`,l),s}function sV(e,t=eV(e)){let n=e.instrumentation;return n==null?yV(e,t):CR(n,`store.getVisibleTreeProjection`,()=>yV(e,t))}function cV(e){return vV(sV(e))}function lV(e,t){let n=aB(e,t);if(n==null||n===e.snapshot.rootId||hR(cB(e,n))&&qz(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=cB(e,i).parentId,n=sB(e,t),s=$L(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=aR(a,n,s),t!==o){let n=cB(e,t),a=Kz(e,t);if(!fz(e,t,n)&&a!==i)return null;qz(e,t)===t&&(r+=1)}i=t}return r}function uV(e,t){let n=aB(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=cB(e,n);if(!hR(r))throw Error(`Path is not a directory: "${t}"`);return fz(e,n,r)?null:(pz(e,n,!0,r),nB(e,n),Ez({affectedAncestorIds:iB(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function dV(e,t){let n=aB(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=cB(e,n);if(!hR(r))throw Error(`Path is not a directory: "${t}"`);return fz(e,n,r)?(pz(e,n,!1,r),nB(e,n),Dz({affectedAncestorIds:iB(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function fV(e,t){return t<0||t>=eV(e)?null:pV(e,e.snapshot.rootId,t,-1)}function pV(e,t,n,r){let i=sB(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?iR(e.snapshot.nodes,i,n):CR(a,`store.getVisibleSlice.selectChildIndex`,()=>iR(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return mV(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function mV(e,t,n,r){if(!hR(cB(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=hV(e,t,r);if(n===0)return i;let a=cB(e,i.terminalNodeId);if(!hR(a)||!fz(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return pV(e,i.terminalNodeId,n-1,i.visibleDepth)}function hV(e,t,n){return hR(cB(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:qz(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:CR(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>qz(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function gV(e,t){let n=cB(e,t);if(!hR(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:Kz(e,r)!==t}function _V(e,t){let n=cB(e,t.terminalNodeId);if(hR(n)){let r=sB(e,t.terminalNodeId);if(fz(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:mV(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=cB(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=sB(e,n),o=$L(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 mV(e,s,0,i);gV(e,r)&&i--,r=n}}function vV(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 yV(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(QB);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=$B(o,y);let x,S=_;if(hR(v))S=f?qz(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:tB(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&&hR(C)&&fz(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 bV(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(!hR(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:tB(e,f)};continue}let h=l?qz(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=xV(e,g);let _=i[h];_!=null&&hR(_)&&fz(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function xV(e,t){let n=cB(e,t.terminalNodeId),r=hR(n)?SV(e,t):null,i=tB(e,t.terminalNodeId),a=WR(e.snapshot.segmentTable,n.nameId),o=hR(n)&&sB(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?Jz(e,t.headNodeId).map(n=>{let r=cB(e,n);return{isTerminal:n===t.terminalNodeId,name:WR(e.snapshot.segmentTable,r.nameId),nodeId:n,path:tB(e,n)}}):CR(c,`store.getVisibleSlice.flatten.collectSegments`,()=>Jz(e,t.headNodeId).map(n=>{let r=cB(e,n);return{isTerminal:n===t.terminalNodeId,name:WR(e.snapshot.segmentTable,r.nameId),nodeId:n,path:tB(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:hR(n)&&fz(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:hR(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function SV(e,t){if(t.headNodeId===t.terminalNodeId)return hz(e,t.terminalNodeId);let n=Jz(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=hz(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function CV(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||!hR(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&&oR(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&hR(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,oR(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function wV(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var TV=class e{#e;constructor(e={}){let t=SR(e),n=CR(t,`store.builder.create`,()=>new sz(e));if(e.preparedInput!=null){let t=iz(e.preparedInput);t==null?n.appendPreparedPaths(rz(e.preparedInput),!1):n.appendPresortedPaths(t,az(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(CR(t,`store.preparePathEntries`,()=>oz(r,e)))}let r=CR(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=CR(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=CR(t,`store.state.create`,()=>cz(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:CR(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||wV(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&CR(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?CR(t,`store.state.initializeOpenVisibleCounts`,()=>CV(this.#e)):CR(t,`store.state.recomputeCounts`,()=>rB(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return ez(e,t)}static prepareInput(e,t={}){return tz(e,t)}static preparePresortedInput(e){return nz(e)}list(e){return CR(this.#e.instrumentation,`store.list`,()=>Yz(this.#e,e))}add(e){CR(this.#e.instrumentation,`store.add`,()=>{let t=eV(this.#e);Iz(this.#e,Pz(this.#e,t,Xz(this.#e,e)))})}remove(e,t={}){CR(this.#e.instrumentation,`store.remove`,()=>{let n=eV(this.#e);Iz(this.#e,Pz(this.#e,n,Zz(this.#e,e,t)))})}move(e,t,n={}){CR(this.#e.instrumentation,`store.move`,()=>{let r=eV(this.#e),i=Qz(this.#e,e,t,n);i!=null&&Iz(this.#e,Pz(this.#e,r,i))})}batch(e){Fz(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 CR(this.#e.instrumentation,`store.getVisibleCount`,()=>eV(this.#e))}getVisibleSlice(e,t){return CR(this.#e.instrumentation,`store.getVisibleSlice`,()=>oV(this.#e,e,t))}getVisibleRowContext(e){return CR(this.#e.instrumentation,`store.getVisibleRowContext`,()=>aV(this.#e,e))}getVisibleTreeProjection(){return cV(this.#e)}getVisibleTreeProjectionData(e){return sV(this.#e,e)}getVisibleIndex(e){return CR(this.#e.instrumentation,`store.getVisibleIndex`,()=>lV(this.#e,e))}getPathInfo(e){return CR(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=aB(this.#e,e);if(t==null)return null;let n=cB(this.#e,t);return{depth:pR(n),kind:hR(n)?`directory`:`file`,path:tB(this.#e,t)}})}isExpanded(e){return CR(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=cB(this.#e,t);return fz(this.#e,t,n)})}expand(e){CR(this.#e.instrumentation,`store.expand`,()=>{let t=eV(this.#e),n=uV(this.#e,e);n!=null&&Iz(this.#e,Pz(this.#e,t,n))})}collapse(e){CR(this.#e.instrumentation,`store.collapse`,()=>{let t=eV(this.#e),n=dV(this.#e,e);n!=null&&Iz(this.#e,Pz(this.#e,t,n))})}on(e,t){return Sz(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return hz(this.#e,t)}markDirectoryUnloaded(e){CR(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(sB(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=eV(this.#e);_z(this.#e,t),Iz(this.#e,Pz(this.#e,n,Oz({affectedAncestorIds:iB(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return CR(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=eV(this.#e),r=gz(this.#e,t);return Iz(this.#e,Pz(this.#e,n,kz({affectedAncestorIds:iB(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return CR(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||hz(this.#e,n)!==`loading`||!yz(this.#e,n,e.attemptId))return!1;let r=tB(this.#e,n);this.validateChildPatch(r,t);let i=eV(this.#e),a=[];for(let e of t.operations){EV(r,e);let t=eV(this.#e);switch(e.type){case`add`:a.push(Pz(this.#e,t,Xz(this.#e,e.path)));break;case`remove`:a.push(Pz(this.#e,t,Zz(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=Qz(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Pz(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Iz(this.#e,Pz(this.#e,i,Az({affectedAncestorIds:iB(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:tB(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return CR(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=eV(this.#e),r=vz(this.#e,t,e.attemptId);return Iz(this.#e,Pz(this.#e,n,jz({affectedAncestorIds:iB(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:tB(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return CR(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=eV(this.#e),i=bz(this.#e,n,e.attemptId,t);return Iz(this.#e,Pz(this.#e,r,Mz({affectedAncestorIds:iB(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:tB(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return CR(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(XB(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=eV(this.#e),n=ZB(this.#e,e.mode??`stable`);return Iz(this.#e,Pz(this.#e,t,Nz({...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=sB(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??DR(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=kR(IR(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(!hR(cB(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=cB(this.#e,n);fz(this.#e,n,i)||(pz(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=cB(this.#e,e);if(!fz(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=aB(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!hR(cB(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!hR(cB(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=cB(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=cB(this.#e,e),r=Kz(this.#e,e);if(!fz(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 EV(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 DV={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function OV(e,t){if(typeof e==`number`)return{itemHeight:t??DV.default.itemHeight,factor:e};let n=DV[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var kV=DV.default.itemHeight,AV=`@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
|
+
`,jV=`@layer base, unsafe;`;function MV(e){return`${jV}
|
|
1863
1863
|
@layer base {
|
|
1864
1864
|
${e}
|
|
1865
|
-
}`}function
|
|
1865
|
+
}`}function NV(e){return`${jV}
|
|
1866
1866
|
@layer unsafe {
|
|
1867
1867
|
${e}
|
|
1868
|
-
}`}var MV=new WeakMap;function NV(e){let t=MV.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(EL,`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(),MV.set(e,i),i}function PV(e,t){if(!e.isConnected)return;let n=NV(t);if(n==null)return;let r=t.querySelector(`style[${DL}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(DL,``),t.appendChild(i)),i.textContent=`:host { ${OL}: ${n}px; }`}var FV;function IV(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){FV??(FV=new CSSStyleSheet,FV.replaceSync(AV(OV)));let t=!1;try{e.adoptedStyleSheets=[FV],t=!0}catch{}if(t){e.querySelector(`style[${wL}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(wL,``),t.textContent=AV(OV),e.prepend(t)}}function LV(e,t){RV(e,t),IV(t),PV(e,t)}function RV(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`});LV(this,e)}}if(customElements.define(CL,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(CL)))e instanceof HTMLElement&&LV(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var zV=e=>e.startsWith(`f::`)?e.slice(3):e;function BV(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function VV(e,t){return e===``?t:`${e}/${t}`}function HV({files:e,path:t,isFolder:n,nextBasename:r}){let i=zV(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}=BV(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=VV(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 UV(e){return e.endsWith(`/`)}function WV(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 GV(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 KV(e,t){return t.includes(e)?GV(t):[e]}function qV(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 JV(e,t){return{draggedPaths:e,target:t}}function YV(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(UV(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function XV(e,t){return t.kind===`root`||t.directoryPath==null?WV(e):t.directoryPath}function ZV(e,t){let n=e.map(e=>{let n=XV(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 QV(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 $V(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(!QV(CV.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 eH(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function tH(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 nH(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function rH(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 nH(e,t.path)?n?e:null:e;case`move`:return tH(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=rH(r,e,n),r==null)return null;return r}}}function iH(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function aH(e){switch(e.operation){case`add`:return{...iH(e),operation:`add`,path:e.path};case`remove`:return{...iH(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...iH(e),from:e.from,operation:`move`,to:e.to}}}function oH(e){return{...iH(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>aH(e)),operation:`batch`}}function sH(e){switch(e.operation){case`add`:case`remove`:case`move`:return aH(e);case`batch`:return oH(e);default:return null}}function cH(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function lH(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 uH(e){return lH(e).at(-1)??null}function dH(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function fH(e){return e.endsWith(`/`)}var pH=e=>e.toLowerCase();function mH(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function hH(e){return e.endsWith(`/`)?e.slice(0,-1):e}function gH(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var _H=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},vH=Symbol(`FILE_TREE_RENAME_VIEW`),yH=512,bH=512;function xH(e){return e===`top`||e===`center`?e:`nearest`}function SH(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=lH(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 CH(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:SH(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var wH=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=$V({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=uH(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:xH(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<=bH){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=KV(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=JV(t.draggedPaths,n);(YV(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}qV(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=JV(e.draggedPaths,t);if(YV(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=ZV(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=fH(r),a=hH(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of lH(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=mH(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[vH](){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,fH(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,fH(e)?{recursive:!0}:void 0);return}let t=fH(e),n=HV({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:hH(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(gH(n.sourcePath,t),gH(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=$V({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=!cH(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=uH(e),n=dH(e,t),r=null,i=null;for(let e of this.#be()){if(uH(e)!==t)continue;let a=dH(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=lH(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=!cH(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 CV({...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 lH(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(pH),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(pH),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 lH(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:_H(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 lH(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 lH(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=CH(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,yH)),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=rH(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=rH(this.#c,e,!0),r=[...this.#B].map(t=>rH(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=rH(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return cH(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&&eH(e)&&(this.#i=null);let t=eH(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=sH(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},TH=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 EH(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 DH(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 OH(e,t){return t?`${e}/`:e}function kH(e,t=null){let n=TH(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=EH(t.path);if(e==null)continue;let n=OH(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 DH(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var AH,jH,MH,NH,PH,FH,IH,LH,RH,zH,BH={},VH=[],HH=Array.isArray,UH=VH.slice,WH=Object.assign;function GH(e){e&&e.parentNode&&e.remove()}function KH(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?UH.call(arguments,2):n),qH(e,o,r,i,null)}function qH(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??++jH,__i:-1,__u:0};return i==null&&AH.vnode!=null&&AH.vnode(a),a}function JH(e){return e.children}function YH(e,t){this.props=e,this.context=t,this.__g=0}function XH(e,t){if(t==null)return e.__?XH(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`?XH(e):null}function ZH(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 ZH(e)}}function QH(e){(8&e.__g||!(e.__g|=8)||!MH.push(e)||PH++)&&NH==AH.debounceRendering||((NH=AH.debounceRendering)||queueMicrotask)($H)}function $H(){for(var e,t,n,r,i,a,o,s,c=1;MH.length;)MH.length>c&&MH.sort(FH),e=MH.shift(),c=MH.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=WH({},r)).__v=r.__v+1,AH.vnode&&AH.vnode(n),sU(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??XH(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,lU(a,n,o),n.__e!=i&&ZH(n)));PH=0}function eU(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||VH,b=t.length;for(c=tU(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?BH:y[m.__i]||BH,m.__i=f,_=sU(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&fU(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=nU(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function tU(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?qH(null,o,null,null,null):HH(o)?qH(JH,{children:o},null,null,null):o.constructor==null&&o.__b>0?qH(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=rU(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=XH(s)),pU(s,s));return r}function nU(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=nU(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=XH(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function rU(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 iU(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function aU(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||iU(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||iU(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(IH,`$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=LH,e.addEventListener(t,a?zH:RH,a)):e.removeEventListener(t,a?zH:RH,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 oU(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=LH++;else if(t.u<n.l)return;return n(AH.event?AH.event(t):t)}}}function sU(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=AH.__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 YH(v,x),f.constructor=M,f.render=mU),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=WH({},f.__s)),WH(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=AH.__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=WH({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===JH&&d.key==null&&(E=uU(d.props.children)),s=eU(e,HH(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--;)GH(a[j]);cU(t)}else t.__e=n.__e,t.__k=n.__k,e.then||cU(t);AH.__e(e,t,n)}else s=t.__e=dU(n.__e,t,n,r,i,a,o,c,l,u);return(d=AH.diffed)&&d(t),128&t.__u?void 0:s}function cU(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(cU)}function lU(e,t,n){for(var r=0;r<n.length;r++)fU(n[r],n[++r],n[++r]);AH.__c&&AH.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){AH.__e(e,t.__v)}})}function uU(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:HH(e)?e.map(uU):WH({},e)}function dU(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&&=(AH.__m&&AH.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=UH.call(e.childNodes),v=n.props||BH,!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;aU(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&&!_||aU(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=``),eU(b==`template`?e.content:e,HH(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&XH(n,0),s,c,l),a!=null)for(u=a.length;u--;)GH(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||aU(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&aU(e,u,g,v[u],i))}return e}function fU(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){AH.__e(e,n)}}function pU(e,t,n){var r,i;if(AH.unmount&&AH.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||fU(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){AH.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&pU(r[i],t,n||typeof e.type!=`function`);n||GH(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function mU(e,t,n){return this.constructor(e,n)}function hU(e,t){var n,r,i,a;t==document&&(t=document.documentElement),AH.__&&AH.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=KH(JH,null,[e]),i=[],a=[],sU(t,e,r||BH,BH,t.namespaceURI,r?null:t.firstChild?UH.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),lU(i,e,a)}function gU(e,t){e.__u|=32,hU(e,t)}AH={__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 PH=0,e}},jH=0,YH.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=WH({},this.state);typeof e==`function`&&(e=e(WH({},n),this.props)),e&&WH(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),QH(this))},YH.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),QH(this))},YH.prototype.render=JH,MH=[],PH=0,FH=function(e,t){return e.__v.__b-t.__v.__b},IH=/(PointerCapture)$|Capture$/i,LH=0,RH=oU(!1),zH=oU(!0);var _U=0;Array.isArray;function vU(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:--_U,__i:-1,__u:0,__source:i,__self:a};return AH.vnode&&AH.vnode(l),l}var yU=16,bU=16,xU={};function SU({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}=xU[e]??{width:yU,height:bU},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return vU(`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:vU(`use`,{href:c})})}var CU=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},wU=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)]},TU=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)]},EU=(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)]},DU=(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)]},OU=(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 kU({children:e,marker:t,variant:n=`default`}){"use no memo";return vU(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:vU(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?vU(`span`,{"data-truncate-fade":!0}):t})})}function AU(e){"use no memo";let{mode:t,children:n}=e;return vU(`div`,{children:[vU(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?vU(`span`,{children:n}):n}),vU(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?vU(`span`,{children:n}):n})]})}function jU({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=vU(AU,{mode:t,children:e},`content`),o=vU(kU,{marker:n,mode:t,variant:r},`marker`),s=vU(`div`,{"data-truncate-fill":!0},`fill`);return vU(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:vU(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function MU({children:e,...t}){"use no memo";return vU(jU,{mode:`truncate`,...t,children:e})}function NU({children:e,...t}){"use no memo";return vU(jU,{mode:`fruncate`,...t,children:e})}function PU({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=vU(MU,{...s,children:t[0]}),l=vU(NU,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return vU(`div`,{className:a,style:o});if(e.length<i)return vU(n===`end`?NU:MU,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=CU:r===`extension`?t=wU:r===`leaf-path`&&(t=TU);else if(typeof r==`number`)t=EU,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=DU:e===`first`&&(t=OU)}else typeof r==`function`&&(t=r);t??=CU;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=vU(MU,{...s,..._,children:f}),l=vU(NU,{...s,...v,children:p})}return vU(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[vU(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),vU(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var FU={endIndex:-1,startIndex:-1};function IU(e,t,n){return Math.min(Math.max(e,t),n)}function LU(e,t){return e<0||t<e?FU:{endIndex:t,startIndex:e}}function RU(e){return e.startIndex<0||e.endIndex<e.startIndex}function zU(e,t){return RU(e)?0:(e.endIndex-e.startIndex+1)*t}function BU(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function VU(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function HU(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 UU(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 WU(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 GU(e,t,n){if(e.length===0||t<=0)return[];let r=WU(e),i=HU(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=UU(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 KU(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=IU(t.scrollTop,0,o),c=t.stickyRows??GU(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=BU(s,n,t.itemHeight),m=BU(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?FU:LU(m,VU(u+d,n,t.itemHeight)),y=g+1,b=RU(v)?FU:LU(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=zU(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:RU(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var qU={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},JU={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},YU=`Contains git status items`;function XU(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 ZU(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return XU({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 QU(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 $U(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 eW(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 tW(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function nW(e,t){return e!=null&&e>0?e:t}function rW(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 iW(e,t,n,r,i=0){let a=XU({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function aW(e,t,n,r,i,a,o=0){let s=ZU({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function oW(e,t,n,r,i,a){let o=QU({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function sW(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function cW(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function lW({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return vU(`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 uW(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 dW(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 fW,pW,mW,hW,gW=Object.is,_W=0,vW=[],yW=AH,bW=yW.__b,xW=yW.__r,SW=yW.diffed,CW=yW.__c,wW=yW.unmount,TW=yW.__;function EW(e,t){yW.__h&&yW.__h(pW,e,_W||t),_W=0;var n=pW.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function DW(e){return _W=1,OW(BW,e)}function OW(e,t,n){var r=EW(fW++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):BW(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);gW(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=pW,!pW.__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,gW(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};pW.__f=!0;var a=pW.shouldComponentUpdate,o=pW.componentWillUpdate;pW.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)},pW.shouldComponentUpdate=i}return r.__N||r.__}function kW(e,t){var n=EW(fW++,3);!yW.__s&&zW(n.__H,t)&&(n.__=e,n.u=t,pW.__H.__h.push(n))}function AW(e,t){var n=EW(fW++,4);!yW.__s&&zW(n.__H,t)&&(n.__=e,n.u=t,pW.__h.push(n))}function jW(e){return _W=5,MW(function(){return{current:e}},[])}function MW(e,t){var n=EW(fW++,7);return zW(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function NW(e,t){return _W=8,MW(function(){return e},t)}function PW(){for(var e;e=vW.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(LW),e.__H.__h.forEach(RW),e.__H.__h=[]}catch(t){e.__H.__h=[],yW.__e(t,e.__v)}}yW.__b=function(e){pW=null,bW&&bW(e)},yW.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),TW&&TW(e,t)},yW.__r=function(e){xW&&xW(e),fW=0;var t=(pW=e.__c).__H;t&&(mW===pW?(t.__h=[],pW.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(LW),t.__h.forEach(RW),t.__h=[],fW=0)),mW=pW},yW.diffed=function(e){SW&&SW(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(vW.push(t)!==1&&hW===yW.requestAnimationFrame||((hW=yW.requestAnimationFrame)||IW)(PW)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),mW=pW=null},yW.__c=function(e,t){t.some(function(e){try{e.__h.forEach(LW),e.__h=e.__h.filter(function(e){return!e.__||RW(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],yW.__e(n,e.__v)}}),CW&&CW(e,t)},yW.unmount=function(e){wW&&wW(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{LW(e)}catch(e){t=e}}),n.__H=void 0,t&&yW.__e(t,n.__v))};var FW=typeof requestAnimationFrame==`function`;function IW(e){var t,n=function(){clearTimeout(r),FW&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);FW&&(t=requestAnimationFrame(n))}function LW(e){var t=pW,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),pW=t}function RW(e){var t=pW;e.__c=e.__(),pW=t}function zW(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!gW(t,e[n])})}function BW(e,t){return typeof t==`function`?t(e):t}function VW(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:vU(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return vU(JH,{children:[vU(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:vU(MU,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function HW(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function UW(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function WW(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 GW({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=KU(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:WW(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?WW(u,1,t,o):i&&r<=0&&c.length>0?GU(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 KW=400,qW=10,JW=40,YW=18;function XW(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))?ZW(e,t,n):a instanceof HTMLElement?a:null}function ZW(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 QW(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 $W(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 eG(){return navigator.vendor!==`Apple Computer, Inc.`}function tG(e,t){let n=e-t.top;if(n<JW)return-Math.ceil((JW-Math.max(0,n))/JW*YW);let r=t.bottom-e;return r<JW?Math.ceil((JW-Math.max(0,r))/JW*YW):0}function nG(e,t){if(e!=null){let t=qU[e];return t==null?null:{text:t,title:JU[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:YU}:null}function rG(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 iG(e){return e!=null&&`toggle`in e}function aG(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function oG(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function sG(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function cG(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function lG(e,t){return t&&cG(e)||(e.ctrlKey||e.metaKey)&&aG(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var uG=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function dG(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 fG(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 pG(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function mG(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function hG(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function gG(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 _G(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 vG(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 yG(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=vG(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 bG(e,t){return{kind:e.kind,name:UW(e),path:t}}function xG(e){return e==null?void 0:`${e}__tree`}function SG(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function CG(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function wG(e,t){if(e==null)return null;if(`text`in e)return vU(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?CG(e.icon)?t(e.icon):{name:e.icon}:CG(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return vU(`span`,{title:e.title,children:vU(SU,{...n})})}function TG(e){e!=null&&$U(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function EG(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=HW(e);return vU(JH,{children:[e.depth>0?vU(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>vU(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,vU(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?vU(SU,{...t(`file-tree-icon-chevron`)}):vU(SU,{...t(`file-tree-icon-file`,u)})}),vU(`div`,{"data-item-section":`content`,children:e.isFlattened?VW(e,c,a):c??vU(PU,{minimumLength:5,split:`extension`,children:e.name})}),i?vU(`div`,{"data-item-section":`decoration`,children:r==null?null:wG(r,t)}):null,s?vU(`div`,{"data-item-section":`git`,children:wG(o,t)}):null,n?vU(`div`,{"data-item-section":`action`,children:l?vU(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:vU(SU,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function DG(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=HW(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??rG(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=nG(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,q=K?a.getValue():``,J=R||!K?null:vU(lW,{ref:D,ariaLabel:`Rename ${UW(t)}`,isFlattened:t.isFlattened,value:q,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ee=EG(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:J,showDecorativeActionAffordance:G}),Y={...uW({ariaLabel:UW(t),domId:t.isFocused?SG(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:pG(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?vU(`div`,{...Y,children:ee}):vU(`button`,{...Y,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:ee})}function OG(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(HW(e))).map((n,r)=>DG(e,n,t.start+r))}function kG({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=DV,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 _=jW(null),v=jW(null),y=jW(!1),b=jW(null),x=jW(null),S=jW(null),C=jW(null),w=jW(null),T=jW(new Map),E=jW(new Map),D=jW(()=>{}),O=jW(null),k=jW(0),A=jW(!1),j=jW(null);j.current!==t&&(A.current=!1,j.current=t);let M=jW(!1),N=jW(null),P=jW(null),F=jW(!1),I=jW(null),L=jW(null),R=jW(null),z=jW(null),B=jW(null),V=jW(null),H=jW(null),U=jW(null),W=jW(!1),G=jW(null),K=jW(null),q=jW(null),J=jW(null),ee=MW(()=>new Map,[]),[,Y]=DW(0),[te,X]=DW(null),[ne,re]=DW(null),[ie,ae]=DW(null),[oe,se]=DW(null),[ce,le]=DW(0),[ue,de]=DW(null),fe=jW(ue);fe.current=ue;let pe=jW(null),me=jW(null),he=jW(null),ge=jW(null),_e=jW(null),ve=jW(!1),ye=()=>{me.current=null,he.current=null,ge.current=null},be=(e,t)=>{me.current=e,he.current=null,ge.current=t==null?null:{path:e,scrollTop:t}},xe=(e,t)=>{me.current=null,he.current={path:e,viewportOffset:t},ge.current=null},Se=jW(d===`retain`&&t.isSearchOpen()),[Ce,we]=DW(p);kW(()=>{p||we(!1)},[p]);let Te=jW(!1),Ee=NW(()=>{Te.current=!0,we(e=>e&&!1)},[]),[De,Oe]=DW(()=>GW({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[ke,Ae]=DW(!1);kW(()=>{Ae(!0)},[]);let je=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Me=e?.contextMenu?.triggerMode??(je?`right-click`:`both`),Ne=Me===`both`||Me===`button`,Pe=e?.contextMenu?.buttonVisibility??`when-needed`,Fe=Me===`both`||Me===`right-click`;AW(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;_e.current=t,re(t),se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(ve.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Ie=NW((e,t)=>{hG(T.current,e,t)},[]),Le=NW((e,t)=>{hG(E.current,e,t)},[]),Re=NW(e=>{x.current=e},[]),ze=NW(e=>gG(e,E.current,T.current),[]),Be=n!=null||r!=null||i!=null,{resolveIcon:Ve}=MW(()=>RL(a),[a]),He=t[vH](),Ue=He.getPath(),We=Ue!=null,Ge=t.isSearchOpen(),Ke=t.getSearchValue(),qe=t.getFocusedPath(),Je=t.getFocusedIndex(),Ye=t.getScrollRequest(),Xe=t.isDragAndDropEnabled(),Ze=t.getDragSession(),Qe=MW(()=>Ze==null?null:new Set(Ze.draggedPaths),[Ze]),$e=Ze?.target??null,et=Ze?.primaryPath??null,tt=xG(o),{overlayHeight:nt,overlayRows:rt,snapshot:it,visibleRows:at}=De,ot=it.physical.viewportHeight,st=MW(()=>({end:it.window.endIndex,start:it.window.startIndex}),[it.window.endIndex,it.window.startIndex]),ct=rt,lt=it.sticky.rows,ut=it.physical.totalHeight,dt=it.sticky.height,ft=MW(()=>new Set(lt.map(e=>HW(e.row))),[lt]),pt=Je>=0&&Je>=st.start&&Je<=st.end,mt=NW((e,t)=>u?.({item:bG(e,t),row:e})??null,[u]),ht=NW(e=>$U(e==null?null:T.current.get(e)??null)?!0:$U(S.current),[]),gt=NW(e=>{ht(t.focusNearestPath(e))},[t,ht]),_t=jW(gt);_t.current=gt;let vt=jW(!0),yt=jW(()=>{}),bt=NW((t=!0)=>{let n=fe.current;n!=null&&(vt.current=vt.current&&t,de(null),e?.contextMenu?.onClose?.(),vt.current&>(n.path))},[e?.contextMenu,gt]);yt.current=bt;let xt=NW(e=>{let t=e==null?null:mG(S.current,e);ae(e=>e===t?e:t)},[]),St=NW((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=ze(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;be(n,e?.scrollTop??null),M.current=!0,X(e=>e===n?e:n)}i.focus(),xt(a),vt.current=!0,de({anchorRect:r?.anchorRect??null,item:bG(e,n),path:n,source:r?.source??`keyboard`})},[t,ze,xt]),Ct=NW(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=tW(e,ot);I.current=Je<0||e==null?null:Math.max(0,Math.min(Je*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),Y(e=>e+1))}},[t,Je,s,l,ot]),wt=NW((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=tW(i,ot),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:GW({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,oW(i,a,s,l,u,d),D.current(),pe.current=n?e:null,!0},[t,s,c,ot,h]),Tt=()=>y.current===!0||J.current!=null||W.current===!0,Et=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Dt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Ot=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},kt=()=>{V.current?.remove(),V.current=null},At=()=>{Dt(L.current),L.current=null,B.current=null},jt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Mt=()=>{U.current?.(),U.current=null,J.current!=null&&(clearTimeout(J.current),J.current=null),W.current=!1,G.current=null,q.current=null,K.current!=null&&(K.current.setAttribute(`draggable`,`true`),K.current.style.removeProperty(`touch-action`),K.current=null),kt(),Ot(),At(),H.current=null},Nt=(e,n)=>{let r=S.current?.getRootNode(),i=QW(XW(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Pt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Ot();return}let r=t.getItem(e.directoryPath),i=iG(r)?r:null;if(i==null||i.isExpanded()){Ot();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(Ot(),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))},Ft=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=tG(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()),Pt(Nt(e.clientX,e.clientY)),L.current=Et(Ft)},It=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Et(Ft)},Lt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Mt(),kt(),Ot(),At(),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),eG())){let t=$W(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),jt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Rt=()=>{kt(),Ot(),At(),H.current=null,t.cancelDrag()},zt=(e,n,r)=>{if(J.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;q.current={clientX:i.clientX,clientY:i.clientY},K.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;J.current!=null&&(clearTimeout(J.current),J.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null)},s=e=>{let t=e.touches[0],n=q.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=qW*qW||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,J.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null;return}W.current=!0,K.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=$W(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`}),jt(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)`),Pt(Nt(t.clientX,t.clientY)),It(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Nt(n.clientX,n.clientY),t.completeDrag(),Mt()},u=()=>{t.cancelDrag(),Mt()};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)},KW)},Bt=e=>{if(ue!=null){if(e.key===`Escape`){bt(),e.preventDefault(),e.stopPropagation();return}uG.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(He.isActive()){if(e.key===`Escape`)He.cancel();else if(e.key===`Enter`)He.commit();else return;se(`focus`),Y(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Ct(qe??void 0),e.preventDefault(),e.stopPropagation();return}if(Ge){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=tW(n,ot);I.current=Je<0||n==null?null:Math.max(0,Math.min(Je*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;se(`focus`),Y(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&oG(e)){t.openSearch(e.key),Y(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=je&&cG(e),r=lG(e,je),i=r&&S.current!=null?eW(S.current):null,a=r?new Set(_G(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==qe&&a.has(o)){let e=C.current;be(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=iG(p)?p:null,h=u!=null&&(ft.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=gG(u,E.current,T.current);e==null||n==null?y=!1:St(e,u)}else if((e.ctrlKey||e.metaKey)&&aG(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ft.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))be(b,v?.scrollTop??null),M.current=!0,X(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(xe(b,yG(S.current,v,i,u,s,dt,ot)),M.current=!0,X(e=>e===b?e:b)):ye()}Y(e=>e+1),e.preventDefault(),e.stopPropagation()};AW(()=>{if(!(!f||!Ge)){if(Se.current){Se.current=!1;return}$U(w.current)}},[Ge,f]),AW(()=>{let e=x.current;switch(cW({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ue})){case`reset`:P.current=null;return;case`reveal-canonical`:Ue!=null&&wt(Ue,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(pe.current=null,P.current=Ue,$U(e),e.select());return}},[st.end,st.start,Ue,wt,ft]),AW(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=eW(e)?.dataset.itemPath??null;X(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,eW(e)!=null){r();return}M.current=!1,X(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,X(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;X(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),AW(()=>{let e=S.current;e!=null&&(it.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[it.physical.scrollTop]),AW(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=tW(n,g);let a=()=>{let e=t.getVisibleCount(),r=nW(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Oe(GW({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=nW(O.current,g),i=t.getVisibleRows(e,e)[0]??null;iW(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?Y(e=>e+1):o=!0,a()}),u=()=>{ve.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,le(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||ve.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),fe.current!=null&&y.current&&yt.current(),ve.current===!0){y.current=!1;return}re(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:rW(e[0]))??tW(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]),AW(()=>{je||ue==null||bt(!1)},[bt,je,ue]);let Vt=MW(()=>ue==null?null:`${ue.path}::${ue.source}`,[ue]);AW(()=>{if(Vt==null){m?.clearSlotContent(AL);return}let t=fe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??fG(n.getBoundingClientRect()),close:e=>{yt.current(e?.restoreFocus??!0)},restoreFocus:()=>{vt.current&&_t.current(fe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(AL,i),e?.contextMenu?.onOpen?.(t.item,r),TG(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&TG(i)}),()=>{m?.clearSlotContent(AL)}},[Vt,e?.contextMenu,m]),AW(()=>{ue!=null&&t.getItem(ue.path)==null&&bt()},[bt,ue,t]),AW(()=>{if(ue==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(dG(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&bt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),bt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[bt,ue]),AW(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=qe;return}let r=qe==null?null:T.current.get(qe)??null,i=eW(n),a=i?.dataset.itemPath??null,o=We&&x.current===i,c=f&&w.current===i,l=F.current&&!Ge,u=I.current??0,d=pe.current,p=me.current,m=he.current,g=ge.current,_=i!=null,v=M.current||_,y=N.current!==qe,b=p!=null&&p===qe&&qe!=null,E=!1,O=!1;if(Ye!=null&&Ye.id!==k.current){k.current=Ye.id;let n=Ye.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,ot-s))):dt;E=!0,O=aW(e,n,s,ot,ut,Ye.offset,t)}t.clearScrollRequest(Ye.id)}let A=!E&&l&&oW(e,Je,s,ot,ut,u),j=!E&&d!=null&&d===qe&&oW(e,Je,s,ot,ut,dt),P=!E&&m!=null&&m.path===qe&&oW(e,Je,s,ot,ut,m.viewportOffset),L=!E&&g!=null&&g.path===qe&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==qe&&!b&&iW(e,Je,s,ot,dt))&&D.current(),E){N.current=qe;return}if(!v){N.current=qe;return}if(o){N.current=qe;return}if(c&&!l){N.current=qe;return}if(r==null){l&&Je>=0&&(oW(e,Je,s,ot,ut,u),D.current()),N.current=qe;return}(y||l||d===qe||p===qe||m?.path===qe||g?.path===qe||a==null||a!==qe)&&($U(r),d===qe&&(pe.current=null),p===qe&&(me.current=null),m?.path===qe&&(he.current=null),g?.path===qe&&(ge.current=null),F.current=!1,I.current=null),N.current=qe},[t,Je,qe,pt,s,We,Ge,st,ot,f,Ye,h,dt,ut,at]);let Ht=Je>=0&&Je>=it.visible.startIndex&&Je<=it.visible.endIndex,Ut=qe!=null&&ct.some(e=>HW(e.row)===qe),Wt=Ht||Ut,Gt=Ne&&M.current===!0&&Wt?qe:null,Kt=oe===`pointer`?ne:null,qt=ue?.path??_e.current??Kt??Gt??ne,Jt=ue?.source===`right-click`;AW(()=>{y.current&&ue==null||xt(ze(qt))},[ue,ze,st,ot,ce,ct,qt,xt,at]);let Yt=NW(e=>{if(y.current||dG(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&se(e=>e===`pointer`?e:`pointer`),re(e=>e===i?e:i)},[]),Xt=NW(()=>{re(null)},[]);AW(()=>{if(!Xe)return;let e=()=>{Mt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Mt(),t.cancelDrag()}},[t,Xe]);let Zt=e=>{if(!Xe||t.getDragSession()==null||W.current)return;let n=QW(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Pt(t.getDragSession()?.target??null),It(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Qt=e=>{if(!Xe||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ot(),At(),t.setDragTarget(null))},$t=e=>{!Xe||t.getDragSession()==null||W.current||(e.preventDefault(),Nt(e.clientX,e.clientY),t.completeDrag(),kt(),Ot(),At(),H.current=null)},en=it.window.height,tn=it.window.offsetTop,nn=Math.min(0,ot-en),rn=Math.min(0,ot-en-dt),an=te===qe||F.current,on=qe!=null&&an&&!pt&&Je>=0?at[Je]??t.getVisibleRows(Je,Je)[0]??null:null,sn=on==null?null:sW(Je,s,st,en),cn=H.current,ln=et!=null&&cn!=null&&cn.path===et&&cn.index>=st.start&&cn.index<=st.end,un=et!=null&&cn!=null&&cn.path===et&&!ln&&cn.path!==on?.path?cn:null,dn=un==null?null:sW(un.index,s,st,en),fn=sG((Je>=0?at[Je]??t.getVisibleRows(Je,Je)[0]??null:null)?.ancestorPaths.at(-1)??null),pn=Ge&&qe!=null?SG(o,qe,!pt):void 0,mn=ue?.path??(Ge?qe:te),hn=ue?.path??ne,gn=ze(qt),_n=je&&Ne&&!Jt&&!We&&gn!=null&&ie!=null&&qt!=null,vn=je&&(_n||ue!=null),yn=ue?.anchorRect,bn=yn==null&&gn!=null&&ie!=null&&(ue!=null||_n)?ie:null,xn=yn==null?bn==null?void 0:{top:`${bn}px`}:{left:`${yn.left}px`,position:`fixed`,right:`auto`,top:`${yn.top}px`},Sn=Jt?{opacity:`0`}:void 0,Cn=NW((e,n,r,i)=>{let a=dW({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Ge,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>=it.visible.startIndex&&n.index<=it.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,X(e=>e===c?e:c),se(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&wt(c,{targetOffset:`sticky-parents`})},[t,Ge,it.visible.endIndex,it.visible.startIndex,wt]),wn=()=>{if(y.current||!Ne||qt==null||gn==null)return;let e=t.getItem(qt);e!=null&&(xt(gn),vt.current=!0,de({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:gn.getAttribute(`aria-label`)??qt,path:e.getPath()},path:e.getPath(),source:`button`}))},Tn={contextHoverPath:hn,contextMenuButtonTriggerEnabled:Ne,contextMenuButtonVisibility:Pe,contextMenuEnabled:je,contextMenuRightClickEnabled:Fe,contextMenuTriggerMode:Me,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Xe,draggedPathSet:Qe,dragTarget:$e,gitLaneActive:Be,gitStatusByPath:n,handleRowDragEnd:Rt,handleRowDragStart:Lt,handleRowTouchStart:zt,ignoredGitDirectories:r,ignoredInheritanceCache:ee,instanceId:o,itemHeight:s,onKeyDown:Bt,onRowClick:Cn,openContextMenuForRow:St,registerButton:Ie,registerRenameInput:Re,renameView:He,renderDecorationForRow:mt,resolveIcon:Ve,shouldSuppressContextMenu:Tt,visualFocusPath:mn},En={...Tn,registerButton:Le};return vU(`div`,{ref:S,id:tt,"data-file-tree-context-menu-button-visibility":je&&Ne?Pe:void 0,"data-file-tree-context-menu-trigger-mode":je?Me:void 0,"data-file-tree-has-context-menu-action-lane":je&&Ne?`true`:void 0,"data-file-tree-has-git-lane":Be?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":$e?.kind===`root`?`true`:void 0,onDragLeave:Xe?Qt:void 0,onDragOver:Xe?Zt:void 0,onDrop:Xe?$t:void 0,onKeyDown:Bt,onPointerLeave:je?Xt:void 0,onPointerOver:je?Yt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[vU(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:fn}}),vU(`slot`,{name:kL,"data-type":`header-slot`}),f?vU(`div`,{"data-file-tree-search-container":!0,"data-open":Ge?`true`:`false`,children:vU(`input`,{ref:w,"aria-activedescendant":pn,"aria-controls":tt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ce?`true`:void 0,value:Ke,onBlur:()=>{d===`retain`&&!Te.current||t.closeSearch()},onFocus:Ee,onPointerDown:Ee,onInput:e=>{Ee();let n=e.currentTarget;t.setSearch(n.value)}})}):null,vU(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&ke&&ct.length>0?vU(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:vU(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${nt}px`},children:ct.map((e,t)=>DG(En,e.row,`sticky:${HW(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ct.length-t}`}}))})}):null,vU(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ut}px`},children:[vU(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${tn}px`}}),vU(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${en}px`,top:`${nn}px`,bottom:`${rn}px`},children:[OG(Tn,st,ft),on!=null&&sn!=null?DG(Tn,on,`parked:${on.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:et===on.path?`none`:void 0,position:`absolute`,right:`0`,top:`${sn}px`}}):null,un!=null&&dn!=null?DG(Tn,un,`parked-drag:${un.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${dn}px`}}):null]})]})]}),je?vU(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":vn?`true`:`false`,style:xn,children:[vU(`button`,{ref:v,type:`button`,"data-type":jL,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":ue==null?`false`:`true`,"data-visible":_n?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),ue!=null){bt();return}wn()},tabIndex:-1,style:Sn,children:vU(SU,{...Ve(`file-tree-icon-ellipsis`)})}),ue==null?null:vU(`slot`,{name:AL})]}):null,ue==null?null:vU(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),bt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),bt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var AG={hydrateRoot:(e,t)=>{gU(KH(kG,t),e)},renderRoot:(e,t)=>{hU(KH(kG,t),e)},unmountRoot:e=>{hU(null,e)}};function jG(e,t){AG.renderRoot(e,t)}function MG(e,t){AG.hydrateRoot(e,t)}function NG(e){AG.unmountRoot(e)}var PG=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)}}},FG=`__c`,IG=`__k`,LG=`__d`,RG=`__s`,zG=/[\s\n\\/='"\0<>]/,BG=/^(xlink|xmlns|xml)([A-Z])/,VG=/^(?: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])/,HG=/^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/,UG=new Set([`draggable`,`spellcheck`]);function WG(e){e.__g===void 0?e[LG]=!0:e.__g|=8}function GG(e){e.__g===void 0?e[LG]=!1:e.__g&=-9}function KG(e){return e.__g===void 0?!0===e[LG]:!!(8&e.__g)}var qG=/["&<]/;function JG(e){if(e.length===0||!1===qG.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 YG={},XG=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(`.`)),ZG=/[A-Z]/g;function QG(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:YG[n]||(YG[n]=n.replace(ZG,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||XG.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function $G(){this.__d=!0}function eK(e,t){return{__v:e,context:t,props:e.props,setState:$G,forceUpdate:$G,__d:!0,__h:[]}}function tK(e,t,n){if(!e.s){if(n instanceof nK){if(!n.s)return void(n.o=tK.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(tK.bind(null,e,t),tK.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var nK=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{tK(r,1,a(this.v))}catch(e){tK(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?tK(r,1,t?t(i):i):n?tK(r,1,n(i)):tK(r,2,i)}catch(e){tK(r,2,e)}},r},e}(),rK,iK,aK,oK,sK={},cK=Array.isArray,lK=Object.assign,uK=``,dK=`<!--$s-->`,fK=`<!--/$s-->`;function pK(e,t){var n,r=e.type,i=!0;return e[FG]?(i=!1,(n=e[FG]).state=n[RG]):n=new r(e.props,t),e[FG]=n,n.__v=e,n.props=e.props,n.context=t,WG(n),n.state??=sK,n[RG]??(n[RG]=n.state),r.getDerivedStateFromProps?n.state=lK({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[RG]===n.state?n.state:n[RG]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),aK&&aK(e),n.render(n.props,n.state,t)}function mK(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===uK)return uK;var s=typeof e;if(s!=`object`)return s==`function`?uK:s==`string`?JG(e):e+uK;if(cK(e)){var c,l=uK;i[IG]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=mK(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=uK,cK(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return uK;e.__=i,rK&&rK(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===JH){if(`tpl`in g){for(var x=uK,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&&!cK(C)?x+=C:x+=mK(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+JG(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=pK(e,b),y=e[FG];else{e[FG]=y=eK(e,b);for(var E=0;KG(y)&&E++<25;){GG(y),aK&&aK(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}WG(y)}if(y.getChildContext!=null&&(t=lK({},t,y.getChildContext())),T&&AH.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===JH&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return mK(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[RG]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,sK),KG(y)?(v=pK(e,t),(y=e[FG]).getChildContext!=null&&(t=lK({},t,y.getChildContext())),mK(v=v!=null&&v.type===JH&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):uK}finally{iK&&iK(e),oK&&oK(e)}}}v=v!=null&&v.type===JH&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=mK(v,t,n,r,e,a,o);return iK&&iK(e),AH.unmount&&AH.unmount(e),e._suspended?typeof D==`string`?dK+D+fK:cK(D)?(D.unshift(dK),D.push(fK),D):D.then(function(e){return dK+e+fK}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return mK(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=AH.__e;return k&&k(i,e),uK}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=mK(v,t,n,r,e,a,o);return e._suspended?dK+s+fK:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=uK;for(var N in g){var P=g[N];if(typeof(P=gK(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=QG(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(BG.test(N))N=N.replace(BG,`$1:$2`).toLowerCase();else{if(zG.test(N))continue;N[4]!==`-`&&!UG.has(N)||P==null?n?HG.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):VG.test(N)&&(N=N.toLowerCase()):P+=uK}}P!=null&&!1!==P&&(j=!0===P||P===uK?j+` `+N:j+` `+N+`="`+(typeof P==`string`?JG(P):P+uK)+`"`)}}if(zG.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=JG(A):A!=null&&!1!==A&&!0!==A&&(M=mK(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),iK&&iK(e),oK&&oK(e),!M&&hK.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return cK(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var hK=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function gK(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var _K=0;function vK(e){return e!=null&&e.length>0?e:(_K+=1,`pst_ft_${_K}`)}function yK({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??DV)}function bK(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 xK(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 SK(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var CK=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new PG;#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=vK(a),this.#p=kH(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=EV(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new wH({...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&&(NG(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(),jG(t.wrapper,this.#w()))}setGitStatus(e){this.#p=kH(e,this.#p);let t=this.#T();t!=null&&jG(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),jG(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),MG(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),jG(r,this.#w())}#C(){return{initialViewportHeight:yK({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(kL,e());return}this.#l.setSlotHtml(kL,this.#e?.header?.html??null)}#k(e){let t=SK(e).find(e=>xK(e)),n=bK(yL(NL(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=SK(e),n=t.find(e=>xK(e)),r=t.filter(e=>e!==n),i=NL(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=bK(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=NL(this.#m);t.colored&&xL(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${TL}]`);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(TL,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=jV(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 LV(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)}},wK=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function TK(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:kL,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:AL,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function EK(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 DK(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 OK(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 kK({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)(()=>OK(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),wK(()=>{n.setComposition(g)},[g,n]),wK(()=>{if(c!=null)return r!=null&&DK(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=EK(TK(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)(CL,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function AK(e){let[t]=(0,Q.useState)(()=>new CK(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 jK={density:`compact`,itemHeight:26,flattenEmptyDirectories:!1},MK={"--trees-level-gap-override":`4px`,"--trees-item-row-gap-override":`4px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`${jK.itemHeight}px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},NK=`
|
|
1868
|
+
}`}var PV=new WeakMap;function FV(e){let t=PV.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(OL,`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(),PV.set(e,i),i}function IV(e,t){if(!e.isConnected)return;let n=FV(t);if(n==null)return;let r=t.querySelector(`style[${kL}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(kL,``),t.appendChild(i)),i.textContent=`:host { ${AL}: ${n}px; }`}var LV;function RV(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){LV??(LV=new CSSStyleSheet,LV.replaceSync(MV(AV)));let t=!1;try{e.adoptedStyleSheets=[LV],t=!0}catch{}if(t){e.querySelector(`style[${EL}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(EL,``),t.textContent=MV(AV),e.prepend(t)}}function zV(e,t){BV(e,t),RV(t),IV(e,t)}function BV(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`});zV(this,e)}}if(customElements.define(TL,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(TL)))e instanceof HTMLElement&&zV(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var VV=e=>e.startsWith(`f::`)?e.slice(3):e;function HV(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function UV(e,t){return e===``?t:`${e}/${t}`}function WV({files:e,path:t,isFolder:n,nextBasename:r}){let i=VV(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}=HV(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=UV(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 GV(e){return e.endsWith(`/`)}function KV(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 qV(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 JV(e,t){return t.includes(e)?qV(t):[e]}function YV(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 XV(e,t){return{draggedPaths:e,target:t}}function ZV(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(GV(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function QV(e,t){return t.kind===`root`||t.directoryPath==null?KV(e):t.directoryPath}function $V(e,t){let n=e.map(e=>{let n=QV(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 eH(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 tH(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(!eH(TV.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 nH(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function rH(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 iH(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function aH(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 iH(e,t.path)?n?e:null:e;case`move`:return rH(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=aH(r,e,n),r==null)return null;return r}}}function oH(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function sH(e){switch(e.operation){case`add`:return{...oH(e),operation:`add`,path:e.path};case`remove`:return{...oH(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...oH(e),from:e.from,operation:`move`,to:e.to}}}function cH(e){return{...oH(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>sH(e)),operation:`batch`}}function lH(e){switch(e.operation){case`add`:case`remove`:case`move`:return sH(e);case`batch`:return cH(e);default:return null}}function uH(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function dH(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 fH(e){return dH(e).at(-1)??null}function pH(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function mH(e){return e.endsWith(`/`)}var hH=e=>e.toLowerCase();function gH(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function _H(e){return e.endsWith(`/`)?e.slice(0,-1):e}function vH(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var yH=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},bH=Symbol(`FILE_TREE_RENAME_VIEW`),xH=512,SH=512;function CH(e){return e===`top`||e===`center`?e:`nearest`}function wH(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=dH(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 TH(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:wH(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var EH=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=tH({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=fH(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:CH(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<=SH){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=JV(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=XV(t.draggedPaths,n);(ZV(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}YV(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=XV(e.draggedPaths,t);if(ZV(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=$V(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=mH(r),a=_H(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of dH(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=gH(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[bH](){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,mH(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,mH(e)?{recursive:!0}:void 0);return}let t=mH(e),n=WV({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:_H(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(vH(n.sourcePath,t),vH(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=tH({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=!uH(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=fH(e),n=pH(e,t),r=null,i=null;for(let e of this.#be()){if(fH(e)!==t)continue;let a=pH(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=dH(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=!uH(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 TV({...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 dH(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(hH),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(hH),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 dH(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:yH(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 dH(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 dH(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=TH(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,xH)),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=aH(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=aH(this.#c,e,!0),r=[...this.#B].map(t=>aH(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=aH(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return uH(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&&nH(e)&&(this.#i=null);let t=nH(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=lH(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},DH=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 OH(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 kH(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 AH(e,t){return t?`${e}/`:e}function jH(e,t=null){let n=DH(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=OH(t.path);if(e==null)continue;let n=AH(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 kH(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var MH,NH,PH,FH,IH,LH,RH,zH,BH,VH,HH={},UH=[],WH=Array.isArray,GH=UH.slice,KH=Object.assign;function qH(e){e&&e.parentNode&&e.remove()}function JH(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?GH.call(arguments,2):n),YH(e,o,r,i,null)}function YH(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??++NH,__i:-1,__u:0};return i==null&&MH.vnode!=null&&MH.vnode(a),a}function XH(e){return e.children}function ZH(e,t){this.props=e,this.context=t,this.__g=0}function QH(e,t){if(t==null)return e.__?QH(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`?QH(e):null}function $H(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 $H(e)}}function eU(e){(8&e.__g||!(e.__g|=8)||!PH.push(e)||IH++)&&FH==MH.debounceRendering||((FH=MH.debounceRendering)||queueMicrotask)(tU)}function tU(){for(var e,t,n,r,i,a,o,s,c=1;PH.length;)PH.length>c&&PH.sort(LH),e=PH.shift(),c=PH.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=KH({},r)).__v=r.__v+1,MH.vnode&&MH.vnode(n),lU(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??QH(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,dU(a,n,o),n.__e!=i&&$H(n)));IH=0}function nU(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||UH,b=t.length;for(c=rU(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?HH:y[m.__i]||HH,m.__i=f,_=lU(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&mU(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=iU(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function rU(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?YH(null,o,null,null,null):WH(o)?YH(XH,{children:o},null,null,null):o.constructor==null&&o.__b>0?YH(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=aU(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=QH(s)),hU(s,s));return r}function iU(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=iU(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=QH(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function aU(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 oU(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function sU(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||oU(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||oU(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(RH,`$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=zH,e.addEventListener(t,a?VH:BH,a)):e.removeEventListener(t,a?VH:BH,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 cU(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=zH++;else if(t.u<n.l)return;return n(MH.event?MH.event(t):t)}}}function lU(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=MH.__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 ZH(v,x),f.constructor=M,f.render=gU),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=KH({},f.__s)),KH(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=MH.__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=KH({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===XH&&d.key==null&&(E=fU(d.props.children)),s=nU(e,WH(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--;)qH(a[j]);uU(t)}else t.__e=n.__e,t.__k=n.__k,e.then||uU(t);MH.__e(e,t,n)}else s=t.__e=pU(n.__e,t,n,r,i,a,o,c,l,u);return(d=MH.diffed)&&d(t),128&t.__u?void 0:s}function uU(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(uU)}function dU(e,t,n){for(var r=0;r<n.length;r++)mU(n[r],n[++r],n[++r]);MH.__c&&MH.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){MH.__e(e,t.__v)}})}function fU(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:WH(e)?e.map(fU):KH({},e)}function pU(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&&=(MH.__m&&MH.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=GH.call(e.childNodes),v=n.props||HH,!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;sU(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&&!_||sU(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=``),nU(b==`template`?e.content:e,WH(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&QH(n,0),s,c,l),a!=null)for(u=a.length;u--;)qH(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||sU(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&sU(e,u,g,v[u],i))}return e}function mU(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){MH.__e(e,n)}}function hU(e,t,n){var r,i;if(MH.unmount&&MH.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||mU(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){MH.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&hU(r[i],t,n||typeof e.type!=`function`);n||qH(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function gU(e,t,n){return this.constructor(e,n)}function _U(e,t){var n,r,i,a;t==document&&(t=document.documentElement),MH.__&&MH.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=JH(XH,null,[e]),i=[],a=[],lU(t,e,r||HH,HH,t.namespaceURI,r?null:t.firstChild?GH.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),dU(i,e,a)}function vU(e,t){e.__u|=32,_U(e,t)}MH={__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 IH=0,e}},NH=0,ZH.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=KH({},this.state);typeof e==`function`&&(e=e(KH({},n),this.props)),e&&KH(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),eU(this))},ZH.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),eU(this))},ZH.prototype.render=XH,PH=[],IH=0,LH=function(e,t){return e.__v.__b-t.__v.__b},RH=/(PointerCapture)$|Capture$/i,zH=0,BH=cU(!1),VH=cU(!0);var yU=0;Array.isArray;function bU(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:--yU,__i:-1,__u:0,__source:i,__self:a};return MH.vnode&&MH.vnode(l),l}var xU=16,SU=16,CU={};function wU({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}=CU[e]??{width:xU,height:SU},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return bU(`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:bU(`use`,{href:c})})}var TU=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},EU=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)]},DU=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)]},OU=(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)]},kU=(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)]},AU=(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 jU({children:e,marker:t,variant:n=`default`}){"use no memo";return bU(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:bU(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?bU(`span`,{"data-truncate-fade":!0}):t})})}function MU(e){"use no memo";let{mode:t,children:n}=e;return bU(`div`,{children:[bU(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?bU(`span`,{children:n}):n}),bU(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?bU(`span`,{children:n}):n})]})}function NU({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=bU(MU,{mode:t,children:e},`content`),o=bU(jU,{marker:n,mode:t,variant:r},`marker`),s=bU(`div`,{"data-truncate-fill":!0},`fill`);return bU(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:bU(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function PU({children:e,...t}){"use no memo";return bU(NU,{mode:`truncate`,...t,children:e})}function FU({children:e,...t}){"use no memo";return bU(NU,{mode:`fruncate`,...t,children:e})}function IU({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=bU(PU,{...s,children:t[0]}),l=bU(FU,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return bU(`div`,{className:a,style:o});if(e.length<i)return bU(n===`end`?FU:PU,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=TU:r===`extension`?t=EU:r===`leaf-path`&&(t=DU);else if(typeof r==`number`)t=OU,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=kU:e===`first`&&(t=AU)}else typeof r==`function`&&(t=r);t??=TU;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=bU(PU,{...s,..._,children:f}),l=bU(FU,{...s,...v,children:p})}return bU(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[bU(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),bU(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var LU={endIndex:-1,startIndex:-1};function RU(e,t,n){return Math.min(Math.max(e,t),n)}function zU(e,t){return e<0||t<e?LU:{endIndex:t,startIndex:e}}function BU(e){return e.startIndex<0||e.endIndex<e.startIndex}function VU(e,t){return BU(e)?0:(e.endIndex-e.startIndex+1)*t}function HU(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function UU(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function WU(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 GU(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 KU(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 qU(e,t,n){if(e.length===0||t<=0)return[];let r=KU(e),i=WU(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=GU(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 JU(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=RU(t.scrollTop,0,o),c=t.stickyRows??qU(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=HU(s,n,t.itemHeight),m=HU(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?LU:zU(m,UU(u+d,n,t.itemHeight)),y=g+1,b=BU(v)?LU:zU(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=VU(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:BU(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var YU={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},XU={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},ZU=`Contains git status items`;function QU(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 $U(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return QU({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 eW(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 tW(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 nW(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 rW(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function iW(e,t){return e!=null&&e>0?e:t}function aW(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 oW(e,t,n,r,i=0){let a=QU({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function sW(e,t,n,r,i,a,o=0){let s=$U({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function cW(e,t,n,r,i,a){let o=eW({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function lW(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function uW(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function dW({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return bU(`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 fW(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 pW(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 mW,hW,gW,_W,vW=Object.is,yW=0,bW=[],xW=MH,SW=xW.__b,CW=xW.__r,wW=xW.diffed,TW=xW.__c,EW=xW.unmount,DW=xW.__;function OW(e,t){xW.__h&&xW.__h(hW,e,yW||t),yW=0;var n=hW.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function kW(e){return yW=1,AW(HW,e)}function AW(e,t,n){var r=OW(mW++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):HW(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);vW(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=hW,!hW.__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,vW(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};hW.__f=!0;var a=hW.shouldComponentUpdate,o=hW.componentWillUpdate;hW.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)},hW.shouldComponentUpdate=i}return r.__N||r.__}function jW(e,t){var n=OW(mW++,3);!xW.__s&&VW(n.__H,t)&&(n.__=e,n.u=t,hW.__H.__h.push(n))}function MW(e,t){var n=OW(mW++,4);!xW.__s&&VW(n.__H,t)&&(n.__=e,n.u=t,hW.__h.push(n))}function NW(e){return yW=5,PW(function(){return{current:e}},[])}function PW(e,t){var n=OW(mW++,7);return VW(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function FW(e,t){return yW=8,PW(function(){return e},t)}function IW(){for(var e;e=bW.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(zW),e.__H.__h.forEach(BW),e.__H.__h=[]}catch(t){e.__H.__h=[],xW.__e(t,e.__v)}}xW.__b=function(e){hW=null,SW&&SW(e)},xW.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),DW&&DW(e,t)},xW.__r=function(e){CW&&CW(e),mW=0;var t=(hW=e.__c).__H;t&&(gW===hW?(t.__h=[],hW.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(zW),t.__h.forEach(BW),t.__h=[],mW=0)),gW=hW},xW.diffed=function(e){wW&&wW(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(bW.push(t)!==1&&_W===xW.requestAnimationFrame||((_W=xW.requestAnimationFrame)||RW)(IW)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),gW=hW=null},xW.__c=function(e,t){t.some(function(e){try{e.__h.forEach(zW),e.__h=e.__h.filter(function(e){return!e.__||BW(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],xW.__e(n,e.__v)}}),TW&&TW(e,t)},xW.unmount=function(e){EW&&EW(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{zW(e)}catch(e){t=e}}),n.__H=void 0,t&&xW.__e(t,n.__v))};var LW=typeof requestAnimationFrame==`function`;function RW(e){var t,n=function(){clearTimeout(r),LW&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);LW&&(t=requestAnimationFrame(n))}function zW(e){var t=hW,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),hW=t}function BW(e){var t=hW;e.__c=e.__(),hW=t}function VW(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!vW(t,e[n])})}function HW(e,t){return typeof t==`function`?t(e):t}function UW(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:bU(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return bU(XH,{children:[bU(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:bU(PU,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function WW(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function GW(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function KW(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 qW({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=JU(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:KW(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?KW(u,1,t,o):i&&r<=0&&c.length>0?qU(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 JW=400,YW=10,XW=40,ZW=18;function QW(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))?$W(e,t,n):a instanceof HTMLElement?a:null}function $W(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 eG(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 tG(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 nG(){return navigator.vendor!==`Apple Computer, Inc.`}function rG(e,t){let n=e-t.top;if(n<XW)return-Math.ceil((XW-Math.max(0,n))/XW*ZW);let r=t.bottom-e;return r<XW?Math.ceil((XW-Math.max(0,r))/XW*ZW):0}function iG(e,t){if(e!=null){let t=YU[e];return t==null?null:{text:t,title:XU[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:ZU}:null}function aG(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 oG(e){return e!=null&&`toggle`in e}function sG(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function cG(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function lG(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function uG(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function dG(e,t){return t&&uG(e)||(e.ctrlKey||e.metaKey)&&sG(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var fG=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function pG(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 mG(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 hG(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function gG(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function _G(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function vG(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 yG(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 bG(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 xG(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=bG(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 SG(e,t){return{kind:e.kind,name:GW(e),path:t}}function CG(e){return e==null?void 0:`${e}__tree`}function wG(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function TG(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function EG(e,t){if(e==null)return null;if(`text`in e)return bU(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?TG(e.icon)?t(e.icon):{name:e.icon}:TG(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return bU(`span`,{title:e.title,children:bU(wU,{...n})})}function DG(e){e!=null&&tW(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function OG(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=WW(e);return bU(XH,{children:[e.depth>0?bU(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>bU(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,bU(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?bU(wU,{...t(`file-tree-icon-chevron`)}):bU(wU,{...t(`file-tree-icon-file`,u)})}),bU(`div`,{"data-item-section":`content`,children:e.isFlattened?UW(e,c,a):c??bU(IU,{minimumLength:5,split:`extension`,children:e.name})}),i?bU(`div`,{"data-item-section":`decoration`,children:r==null?null:EG(r,t)}):null,s?bU(`div`,{"data-item-section":`git`,children:EG(o,t)}):null,n?bU(`div`,{"data-item-section":`action`,children:l?bU(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:bU(wU,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function kG(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=WW(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??aG(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=iG(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,q=K?a.getValue():``,J=R||!K?null:bU(dW,{ref:D,ariaLabel:`Rename ${GW(t)}`,isFlattened:t.isFlattened,value:q,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ee=OG(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:J,showDecorativeActionAffordance:G}),Y={...fW({ariaLabel:GW(t),domId:t.isFocused?wG(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:hG(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?bU(`div`,{...Y,children:ee}):bU(`button`,{...Y,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:ee})}function AG(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(WW(e))).map((n,r)=>kG(e,n,t.start+r))}function jG({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=kV,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 _=NW(null),v=NW(null),y=NW(!1),b=NW(null),x=NW(null),S=NW(null),C=NW(null),w=NW(null),T=NW(new Map),E=NW(new Map),D=NW(()=>{}),O=NW(null),k=NW(0),A=NW(!1),j=NW(null);j.current!==t&&(A.current=!1,j.current=t);let M=NW(!1),N=NW(null),P=NW(null),F=NW(!1),I=NW(null),L=NW(null),R=NW(null),z=NW(null),B=NW(null),V=NW(null),H=NW(null),U=NW(null),W=NW(!1),G=NW(null),K=NW(null),q=NW(null),J=NW(null),ee=PW(()=>new Map,[]),[,Y]=kW(0),[te,X]=kW(null),[ne,re]=kW(null),[ie,ae]=kW(null),[oe,se]=kW(null),[ce,le]=kW(0),[ue,de]=kW(null),fe=NW(ue);fe.current=ue;let pe=NW(null),me=NW(null),he=NW(null),ge=NW(null),_e=NW(null),ve=NW(!1),ye=()=>{me.current=null,he.current=null,ge.current=null},be=(e,t)=>{me.current=e,he.current=null,ge.current=t==null?null:{path:e,scrollTop:t}},xe=(e,t)=>{me.current=null,he.current={path:e,viewportOffset:t},ge.current=null},Se=NW(d===`retain`&&t.isSearchOpen()),[Ce,we]=kW(p);jW(()=>{p||we(!1)},[p]);let Te=NW(!1),Ee=FW(()=>{Te.current=!0,we(e=>e&&!1)},[]),[De,Oe]=kW(()=>qW({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[ke,Ae]=kW(!1);jW(()=>{Ae(!0)},[]);let je=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Me=e?.contextMenu?.triggerMode??(je?`right-click`:`both`),Ne=Me===`both`||Me===`button`,Pe=e?.contextMenu?.buttonVisibility??`when-needed`,Fe=Me===`both`||Me===`right-click`;MW(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;_e.current=t,re(t),se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(ve.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Ie=FW((e,t)=>{_G(T.current,e,t)},[]),Le=FW((e,t)=>{_G(E.current,e,t)},[]),Re=FW(e=>{x.current=e},[]),ze=FW(e=>vG(e,E.current,T.current),[]),Be=n!=null||r!=null||i!=null,{resolveIcon:Ve}=PW(()=>BL(a),[a]),He=t[bH](),Ue=He.getPath(),We=Ue!=null,Ge=t.isSearchOpen(),Ke=t.getSearchValue(),qe=t.getFocusedPath(),Je=t.getFocusedIndex(),Ye=t.getScrollRequest(),Xe=t.isDragAndDropEnabled(),Ze=t.getDragSession(),Qe=PW(()=>Ze==null?null:new Set(Ze.draggedPaths),[Ze]),$e=Ze?.target??null,et=Ze?.primaryPath??null,tt=CG(o),{overlayHeight:nt,overlayRows:rt,snapshot:it,visibleRows:at}=De,ot=it.physical.viewportHeight,st=PW(()=>({end:it.window.endIndex,start:it.window.startIndex}),[it.window.endIndex,it.window.startIndex]),ct=rt,lt=it.sticky.rows,ut=it.physical.totalHeight,dt=it.sticky.height,ft=PW(()=>new Set(lt.map(e=>WW(e.row))),[lt]),pt=Je>=0&&Je>=st.start&&Je<=st.end,mt=FW((e,t)=>u?.({item:SG(e,t),row:e})??null,[u]),ht=FW(e=>tW(e==null?null:T.current.get(e)??null)?!0:tW(S.current),[]),gt=FW(e=>{ht(t.focusNearestPath(e))},[t,ht]),_t=NW(gt);_t.current=gt;let vt=NW(!0),yt=NW(()=>{}),bt=FW((t=!0)=>{let n=fe.current;n!=null&&(vt.current=vt.current&&t,de(null),e?.contextMenu?.onClose?.(),vt.current&>(n.path))},[e?.contextMenu,gt]);yt.current=bt;let xt=FW(e=>{let t=e==null?null:gG(S.current,e);ae(e=>e===t?e:t)},[]),St=FW((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=ze(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;be(n,e?.scrollTop??null),M.current=!0,X(e=>e===n?e:n)}i.focus(),xt(a),vt.current=!0,de({anchorRect:r?.anchorRect??null,item:SG(e,n),path:n,source:r?.source??`keyboard`})},[t,ze,xt]),Ct=FW(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=rW(e,ot);I.current=Je<0||e==null?null:Math.max(0,Math.min(Je*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),Y(e=>e+1))}},[t,Je,s,l,ot]),wt=FW((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=rW(i,ot),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:qW({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,cW(i,a,s,l,u,d),D.current(),pe.current=n?e:null,!0},[t,s,c,ot,h]),Tt=()=>y.current===!0||J.current!=null||W.current===!0,Et=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Dt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Ot=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},kt=()=>{V.current?.remove(),V.current=null},At=()=>{Dt(L.current),L.current=null,B.current=null},jt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Mt=()=>{U.current?.(),U.current=null,J.current!=null&&(clearTimeout(J.current),J.current=null),W.current=!1,G.current=null,q.current=null,K.current!=null&&(K.current.setAttribute(`draggable`,`true`),K.current.style.removeProperty(`touch-action`),K.current=null),kt(),Ot(),At(),H.current=null},Nt=(e,n)=>{let r=S.current?.getRootNode(),i=eG(QW(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Pt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Ot();return}let r=t.getItem(e.directoryPath),i=oG(r)?r:null;if(i==null||i.isExpanded()){Ot();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(Ot(),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))},Ft=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=rG(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()),Pt(Nt(e.clientX,e.clientY)),L.current=Et(Ft)},It=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Et(Ft)},Lt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Mt(),kt(),Ot(),At(),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),nG())){let t=tG(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),jt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Rt=()=>{kt(),Ot(),At(),H.current=null,t.cancelDrag()},zt=(e,n,r)=>{if(J.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;q.current={clientX:i.clientX,clientY:i.clientY},K.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;J.current!=null&&(clearTimeout(J.current),J.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null)},s=e=>{let t=e.touches[0],n=q.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=YW*YW||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,J.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null;return}W.current=!0,K.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=tG(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`}),jt(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)`),Pt(Nt(t.clientX,t.clientY)),It(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Nt(n.clientX,n.clientY),t.completeDrag(),Mt()},u=()=>{t.cancelDrag(),Mt()};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)},JW)},Bt=e=>{if(ue!=null){if(e.key===`Escape`){bt(),e.preventDefault(),e.stopPropagation();return}fG.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(He.isActive()){if(e.key===`Escape`)He.cancel();else if(e.key===`Enter`)He.commit();else return;se(`focus`),Y(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Ct(qe??void 0),e.preventDefault(),e.stopPropagation();return}if(Ge){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=rW(n,ot);I.current=Je<0||n==null?null:Math.max(0,Math.min(Je*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;se(`focus`),Y(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&cG(e)){t.openSearch(e.key),Y(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=je&&uG(e),r=dG(e,je),i=r&&S.current!=null?nW(S.current):null,a=r?new Set(yG(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==qe&&a.has(o)){let e=C.current;be(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=oG(p)?p:null,h=u!=null&&(ft.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=vG(u,E.current,T.current);e==null||n==null?y=!1:St(e,u)}else if((e.ctrlKey||e.metaKey)&&sG(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ft.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))be(b,v?.scrollTop??null),M.current=!0,X(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(xe(b,xG(S.current,v,i,u,s,dt,ot)),M.current=!0,X(e=>e===b?e:b)):ye()}Y(e=>e+1),e.preventDefault(),e.stopPropagation()};MW(()=>{if(!(!f||!Ge)){if(Se.current){Se.current=!1;return}tW(w.current)}},[Ge,f]),MW(()=>{let e=x.current;switch(uW({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ue})){case`reset`:P.current=null;return;case`reveal-canonical`:Ue!=null&&wt(Ue,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(pe.current=null,P.current=Ue,tW(e),e.select());return}},[st.end,st.start,Ue,wt,ft]),MW(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=nW(e)?.dataset.itemPath??null;X(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,nW(e)!=null){r();return}M.current=!1,X(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,X(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;X(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),MW(()=>{let e=S.current;e!=null&&(it.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[it.physical.scrollTop]),MW(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=rW(n,g);let a=()=>{let e=t.getVisibleCount(),r=iW(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Oe(qW({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=iW(O.current,g),i=t.getVisibleRows(e,e)[0]??null;oW(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?Y(e=>e+1):o=!0,a()}),u=()=>{ve.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,le(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||ve.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),fe.current!=null&&y.current&&yt.current(),ve.current===!0){y.current=!1;return}re(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:aW(e[0]))??rW(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]),MW(()=>{je||ue==null||bt(!1)},[bt,je,ue]);let Vt=PW(()=>ue==null?null:`${ue.path}::${ue.source}`,[ue]);MW(()=>{if(Vt==null){m?.clearSlotContent(ML);return}let t=fe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??mG(n.getBoundingClientRect()),close:e=>{yt.current(e?.restoreFocus??!0)},restoreFocus:()=>{vt.current&&_t.current(fe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(ML,i),e?.contextMenu?.onOpen?.(t.item,r),DG(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&DG(i)}),()=>{m?.clearSlotContent(ML)}},[Vt,e?.contextMenu,m]),MW(()=>{ue!=null&&t.getItem(ue.path)==null&&bt()},[bt,ue,t]),MW(()=>{if(ue==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(pG(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&bt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),bt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[bt,ue]),MW(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=qe;return}let r=qe==null?null:T.current.get(qe)??null,i=nW(n),a=i?.dataset.itemPath??null,o=We&&x.current===i,c=f&&w.current===i,l=F.current&&!Ge,u=I.current??0,d=pe.current,p=me.current,m=he.current,g=ge.current,_=i!=null,v=M.current||_,y=N.current!==qe,b=p!=null&&p===qe&&qe!=null,E=!1,O=!1;if(Ye!=null&&Ye.id!==k.current){k.current=Ye.id;let n=Ye.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,ot-s))):dt;E=!0,O=sW(e,n,s,ot,ut,Ye.offset,t)}t.clearScrollRequest(Ye.id)}let A=!E&&l&&cW(e,Je,s,ot,ut,u),j=!E&&d!=null&&d===qe&&cW(e,Je,s,ot,ut,dt),P=!E&&m!=null&&m.path===qe&&cW(e,Je,s,ot,ut,m.viewportOffset),L=!E&&g!=null&&g.path===qe&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==qe&&!b&&oW(e,Je,s,ot,dt))&&D.current(),E){N.current=qe;return}if(!v){N.current=qe;return}if(o){N.current=qe;return}if(c&&!l){N.current=qe;return}if(r==null){l&&Je>=0&&(cW(e,Je,s,ot,ut,u),D.current()),N.current=qe;return}(y||l||d===qe||p===qe||m?.path===qe||g?.path===qe||a==null||a!==qe)&&(tW(r),d===qe&&(pe.current=null),p===qe&&(me.current=null),m?.path===qe&&(he.current=null),g?.path===qe&&(ge.current=null),F.current=!1,I.current=null),N.current=qe},[t,Je,qe,pt,s,We,Ge,st,ot,f,Ye,h,dt,ut,at]);let Ht=Je>=0&&Je>=it.visible.startIndex&&Je<=it.visible.endIndex,Ut=qe!=null&&ct.some(e=>WW(e.row)===qe),Wt=Ht||Ut,Gt=Ne&&M.current===!0&&Wt?qe:null,Kt=oe===`pointer`?ne:null,qt=ue?.path??_e.current??Kt??Gt??ne,Jt=ue?.source===`right-click`;MW(()=>{y.current&&ue==null||xt(ze(qt))},[ue,ze,st,ot,ce,ct,qt,xt,at]);let Yt=FW(e=>{if(y.current||pG(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&se(e=>e===`pointer`?e:`pointer`),re(e=>e===i?e:i)},[]),Xt=FW(()=>{re(null)},[]);MW(()=>{if(!Xe)return;let e=()=>{Mt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Mt(),t.cancelDrag()}},[t,Xe]);let Zt=e=>{if(!Xe||t.getDragSession()==null||W.current)return;let n=eG(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Pt(t.getDragSession()?.target??null),It(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Qt=e=>{if(!Xe||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ot(),At(),t.setDragTarget(null))},$t=e=>{!Xe||t.getDragSession()==null||W.current||(e.preventDefault(),Nt(e.clientX,e.clientY),t.completeDrag(),kt(),Ot(),At(),H.current=null)},en=it.window.height,tn=it.window.offsetTop,nn=Math.min(0,ot-en),rn=Math.min(0,ot-en-dt),an=te===qe||F.current,on=qe!=null&&an&&!pt&&Je>=0?at[Je]??t.getVisibleRows(Je,Je)[0]??null:null,sn=on==null?null:lW(Je,s,st,en),cn=H.current,ln=et!=null&&cn!=null&&cn.path===et&&cn.index>=st.start&&cn.index<=st.end,un=et!=null&&cn!=null&&cn.path===et&&!ln&&cn.path!==on?.path?cn:null,dn=un==null?null:lW(un.index,s,st,en),fn=lG((Je>=0?at[Je]??t.getVisibleRows(Je,Je)[0]??null:null)?.ancestorPaths.at(-1)??null),pn=Ge&&qe!=null?wG(o,qe,!pt):void 0,mn=ue?.path??(Ge?qe:te),hn=ue?.path??ne,gn=ze(qt),_n=je&&Ne&&!Jt&&!We&&gn!=null&&ie!=null&&qt!=null,vn=je&&(_n||ue!=null),yn=ue?.anchorRect,bn=yn==null&&gn!=null&&ie!=null&&(ue!=null||_n)?ie:null,xn=yn==null?bn==null?void 0:{top:`${bn}px`}:{left:`${yn.left}px`,position:`fixed`,right:`auto`,top:`${yn.top}px`},Sn=Jt?{opacity:`0`}:void 0,Cn=FW((e,n,r,i)=>{let a=pW({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Ge,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>=it.visible.startIndex&&n.index<=it.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,X(e=>e===c?e:c),se(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&wt(c,{targetOffset:`sticky-parents`})},[t,Ge,it.visible.endIndex,it.visible.startIndex,wt]),wn=()=>{if(y.current||!Ne||qt==null||gn==null)return;let e=t.getItem(qt);e!=null&&(xt(gn),vt.current=!0,de({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:gn.getAttribute(`aria-label`)??qt,path:e.getPath()},path:e.getPath(),source:`button`}))},Tn={contextHoverPath:hn,contextMenuButtonTriggerEnabled:Ne,contextMenuButtonVisibility:Pe,contextMenuEnabled:je,contextMenuRightClickEnabled:Fe,contextMenuTriggerMode:Me,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Xe,draggedPathSet:Qe,dragTarget:$e,gitLaneActive:Be,gitStatusByPath:n,handleRowDragEnd:Rt,handleRowDragStart:Lt,handleRowTouchStart:zt,ignoredGitDirectories:r,ignoredInheritanceCache:ee,instanceId:o,itemHeight:s,onKeyDown:Bt,onRowClick:Cn,openContextMenuForRow:St,registerButton:Ie,registerRenameInput:Re,renameView:He,renderDecorationForRow:mt,resolveIcon:Ve,shouldSuppressContextMenu:Tt,visualFocusPath:mn},En={...Tn,registerButton:Le};return bU(`div`,{ref:S,id:tt,"data-file-tree-context-menu-button-visibility":je&&Ne?Pe:void 0,"data-file-tree-context-menu-trigger-mode":je?Me:void 0,"data-file-tree-has-context-menu-action-lane":je&&Ne?`true`:void 0,"data-file-tree-has-git-lane":Be?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":$e?.kind===`root`?`true`:void 0,onDragLeave:Xe?Qt:void 0,onDragOver:Xe?Zt:void 0,onDrop:Xe?$t:void 0,onKeyDown:Bt,onPointerLeave:je?Xt:void 0,onPointerOver:je?Yt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[bU(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:fn}}),bU(`slot`,{name:jL,"data-type":`header-slot`}),f?bU(`div`,{"data-file-tree-search-container":!0,"data-open":Ge?`true`:`false`,children:bU(`input`,{ref:w,"aria-activedescendant":pn,"aria-controls":tt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ce?`true`:void 0,value:Ke,onBlur:()=>{d===`retain`&&!Te.current||t.closeSearch()},onFocus:Ee,onPointerDown:Ee,onInput:e=>{Ee();let n=e.currentTarget;t.setSearch(n.value)}})}):null,bU(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&ke&&ct.length>0?bU(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:bU(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${nt}px`},children:ct.map((e,t)=>kG(En,e.row,`sticky:${WW(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ct.length-t}`}}))})}):null,bU(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ut}px`},children:[bU(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${tn}px`}}),bU(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${en}px`,top:`${nn}px`,bottom:`${rn}px`},children:[AG(Tn,st,ft),on!=null&&sn!=null?kG(Tn,on,`parked:${on.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:et===on.path?`none`:void 0,position:`absolute`,right:`0`,top:`${sn}px`}}):null,un!=null&&dn!=null?kG(Tn,un,`parked-drag:${un.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${dn}px`}}):null]})]})]}),je?bU(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":vn?`true`:`false`,style:xn,children:[bU(`button`,{ref:v,type:`button`,"data-type":NL,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":ue==null?`false`:`true`,"data-visible":_n?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),ue!=null){bt();return}wn()},tabIndex:-1,style:Sn,children:bU(wU,{...Ve(`file-tree-icon-ellipsis`)})}),ue==null?null:bU(`slot`,{name:ML})]}):null,ue==null?null:bU(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),bt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),bt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var MG={hydrateRoot:(e,t)=>{vU(JH(jG,t),e)},renderRoot:(e,t)=>{_U(JH(jG,t),e)},unmountRoot:e=>{_U(null,e)}};function NG(e,t){MG.renderRoot(e,t)}function PG(e,t){MG.hydrateRoot(e,t)}function FG(e){MG.unmountRoot(e)}var IG=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)}}},LG=`__c`,RG=`__k`,zG=`__d`,BG=`__s`,VG=/[\s\n\\/='"\0<>]/,HG=/^(xlink|xmlns|xml)([A-Z])/,UG=/^(?: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])/,WG=/^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/,GG=new Set([`draggable`,`spellcheck`]);function KG(e){e.__g===void 0?e[zG]=!0:e.__g|=8}function qG(e){e.__g===void 0?e[zG]=!1:e.__g&=-9}function JG(e){return e.__g===void 0?!0===e[zG]:!!(8&e.__g)}var YG=/["&<]/;function XG(e){if(e.length===0||!1===YG.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 ZG={},QG=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(`.`)),$G=/[A-Z]/g;function eK(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:ZG[n]||(ZG[n]=n.replace($G,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||QG.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function tK(){this.__d=!0}function nK(e,t){return{__v:e,context:t,props:e.props,setState:tK,forceUpdate:tK,__d:!0,__h:[]}}function rK(e,t,n){if(!e.s){if(n instanceof iK){if(!n.s)return void(n.o=rK.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(rK.bind(null,e,t),rK.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var iK=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{rK(r,1,a(this.v))}catch(e){rK(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?rK(r,1,t?t(i):i):n?rK(r,1,n(i)):rK(r,2,i)}catch(e){rK(r,2,e)}},r},e}(),aK,oK,sK,cK,lK={},uK=Array.isArray,dK=Object.assign,fK=``,pK=`<!--$s-->`,mK=`<!--/$s-->`;function hK(e,t){var n,r=e.type,i=!0;return e[LG]?(i=!1,(n=e[LG]).state=n[BG]):n=new r(e.props,t),e[LG]=n,n.__v=e,n.props=e.props,n.context=t,KG(n),n.state??=lK,n[BG]??(n[BG]=n.state),r.getDerivedStateFromProps?n.state=dK({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[BG]===n.state?n.state:n[BG]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),sK&&sK(e),n.render(n.props,n.state,t)}function gK(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===fK)return fK;var s=typeof e;if(s!=`object`)return s==`function`?fK:s==`string`?XG(e):e+fK;if(uK(e)){var c,l=fK;i[RG]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=gK(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=fK,uK(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return fK;e.__=i,aK&&aK(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===XH){if(`tpl`in g){for(var x=fK,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&&!uK(C)?x+=C:x+=gK(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+XG(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=hK(e,b),y=e[LG];else{e[LG]=y=nK(e,b);for(var E=0;JG(y)&&E++<25;){qG(y),sK&&sK(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}KG(y)}if(y.getChildContext!=null&&(t=dK({},t,y.getChildContext())),T&&MH.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===XH&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return gK(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[BG]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,lK),JG(y)?(v=hK(e,t),(y=e[LG]).getChildContext!=null&&(t=dK({},t,y.getChildContext())),gK(v=v!=null&&v.type===XH&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):fK}finally{oK&&oK(e),cK&&cK(e)}}}v=v!=null&&v.type===XH&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=gK(v,t,n,r,e,a,o);return oK&&oK(e),MH.unmount&&MH.unmount(e),e._suspended?typeof D==`string`?pK+D+mK:uK(D)?(D.unshift(pK),D.push(mK),D):D.then(function(e){return pK+e+mK}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return gK(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=MH.__e;return k&&k(i,e),fK}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=gK(v,t,n,r,e,a,o);return e._suspended?pK+s+mK:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=fK;for(var N in g){var P=g[N];if(typeof(P=vK(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=eK(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(HG.test(N))N=N.replace(HG,`$1:$2`).toLowerCase();else{if(VG.test(N))continue;N[4]!==`-`&&!GG.has(N)||P==null?n?WG.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):UG.test(N)&&(N=N.toLowerCase()):P+=fK}}P!=null&&!1!==P&&(j=!0===P||P===fK?j+` `+N:j+` `+N+`="`+(typeof P==`string`?XG(P):P+fK)+`"`)}}if(VG.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=XG(A):A!=null&&!1!==A&&!0!==A&&(M=gK(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),oK&&oK(e),cK&&cK(e),!M&&_K.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return uK(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var _K=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function vK(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var yK=0;function bK(e){return e!=null&&e.length>0?e:(yK+=1,`pst_ft_${yK}`)}function xK({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??kV)}function SK(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 CK(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 wK(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var TK=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new IG;#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=bK(a),this.#p=jH(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=OV(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new EH({...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&&(FG(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(),NG(t.wrapper,this.#w()))}setGitStatus(e){this.#p=jH(e,this.#p);let t=this.#T();t!=null&&NG(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),NG(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),PG(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),NG(r,this.#w())}#C(){return{initialViewportHeight:xK({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(jL,e());return}this.#l.setSlotHtml(jL,this.#e?.header?.html??null)}#k(e){let t=wK(e).find(e=>CK(e)),n=SK(xL(FL(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=wK(e),n=t.find(e=>CK(e)),r=t.filter(e=>e!==n),i=FL(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=SK(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=FL(this.#m);t.colored&&CL(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${DL}]`);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(DL,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=NV(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 zV(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)}},EK=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function DK(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:jL,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:ML,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function OK(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 kK(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 AK(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 jK({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)(()=>AK(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),EK(()=>{n.setComposition(g)},[g,n]),EK(()=>{if(c!=null)return r!=null&&kK(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=OK(DK(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)(TL,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function MK(e){let[t]=(0,Q.useState)(()=>new TK(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 NK={density:`compact`,itemHeight:26,flattenEmptyDirectories:!1},PK={"--trees-level-gap-override":`4px`,"--trees-item-row-gap-override":`4px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`${NK.itemHeight}px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},FK=`
|
|
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
|
+
`,IK=`
|
|
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 LK(e){return{...KL({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))`,...PK}}var RK=`data-ok-ext-badge`,zK=`data-ok-ext-row`,BK=`data-ok-fullname-row`,VK=`
|
|
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'][${zK}] [data-truncate-segment-priority]:last-child {
|
|
1894
1894
|
display: none;
|
|
1895
1895
|
}
|
|
1896
|
-
[data-type='item'][${
|
|
1896
|
+
[data-type='item'][${BK}] [data-truncate-segment-priority]:last-child {
|
|
1897
1897
|
display: none;
|
|
1898
1898
|
}
|
|
1899
|
-
[${
|
|
1899
|
+
[${RK}] {
|
|
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 HK(e){let t=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of t){let t=e.dataset.itemPath;if(!t){WK(e);continue}if(t.endsWith(`/`)){KK(e,t);continue}let n=sP(t);if(!n){WK(e);continue}let r=GK(e);if(r){if(e.setAttribute(zK,``),e.removeAttribute(BK),XK(r),n.toLowerCase()===`.md`){UK(e);continue}ZK(e,n.slice(1).toUpperCase())}}}function UK(e){let t=e.querySelector(`[${RK}]`);t&&t.remove()}function WK(e){e.removeAttribute(zK),e.removeAttribute(BK),UK(e)}function GK(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 KK(e,t){e.removeAttribute(zK),UK(e);let n=GK(e),r=qK(t);if(!n||!r){e.removeAttribute(BK);return}YK(n,r),e.setAttribute(BK,``)}function qK(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function JK(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 YK(e,t){JK(e,()=>t)}function XK(e){JK(e,e=>e.replace(/\.+$/,``))}function ZK(e,t){let n=e.querySelector(`[${RK}]`);if(!n){n=e.ownerDocument.createElement(`span`),n.setAttribute(RK,``),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 QK(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function $K(e){let t=QK(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}var eq=`data-ok-renaming`,tq=`data-ok-rename-selection-applied`,nq=null,rq=null,iq=5e3,aq=`
|
|
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
|
+
[${eq}='.md'] [data-item-section="icon"],
|
|
1923
|
+
[${eq}='.mdx'] [data-item-section="icon"] {
|
|
1924
1924
|
position: relative;
|
|
1925
1925
|
}
|
|
1926
|
-
[${
|
|
1927
|
-
[${
|
|
1926
|
+
[${eq}='.md'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']),
|
|
1927
|
+
[${eq}='.mdx'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']) {
|
|
1928
1928
|
visibility: hidden;
|
|
1929
1929
|
}
|
|
1930
|
-
[${
|
|
1931
|
-
[${
|
|
1930
|
+
[${eq}='.md'] [data-item-section="icon"]::before,
|
|
1931
|
+
[${eq}='.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 iq(e){sq(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=aP(r);sP(r)&&aq(i),!t.hasAttribute($K)&&(cq(t),t.setAttribute($K,``))}function aq(e){eq=e,tq!==null&&clearTimeout(tq),tq=setTimeout(oq,nq)}function oq(){eq=null,tq!==null&&(clearTimeout(tq),tq=null)}function sq(e){let t=e.querySelectorAll(`[${QK}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(QK);if(!t){e.removeAttribute(QK);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(QK);continue}let r=aP(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(QK)}if(eq===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(`/`)||aP(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==eq&&e.setAttribute(QK,eq))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&oq()}function cq(e){let t=aP(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function lq(e){let t=e.getFocusedPath();t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function uq(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function dq(e,t,n={}){if(!e)return uq(t);let r=Ss(e);if(t&&r!==t)return uq(t);switch(e.kind){case`doc`:return uq(t??e.docName);case`large-file`:return uq(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?uq(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function fq(e,t){if(!e)return{kind:`none`};let n=t.find(t=>pP(t)===e);if(n&&os(n))return{kind:`asset`,path:n.path,hash:gs(n.path),mediaKind:n.mediaKind};let r=_P(e);return e.endsWith(`/`)?t.some(e=>ys(e)?e.path===r||e.path.startsWith(`${r}/`):(os(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Ps(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var pq=`You can restore this file from the Trash.`;function mq(e){let t=pq,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 hq(e,t){return e===`web`?null:mq(t)}function gq(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function _q(e,t,n){let r=fq(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=>Ps(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var vq=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function yq(e){return typeof e==`string`&&vq.includes(e)?e:`system-error`}function bq(e){switch(e){case`not-found`:return Is._({id:`v41fCm`});case`permission-denied`:return Is._({id:`sJK6pq`});case`system-error`:return Is._({id:`Jqqevv`});case`path-escape`:return Is._({id:`WL6puM`})}}function xq(e){let t=bq(e.reason),n=e.detail;return n?Is._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Is._({id:`dTaauv`,values:{reason:t}})}function Sq(e){return e.kind===`folder`?`${e.name}/`:e.name}function Cq(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?Sq(l):``;d=c?Is._({id:`5qNxOe`,values:{count:u}}):l?`${Is._({id:`E_BHoD`,values:{targetName:e}})}\n${xq(l)}`:Is._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Go,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(Yo,{children:[p,(0,Z.jsx)(Wo,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let h;t[7]!==n||t[8]!==c?(h=c?(0,Z.jsx)(qo,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(wq)})}):null,t[7]=n,t[8]=c,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=g):g=t[10];let _;t[11]!==r||t[12]!==o?(_=(0,Z.jsx)(Ai,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:g}),t[11]=r,t[12]=o,t[13]=_):_=t[13];let v;t[14]===r?v=t[15]:(v=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=v);let y;t[16]!==r||t[17]!==a||t[18]!==v?(y=(0,Z.jsx)(Ai,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:v}),t[16]=r,t[17]=a,t[18]=v,t[19]=y):y=t[19];let b;t[20]===r?b=t[21]:(b=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=b);let x;t[22]!==r||t[23]!==i||t[24]!==b?(x=(0,Z.jsx)(Ai,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:b}),t[22]=r,t[23]=i,t[24]=b,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==_||t[28]!==y?(S=(0,Z.jsxs)(Jo,{children:[_,y,x]}),t[26]=x,t[27]=_,t[28]=y,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h?(C=(0,Z.jsxs)(Ko,{className:`sm:max-w-md`,children:[m,h,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=C):C=t[33],C}function wq(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:Sq(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:xq(e)})]},e.path)}function Tq(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=ao(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,c;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=ug(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),c=n;break bb0}let l;t[16]!==i||t[17]!==r?(l=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=l):l=t[18],o=n.map(l)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=c}else o=t[9],c=t[10];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[19]===o?l=t[20]:(l=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=l),l}function Eq(e){return e?.isDirectory()?e:null}function Dq(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function Oq(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=Eq(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}Dq(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 kq=`open-knowledge:file-tree-menu-action-delete`,Aq=`open-knowledge:file-tree-menu-action-rename`,jq=`open-knowledge:file-tree-menu-action-duplicate`;function Mq(e){window.dispatchEvent(new CustomEvent(kq,{detail:{target:e}}))}function Nq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(kq,t),()=>window.removeEventListener(kq,t)}function Pq(e){window.dispatchEvent(new CustomEvent(Aq,{detail:{target:e}}))}function Fq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(Aq,t),()=>window.removeEventListener(Aq,t)}function Iq(e){window.dispatchEvent(new CustomEvent(jq,{detail:{target:e}}))}function Lq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(jq,t),()=>window.removeEventListener(jq,t)}function Rq(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 zq={Accept:`application/x-ndjson, application/json`};function Bq(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var Vq=class extends Error{};function Hq(e){return typeof e==`object`&&!!e&&`type`in e}async function Uq(e){let t=e.body;if(!t)throw new Vq(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(Hq(n)){if(n.type===`error`)throw new Vq(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return a=n.truncated===!0,!0}let r=Bn.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1};try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
|
|
1943
|
+
`;function oq(e){lq(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=sP(r);lP(r)&&sq(i),!t.hasAttribute(tq)&&(uq(t),t.setAttribute(tq,``))}function sq(e){nq=e,rq!==null&&clearTimeout(rq),rq=setTimeout(cq,iq)}function cq(){nq=null,rq!==null&&(clearTimeout(rq),rq=null)}function lq(e){let t=e.querySelectorAll(`[${eq}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(eq);if(!t){e.removeAttribute(eq);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(eq);continue}let r=sP(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(eq)}if(nq===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(`/`)||sP(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==nq&&e.setAttribute(eq,nq))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&cq()}function uq(e){let t=sP(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function dq(e){let t=e.getFocusedPath();t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function fq(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function pq(e,t,n={}){if(!e)return fq(t);let r=Ss(e);if(t&&r!==t)return fq(t);switch(e.kind){case`doc`:return fq(t??e.docName);case`large-file`:return fq(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?fq(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function mq(e,t){if(!e)return{kind:`none`};let n=t.find(t=>hP(t)===e);if(n&&os(n))return{kind:`asset`,path:n.path,hash:gs(n.path),mediaKind:n.mediaKind};let r=yP(e);return e.endsWith(`/`)?t.some(e=>ys(e)?e.path===r||e.path.startsWith(`${r}/`):(os(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Ps(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var hq=`You can restore this file from the Trash.`;function gq(e){let t=hq,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 _q(e,t){return e===`web`?null:gq(t)}function vq(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function yq(e,t,n){let r=mq(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=>Ps(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var bq=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function xq(e){return typeof e==`string`&&bq.includes(e)?e:`system-error`}function Sq(e){switch(e){case`not-found`:return Is._({id:`v41fCm`});case`permission-denied`:return Is._({id:`sJK6pq`});case`system-error`:return Is._({id:`Jqqevv`});case`path-escape`:return Is._({id:`WL6puM`})}}function Cq(e){let t=Sq(e.reason),n=e.detail;return n?Is._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Is._({id:`dTaauv`,values:{reason:t}})}function wq(e){return e.kind===`folder`?`${e.name}/`:e.name}function Tq(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?wq(l):``;d=c?Is._({id:`5qNxOe`,values:{count:u}}):l?`${Is._({id:`E_BHoD`,values:{targetName:e}})}\n${Cq(l)}`:Is._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Go,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(Yo,{children:[p,(0,Z.jsx)(Wo,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let h;t[7]!==n||t[8]!==c?(h=c?(0,Z.jsx)(qo,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(Eq)})}):null,t[7]=n,t[8]=c,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=g):g=t[10];let _;t[11]!==r||t[12]!==o?(_=(0,Z.jsx)(Ai,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:g}),t[11]=r,t[12]=o,t[13]=_):_=t[13];let v;t[14]===r?v=t[15]:(v=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=v);let y;t[16]!==r||t[17]!==a||t[18]!==v?(y=(0,Z.jsx)(Ai,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:v}),t[16]=r,t[17]=a,t[18]=v,t[19]=y):y=t[19];let b;t[20]===r?b=t[21]:(b=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=b);let x;t[22]!==r||t[23]!==i||t[24]!==b?(x=(0,Z.jsx)(Ai,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:b}),t[22]=r,t[23]=i,t[24]=b,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==_||t[28]!==y?(S=(0,Z.jsxs)(Jo,{children:[_,y,x]}),t[26]=x,t[27]=_,t[28]=y,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h?(C=(0,Z.jsxs)(Ko,{className:`sm:max-w-md`,children:[m,h,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=C):C=t[33],C}function Eq(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:wq(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:Cq(e)})]},e.path)}function Dq(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=ao(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,c;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=ug(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),c=n;break bb0}let l;t[16]!==i||t[17]!==r?(l=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=l):l=t[18],o=n.map(l)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=c}else o=t[9],c=t[10];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[19]===o?l=t[20]:(l=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=l),l}function Oq(e){return e?.isDirectory()?e:null}function kq(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function Aq(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=Oq(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}kq(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 jq=`open-knowledge:file-tree-menu-action-delete`,Mq=`open-knowledge:file-tree-menu-action-rename`,Nq=`open-knowledge:file-tree-menu-action-duplicate`;function Pq(e){window.dispatchEvent(new CustomEvent(jq,{detail:{target:e}}))}function Fq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(jq,t),()=>window.removeEventListener(jq,t)}function Iq(e){window.dispatchEvent(new CustomEvent(Mq,{detail:{target:e}}))}function Lq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(Mq,t),()=>window.removeEventListener(Mq,t)}function Rq(e){window.dispatchEvent(new CustomEvent(Nq,{detail:{target:e}}))}function zq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(Nq,t),()=>window.removeEventListener(Nq,t)}function Bq(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 Vq={Accept:`application/x-ndjson, application/json`};function Hq(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var Uq=class extends Error{};function Wq(e){return typeof e==`object`&&!!e&&`type`in e}async function Gq(e){let t=e.body;if(!t)throw new Uq(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(Wq(n)){if(n.type===`error`)throw new Uq(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return a=n.truncated===!0,!0}let r=Bn.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1};try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
|
|
1944
1944
|
`);for(;i!==-1;){let t=s(o.slice(0,i));if(o=o.slice(i+1),t){e=!0;break}i=o.indexOf(`
|
|
1945
1945
|
`)}}o+=r.decode(),o.includes(`
|
|
1946
|
-
`)||s(o)}finally{n.releaseLock()}return{entries:i,truncated:a}}function
|
|
1947
|
-
${
|
|
1948
|
-
${
|
|
1949
|
-
${
|
|
1950
|
-
</svg>`,
|
|
1946
|
+
`)||s(o)}finally{n.releaseLock()}return{entries:i,truncated:a}}function Kq(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>hP(e))),a=[];for(let e of t){let t=hP(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 qq(e,t,n,r,i=Date.now()){if(t!==``&&!e.some(e=>hP(e)===t))return[...e];let a=[],o=[];for(let n of e)Jq(t,hP(n))?a.push(n):o.push(n);let s=Kq(n,a,r,i),c=new Set(s.map(e=>hP(e)).filter(e=>e.endsWith(`/`)));return[...o.filter(e=>{let n=hP(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 Jq(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(`/`)}function Yq(e){return e?Is._({id:`wTcjov`}):null}function Xq(e){let t=(0,$.c)(29),{_:n}=i(),r=Kg(),a=RS();if(r)return null;let{input:o,installStates:c,dispatch:l}=e,u=o===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){let e=Yq(u),r;t[12]===c?r=t[13]:(r=e=>c[e.id]?.installed===!0,t[12]=c,t[13]=r);let i=Yg.filter(r),_;t[14]===c?_=t[15]:(_=Yg.some(e=>c[e.id]?.installed==null),t[14]=c,t[15]=_);let v=_,y=i.length>0,b=a!==null,x=!y&&!b;f=lo,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(Za,{children:[(0,Z.jsx)(Vi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[16]=g):g=t[16],d=Ao,p=y?(0,Z.jsxs)(qa,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(To,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(go,{disabled:!r,onSelect:()=>{o&&l(t.id,o)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(FS,{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[17]!==v||t[18]!==x?(m=x?(0,Z.jsx)(go,{disabled:!0,"data-testid":`file-tree-open-in-empty`,children:v?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}):null,t[17]=v,t[18]=x,t[19]=m):m=t[19],h=b?(0,Z.jsxs)(Z.Fragment,{children:[y?(0,Z.jsx)(Xa,{}):null,(0,Z.jsxs)(qa,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(To,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),zS.map(t=>{let{displayName:r}=Ci[t];return(0,Z.jsxs)(go,{onSelect:()=>{o!==null&&a.launchInTerminal(o,t)},disabled:u,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(FS,{id:BS(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,t[0]=n,t[1]=l,t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11];let _;t[20]!==d||t[21]!==p||t[22]!==m||t[23]!==h?(_=(0,Z.jsxs)(d,{children:[p,m,h]}),t[20]=d,t[21]=p,t[22]=m,t[23]=h,t[24]=_):_=t[24];let v;return t[25]!==f||t[26]!==g||t[27]!==_?(v=(0,Z.jsxs)(f,{children:[g,_]}),t[25]=f,t[26]=g,t[27]=_,t[28]=v):v=t[28],v}var Zq=G(`HOVER_INTENT_MS`,80),Qq=3,$q=20,eJ=new Map,tJ=new Set,nJ=[],rJ=new Map;function iJ(e){for(rJ.delete(e),rJ.set(e,!0);rJ.size>$q;){let e=rJ.keys().next().value;if(e===void 0)break;rJ.delete(e)}}function aJ(e){tJ.delete(e),sJ()}function oJ(e,t){let n=Date.now();lt(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),we(e,t,n)}function sJ(){for(;tJ.size<Qq&&nJ.length>0;){let e=nJ.shift();if(!e)break;if(!rJ.has(e.docName)){tJ.add(e.docName),iJ(e.docName);try{let t=e.prewarm(e.docName);t&&oJ(e.docName,t)}catch(t){lt(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{aJ(e.docName)}}}}function cJ(e,t){if(Xe(e)||rJ.has(e))return;let n=eJ.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(eJ.delete(e),tJ.size>=Qq){nJ.push({docName:e,prewarm:t});return}iJ(e),tJ.add(e);try{let n=t(e);n&&oJ(e,n)}catch(t){lt(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{aJ(e)}},Zq);eJ.set(e,{timer:r,prewarm:t})}function lJ(e){let t=eJ.get(e);t&&(clearTimeout(t.timer),eJ.delete(e))}var uJ=/\.(md|mdx)$/i;function dJ(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function fJ(e){let t=e.match(uJ);return t?t[0]:null}function pJ(e){window.requestAnimationFrame(()=>{let t=U(e);if(!(!t||t.isDestroyed))try{t.commands.focus()}catch{}})}function mJ(e){let t=e.current;t.row?.removeAttribute(DJ),t.root?.removeAttribute(OJ),e.current={row:null,root:null}}function hJ(e,t){let n=e.current;n.row===t.row&&n.root===t.root||(mJ(e),t.row?.setAttribute(DJ,`true`),t.root?.setAttribute(OJ,`true`),e.current={row:t.row,root:t.root})}async function gJ(e,t){try{await navigator.clipboard.writeText(e),Ls.success(t===`full`?Is._({id:`6_ZOw4`}):Is._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),Ls.error(t===`full`?Is._({id:`vfRlCI`}):Is._({id:`5QGTaA`}))}}var _J=new Set([`agents`,`agent`,`claude`,`skill`]),vJ=`ok-file-tree-link-decoration`,yJ=`ok-file-tree-agent-decoration`,bJ=`ok-file-tree-markdown`,xJ=`0 0 32 32`,SJ=`<symbol id="${bJ}" viewBox="${xJ}" fill="currentColor"><path d="M26.7075 10.2925L19.7075 3.2925C19.6146 3.19967 19.5042 3.12605 19.3829 3.07586C19.2615 3.02568 19.1314 2.9999 19 3H7C6.46957 3 5.96086 3.21071 5.58579 3.58579C5.21071 3.96086 5 4.46957 5 5V14C5 14.2652 5.10536 14.5196 5.29289 14.7071C5.48043 14.8946 5.73478 15 6 15C6.26522 15 6.51957 14.8946 6.70711 14.7071C6.89464 14.5196 7 14.2652 7 14V5H18V11C18 11.2652 18.1054 11.5196 18.2929 11.7071C18.4804 11.8946 18.7348 12 19 12H25V28C25 28.2652 25.1054 28.5196 25.2929 28.7071C25.4804 28.8946 25.7348 29 26 29C26.2652 29 26.5196 28.8946 26.7071 28.7071C26.8946 28.5196 27 28.2652 27 28V11C27.0001 10.8686 26.9743 10.7385 26.9241 10.6172C26.8739 10.4958 26.8003 10.3854 26.7075 10.2925ZM20 6.41375L23.5863 10H20V6.41375ZM18 18H16C15.7348 18 15.4804 18.1054 15.2929 18.2929C15.1054 18.4804 15 18.7348 15 19V26C15 26.2652 15.1054 26.5196 15.2929 26.7071C15.4804 26.8946 15.7348 27 16 27H18C19.1935 27 20.3381 26.5259 21.182 25.682C22.0259 24.8381 22.5 23.6935 22.5 22.5C22.5 21.3065 22.0259 20.1619 21.182 19.318C20.3381 18.4741 19.1935 18 18 18ZM18 25H17V20H18C18.663 20 19.2989 20.2634 19.7678 20.7322C20.2366 21.2011 20.5 21.837 20.5 22.5C20.5 23.163 20.2366 23.7989 19.7678 24.2678C19.2989 24.7366 18.663 25 18 25ZM13 19V26C13 26.2652 12.8946 26.5196 12.7071 26.7071C12.5196 26.8946 12.2652 27 12 27C11.7348 27 11.4804 26.8946 11.2929 26.7071C11.1054 26.5196 11 26.2652 11 26V22.1725L9.31875 24.5737C9.22652 24.7053 9.10396 24.8126 8.96144 24.8868C8.81892 24.9609 8.66064 24.9996 8.5 24.9996C8.33936 24.9996 8.18108 24.9609 8.03856 24.8868C7.89604 24.8126 7.77348 24.7053 7.68125 24.5737L6 22.1725V26C6 26.2652 5.89464 26.5196 5.70711 26.7071C5.51957 26.8946 5.26522 27 5 27C4.73478 27 4.48043 26.8946 4.29289 26.7071C4.10536 26.5196 4 26.2652 4 26V19C4.00009 18.7874 4.06791 18.5804 4.19363 18.409C4.31935 18.2376 4.49642 18.1107 4.69915 18.0467C4.90188 17.9828 5.11971 17.9851 5.32104 18.0533C5.52236 18.1216 5.6967 18.2522 5.81875 18.4263L8.5 22.2563L11.1812 18.4263C11.3033 18.2522 11.4776 18.1216 11.679 18.0533C11.8803 17.9851 12.0981 17.9828 12.3008 18.0467C12.5036 18.1107 12.6807 18.2376 12.8064 18.409C12.9321 18.5804 12.9999 18.7874 13 19Z"/></symbol>`;function CJ(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function wJ(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${CJ(t)}</symbol>`}var TJ=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1947
|
+
${wJ(vJ,Ht)}
|
|
1948
|
+
${wJ(yJ,Il)}
|
|
1949
|
+
${SJ}
|
|
1950
|
+
</svg>`,EJ=`
|
|
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
|
+
`,DJ=`data-ok-external-file-drop-target`,OJ=`data-ok-external-file-drop-root-target`,kJ=`__external-file-drop__`,AJ=2e3,jJ=`
|
|
1974
|
+
[data-type="item"][${DJ}="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][${OJ}="true"] {
|
|
1979
1979
|
position: relative;
|
|
1980
1980
|
}
|
|
1981
|
-
[data-file-tree-virtualized-root][${
|
|
1981
|
+
[data-file-tree-virtualized-root][${OJ}="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"][${DJ}="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][${OJ}="true"]::after {
|
|
1997
1997
|
border: 2px solid Highlight;
|
|
1998
1998
|
}
|
|
1999
1999
|
}
|
|
2000
|
-
`,
|
|
2001
|
-
:host([${
|
|
2000
|
+
`,MJ=`data-ok-creation-cleared`,NJ=`${VK}\n${aq}\n${EJ}\n${jJ}\n${`
|
|
2001
|
+
:host([${MJ}]) [data-item-focused="true"] {
|
|
2002
2002
|
--trees-focus-ring-color: transparent;
|
|
2003
2003
|
}
|
|
2004
|
-
`}\n${NK}\n${PK}`;function MJ(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&hJ.has(t)}function NJ(e){return e===`darwin`?Is._({id:`LtSYdi`}):e===`win32`?Is._({id:`qi1F96`}):Is._({id:`e1Rn_k`})}function PJ(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:a}=e,{_:o}=i(),s=typeof window<`u`?window.okDesktop:void 0;if(!s)return null;let c=s.platform,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=NJ(c),t[0]=l):l=t[0];let u=l,d,f;t[1]!==o||t[2]!==r?(d=r?null:o({id:`wTcjov`}),f=o(c===`darwin`?d?{id:`FvpFSZ`,values:{hint:d}}:{id:`LtSYdi`}:c===`win32`?d?{id:`o4dcAf`,values:{hint:d}}:{id:`qi1F96`}:d?{id:`zUhPuR`,values:{hint:d}}:{id:`e1Rn_k`}),t[1]=o,t[2]=r,t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=f,m=!r,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=()=>{if(!r)return;a();let e=A_(r.contentDir,DP(n),r.pathSeparator);s.shell.showItemInFolder(e)},t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(ht,{"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{className:`flex-1`,children:u}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===d?v=t[12]:(v=d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null,t[11]=d,t[12]=v);let y;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(go,{disabled:m,onSelect:h,"aria-label":p,children:[g,_,v]}),t[13]=p,t[14]=m,t[15]=h,t[16]=v,t[17]=y):y=t[17],y}function FJ(e,t){return EP({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function IJ(e,t){return e!==t&&e.startsWith(t)}function LJ(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>IJ(e,t))).map(e=>FJ(e,t))}function RJ(e,t){return e===t||e.startsWith(`${t}/`)}function zJ(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 BJ(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)Ps(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):os(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=hP(e);RJ(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function VJ(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:RJ(t.createdPath,e.path)}function HJ(e){let t=(0,$.c)(55),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:u,projectLocalBinding:d,mergedConfig:f,onStartCreating:p,onCreateFromTemplate:m,onDuplicate:h,onDelete:g,onExpandSubtree:_,onCollapseSubtree:v,folderTreePaths:y,isAsset:b,documents:x}=e,{_:S}=i(),C=EP(n,x),w=n.kind===`directory`,T=C.kind===`asset`?null:C,E=T!==null&&u!==null,D;t[0]!==S||t[1]!==w?(D=S(w?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=S,t[1]=w,t[2]=D):D=t[2];let O=D,k=f?.appearance?.sidebar?.showHiddenFiles??!1,A=d!==null,j;t[3]!==w||t[4]!==n.path?(j=w?hP(n.path):null,t[3]=w,t[4]=n.path,t[5]=j):j=t[5];let M=ao(j),N=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,P=l.getSelectedPaths(),F=P.includes(C.treePath)?LJ(P,x):[],I=F.length>1?F:[C],R=I.length,z=Is._({id:`djjdjr`,values:{deleteCount:R}}),B;t[6]!==b||t[7]!==w||t[8]!==n||t[9]!==o?(B=b?null:w?I_({folderRelativePath:DP(n),workspace:o}):M_({docName:fP(n.path),workspace:o}),t[6]=b,t[7]=w,t[8]=n,t[9]=o,t[10]=B):B=t[10];let V=B,H;t[11]===r?H=t[12]:(H=()=>r.close({restoreFocus:!1}),t[11]=r,t[12]=H);let U=H,W;t[13]===r?W=t[14]:(W=()=>r.close(),t[13]=r,t[14]=W);let G=W,K;t[15]!==S||t[16]!==d?(K=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,ni(t.error)),Ls.error(S({id:`P47EWZ`}),{description:ni(t.error)}))},t[15]=S,t[16]=d,t[17]=K):K=t[17];let q=K,J=0,ee=0;if(w){let e=gP(n.path);for(let t of y)(t===e||t.startsWith(e))&&(J++,Eq(l.getItem(t))?.isExpanded()&&ee++)}let Y=w&&ee<J,te=w&&ee>0,X;t[18]===G?X=t[19]:(X=e=>{e||G()},t[18]=G,t[19]=X);let ne;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(eo,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[20]=ne):ne=t[20];let re;t[21]!==S||t[22]!==a||t[23]!==E||t[24]!==A||t[25]!==G||t[26]!==U||t[27]!==z||t[28]!==I||t[29]!==N||t[30]!==q||t[31]!==c||t[32]!==V||t[33]!==O||t[34]!==b||t[35]!==w||t[36]!==n||t[37]!==l||t[38]!==u||t[39]!==T||t[40]!==v||t[41]!==m||t[42]!==g||t[43]!==h||t[44]!==_||t[45]!==p||t[46]!==k||t[47]!==te||t[48]!==Y||t[49]!==C||t[50]!==o?(re=(0,Z.jsx)(ro,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{U(),p(`file`,hP(n.path))},children:[(0,Z.jsx)(Mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`HdkSiO`})]}),N?(0,Z.jsxs)(lo,{children:[(0,Z.jsxs)(Za,{disabled:a,children:[(0,Z.jsx)(ho,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(Ao,{children:(0,Z.jsx)(Tq,{parentDir:hP(n.path),onSelectTemplate:e=>{U(),m(hP(n.path),e)},ItemComponent:go})})]}):null,(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{U(),p(`folder`,hP(n.path))},children:[(0,Z.jsx)($l,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`96G6Re`})]}),(0,Z.jsx)(Xa,{}),(0,Z.jsx)(PJ,{item:n,workspace:o,onClose:G}),(0,Z.jsx)(Jq,{input:V,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(lo,{children:[(0,Z.jsxs)(Za,{children:[(0,Z.jsx)(Ne,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ao,{children:[(0,Z.jsx)(go,{disabled:!o,onSelect:()=>{o&&(G(),mJ(A_(o.contentDir,DP(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(go,{onSelect:()=>{G(),mJ(DP(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(Xa,{}),(0,Z.jsx)(Co,{checked:k,onCheckedChange:q,disabled:!A,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`XcGbim`})}),Y||te?(0,Z.jsx)(Xa,{}):null,Y?(0,Z.jsxs)(go,{onSelect:()=>{G(),_(n.path)},children:[(0,Z.jsx)(Gu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,te?(0,Z.jsxs)(go,{onSelect:()=>{G(),v(n.path)},children:[(0,Z.jsx)(Zl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,(0,Z.jsx)(Xa,{}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{C.kind!==`asset`&&(G(),h(C))},children:[(0,Z.jsx)(Yt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{U(),l.startRenaming(n.path)},children:[(0,Z.jsx)(L,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)(go,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u||!T)return;G();let e=ZK(T),t=ko(u.current()),n=mo(t,e);if(n===t)return;u.patch(_o(n));let r=T.path.split(`/`).pop()||T.path;Ls.success(S({id:`4xtLTl`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(rt,{"aria-hidden":`true`}),O]}),(0,Z.jsxs)(go,{variant:`destructive`,disabled:a,onSelect:()=>{G(),g(I)},children:[(0,Z.jsx)(_e,{"aria-hidden":`true`}),z]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(PJ,{item:n,workspace:o,onClose:G}),!b&&(0,Z.jsx)(Jq,{input:V,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(lo,{children:[(0,Z.jsxs)(Za,{children:[(0,Z.jsx)(Ne,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ao,{children:[(0,Z.jsx)(go,{disabled:!o,onSelect:()=>{o&&(G(),mJ(A_(o.contentDir,DP(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(go,{onSelect:()=>{G(),mJ(DP(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(Xa,{}),b?null:(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{G(),h(C)},children:[(0,Z.jsx)(Yt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{U(),l.startRenaming(n.path)},children:[(0,Z.jsx)(L,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),T?(0,Z.jsxs)(go,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u)return;G();let e=ZK(T),t=ko(u.current()),n=mo(t,e);if(n===t)return;u.patch(_o(n));let r=T.path.split(`/`).pop()||T.path;Ls.success(S({id:`OD0FCX`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(rt,{"aria-hidden":`true`}),O]}):null,(0,Z.jsxs)(go,{variant:`destructive`,disabled:a,onSelect:()=>{G(),g(I)},children:[(0,Z.jsx)(_e,{"aria-hidden":`true`}),z]})]})}),t[21]=S,t[22]=a,t[23]=E,t[24]=A,t[25]=G,t[26]=U,t[27]=z,t[28]=I,t[29]=N,t[30]=q,t[31]=c,t[32]=V,t[33]=O,t[34]=b,t[35]=w,t[36]=n,t[37]=l,t[38]=u,t[39]=T,t[40]=v,t[41]=m,t[42]=g,t[43]=h,t[44]=_,t[45]=p,t[46]=k,t[47]=te,t[48]=Y,t[49]=C,t[50]=o,t[51]=re):re=t[51];let ie;return t[52]!==X||t[53]!==re?(ie=(0,Z.jsxs)(po,{open:!0,modal:!1,onOpenChange:X,children:[ne,re]}),t[52]=X,t[53]=re,t[54]=ie):ie=t[54],ie}async function UJ(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:zq});if(Bq(i)){let e=await Uq(i);return{kind:`entries`,entries:ss(e.entries),truncated:e.truncated}}let a=await j(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=Wr.safeParse(a.body);return o.success?{kind:`entries`,entries:ss(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof Vq?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function WJ(e){let t=(0,$.c)(352),{ref:n}=e,{_:r,i18n:a}=i(),{activeDocName:o,activeTarget:c,closeTabs:l,closeDocument:u,closeAndClearForRename:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,openTarget:h,prewarm:g,remapTabsForRename:_}=yt(),{notifySidebarFileSelected:v}=pM(),{resolvedTheme:y}=Ar(),{addPage:b,pageMeta:x}=Ts(),S;t[0]===x?S=t[1]:(S=function(e,t){return Ms(e,t??x.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=x,t[1]=S);let C=S,w;t[2]!==C||t[3]!==v||t[4]!==h?(w=function(e,t){h(C(e,t),{tabBehavior:`replace-active`}),_s(ls(e)),v()},t[2]=C,t[3]=v,t[4]=h,t[5]=w):w=t[5];let T=w,E;t[6]!==v||t[7]!==h?(E=function(e){let t=ds(e);h({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),_s(t),v()},t[6]=v,t[7]=h,t[8]=E):E=t[8];let D=E,O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[9]=O):O=t[9];let[k,A]=(0,Q.useState)(O),[M,N]=(0,Q.useState)(!0),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=zm(),z=(0,Q.useRef)(null),[V,H]=(0,Q.useState)(null),[U,W]=(0,Q.useState)(null),[G,K]=(0,Q.useState)(null),[q,J]=(0,Q.useState)(null),{conflicts:ee}=ea(),[Y,te]=(0,Q.useState)(null),[X,ne]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(!1),ae=(0,Q.useRef)(re),oe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(oe=new Set,t[10]=oe):oe=t[10];let se=(0,Q.useRef)(oe),ce=(0,Q.useRef)(k),le=(0,Q.useRef)(x),ue;t[11]!==k||t[12]!==D||t[13]!==T||t[14]!==v||t[15]!==h?(ue=function(e,t){let n=t===void 0?k:t,r=fq(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,_P(e));return}if(r.kind===`asset`){h({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),_s(r.hash),v();return}if(r.kind===`folder`){D(r.path);return}let i=n.find(e=>Ps(e)&&e.docName===r.path);T(r.path,i?.size)},t[11]=k,t[12]=D,t[13]=T,t[14]=v,t[15]=h,t[16]=ue):ue=t[16];let de=ue,pe;t[17]!==v||t[18]!==h?(pe=function(e,t){h({kind:`asset`,target:e,assetPath:e,mediaKind:(t??ce.current).find(t=>os(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),_s(gs(e)),v()},t[17]=v,t[18]=h,t[19]=pe):pe=t[19];let me=pe,he=(0,Q.useRef)(o),_e;t[20]===k?_e=t[21]:(_e=new Set(k.filter(os).map(_Y)),t[20]=k,t[21]=_e);let ve=_e,ye=(0,Q.useRef)(ve),be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=[],t[22]=be):be=t[22];let xe=(0,Q.useRef)(be),Se=(0,Q.useRef)(null),Ce=(0,Q.useRef)(gY),we=(0,Q.useRef)(null),Te=(0,Q.useRef)(null),Ee=(0,Q.useRef)(!1),De=(0,Q.useRef)(!1),Oe=(0,Q.useRef)(null),ke;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ke={row:null,root:null},t[23]=ke):ke=t[23];let Ae=(0,Q.useRef)(ke),je=(0,Q.useRef)(hY),Me=(0,Q.useRef)(null),Ne;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=new Map,t[24]=Ne):Ne=t[24];let Fe=(0,Q.useRef)(Ne),Ie;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=new Set,t[25]=Ie):Ie=t[25];let Le=(0,Q.useRef)(Ie),Re;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Re=new Map,t[26]=Re):Re=t[26];let ze=(0,Q.useRef)(Re),Be=(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)(mY),We=(0,Q.useRef)(pY),Ge=(0,Q.useRef)(!1),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(null),Je=(0,Q.useRef)(fY),Ye=(0,Q.useRef)(dY),Xe=(0,Q.useRef)(uY),Ze=(0,Q.useRef)(lY),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 it=rt,at;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(at=function(e){it(),F(e)},t[30]=at):at=t[30];let ot=at,st;t[31]===r?st=t[32]:(st=function(){if(nt(),Fm()){F(null),L(!0),z.current=setTimeout(()=>{z.current=null,Ke.current?.()},OJ);return}L(!1),F(r({id:`34qyH5`}))},t[31]=r,t[32]=st);let ct=st,lt=(0,Q.useRef)(!0),ut;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ut=()=>{if(lt.current){lt.current=!1;return}Ke.current?.()},t[33]=ut):ut=t[33];let dt;t[34]===R?dt=t[35]:(dt=[R],t[34]=R,t[35]=dt),(0,Q.useEffect)(ut,dt);let ft,pt;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ft=()=>nt,pt=[],t[36]=ft,t[37]=pt):(ft=t[36],pt=t[37]),(0,Q.useEffect)(ft,pt);let mt,ht;t[38]!==k.length||t[39]!==M?(mt=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(CL)?.shadowRoot;if(!e)return;let t=e,n=function(){Oe.current!==null&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{De.current=!1,Oe.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=yY(e),n=t?.dataset.itemPath;if(!n)return;let r=_q(t.dataset.itemType===`folder`?gP(n):n,ce.current,le.current);r&&(Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!0,e.dataTransfer?.setData(HO,WO(r)))},i=function(e){if(!(e instanceof DragEvent)||!FP(e))return;let t=xY(e);if(!t){fJ(Ae);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),pJ(Ae,t)},a=function(e){if(!(e instanceof DragEvent)||!FP(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||fJ(Ae)},o=function(e){if(!(e instanceof DragEvent)||!FP(e))return;let t=xY(e),n=IP(e);if(!t||n.length===0){fJ(Ae);return}e.preventDefault(),e.stopPropagation(),fJ(Ae),je.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),fJ(Ae),Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!1}},ht=[k.length,M],t[38]=k.length,t[39]=M,t[40]=mt,t[41]=ht):(mt=t[40],ht=t[41]),(0,Q.useEffect)(mt,ht);let{selectedFilePath:gt,selectedFolderPath:_t,navigationPath:vt}=dq(c,m?null:o),bt=gt?dP(gt,k.find(e=>Ps(e)&&e.docName===gt)?.docExt):_t?gP(_t):c?.kind===`asset`?c.assetPath:null,xt=re?null:bt,St=ov().states,{dispatch:Ct}=Y_(),wt;t[42]!==Ct||t[43]!==St?(wt={installStates:St,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Ct},t[42]=Ct,t[43]=St,t[44]=wt):wt=t[44];let Tt=wt,{okignoreBinding:Et,projectLocalBinding:Dt,merged:Ot}=ge(),kt=Ot?.appearance?.sidebar?.showHiddenFiles??!1,At;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>Me.current===null,t[45]=At):At=t[45];let jt=At,Mt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=[],t[46]=Mt):Mt=t[46];let Nt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Nt={set:`complete`,spriteSheet:CJ,byFileExtension:{md:{name:vJ,viewBox:yJ},mdx:{name:vJ,viewBox:yJ}}},t[47]=Nt):Nt=t[47];let Pt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Pt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[48]=Pt):Pt=t[48];let Ft;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ft={canDrag:jt,canDrop:jt,onDropComplete:e=>Ze.current(e),onDropError:cY},t[49]=Ft):Ft=t[49];let It,Lt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(It={canRename:jt,onRename:e=>Ye.current(e),onError:e=>Xe.current(e)},Lt=e=>Je.current(e),t[50]=It,t[51]=Lt):(It=t[50],Lt=t[51]);let Rt;t[52]===r?Rt=t[53]:(Rt={paths:Mt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...jK,icons:Nt,unsafeCSS:jJ,composition:Pt,dragAndDrop:Ft,renaming:It,onSelectionChange:Lt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=ce.current.find(e=>Ps(e)&&dP(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:gJ,title:r(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return MJ(t.path)?{icon:_J,title:r({id:`i9toLO`})}:null}let n=ce.current.find(e=>ys(e)&&gP(e.path)===gP(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:gJ,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[52]=r,t[53]=Rt);let{model:zt}=AK(Rt),Bt;t[54]===zt?Bt=t[55]:(Bt=function(e){let t=zt.getItem(e)??zt.getItem(gP(e));return t?.isDirectory()?gP(hP(t.getPath())):e},t[54]=zt,t[55]=Bt);let Vt=Bt,Ht,Ut;t[56]===k?(Ht=t[57],Ut=t[58]):(Ut=vP(k),Ht=yP(Ut),t[56]=k,t[57]=Ht,t[58]=Ut);let Wt=Ht,Gt=(0,Q.useRef)(Ut),Kt;t[59]===k?Kt=t[60]:(Kt=xP(k),t[59]=k,t[60]=Kt);let qt=Kt,Jt=(0,Q.useRef)(qt),Yt=_t?SP(gP(_t)).slice(0,-1):SP(xt??vt),Xt=Yt.join(`\0`),Zt;t[61]===zt?Zt=t[62]:(Zt=()=>{let e=new Set;for(let t of Jt.current)Eq(zt.getItem(t))?.isExpanded()&&e.add(t);return e},t[61]=zt,t[62]=Zt);let Qt=Zt,$t;t[63]===Qt?$t=t[64]:($t=e=>{let t=new Set(xP(e??ce.current)),n=Qt();for(let e of xe.current)n.add(e);return[...n].filter(e=>t.has(e))},t[63]=Qt,t[64]=$t);let en=$t,tn;t[65]!==en||t[66]!==zt?(tn=e=>{let t=vP(e??ce.current);zt.resetPaths(t,{initialExpandedPaths:en(e)})},t[65]=en,t[66]=zt,t[67]=tn):tn=t[67];let nn=tn,rn;t[68]!==r||t[69]!==ct?(rn=async function(e){let t=Be.current,n=new AbortController;ze.current.set(e,n);let i=await UJ(hP(e),n.signal,r({id:`8RtNI0`}),r({id:`HlmZBk`}));if(ze.current.get(e)===n&&ze.current.delete(e),n.signal.aborted||t!==Be.current)return;if(i.kind===`network-error`){ct(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,i.cause);return}if(i.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,i.title),ot(i.title);return}let a=Ge.current,o=vs(i.entries,a);Le.current.add(e),A(t=>Gq(t,e,o,Fe.current)),F(null),it(),i.truncated&&H(i.entries.length)},t[68]=r,t[69]=ct,t[70]=rn):rn=t[70];let on=rn,sn;t[71]!==Qt||t[72]!==on?(sn=()=>{let e=Qt(),t=He.current;He.current=e;for(let n of e){if(t.has(n)||Le.current.has(n)||ze.current.has(n))continue;let e=hP(n);ce.current.find(t=>ys(t)&&t.path===e)?.hasChildren!==!1&&on(n)}},t[71]=Qt,t[72]=on,t[73]=sn):sn=t[73];let cn=sn,ln;t[74]!==Qt||t[75]!==on?(ln=()=>{for(let e of Qt())Le.current.has(e)||ze.current.has(e)||on(e)},t[74]=Qt,t[75]=on,t[76]=ln):ln=t[76];let un=ln,dn;t[77]!==zt||t[78]!==nn?(dn=(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=>Ps(e)&&e.docName===r);if(n==null||zt.getItem(i)==null)continue;let s=dP(i,t.find(e=>Ps(e)&&e.docName===i)?.docExt??n.docExt);zt.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=aP(e);if(t===``)continue;let n=e.slice(0,-t.length);zt.getItem(n)!=null&&(zt.getItem(e)??zt.move(n,e),o=e,a+=1)}a!==0&&(nn(t),o!=null&&zt.focusPath(o))},t[77]=zt,t[78]=nn,t[79]=dn):dn=t[79];let fn=dn,pn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(pn=e=>{we.current=bP(e)},t[80]=pn):pn=t[80];let mn=pn,hn;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(hn=e=>ye.current.has(e),t[81]=hn):hn=t[81];let gn=hn,_n;t[82]!==r||t[83]!==b||t[84]!==D||t[85]!==T||t[86]!==nn?(_n=async function(e){if(e.kind===`asset`||Me.current!==null)return;let t=()=>{W(null),Me.current=null};Me.current=e.path,W(e.path),F(null);try{let n=await j(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){Ls.error(n.title),nn(),t();return}let i=B(or,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});Ls.error(e),F(e),ks([`files`,`backlinks`,`graph`]),nn(),t();return}for(let e of i.duplicatedDocNames)b(e);A(t=>{let n=KP(t,e,i);return nn(n),mn(n),n}),ks([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?D(i.path):T(i.path)),Ls.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),Ls.error(r({id:`EBVbtP`}),{description:i}),nn(),t()}},t[82]=r,t[83]=b,t[84]=D,t[85]=T,t[86]=nn,t[87]=_n):_n=t[87];let vn=_n,yn=(0,Q.useRef)(vn),bn;t[88]===vn?bn=t[89]:(bn=()=>{yn.current=vn},t[88]=vn,t[89]=bn),(0,Q.useEffect)(bn);let xn=function(e){let t=lJ(e);if(!t||uJ(t))return!1;let n=zt.getFocusedPath()??zt.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||gn(n))return!1;let r=uJ(n);if(!r)return!1;let i=gP(t);if(!Jt.current.includes(i))return!1;let a=`${t}${r}`;return Gt.current.includes(a)?!1:($n({sourcePath:n,destinationPath:a,isFolder:!1}),zt.move(n,a),!0)},Sn;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Sn=e=>{let t=e??Se.current;!t||Se.current!==t||(t.disposeCommitListener(),Se.current=null)},t[90]=Sn):Sn=t[90];let Cn=Sn,wn;t[91]!==r||t[92]!==Cn||t[93]!==u||t[94]!==l||t[95]!==nn?(wn=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;Cn(e),i&&W(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 j(t,r({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=r({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});i?Ls.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(W(null),nn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;Ls.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(W(null),nn());return}i&&(e.kind===`file`?u(e.createdPath):l([Pe(e.createdPath)],{force:!0})),i&&A(t=>{let n=WP(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return mn(n),n}),ks([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&W(null)},t[91]=r,t[92]=Cn,t[93]=u,t[94]=l,t[95]=nn,t[96]=wn):wn=t[96];let Tn=wn,En,Dn;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(En=()=>()=>{let e=Se.current;e&&Ce.current(e,{restoreLocation:!1,updateUi:!1}).catch(sY)},Dn=[],t[97]=En,t[98]=Dn):(En=t[97],Dn=t[98]),(0,Q.useEffect)(En,Dn);let On;t[99]!==r||t[100]!==ct?(On=()=>{let e=!0,t=null,n=Rq(async function(){t?.abort();let n=new AbortController;t=n,Be.current+=1;for(let e of ze.current.values())e.abort();ze.current.clear(),Le.current.clear();try{let t=await fetch(`/api/documents?showAll=true&dir=&depth=1`,{signal:n.signal,headers:zq});if(Bq(t)){let{entries:n,truncated:r}=await Uq(t);if(!e)return;let i=Ge.current,a=vs(ss(n),i);A(e=>Gq(e,``,a,Fe.current)),F(null),it(),H(r?n.length:null),We.current()}else{let n=await j(t,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)ot(n.title),H(null);else{let e=Wr.safeParse(n.body);if(!e.success)ot(r({id:`HlmZBk`})),H(null);else{let t=Ge.current,n=vs(ss(e.data.documents),t);A(e=>Gq(e,``,n,Fe.current)),F(null),it(),H(e.data.truncated===!0?e.data.documents.length:null),We.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof Vq?ot(r.message):ct()),console.warn(`[FileTree] fetch failed:`,r)}e&&N(!1)},()=>t?.abort());Ke.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=xs(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Ke.current=null,n.dispose();for(let e of ze.current.values())e.abort();ze.current.clear(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},t[99]=r,t[100]=ct,t[101]=On):On=t[101];let kn;t[102]===r?kn=t[103]:(kn=[r],t[102]=r,t[103]=kn),(0,Q.useEffect)(On,kn);let An=(0,Q.useRef)(!0),jn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(jn=()=>{if(An.current){An.current=!1;return}Ke.current?.()},t[104]=jn):jn=t[104];let Mn;t[105]===kt?Mn=t[106]:(Mn=[kt],t[105]=kt,t[106]=Mn),(0,Q.useEffect)(jn,Mn);let Nn,Pn;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Nn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=B(Kr,n,`workspace`,null);r&&ne({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(oY),()=>{e=!1}},Pn=[],t[107]=Nn,t[108]=Pn):(Nn=t[107],Pn=t[108]),(0,Q.useEffect)(Nn,Pn);let Fn;t[109]!==en||t[110]!==zt||t[111]!==Wt?(Fn=()=>{if(we.current===Wt){we.current=null;return}zt.resetPaths(Gt.current,{initialExpandedPaths:en()})},t[109]=en,t[110]=zt,t[111]=Wt,t[112]=Fn):Fn=t[112];let In;t[113]!==zt||t[114]!==Wt?(In=[zt,Wt],t[113]=zt,t[114]=Wt,t[115]=In):In=t[115],(0,Q.useEffect)(Fn,In),Oq(zt,xt,Xt,Ee,Wt);let Ln;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=()=>{ie(!1)},t[116]=Ln):Ln=t[116];let Rn;t[117]===bt?Rn=t[118]:(Rn=[bt],t[117]=bt,t[118]=Rn),(0,Q.useEffect)(Ln,Rn);let zn,Bn;t[119]===re?(zn=t[120],Bn=t[121]):(zn=()=>{ae.current=re;for(let e of se.current)e()},Bn=[re],t[119]=re,t[120]=zn,t[121]=Bn),(0,Q.useEffect)(zn,Bn);let Vn;t[122]!==xt||t[123]!==M||t[124]!==zt?(Vn=()=>{M||!xt||lq(zt)},t[122]=xt,t[123]=M,t[124]=zt,t[125]=Vn):Vn=t[125];let Hn;t[126]!==Xt||t[127]!==xt||t[128]!==M||t[129]!==zt||t[130]!==Wt?(Hn=[xt,Xt,Wt,M,zt],t[126]=Xt,t[127]=xt,t[128]=M,t[129]=zt,t[130]=Wt,t[131]=Hn):Hn=t[131],(0,Q.useEffect)(Vn,Hn);let Un,Wn;t[132]===zt?(Un=t[133],Wn=t[134]):(Un=()=>zt.subscribe(()=>{if(!zt.isSearchOpen())for(let e of xe.current){let t=Eq(zt.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Wn=[zt],t[132]=zt,t[133]=Un,t[134]=Wn),(0,Q.useEffect)(Un,Wn);let Gn,qn;t[135]===zt?(Gn=t[136],qn=t[137]):(Gn=()=>zt.subscribe(()=>Ue.current()),qn=[zt],t[135]=zt,t[136]=Gn,t[137]=qn),(0,Q.useEffect)(Gn,qn);let Jn,Xn;t[138]===zt?(Jn=t[139],Xn=t[140]):(Jn=()=>zt.onMutation(`remove`,e=>{let t=Se.current;!t||e.path!==t.renamePath||Ce.current(t)}),Xn=[zt],t[138]=zt,t[139]=Jn,t[140]=Xn),(0,Q.useEffect)(Jn,Xn);let Zn;t[141]!==b||t[142]!==d||t[143]!==f||t[144]!==me||t[145]!==D||t[146]!==T||t[147]!==p||t[148]!==fn||t[149]!==_?(Zn=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 ce.current){if(Ps(e)){let t=o.find(t=>t.fromPath===dP(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(os(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&sP(t)&&u.set(e.path,fP(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(Qe.current?.kind===`folder`?Qe.current.folderPath:null),g=h?an(h,a):null,v=r?.assetPath??(Qe.current?.kind===`asset`?Qe.current.assetPath:null),y=v?u.get(v)??null:null,x=m?null:y??qP(c,e),S=m??(v?y?null:o.find(e=>e.fromPath===v)?.toPath??an(v,a):null);fe(e);let C=[...JP(e,f(),p),...l.keys()];await Promise.all(C.map(e=>d(e)));for(let t of e)b(t.toDocName);for(let e of u.values())b(e);_(e,a,o);let w=null;A(t=>{let n=UP(t,e,a,o,s);return w=n,fn(t,n,e,o),mn(n),n}),h&&g&&g!==h?D(g):x&&x!==c?(T(x),dJ(x)):S&&(m||S!==v)&&me(S,w??ce.current),ks([`files`,`backlinks`,`graph`])},t[141]=b,t[142]=d,t[143]=f,t[144]=me,t[145]=D,t[146]=T,t[147]=p,t[148]=fn,t[149]=_,t[150]=Zn):Zn=t[150];let Qn=Zn;async function $n(e){let t=!e.isFolder&&gn(e.sourcePath),n=t?e.sourcePath:OP(e.sourcePath,e.isFolder);W(n),F(null);try{let i=cP(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!sP(i.destinationPath),o=t||a?i.destinationPath:OP(i.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:hP(n),toPath:hP(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:fP(n),toPath:o},c={docName:he.current,folderPath:Qe.current?.kind===`folder`?Qe.current.folderPath:null,assetPath:Qe.current?.kind===`asset`?Qe.current.assetPath:null},l=await j(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`gijbne`}));if(!l.ok){Ls.error(l.title),nn();let e=Se.current;e&&e.renamePath===n?await Tn(e):Cn(),W(null);return}let u=B(mi,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await Qn(u.renamed,e.isFolder?[{fromPath:hP(n),toPath:hP(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=aP(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),Ls.error(r({id:`dDpCOp`}))}Cn(),W(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});Ls.error(t),F(t),nn();let i=Se.current;i&&i.renamePath===n?await Tn(i):Cn(),W(null)}}let er;t[151]!==r||t[152]!==Qn||t[153]!==nn?(er=async function(e){let t=e.draggedPaths.map(t=>{let n=jP(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(aY);if(t.length!==0){W(t[0]?.sourcePath??null),F(null);try{let e=[],n=[],i=[],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&&gn(a.sourcePath),s=t?{kind:`folder`,fromPath:hP(a.sourcePath),toPath:hP(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:fP(a.sourcePath),toPath:fP(a.destinationTreePath)},c=await j(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){Ls.error(c.title),nn(),W(null);return}let l=B(mi,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:hP(a.sourcePath),toPath:hP(a.destinationTreePath)})}try{await Qn(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),Ls.error(r({id:`8OxKZy`}))}W(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Ls.error(r({id:`HIb0vl`})),nn(),W(null)}}},t[151]=r,t[152]=Qn,t[153]=nn,t[154]=er):er=t[154];let nr=er,rr;t[155]!==r||t[156]!==b||t[157]!==nn?(rr=async function(e,t,n){if(e.length===0||Me.current!==null)return;let i=()=>{Me.current=null,W(null)};Me.current=n,W(n),F(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),e.append(`parentDocName`,NP(t,n.name||`upload`));try{let i=await j(await fetch(`/api/upload`,{method:`POST`,body:e}),r({id:`4Gz2wC`}));if(!i.ok){s+=1,Ls.error(i.title,{description:n.name});continue}let c=B(vi,i.body,`upload:drop`,null);if(c===null){s+=1,Ls.error(r({id:`4Gz2wC`}),{description:n.name});continue}let l=PP(t,c);if(c.deduped===!0){s+=1,Ls.error(r({id:`4sKwf6`}),{description:l});continue}o+=1;let u=LP(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),Ls.error(t instanceof TypeError?r({id:`HIb0vl`}):r({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)Ps(e)&&b(e.docName);A(e=>{let t=new Set(e.map(pP)),n=!1,r=[...e];for(let e of a){let i=pP(e);Fe.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(nn(r),mn(r),r):e})}o>0&&(ks([`files`,`backlinks`,`graph`]),Ke.current?.(),Ls.success(Is._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||r({id:`RSqaSd`})})),s>0&&F(o>0?Is._({id:`yH7T4q`,values:{failedCount:s}}):r({id:`4Gz2wC`})),i()}catch(e){let t=e,n=r({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),Ls.error(n),F(n),i()}},t[155]=r,t[156]=b,t[157]=nn,t[158]=rr):rr=t[158];let ir=rr,ar;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(ar=function(e){te({parentDir:e})},t[159]=ar):ar=t[159];let sr=ar,cr;t[160]!==r||t[161]!==b||t[162]!==Tn||t[163]!==Cn||t[164]!==zt||t[165]!==D||t[166]!==T||t[167]!==nn||t[168]!==Ut?(cr=async function(e,t,n){if(Me.current)return;let i=Se.current;i&&Cn(i);try{let i=kP(e,t,[...Ut,...Jt.current]);W(i.renamePath),Me.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=AP(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await j(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){Ls.error(a.title),W(null),Me.current=null;return}let s=fP(e),c=B(gi,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};b(c),A(e=>{if(e.some(e=>Ps(e)&&e.docName===c))return e;let t=[...e,l];return mn(t),Fe.current.set(pP(l),Date.now()),t}),ks([`files`,`backlinks`,`graph`]),T(c)}else{let e=hP(i.addPath),t=await j(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){Ls.error(t.title),W(null),Me.current=null;return}o=B(Kn,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};A(e=>{if(e.some(e=>ys(e)&&e.path===o))return e;let t=[...e,n];return mn(t),Fe.current.set(pP(n),Date.now()),t}),ks([`files`]),D(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=Se.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>Cn(t))};document.addEventListener(`keydown`,c,!0),Se.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},W(null),Me.current=null,zt.add(i.addPath),zt.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Ls.error(r({id:`S6l5dv`}));let t=Se.current;t?await Tn(t):Cn(),W(null),Me.current=null,nn()}},t[160]=r,t[161]=b,t[162]=Tn,t[163]=Cn,t[164]=zt,t[165]=D,t[166]=T,t[167]=nn,t[168]=Ut,t[169]=cr):cr=t[169];let lr=cr,ur;t[170]===zt?ur=t[171]:(ur=function(e){let t=gP(e);(0,Q.startTransition)(()=>{for(let e of Jt.current)if(e===t||e.startsWith(t)){let t=Eq(zt.getItem(e));t&&t.expand()}})},t[170]=zt,t[171]=ur);let fr=ur,pr;t[172]===zt?pr=t[173]:(pr=function(e){let t=gP(e),n=new Set(xe.current);(0,Q.startTransition)(()=>{for(let e of[...Jt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=Eq(zt.getItem(e));t&&t.collapse()}})},t[172]=zt,t[173]=pr);let mr=pr,hr;t[174]!==de||t[175]!==Yt||t[176]!==o||t[177]!==c||t[178]!==ve||t[179]!==U||t[180]!==Tn||t[181]!==cn||t[182]!==k||t[183]!==qt||t[184]!==nr||t[185]!==$n||t[186]!==Vt||t[187]!==x||t[188]!==xn||t[189]!==un||t[190]!==kt||t[191]!==Ut||t[192]!==ir?(hr=()=>{ce.current=k,le.current=x,he.current=o,Qe.current=c,ye.current=ve,Me.current=U,Ge.current=kt,Gt.current=Ut,Jt.current=qt,xe.current=Yt,Ue.current=cn,We.current=un,Ce.current=Tn,je.current=(e,t,n)=>{ir(e,t,n)},Je.current=e=>{if(Ee.current||De.current||e.length!==1)return;let t=e[0];t&&(ie(!1),de(Vt(t),k))},Xe.current=e=>{xn(e)||Ls.error(e)},Ye.current=$n,Ze.current=nr},t[174]=de,t[175]=Yt,t[176]=o,t[177]=c,t[178]=ve,t[179]=U,t[180]=Tn,t[181]=cn,t[182]=k,t[183]=qt,t[184]=nr,t[185]=$n,t[186]=Vt,t[187]=x,t[188]=xn,t[189]=un,t[190]=kt,t[191]=Ut,t[192]=ir,t[193]=hr):hr=t[193],(0,Q.useLayoutEffect)(hr);let gr,_r;t[194]===zt?(gr=t[195],_r=t[196]):(gr=()=>{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||zJ(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=zt.getFocusedPath()??zt.getSelectedPaths()[0]??null;if(!t)return;let n=zt.getItem(t)??zt.getItem(gP(t)),r=n?.isDirectory()?gP(hP(n.getPath())):t;if(ye.current.has(r))return;yn.current(FJ(r,ce.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Jt.current,...Gt.current]);Ee.current=!0;for(let e of u)e&&zt.getItem(e)?.select();queueMicrotask(()=>{Ee.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},_r=[zt],t[194]=zt,t[195]=gr,t[196]=_r),(0,Q.useEffect)(gr,_r);let vr,yr;t[197]!==k.length||t[198]!==M?(vr=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(CL)?.shadowRoot;if(!e)return;let t=iY,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()},yr=[M,k.length],t[197]=k.length,t[198]=M,t[199]=vr,t[200]=yr):(vr=t[199],yr=t[200]),(0,Q.useEffect)(vr,yr);let br,xr;t[201]!==k.length||t[202]!==M?(br=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(CL)?.shadowRoot;if(!e)return;let t=()=>BK(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()},xr=[M,k.length],t[201]=k.length,t[202]=M,t[203]=br,t[204]=xr):(br=t[203],xr=t[204]),(0,Q.useEffect)(br,xr);let Sr,Cr;t[205]!==k.length||t[206]!==M?(Sr=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(CL)?.shadowRoot;if(!e)return;let t=()=>iq(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Cr=[M,k.length],t[205]=k.length,t[206]=M,t[207]=Sr,t[208]=Cr):(Sr=t[207],Cr=t[208]),(0,Q.useEffect)(Sr,Cr);let wr;t[209]===Symbol.for(`react.memo_cache_sentinel`)?(wr={folderCount:0,expandedCount:0},t[209]=wr):wr=t[209];let Tr=(0,Q.useRef)(wr),Er=(0,Q.useRef)(lr),Dr=(0,Q.useRef)(sr),Or;t[210]===lr?Or=t[211]:(Or=()=>{Er.current=lr,Dr.current=sr},t[210]=lr,t[211]=Or),(0,Q.useEffect)(Or);let kr,jr;t[212]===zt?(kr=t[213],jr=t[214]):(kr=()=>({startCreating(e,t){Er.current(e,t)},startCreatingFromTemplate(e){Dr.current(e)},createFromTemplate(e,t){Er.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Jt.current){let t=Eq(zt.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(xe.current);(0,Q.startTransition)(()=>{for(let t of[...Jt.current].reverse()){if(e.has(t))continue;let n=Eq(zt.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Jt.current,t=0;for(let n of e)Eq(zt.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Tr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Tr.current=i,i},isCreationTargetCleared(){return ae.current},subscribe(e){se.current.add(e);let t=zt.subscribe(e);return()=>{se.current.delete(e),t()}}}),jr=[zt],t[212]=zt,t[213]=kr,t[214]=jr),(0,Q.useImperativeHandle)(n,kr,jr);let Mr;t[215]!==Cn||t[216]!==d||t[217]!==l||t[218]!==zt?(Mr=async function(e,t,n){let r=BJ(e,ce.current,Jt.current),i=Se.current;i&&e.some(e=>VJ(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Cn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(rY).map(nY)]);l([...[...a].map(tY),...[...o].map(eY),...[...s].map($J)],{force:!0}),await Promise.all([...a].map(e=>d(e)));for(let t of e){let e=t.kind===`folder`?gP(t.path):t.kind===`asset`?t.path:dP(t.path,t.docExt);zt.getItem(e)&&zt.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}A(e=>{let t=WP(e,[...a],void 0,[...s]);for(let e of o)t=WP(t,[],e);return mn(t),t}),ks([`files`,`backlinks`,`graph`])},t[215]=Cn,t[216]=d,t[217]=l,t[218]=zt,t[219]=Mr):Mr=t[219];let Nr=Mr,Pr;t[220]!==r||t[221]!==Nr?(Pr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;W(a.path);let o=await j(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!o.ok)return i.length>0&&await Nr(i,t,n),Ls.error(o.title),!1;let s=B(dr,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await Nr(i,t,n),!0},t[220]=r,t[221]=Nr,t[222]=Pr):Pr=t[222];let Fr=Pr,Ir;t[223]===Symbol.for(`react.memo_cache_sentinel`)?(Ir=async function(e,t,n){let r=[],i=[];for(let a of e){W(a.path);let e=YP(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:yq(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[223]=Ir):Ir=t[223];let Lr=Ir,Rr;t[224]===r?Rr=t[225]:(Rr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await j(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),i.push({target:a,reason:o.title});continue}let s=B(Yn,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length;Ls.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`vEJDlt`})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[224]=r,t[225]=Rr);let zr=Rr,Br;t[226]!==r||t[227]!==ee||t[228]!==Nr||t[229]!==Fr||t[230]!==zr||t[231]!==nn||t[232]!==X?(Br=async function(e){let t=e.map(e=>GP(e,ce.current)),n=t[0];if(!n)return;let i=ee.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(QJ),t=i.length>e.length?`, +${i.length-e.length} more`:``;Ls.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}W(n.path),K(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&X){let{trashed:e,failed:n}=await Lr(t,a,X);if(e.length>0){let t=await zr(e);t?await Nr(e,t.deletedDocNames,t.deletedFolderPaths):await Nr(e,e.filter(ZJ).map(XJ),e.filter(YJ).map(JJ))}n.length>0&&J({failed:n,originalTargets:[...t]}),W(null)}else{let e=await Fr(t);W(null),e||nn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),Ls.error(r({id:`0eHrMb`}),{description:n}),W(null),nn()}},t[226]=r,t[227]=ee,t[228]=Nr,t[229]=Fr,t[230]=zr,t[231]=nn,t[232]=X,t[233]=Br):Br=t[233];let Vr=Br,Hr;t[234]!==r||t[235]!==Fr||t[236]!==nn||t[237]!==q?(Hr=async function(){if(!q)return;let e=new Set(q.failed.map(qJ)),t=q.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(J(null),t.length!==0){W(t[0]?.path??null);try{let e=await Fr(t);W(null),e||nn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),Ls.error(r({id:`0eHrMb`}),{description:n}),W(null),nn()}}},t[234]=r,t[235]=Fr,t[236]=nn,t[237]=q,t[238]=Hr):Hr=t[238];let Ur=Hr,Gr;t[239]!==Vr||t[240]!==q?(Gr=async function(){if(!q)return;let e=new Set(q.failed.map(KJ)),t=q.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));J(null),await Vr(t)},t[239]=Vr,t[240]=q,t[241]=Gr):Gr=t[241];let qr=Gr,Jr=(0,Q.useRef)(Vr),Yr;t[242]===Vr?Yr=t[243]:(Yr=()=>{Jr.current=Vr},t[242]=Vr,t[243]=Yr),(0,Q.useEffect)(Yr);let Xr,Zr;t[244]===Symbol.for(`react.memo_cache_sentinel`)?(Xr=()=>Nq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ce.current.find(e=>Ps(e)&&e.docName===t);Jr.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Jr.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){Jr.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}))}),Zr=[],t[244]=Xr,t[245]=Zr):(Xr=t[244],Zr=t[245]),(0,Q.useEffect)(Xr,Zr);let Qr,$r;t[246]===Symbol.for(`react.memo_cache_sentinel`)?(Qr=()=>Lq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ce.current.find(e=>Ps(e)&&e.docName===t);yn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){yn.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}))}),$r=[],t[246]=Qr,t[247]=$r):(Qr=t[246],$r=t[247]),(0,Q.useEffect)(Qr,$r);let ei,ti;t[248]===zt?(ei=t[249],ti=t[250]):(ei=()=>Fq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=dP(t,ce.current.find(e=>Ps(e)&&e.docName===t)?.docExt);zt.startRenaming(n);return}if(e.kind===`folder`){zt.startRenaming(e.folderPath);return}if(e.kind===`asset`){zt.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),ti=[zt],t[248]=zt,t[249]=ei,t[250]=ti),(0,Q.useEffect)(ei,ti);let ni;t[251]===Symbol.for(`react.memo_cache_sentinel`)?(ni=function(){let e=Te.current;e&&sJ(e),Te.current=null},t[251]=ni):ni=t[251];let ri=ni,ii;t[252]===g?ii=t[253]:(ii=function(e){let t=vY(e.nativeEvent);if(!t||t.endsWith(`/`)){ri();return}let n=fP(t),r=ce.current.find(e=>pP(e)===t);if(r&&os(r)){ri();return}if(r&&Ps(r)&&tr(r.size)){ri();return}Te.current!==n&&(ri(),Te.current=n,oJ(n,e=>g(e)))},t[252]=g,t[253]=ii);let ai=ii,oi;t[254]!==de||t[255]!==zt||t[256]!==D?(oi=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=yY(e.nativeEvent);if(!t){SY(e.nativeEvent)&&ie(!0);return}if(t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?gP(n):n;if(zt.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=hP(r);if(window.location.hash===ds(e))return;queueMicrotask(()=>D(e));return}let i=fP(r);window.location.hash!==ls(i)&&queueMicrotask(()=>de(r))},t[254]=de,t[255]=zt,t[256]=D,t[257]=oi):oi=t[257];let si=oi,ci;t[258]===Symbol.for(`react.memo_cache_sentinel`)?(ci=function(e){FP(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,et(!0))},t[258]=ci):ci=t[258];let li=ci,ui;t[259]===Symbol.for(`react.memo_cache_sentinel`)?(ui=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||et(!1)},t[259]=ui):ui=t[259];let di=ui,fi;t[260]===ir?fi=t[261]:(fi=function(e){if(!FP(e.nativeEvent))return;let t=IP(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),et(!1),ir(t,``,DJ))},t[260]=ir,t[261]=fi);let pi=fi;if(M){let e;return t[262]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(wY,{}),t[262]=e):e=t[262],e}let hi;t[263]!==r||t[264]!==I||t[265]!==R?(hi=I?r(R?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[263]=r,t[264]=I,t[265]=R,t[266]=hi):hi=t[266];let _i=hi;if(k.length===0){if(_i!==null){let e;return t[267]===_i?e=t[268]:(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:_i})}),t[267]=_i,t[268]=e),e}if(P){let e;return t[269]===P?e=t[270]:(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[269]=P,t[270]=e),e}let e;t[271]===r?e=t[272]:(e=r({id:`5ZB7XC`}),t[271]=r,t[272]=e);let n=$e&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,i;t[273]===n?i=t[274]:(i=Oi(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[273]=n,t[274]=i);let a;t[275]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(s,{id:`xiv-dW`})}),t[275]=a):a=t[275];let o;t[276]===lr?o=t[277]:(o=()=>lr(`file`,``),t[276]=lr,t[277]=o);let c;t[278]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(s,{id:`6ibbCg`}),t[278]=c):c=t[278];let l;t[279]===o?l=t[280]:(l=(0,Z.jsx)(Ai,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:c}),t[279]=o,t[280]=l);let u;return t[281]!==pi||t[282]!==e||t[283]!==i||t[284]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":e,className:i,onDragOver:li,onDragLeave:di,onDrop:pi,children:[a,l]}),t[281]=pi,t[282]=e,t[283]=i,t[284]=l,t[285]=u):u=t[285],u}let yi=U!==null,bi=G?.targets[0]??null,xi=null;if(V!==null){let e;if(t[286]!==a.locale||t[287]!==V){let n=new Intl.NumberFormat(a.locale).format(V);e=Is._({id:`LuoJWu`,values:{truncatedShownCount:V,formattedCount:n}}),t[286]=a.locale,t[287]=V,t[288]=e}else e=t[288];xi=e}let Si;t[289]!==P||t[290]!==_i||t[291]!==xi?(Si=(P||_i!==null||xi!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[_i===null?P&&(0,Z.jsx)(EY,{kind:`error`,children:P}):(0,Z.jsx)(EY,{kind:`reconnecting`,children:_i}),xi!==null&&(0,Z.jsx)(EY,{kind:`info`,children:xi})]}),t[289]=P,t[290]=_i,t[291]=xi,t[292]=Si):Si=t[292];let Ci;t[293]===y?Ci=t[294]:(Ci=FK(y),t[293]=y,t[294]=Ci);let wi=re?``:void 0,Ti;t[295]===wi?Ti=t[296]:(Ti={[AJ]:wi},t[295]=wi,t[296]=Ti);let Ei;t[297]!==yi||t[298]!==ve||t[299]!==mr||t[300]!==k||t[301]!==fr||t[302]!==qt||t[303]!==vn||t[304]!==Tt||t[305]!==Ot||t[306]!==zt||t[307]!==Et||t[308]!==Dt||t[309]!==lr||t[310]!==X?(Ei=(e,t)=>(0,Z.jsx)(HJ,{item:e,context:t,anyActionBusy:yi,workspace:X,handoff:Tt,model:zt,okignoreBinding:Et,projectLocalBinding:Dt,mergedConfig:Ot,onStartCreating:lr,onCreateFromTemplate:(e,t)=>lr(`file`,e,{template:t}),onDuplicate:vn,onDelete:e=>K({targets:e}),onExpandSubtree:fr,onCollapseSubtree:mr,folderTreePaths:qt,isAsset:ve.has(e.path),documents:k}),t[297]=yi,t[298]=ve,t[299]=mr,t[300]=k,t[301]=fr,t[302]=qt,t[303]=vn,t[304]=Tt,t[305]=Ot,t[306]=zt,t[307]=Et,t[308]=Dt,t[309]=lr,t[310]=X,t[311]=Ei):Ei=t[311];let Di;t[312]!==si||t[313]!==ai||t[314]!==zt||t[315]!==Si||t[316]!==Ci||t[317]!==Ti||t[318]!==Ei?(Di=(0,Z.jsx)(`div`,{ref:qe,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(kK,{header:Si,model:zt,style:Ci,...Ti,onClickCapture:si,onMouseMove:ai,onMouseLeave:ri,renderContextMenu:Ei})}),t[312]=si,t[313]=ai,t[314]=zt,t[315]=Si,t[316]=Ci,t[317]=Ti,t[318]=Ei,t[319]=Di):Di=t[319];let ki=!!G,ji;t[320]===U?ji=t[321]:(ji=e=>{!e&&!U&&K(null)},t[320]=U,t[321]=ji);let Mi;t[322]!==r||t[323]!==U||t[324]!==G||t[325]!==Vr||t[326]!==bi?(Mi=G&&bi&&(0,Z.jsx)(va,{...(()=>{let e=hq(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,G.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(GJ)}):null};let t=G.targets.length,n=bi.name;return{itemName:t===1?bi.kind===`folder`?`${bi.name}/`:bi.kind===`file`?`${bi.name}${bi.docExt??`.md`}`:bi.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):bi.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:U!==null,onDelete:()=>Vr(G.targets)}),t[322]=r,t[323]=U,t[324]=G,t[325]=Vr,t[326]=bi,t[327]=Mi):Mi=t[327];let Ni;t[328]!==ki||t[329]!==ji||t[330]!==Mi?(Ni=(0,Z.jsx)(Xo,{open:ki,onOpenChange:ji,children:Mi}),t[328]=ki,t[329]=ji,t[330]=Mi,t[331]=Ni):Ni=t[331];let Pi=!!q,Fi;t[332]===U?Fi=t[333]:(Fi=e=>{!e&&!U&&J(null)},t[332]=U,t[333]=Fi);let Ii;t[334]!==U||t[335]!==Ur||t[336]!==qr||t[337]!==q?(Ii=q&&(0,Z.jsx)(Cq,{failedTargets:q.failed,isSubmitting:U!==null,onDeletePermanently:Ur,onRetry:qr,onCancel:()=>J(null)}),t[334]=U,t[335]=Ur,t[336]=qr,t[337]=q,t[338]=Ii):Ii=t[338];let Li;t[339]!==Pi||t[340]!==Fi||t[341]!==Ii?(Li=(0,Z.jsx)(Xo,{open:Pi,onOpenChange:Fi,children:Ii}),t[339]=Pi,t[340]=Fi,t[341]=Ii,t[342]=Li):Li=t[342];let Ri=Y!==null,zi;t[343]===Symbol.for(`react.memo_cache_sentinel`)?(zi=e=>{e||te(null)},t[343]=zi):zi=t[343];let Bi=Y?.parentDir??``,Vi;t[344]!==Ri||t[345]!==Bi?(Vi=(0,Z.jsx)(_g,{open:Ri,onOpenChange:zi,kind:`file`,initialDir:Bi,defaultToTemplate:!0}),t[344]=Ri,t[345]=Bi,t[346]=Vi):Vi=t[346];let Hi;return t[347]!==Di||t[348]!==Ni||t[349]!==Li||t[350]!==Vi?(Hi=(0,Z.jsxs)(Z.Fragment,{children:[Di,Ni,Li,Vi]}),t[347]=Di,t[348]=Ni,t[349]=Li,t[350]=Vi,t[351]=Hi):Hi=t[351],Hi}function GJ(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:gq(e)},`${e.kind}:${e.path}`)}function KJ(e){return`${e.kind}:${e.path}`}function qJ(e){return`${e.kind}:${e.path}`}function JJ(e){return e.path}function YJ(e){return e.kind===`folder`}function XJ(e){return e.path}function ZJ(e){return e.kind===`file`}function QJ(e){return e.file}function $J(e){return vt(e)}function eY(e){return Pe(e)}function tY(e){return it(e)}function nY(e){return e.path}function rY(e){return e.kind===`asset`}function iY(e){return e.endsWith(`/`)?e.slice(0,-1):e}function aY(e){return!!e}function oY(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function sY(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function cY(e){Ls.error(e)}function lY(){}function uY(e){return Ls.error(e)}function dY(){}function fY(){}function pY(){}function mY(){}function hY(){}async function gY(){}function _Y(e){return pP(e)}function vY(e){return yY(e)?.dataset.itemPath??null}function yY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function bY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function xY(e){let t=yY(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=MP(e,n);return{parentDir:r,row:t,root:null,busyPath:n?gP(r):e}}return SY(e)?{parentDir:``,row:null,root:bY(e),busyPath:DJ}:null}function SY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var CY=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function wY(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=CY.map(TY),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function TY(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(ya,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(ya,{className:`h-3 ${e}`})]},t)}function EY(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?as:n===`reconnecting`?no:Qo,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=Oi(`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=Oi(`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 DY(e){return e?Is._({id:`wTcjov`}):null}function OY(e){let t=(0,$.c)(23),{_:n}=i(),r=Kg(),a=RS();if(r)return null;let{input:o,installStates:c,dispatch:l}=e,u=o===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=DY(u),r;t[12]===c?r=t[13]:(r=e=>c[e.id]?.installed===!0,t[12]=c,t[13]=r);let i=Yg.filter(r),_=i.length>0,v=a!==null;if(!_&&!v){g=null;break bb0}f=iF,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsxs)(sF,{children:[(0,Z.jsx)(Vi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[14]=h):h=t[14],d=cF,p=_?(0,Z.jsxs)(rF,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(uF,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(oF,{disabled:!r,onSelect:()=>{o&&l(t.id,o)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(FS,{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,m=v?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(dF,{}):null,(0,Z.jsxs)(rF,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(uF,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),zS.map(t=>{let{displayName:r}=Ci[t];return(0,Z.jsxs)(oF,{onSelect:()=>{o!==null&&a.launchInTerminal(o,t)},disabled:u,"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)(FS,{id:BS(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}t[0]=n,t[1]=l,t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[15]!==d||t[16]!==p||t[17]!==m?(_=(0,Z.jsxs)(d,{children:[p,m]}),t[15]=d,t[16]=p,t[17]=m,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==h||t[21]!==_?(v=(0,Z.jsxs)(f,{children:[h,_]}),t[19]=f,t[20]=h,t[21]=_,t[22]=v):v=t[22],v}var kY=(e,t,n)=>Xu(e,t,n,`ProjectSwitcher`);function AY(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h=NM(),g=typeof window<`u`&&window.okDesktop!=null,_=(0,Q.useRef)(!1),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{u(e),e||f(``)},t[1]=v):v=t[1];let y=v,b;t[2]!==r||t[3]!==n.project||t[4]!==l?(b=()=>{if(!l)return;let e=!1;return kY(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=l,t[5]=b):b=t[5];let x;t[6]!==r||t[7]!==n||t[8]!==l?(x=[l,n,r],t[6]=r,t[7]=n,t[8]=l,t[9]=x):x=t[9],(0,Q.useEffect)(b,x);let S;t[10]!==r||t[11]!==n.project?(S=e=>{u(!1),kY(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=S):S=t[12];let C=S,w;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(w=()=>{u(!1),kY(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=w):w=t[16];let T=w,E;t[17]!==r||t[18]!==n.navigator?(E=()=>{u(!1),kY(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=E):E=t[19];let D=E,O;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{u(!1),m(!0)},t[20]=O):O=t[20];let k=O,j=n.config.projectPath,M,N,P,F,I,L,R,z,B,V,H;if(t[21]!==r||t[22]!==h||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==j||t[26]!==l||t[27]!==C||t[28]!==o||t[29]!==d){let e;t[41]===j?e=t[42]:(e=e=>e.path!==j,t[41]=j,t[42]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;N=po,R=l,z=y,B=!1;let u=h!==null&&`h-auto py-1.5`,p;t[43]===u?p=t[44]:(p=Oi(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,u),t[43]=u,t[44]=p);let m;t[45]===r?m=t[46]:(m=r({id:`zZ_I5K`}),t[45]=r,t[46]=m);let v;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(v=g?()=>{_.current=!0}:void 0,t[47]=v):v=t[47];let b;t[48]===l?b=t[49]:(b=g?()=>{if(_.current){_.current=!1;return}y(!l)}:void 0,t[48]=l,t[49]=b);let x;t[50]===n.config.projectName?x=t[51]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=x);let S;t[52]===h?S=t[53]:(S=h===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(He,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:h})]}),t[52]=h,t[53]=S);let w;t[54]!==x||t[55]!==S?(w=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x,S]}),t[54]=x,t[55]=S,t[56]=w):w=t[56];let T;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=T):T=t[57],t[58]!==n.config.projectPath||t[59]!==p||t[60]!==m||t[61]!==b||t[62]!==w?(V=(0,Z.jsx)(eo,{asChild:!0,children:(0,Z.jsxs)(DM,{className:p,"data-testid":`project-switcher-trigger`,"aria-label":m,title:n.config.projectPath,onPointerDown:v,onClick:b,children:[w,T]})}),t[58]=n.config.projectPath,t[59]=p,t[60]=m,t[61]=b,t[62]=w,t[63]=V):V=t[63],M=ro,H=`start`,P=`top`,F=`min-w-[260px]`,I=`project-switcher-menu`,L=i.length===0?(0,Z.jsx)(To,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(wT,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(kT,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:jY,"data-testid":`project-switcher-search`}),(0,Z.jsx)(ET,{children:(0,Z.jsx)(A,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Xa,{}),c.length===0?(0,Z.jsx)(To,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(s,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)(go,{disabled:e.missing,onSelect:()=>C(e.path),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)(`span`,{className:`w-full truncate font-medium text-sm`,title:e.name,children:e.name}),(0,Z.jsxs)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:e.path,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[21]=r,t[22]=h,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=j,t[26]=l,t[27]=C,t[28]=o,t[29]=d,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=R,t[37]=z,t[38]=B,t[39]=V,t[40]=H}else M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35],R=t[36],z=t[37],B=t[38],V=t[39],H=t[40];let U;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Xa,{}),t[64]=U):U=t[64];let W,G;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(ht,{"aria-hidden":`true`,className:`text-muted-foreground`}),G=(0,Z.jsx)(s,{id:`PVUn_c`}),t[65]=W,t[66]=G):(W=t[65],G=t[66]);let K;t[67]===T?K=t[68]:(K=(0,Z.jsxs)(go,{onSelect:T,"data-testid":`project-switcher-open-folder`,children:[W,G]}),t[67]=T,t[68]=K);let q,J;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(xt,{"aria-hidden":`true`,className:`text-muted-foreground`}),J=(0,Z.jsx)(s,{id:`xaDWAI`}),t[69]=q,t[70]=J):(q=t[69],J=t[70]);let ee;t[71]===D?ee=t[72]:(ee=(0,Z.jsxs)(go,{onSelect:D,"data-testid":`project-switcher-switch-project`,children:[q,J]}),t[71]=D,t[72]=ee);let Y;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsxs)(go,{onSelect:k,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(At,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[73]=Y):Y=t[73];let te;t[74]!==M||t[75]!==P||t[76]!==F||t[77]!==I||t[78]!==L||t[79]!==K||t[80]!==ee||t[81]!==H?(te=(0,Z.jsxs)(M,{align:H,side:P,className:F,"data-testid":I,children:[L,U,K,ee,Y]}),t[74]=M,t[75]=P,t[76]=F,t[77]=I,t[78]=L,t[79]=K,t[80]=ee,t[81]=H,t[82]=te):te=t[82];let X;t[83]!==N||t[84]!==R||t[85]!==z||t[86]!==B||t[87]!==V||t[88]!==te?(X=(0,Z.jsxs)(N,{open:R,onOpenChange:z,modal:B,children:[V,te]}),t[83]=N,t[84]=R,t[85]=z,t[86]=B,t[87]=V,t[88]=te,t[89]=X):X=t[89];let ne;t[90]!==n||t[91]!==p?(ne=(0,Z.jsx)(Kf,{open:p,onOpenChange:m,bridge:n}),t[90]=n,t[91]=p,t[92]=ne):ne=t[92];let re;return t[93]!==X||t[94]!==ne?(re=(0,Z.jsxs)(Z.Fragment,{children:[X,ne]}),t[93]=X,t[94]=ne,t[95]=re):re=t[95],re}function jY(e){return e.stopPropagation()}function MY(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})),sr(`sidebarSearchPill`)}function NY(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Oi(`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)(A,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(s,{id:`A1taO8`})}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Se,{className:`text-foreground/70`,children:Sc(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(Ai,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function PY(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:a}=i(),o=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,s;t[0]!==a||t[1]!==n.dismissible||t[2]!==r?(s=n.dismissible===!1?null:(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":a({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(Rs,{"aria-hidden":`true`,className:`size-3`})}),t[0]=a,t[1]=n.dismissible,t[2]=r,t[3]=s):s=t[3];let c=s,l=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${o}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let a;t[6]!==c||t[7]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,c]}),t[6]=c,t[7]=i,t[8]=a):a=t[8];let s;t[9]!==l||t[10]!==n.action?(s=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=l,t[10]=n.action,t[11]=s):s=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==l||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:u,children:n.secondaryAction.label}),t[14]=l,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==s||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[s,d]}),t[18]=s,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==a||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[a,f]}),t[21]=e,t[22]=r,t[23]=a,t[24]=f,t[25]=p):p=t[25],p}let u=`update-notice-${n.id}`,d=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${o}`,f;t[26]===n.body?f=t[27]:(f=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=f);let p;t[28]!==l||t[29]!==n.action?(p=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=l,t[29]=n.action,t[30]=p):p=t[30];let m;return t[31]!==c||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":u,className:d,children:[f,p,c]}),t[31]=c,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m):m=t[36],m}function FY(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 IY(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(yh,vh,vh),n;e[0]===t?n=e[1]:(n=FY(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),_h(r.id)},e[2]=r,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(PY,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function LY(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?A_(n.contentDir,j_(t),n.pathSeparator):e?.kind===`folder`?A_(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?A_(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function RY(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?j_(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function zY(e,t,n){return e===null?N_({workspace:n}):e.kind===`folder`?n?I_({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?M_({docName:t,workspace:n}):null}var BY={folderCount:0,expandedCount:0},VY=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function HY(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(VY)!==null}function UY(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(f,{name:`file-sidebar`,children:(0,Z.jsx)(GY,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var WY=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)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{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)(tc,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(ic,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function GY(e){let t=(0,$.c)(178),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=yt(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:Fs(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,h=typeof window<`u`&&window.okDesktop!=null,{state:g,toggleSidebar:_}=pM(),v=Kg(),y=g===`expanded`,b=h&&g===`collapsed`,[x,S]=(0,Q.useState)(BY),C,w;t[3]===a?(C=t[4],w=t[5]):(C=()=>{if(a===null)return;let e=()=>{S(a.getFolderState()),p(a.isCreationTargetCleared())};return e(),a.subscribe(e)},w=[a],t[3]=a,t[4]=C,t[5]=w),(0,Q.useEffect)(C,w);let T,E;t[6]===a?(T=t[7],E=t[8]):(T=()=>{if(a!==null)return uw(e=>{let t=e.initialDir??``;if(e.template){a.createFromTemplate(e.template.folder,e.template.name);return}a.startCreating(`file`,t)})},E=[a],t[6]=a,t[7]=T,t[8]=E),(0,Q.useEffect)(T,E);let D=x.folderCount>0,O=D&&x.expandedCount===x.folderCount,k=x.expandedCount===0,A=ao(``),j=ao(m===``?null:m),M=m===``?A:j,N=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,P=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,F=typeof window<`u`?window.okDesktop:void 0,I=ja(),L=ov().states,{dispatch:R}=Y_(),z;t[9]===I?z=t[10]:(z=N_({workspace:I}),t[9]=I,t[10]=z);let B=z,{projectLocalBinding:V,merged:H}=ge(),U=H?.appearance?.sidebar?.showHiddenFiles??!1,W=D&&!O,G=D&&!k,K=W||G,q=qY,J;t[11]!==a||t[12]!==I?(J=()=>{I&&a?.startCreating(`file`,``)},t[11]=a,t[12]=I,t[13]=J):J=t[13];let ee=J,Y;t[14]!==a||t[15]!==I?(Y=e=>{I&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=I,t[16]=Y):Y=t[16];let te=Y,X;t[17]!==a||t[18]!==I?(X=()=>{I&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=I,t[19]=X):X=t[19];let ne=X,re;t[20]===I?re=t[21]:(re=()=>{!I||!F||F.shell.showItemInFolder(I.contentDir)},t[20]=I,t[21]=re);let ie=re,ae;t[22]!==r||t[23]!==I?(ae=async()=>{if(I)try{await navigator.clipboard.writeText(I.contentDir),Ls.success(r({id:`6_ZOw4`}),{description:I.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),Ls.error(r({id:`vfRlCI`}))}},t[22]=r,t[23]=I,t[24]=ae):ae=t[24];let oe=ae,se;t[25]!==r||t[26]!==V?(se=e=>{if(V===null)return;let t=V.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,ni(t.error)),Ls.error(r({id:`P47EWZ`}),{description:ni(t.error)}))},t[25]=r,t[26]=V,t[27]=se):se=t[27];let ce=se,le;t[28]===a?le=t[29]:(le=()=>{a?.expandAll()},t[28]=a,t[29]=le);let ue=le,fe;t[30]===a?fe=t[31]:(fe=()=>{a?.collapseAll()},t[30]=a,t[31]=fe);let pe=fe,me,he;t[32]!==G||t[33]!==W||t[34]!==U||t[35]!==g?(me=()=>{F&&F.editor.notifyViewMenuStateChanged({showHiddenFiles:U,canExpandAll:W,canCollapseAll:G,sidebarVisible:g===`expanded`})},he=[F,U,W,G,g],t[32]=G,t[33]=W,t[34]=U,t[35]=g,t[36]=me,t[37]=he):(me=t[36],he=t[37]),(0,Q.useEffect)(me,he);let _e,ve;t[38]!==r||t[39]!==c||t[40]!==l||t[41]!==R||t[42]!==L||t[43]!==m||t[44]!==V||t[45]!==U||t[46]!==_||t[47]!==a||t[48]!==I?(_e=()=>{if(F)return F.onMenuAction(e=>{switch(e){case`new-doc`:if(!I||!a)return;a.startCreating(`file`,m);return;case`new-folder`:if(!I||!a)return;a.startCreating(`folder`,m);return;case`new-from-template`:if(!I||!a)return;a.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;Pq(l);return;case`duplicate`:if(!l)return;Iq(l);return;case`move-to-trash`:if(!l)return;Mq(l);return;case`reveal-in-finder`:{if(!F||!I)return;let e=LY(l,c,I);F.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=Yg.filter(e=>L[e.id]?.installed===!0);if(e.length===0){Ls.error(r({id:`LKOLNn`}));return}let t=zY(l,c,I);if(!t)return;let[n]=e;if(!n)return;R(n.id,t);return}case`copy-full-path`:{if(!I)return;let e=LY(l,c,I);navigator.clipboard.writeText(e).then(()=>Ls.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ls.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=RY(l,c);if(e===``){Ls.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>Ls.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ls.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(V===null)return;let e=V.patch({appearance:{sidebar:{showHiddenFiles:!U}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,ni(e.error)),Ls.error(r({id:`P47EWZ`}),{description:ni(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`toggle-sidebar`:_();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}})},ve=[F,a,I,l,c,m,V,U,L,R,_,r],t[38]=r,t[39]=c,t[40]=l,t[41]=R,t[42]=L,t[43]=m,t[44]=V,t[45]=U,t[46]=_,t[47]=a,t[48]=I,t[49]=_e,t[50]=ve):(_e=t[49],ve=t[50]),(0,Q.useEffect)(_e,ve);let ye=h&&y&&`motion-safe:delay-100`,be=b&&`opacity-0`,xe;t[51]!==ye||t[52]!==be?(xe=Oi(`flex-row h-12 items-center py-0 px-3`,`justify-between`,h&&`overflow-x-clip`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,ye,be,h&&`[-webkit-app-region:drag]`),t[51]=ye,t[52]=be,t[53]=xe):xe=t[53];let Se;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Se=h?(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[54]=Se):Se=t[54];let Ce;t[55]===y?Ce=t[56]:(Ce=y&&!h?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(s,{id:`sER-bs`})}):null,t[55]=y,t[56]=Ce);let we;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(we=Oi(`flex items-center gap-1`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[57]=we):we=t[57];let Te;t[58]!==r||t[59]!==O||t[60]!==D||t[61]!==k||t[62]!==a?(Te=D?(0,Z.jsxs)(po,{children:[(0,Z.jsx)(eo,{asChild:!0,children:(0,Z.jsx)(WY,{icon:cu,label:r({id:`Rq1vFD`})})}),(0,Z.jsxs)(ro,{align:`end`,children:[O?null:(0,Z.jsxs)(go,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(Gu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}),k?null:(0,Z.jsxs)(go,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(Zl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]})]})]}):null,t[58]=r,t[59]=O,t[60]=D,t[61]=k,t[62]=a,t[63]=Te):Te=t[63];let Ee;t[64]===r?Ee=t[65]:(Ee=r({id:`HdkSiO`}),t[64]=r,t[65]=Ee);let De;t[66]!==m||t[67]!==a?(De=()=>a?.startCreating(`file`,m),t[66]=m,t[67]=a,t[68]=De):De=t[68];let Oe;t[69]!==Ee||t[70]!==De?(Oe=(0,Z.jsx)(WY,{icon:Mu,label:Ee,onClick:De}),t[69]=Ee,t[70]=De,t[71]=Oe):Oe=t[71];let ke;t[72]!==r||t[73]!==P||t[74]!==m||t[75]!==a?(ke=P?(0,Z.jsxs)(po,{children:[(0,Z.jsx)(eo,{asChild:!0,children:(0,Z.jsx)(WY,{icon:ho,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(ro,{align:`end`,children:(0,Z.jsx)(Tq,{parentDir:m,onSelectTemplate:e=>a?.createFromTemplate(m,e),ItemComponent:go})})]}):null,t[72]=r,t[73]=P,t[74]=m,t[75]=a,t[76]=ke):ke=t[76];let Ae;t[77]===r?Ae=t[78]:(Ae=r({id:`96G6Re`}),t[77]=r,t[78]=Ae);let je;t[79]!==m||t[80]!==a?(je=()=>a?.startCreating(`folder`,m),t[79]=m,t[80]=a,t[81]=je):je=t[81];let Me;t[82]!==Ae||t[83]!==je?(Me=(0,Z.jsx)(WY,{icon:$l,label:Ae,onClick:je}),t[82]=Ae,t[83]=je,t[84]=Me):Me=t[84];let Pe;t[85]!==Te||t[86]!==Oe||t[87]!==ke||t[88]!==Me?(Pe=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:we,children:[Te,Oe,ke,Me]}),t[85]=Te,t[86]=Oe,t[87]=ke,t[88]=Me,t[89]=Pe):Pe=t[89];let Fe;t[90]!==xe||t[91]!==Ce||t[92]!==Pe?(Fe=(0,Z.jsxs)(xM,{"data-electron-drag":h?``:void 0,className:xe,children:[Se,Ce,Pe]}),t[90]=xe,t[91]=Ce,t[92]=Pe,t[93]=Fe):Fe=t[93];let Ie=h&&y&&`motion-safe:delay-100`,Le=b&&`opacity-0`,Re;t[94]!==Ie||t[95]!==Le?(Re=Oi(`px-2 pb-2`,h&&`[-webkit-app-region:no-drag]`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ie,Le),t[94]=Ie,t[95]=Le,t[96]=Re):Re=t[96];let ze;t[97]===g?ze=t[98]:(ze=[g],t[97]=g,t[98]=ze);let Be;t[99]===n?Be=t[100]:(Be=(0,Z.jsx)(NY,{onClick:n}),t[99]=n,t[100]=Be);let Ve;t[101]!==ze||t[102]!==Be?(Ve=(0,Z.jsx)(de,{fallbackRender:KY,onError:MY,resetKeys:ze,children:Be}),t[101]=ze,t[102]=Be,t[103]=Ve):Ve=t[103];let He;t[104]!==Re||t[105]!==Ve?(He=(0,Z.jsx)(`div`,{className:Re,children:Ve}),t[104]=Re,t[105]=Ve,t[106]=He):He=t[106];let Ue;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsxs)(CM,{children:[(0,Z.jsx)(cI,{}),(0,Z.jsx)(WJ,{ref:o})]}),t[107]=Ue):Ue=t[107];let We;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsxs)(SM,{className:`px-0`,children:[(0,Z.jsx)(IY,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(wM,{children:(0,Z.jsx)(TM,{children:(0,Z.jsx)(AY,{bridge:window.okDesktop})})}):null]}),t[108]=We):We=t[108];let Ge=!(v&&g===`collapsed`),Ke;t[109]===Ge?Ke=t[110]:(Ke=(0,Z.jsx)(yM,{enableToggle:!1,enableDrag:Ge}),t[109]=Ge,t[110]=Ke);let qe;t[111]!==Fe||t[112]!==He||t[113]!==Ke?(qe=(0,Z.jsx)(nF,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:q,children:[Fe,He,Ue,We,Ke]})}),t[111]=Fe,t[112]=He,t[113]=Ke,t[114]=qe):qe=t[114];let Je=!I,Ye,Xe;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(Mu,{"aria-hidden":`true`}),Xe=(0,Z.jsx)(s,{id:`HdkSiO`}),t[115]=Ye,t[116]=Xe):(Ye=t[115],Xe=t[116]);let Ze;t[117]!==ee||t[118]!==Je?(Ze=(0,Z.jsxs)(oF,{disabled:Je,onSelect:ee,"data-testid":`empty-space-menu-new-file`,children:[Ye,Xe]}),t[117]=ee,t[118]=Je,t[119]=Ze):Ze=t[119];let Qe;t[120]!==te||t[121]!==N||t[122]!==I?(Qe=N?(0,Z.jsxs)(iF,{children:[(0,Z.jsxs)(sF,{disabled:!I,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(ho,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(cF,{children:(0,Z.jsx)(Tq,{parentDir:``,onSelectTemplate:te,ItemComponent:oF})})]}):null,t[120]=te,t[121]=N,t[122]=I,t[123]=Qe):Qe=t[123];let $e=!I,et,tt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)($l,{"aria-hidden":`true`}),tt=(0,Z.jsx)(s,{id:`96G6Re`}),t[124]=et,t[125]=tt):(et=t[124],tt=t[125]);let nt;t[126]!==ne||t[127]!==$e?(nt=(0,Z.jsxs)(oF,{disabled:$e,onSelect:ne,"data-testid":`empty-space-menu-new-folder`,children:[et,tt]}),t[126]=ne,t[127]=$e,t[128]=nt):nt=t[128];let rt;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(dF,{}),t[129]=rt):rt=t[129];let it;t[130]!==r||t[131]!==ie||t[132]!==I?(it=F?(0,Z.jsxs)(oF,{disabled:!I,onSelect:ie,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(I?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(ht,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[130]=r,t[131]=ie,t[132]=I,t[133]=it):it=t[133];let at;t[134]!==R||t[135]!==B||t[136]!==L?(at=(0,Z.jsx)(OY,{input:B,installStates:L,dispatch:R}),t[134]=R,t[135]=B,t[136]=L,t[137]=at):at=t[137];let ot=!I,st;t[138]!==r||t[139]!==I?(st=r(I?{id:`Up2_7p`}:{id:`U8CD-l`}),t[138]=r,t[139]=I,t[140]=st):st=t[140];let ct;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(Ne,{"aria-hidden":`true`}),t[141]=ct):ct=t[141];let lt;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[142]=lt):lt=t[142];let ut;t[143]===I?ut=t[144]:(ut=I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[143]=I,t[144]=ut);let dt;t[145]!==oe||t[146]!==ot||t[147]!==st||t[148]!==ut?(dt=(0,Z.jsxs)(oF,{disabled:ot,onSelect:oe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":st,children:[ct,lt,ut]}),t[145]=oe,t[146]=ot,t[147]=st,t[148]=ut,t[149]=dt):dt=t[149];let ft;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(dF,{}),t[150]=ft):ft=t[150];let pt=V===null,mt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(s,{id:`XcGbim`}),t[151]=mt):mt=t[151];let gt;t[152]!==ce||t[153]!==U||t[154]!==pt?(gt=(0,Z.jsx)(lF,{checked:U,onCheckedChange:ce,disabled:pt,"data-testid":`empty-space-menu-show-hidden-files`,children:mt}),t[152]=ce,t[153]=U,t[154]=pt,t[155]=gt):gt=t[155];let _t;t[156]===K?_t=t[157]:(_t=K?(0,Z.jsx)(dF,{}):null,t[156]=K,t[157]=_t);let vt;t[158]!==ue||t[159]!==W?(vt=W?(0,Z.jsxs)(oF,{onSelect:ue,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Gu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[158]=ue,t[159]=W,t[160]=vt):vt=t[160];let bt;t[161]!==pe||t[162]!==G?(bt=G?(0,Z.jsxs)(oF,{onSelect:pe,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Zl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[161]=pe,t[162]=G,t[163]=bt):bt=t[163];let xt;t[164]!==Ze||t[165]!==Qe||t[166]!==nt||t[167]!==it||t[168]!==at||t[169]!==dt||t[170]!==gt||t[171]!==_t||t[172]!==vt||t[173]!==bt?(xt=(0,Z.jsxs)(aF,{children:[Ze,Qe,nt,rt,it,at,dt,ft,gt,_t,vt,bt]}),t[164]=Ze,t[165]=Qe,t[166]=nt,t[167]=it,t[168]=at,t[169]=dt,t[170]=gt,t[171]=_t,t[172]=vt,t[173]=bt,t[174]=xt):xt=t[174];let St;return t[175]!==qe||t[176]!==xt?(St=(0,Z.jsx)(_M,{variant:`inset`,children:(0,Z.jsxs)(tF,{children:[qe,xt]})}),t[175]=qe,t[176]=xt,t[177]=St):St=t[177],St}function KY(){return null}function qY(e){HY(e.target)&&(e.preventDefault(),e.stopPropagation())}function JY(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 YY(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function XY(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 ZY={phase:`loading`};function QY(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function $Y(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function eX(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=XY(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 tX(e){return e!==null&&e.kind===`project-branch-switch`}function nX(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,a=r===void 0?gp:r,{_:o}=i(),c=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,cX),[l,u]=(0,Q.useState)(ZY),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(!1),p;t[0]===c?p=t[1]:(p=tX(c)?c:null,t[0]=c,t[1]=p);let m=p,h;t[2]!==o||t[3]!==m?.share.target.kind?(h=m?.share.target.kind===`folder`?o({id:`ugoTXs`}):o({id:`XH30C4`}),t[2]=o,t[3]=m?.share.target.kind,t[4]=h):h=t[4];let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{u(ZY),d.current=!1,f.current=!1},t[5]=_):_=t[5];let v;t[6]===c?v=t[7]:(v=[c],t[6]=c,t[7]=v),(0,Q.useEffect)(_,v);let y;t[8]!==m||t[9]!==n?(y=()=>{m&&(d.current||(d.current=!0,n.project.fetchBranchInfo({projectPath:m.projectPath,branch:m.share.branch,kind:m.share.target.kind,path:sn(m.share.target)}).then(e=>{u(t=>QY(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),u(sX)})))},t[8]=m,t[9]=n,t[10]=y):y=t[10];let b;t[11]===m?b=t[12]:(b=[m],t[11]=m,t[12]=b),(0,Q.useEffect)(y,b);let x;t[13]!==o||t[14]!==m||t[15]!==l.phase||t[16]!==n||t[17]!==a||t[18]!==g?(x=()=>{if(l.phase!==`awaiting-cc1-recycle`||!m)return;let e=m.share.branch;if(!e){a.dismiss();return}if(f.current)return;f.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:m.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(td({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:m.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:m.share.target.kind,path:sn(m.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),Ls.error(o({id:`gQV-9w`,values:{targetNoun:g}}))}),a.dismiss();return}console.log(td({branch_dialog_action:`branch-switch-timeout`,branch:e})),Ls.error(o({id:`LBwUR6`,values:{targetNoun:g}})),a.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),Ls.error(o({id:`Jw6EC4`,values:{targetNoun:g}})),a.dismiss())}),()=>{t=!0}},t[13]=o,t[14]=m,t[15]=l.phase,t[16]=n,t[17]=a,t[18]=g,t[19]=x):x=t[19];let S;if(t[20]!==m||t[21]!==l.phase?(S=[l.phase,m],t[20]=m,t[21]=l.phase,t[22]=S):S=t[22],(0,Q.useEffect)(x,S),!m)return null;let{share:C,projectPath:w,currentBranch:T}=m,E=C.branch,D;t[23]!==o||t[24]!==l.info||t[25]!==l.phase||t[26]!==n.project||t[27]!==w||t[28]!==C.target||t[29]!==E||t[30]!==a?(D=function(){l.phase===`ready`&&JY(l.info).switchEnabled&&(console.log(td({branch_dialog_action:`switch`,branch_action:`switch`,branch:E})),u(e=>$Y(e,sn(C.target))),n.project.runCheckout({projectPath:w,branch:E}).then(e=>{let t=null,n=!1;u(r=>{let{state:i,sideEffect:a}=eX(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?Ls.error(o({id:`NJyQi_`,values:{shareBranch:E}})):t===`fetch-failed`?Ls.error(o({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&Ls.error(o({id:`c863eW`,values:{shareBranch:E}})),n&&a.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),u(oX),Ls.error(o({id:`c863eW`,values:{shareBranch:E}}))}))},t[23]=o,t[24]=l.info,t[25]=l.phase,t[26]=n.project,t[27]=w,t[28]=C.target,t[29]=E,t[30]=a,t[31]=D):D=t[31];let O=D,k;t[32]!==o||t[33]!==n.project||t[34]!==w||t[35]!==C.target||t[36]!==E||t[37]!==a||t[38]!==g?(k=function(){console.log(td({branch_dialog_action:`open-current`,branch:E})),n.project.open({path:w,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:sn(C.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),Ls.error(o({id:`b5aNbi`,values:{targetNoun:g}}))}),a.dismiss()},t[32]=o,t[33]=n.project,t[34]=w,t[35]=C.target,t[36]=E,t[37]=a,t[38]=g,t[39]=k):k=t[39];let A=k,j;t[40]!==o||t[41]!==l.otherWorktreePath||t[42]!==l.phase||t[43]!==n.project||t[44]!==C.target||t[45]!==E||t[46]!==a?(j=function(){if(l.phase!==`branch-in-other-worktree`)return;let e=l.otherWorktreePath;console.log(td({branch_dialog_action:`pivot-to-other-worktree`,branch:E})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:sn(C.target)},pendingBranch:E}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),Ls.error(o({id:`LdABLa`,values:{target:e}}))}),a.dismiss()},t[40]=o,t[41]=l.otherWorktreePath,t[42]=l.phase,t[43]=n.project,t[44]=C.target,t[45]=E,t[46]=a,t[47]=j):j=t[47];let M=j,N;t[48]===a?N=t[49]:(N=function(){console.log(td({branch_dialog_action:`cancel`})),a.dismiss()},t[48]=a,t[49]=N);let P=N,F,I,L,R,z,B,V,H,U,W,G,K,q,J,ee,Y,te;if(t[50]!==o||t[51]!==l.info||t[52]!==l.otherWorktreePath||t[53]!==l.phase||t[54]!==P||t[55]!==T||t[56]!==C.branch||t[57]!==C.owner||t[58]!==C.repo||t[59]!==C.target||t[60]!==E||t[61]!==g){te=l.phase===`ready`||l.phase===`switching`?JY(l.info):null;let e;t[79]!==l.info||t[80]!==l.phase||t[81]!==T?(e=l.phase===`ready`||l.phase===`switching`?YY(l.info):T??`HEAD`,t[79]=l.info,t[80]=l.phase,t[81]=T,t[82]=e):e=t[82];let n=e;B=l.phase===`switching`||l.phase===`awaiting-cc1-recycle`;let r;t[83]===o?r=t[84]:(r=o({id:`OuY8t9`}),t[83]=o,t[84]=r),R=r;let i;t[85]!==o||t[86]!==E?(i=o({id:`_BthEY`,values:{shareBranch:E}}),t[85]=o,t[86]=E,t[87]=i):i=t[87],z=i;let a=l.phase===`loading`,c=l.phase===`error`;L=Xo,ee=!0,t[88]===P?Y=t[89]:(Y=e=>{e||P()},t[88]=P,t[89]=Y),I=Ko,W=`sm:max-w-xl`,G=`share-branch-switch-dialog`,K=aX,q=iX;let u;t[90]===g?u=t[91]:(u=(0,Z.jsx)(Go,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:g}})}),t[90]=g,t[91]=u);let d=C.owner,f=C.repo,p;t[92]===C.target?p=t[93]:(p=sn(C.target),t[92]=C.target,t[93]=p);let m;t[94]!==C.owner||t[95]!==C.repo||t[96]!==p?(m=(0,Z.jsx)(Wo,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`f8jU-L`,values:{0:d,1:f,2:p}})}),t[94]=C.owner,t[95]=C.repo,t[96]=p,t[97]=m):m=t[97],t[98]!==u||t[99]!==m?(J=(0,Z.jsxs)(Yo,{children:[u,m]}),t[98]=u,t[99]=m,t[100]=J):J=t[100],F=qo;let h=C.owner,_=C.repo,v;t[101]===C.target?v=t[102]:(v=sn(C.target),t[101]=C.target,t[102]=v),t[103]!==C.branch||t[104]!==C.owner||t[105]!==C.repo||t[106]!==C.target.kind||t[107]!==v?(V=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(cp,{owner:h,repo:_,path:v,kind:C.target.kind,branch:C.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=C.branch,t[104]=C.owner,t[105]=C.repo,t[106]=C.target.kind,t[107]=v,t[108]=V):V=t[108],H=l.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(s,{id:`yjExfe`,values:{shareBranch:E},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:l.otherWorktreePath})]}):a?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Te,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`w4hMYl`})}):te?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XnoA1k`,values:{targetNoun:g,shareBranch:E},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):te?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`sZ2IOu`,values:{targetNoun:g,shareBranch:E,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_902BE`,values:{targetNoun:g,shareBranch:E,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),U=te&&!te.switchEnabled&&te.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(s,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:te.conflictingFiles.map(rX)})]}):null,t[50]=o,t[51]=l.info,t[52]=l.otherWorktreePath,t[53]=l.phase,t[54]=P,t[55]=T,t[56]=C.branch,t[57]=C.owner,t[58]=C.repo,t[59]=C.target,t[60]=E,t[61]=g,t[62]=F,t[63]=I,t[64]=L,t[65]=R,t[66]=z,t[67]=B,t[68]=V,t[69]=H,t[70]=U,t[71]=W,t[72]=G,t[73]=K,t[74]=q,t[75]=J,t[76]=ee,t[77]=Y,t[78]=te}else F=t[62],I=t[63],L=t[64],R=t[65],z=t[66],B=t[67],V=t[68],H=t[69],U=t[70],W=t[71],G=t[72],K=t[73],q=t[74],J=t[75],ee=t[76],Y=t[77],te=t[78];let X;t[109]===B?X=t[110]:(X=B?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Te,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CU3AiE`})]}):null,t[109]=B,t[110]=X);let ne;t[111]!==F||t[112]!==V||t[113]!==H||t[114]!==U||t[115]!==X?(ne=(0,Z.jsxs)(F,{children:[V,H,U,X]}),t[111]=F,t[112]=V,t[113]=H,t[114]=U,t[115]=X,t[116]=ne):ne=t[116];let re;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(s,{id:`dEgA5A`}),t[117]=re):re=t[117];let ie;t[118]===P?ie=t[119]:(ie=(0,Z.jsx)(Ai,{variant:`ghost`,className:`font-mono uppercase`,onClick:P,"data-testid":`share-branch-switch-cancel`,children:re}),t[118]=P,t[119]=ie);let ae;t[120]!==l.phase||t[121]!==A||t[122]!==M||t[123]!==O||t[124]!==R||t[125]!==z||t[126]!==B||t[127]!==te?(ae=l.phase===`branch-in-other-worktree`?(0,Z.jsx)(Ai,{onClick:M,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(s,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[te?.openCurrentEnabled?(0,Z.jsxs)(Ai,{variant:`outline`,className:`font-mono uppercase`,onClick:A,disabled:B,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(fu,{className:`size-3.5`,"aria-hidden":!0}),R]}):null,(0,Z.jsx)(Ai,{onClick:O,disabled:!te?.switchEnabled||B,"aria-disabled":!te?.switchEnabled||B,"aria-describedby":te&&!te.switchEnabled&&te.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:B?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),z]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(He,{className:`size-3.5`,"aria-hidden":!0}),z]})})]}),t[120]=l.phase,t[121]=A,t[122]=M,t[123]=O,t[124]=R,t[125]=z,t[126]=B,t[127]=te,t[128]=ae):ae=t[128];let oe;t[129]!==ie||t[130]!==ae?(oe=(0,Z.jsxs)(Jo,{className:`sm:justify-between`,children:[ie,ae]}),t[129]=ie,t[130]=ae,t[131]=oe):oe=t[131];let se;t[132]!==I||t[133]!==W||t[134]!==G||t[135]!==K||t[136]!==q||t[137]!==J||t[138]!==ne||t[139]!==oe?(se=(0,Z.jsxs)(I,{className:W,"data-testid":G,onInteractOutside:K,onPointerDownOutside:q,children:[J,ne,oe]}),t[132]=I,t[133]=W,t[134]=G,t[135]=K,t[136]=q,t[137]=J,t[138]=ne,t[139]=oe,t[140]=se):se=t[140];let ce;return t[141]!==L||t[142]!==ee||t[143]!==Y||t[144]!==se?(ce=(0,Z.jsx)(L,{open:ee,onOpenChange:Y,children:se}),t[141]=L,t[142]=ee,t[143]=Y,t[144]=se,t[145]=ce):ce=t[145],ce}function rX(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function iX(e){e.preventDefault()}function aX(e){e.preventDefault()}function oX(e){return eX(e,null).state}function sX(e){return QY(e,null)}function cX(){return null}function lX(){let e=(0,$.c)(17),t=Pn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=yt(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Ze,i=new kt({url:n,name:ii,document:e,onStateless:e=>{let{payload:t}=e;xe(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:hX,onConfigValidationRejected:mX,onConfigIgnoreNestedError:pX,onUnknown:fX})},onClose:dX,onDisconnect:uX}),a=xs(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`,()=>{ks([`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 uX(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function dX(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function fX(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function pX(e){xo(e)}function mX(e){Eo(e)}function hX(e){ks([e.ch])}var gX=`#install-claude-desktop`;function _X(e){return e===`#settings`||e===gX}function vX(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function yX(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=yt(),{openTargetTransition:i}=Mt(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=Ts(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=vX(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(_X(window.location.hash))return;let e=is(window.location.hash);if(e){let t=nr(e.split(`.`).pop()??``);lt(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}if(fs(window.location.hash)){lt(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let n=Es(window.location.hash);if(!n){lt(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){lt(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=Cs(n,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(r.kind===`missing`&&/\/+$/.test(n.trim())){lt(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=Os(js(r),c);lt(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function bX(){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)(xX,t),null}function xX(){let e=wX;if(!e(window.location.hash))return;let t=new AbortController;return N(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(CX))}).catch(SX),()=>t.abort()}function SX(){}function CX(){}function wX(e){return!_X(e)&&!is(e)&&!Es(e)&&(e===``||e===`#`||e===`#/`)}function TX(){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)(EX,t),null}function EX(){let e=function(e){let t=e.target;n_({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=t_))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function DX(){let e=(0,$.c)(4),{activeTarget:t}=yt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function OX(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=yt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Fs(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;hg({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)(_g,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function kX(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=yt(),i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(M,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function AX(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(f,{name:`app`,children:(0,Z.jsx)(Bt,{children:(0,Z.jsx)(kX,{children:(0,Z.jsx)(Zg,{children:(0,Z.jsx)(jX,{})})})})}),e[0]=t):t=e[0],t}function jX(){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=e_(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:MX}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Dv,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(lX,{}),u=(0,Z.jsx)(yX,{}),d=(0,Z.jsx)(bX,{}),f=(0,Z.jsx)(DX,{}),p=(0,Z.jsx)(OX,{}),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)(TX,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(Ov,{bridge:t}):null,h=(0,Z.jsx)(ip,{}),g=t?(0,Z.jsx)(nX,{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)(yv,{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)(UY,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(bM,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(iI,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(LS,{value:s,children:(0,Z.jsxs)(mM,{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)(As,{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 MX(e,t){nI(W_(e,t),t)}ml(),Rp({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Zp(),Cm()&&km(),bh(),Rm(),typeof window<`u`&&$p({bridge:window.okDesktop}),typeof window<`u`&&um({bridge:window.okDesktop}),typeof window<`u`&&bc({bridge:window.okDesktop}),typeof window<`u`&&hc({bridge:window.okDesktop}),typeof window<`u`&&nm({bridge:window.okDesktop}),typeof window<`u`&&_p({bridge:window.okDesktop}),Hm();var NX=new Cl({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),PX=document.getElementById(`root`);if(!PX)throw Error(`Root element not found`);var FX=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Fl.createRoot)(PX).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:Is,children:(0,Z.jsx)(En,{client:NX,children:(0,Z.jsxs)(xi,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(rc,{children:FX&&window.okDesktop?(0,Z.jsx)(jp,{bridge:window.okDesktop}):(0,Z.jsx)(AX,{})}),(0,Z.jsx)(Ip,{richColors:!0,closeButton:!0})]})})})}));
|
|
2004
|
+
`}\n${FK}\n${IK}`;function PJ(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&_J.has(t)}function FJ(e){return e===`darwin`?Is._({id:`LtSYdi`}):e===`win32`?Is._({id:`qi1F96`}):Is._({id:`e1Rn_k`})}function IJ(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:a}=e,{_:o}=i(),s=typeof window<`u`?window.okDesktop:void 0;if(!s)return null;let c=s.platform,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=FJ(c),t[0]=l):l=t[0];let u=l,d,f;t[1]!==o||t[2]!==r?(d=r?null:o({id:`wTcjov`}),f=o(c===`darwin`?d?{id:`FvpFSZ`,values:{hint:d}}:{id:`LtSYdi`}:c===`win32`?d?{id:`o4dcAf`,values:{hint:d}}:{id:`qi1F96`}:d?{id:`zUhPuR`,values:{hint:d}}:{id:`e1Rn_k`}),t[1]=o,t[2]=r,t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=f,m=!r,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=()=>{if(!r)return;a();let e=A_(r.contentDir,kP(n),r.pathSeparator);s.shell.showItemInFolder(e)},t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(ht,{"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{className:`flex-1`,children:u}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===d?v=t[12]:(v=d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null,t[11]=d,t[12]=v);let y;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(go,{disabled:m,onSelect:h,"aria-label":p,children:[g,_,v]}),t[13]=p,t[14]=m,t[15]=h,t[16]=v,t[17]=y):y=t[17],y}function LJ(e,t){return OP({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function RJ(e,t){return e!==t&&e.startsWith(t)}function zJ(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>RJ(e,t))).map(e=>LJ(e,t))}function BJ(e,t){return e===t||e.startsWith(`${t}/`)}function VJ(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 HJ(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)Ps(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):os(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=_P(e);BJ(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function UJ(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:BJ(t.createdPath,e.path)}function WJ(e){let t=(0,$.c)(55),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:u,projectLocalBinding:d,mergedConfig:f,onStartCreating:p,onCreateFromTemplate:m,onDuplicate:h,onDelete:g,onExpandSubtree:_,onCollapseSubtree:v,folderTreePaths:y,isAsset:b,documents:x}=e,{_:S}=i(),C=OP(n,x),w=n.kind===`directory`,T=C.kind===`asset`?null:C,E=T!==null&&u!==null,D;t[0]!==S||t[1]!==w?(D=S(w?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=S,t[1]=w,t[2]=D):D=t[2];let O=D,k=f?.appearance?.sidebar?.showHiddenFiles??!1,A=d!==null,j;t[3]!==w||t[4]!==n.path?(j=w?_P(n.path):null,t[3]=w,t[4]=n.path,t[5]=j):j=t[5];let M=ao(j),N=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,P=l.getSelectedPaths(),F=P.includes(C.treePath)?zJ(P,x):[],I=F.length>1?F:[C],R=I.length,z=Is._({id:`djjdjr`,values:{deleteCount:R}}),B;t[6]!==b||t[7]!==w||t[8]!==n||t[9]!==o?(B=b?null:w?I_({folderRelativePath:kP(n),workspace:o}):M_({docName:mP(n.path),workspace:o}),t[6]=b,t[7]=w,t[8]=n,t[9]=o,t[10]=B):B=t[10];let V=B,H;t[11]===r?H=t[12]:(H=()=>r.close({restoreFocus:!1}),t[11]=r,t[12]=H);let U=H,W;t[13]===r?W=t[14]:(W=()=>r.close(),t[13]=r,t[14]=W);let G=W,K;t[15]!==S||t[16]!==d?(K=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,ni(t.error)),Ls.error(S({id:`P47EWZ`}),{description:ni(t.error)}))},t[15]=S,t[16]=d,t[17]=K):K=t[17];let q=K,J=0,ee=0;if(w){let e=vP(n.path);for(let t of y)(t===e||t.startsWith(e))&&(J++,Oq(l.getItem(t))?.isExpanded()&&ee++)}let Y=w&&ee<J,te=w&&ee>0,X;t[18]===G?X=t[19]:(X=e=>{e||G()},t[18]=G,t[19]=X);let ne;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(eo,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[20]=ne):ne=t[20];let re;t[21]!==S||t[22]!==a||t[23]!==E||t[24]!==A||t[25]!==G||t[26]!==U||t[27]!==z||t[28]!==I||t[29]!==N||t[30]!==q||t[31]!==c||t[32]!==V||t[33]!==O||t[34]!==b||t[35]!==w||t[36]!==n||t[37]!==l||t[38]!==u||t[39]!==T||t[40]!==v||t[41]!==m||t[42]!==g||t[43]!==h||t[44]!==_||t[45]!==p||t[46]!==k||t[47]!==te||t[48]!==Y||t[49]!==C||t[50]!==o?(re=(0,Z.jsx)(ro,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{U(),p(`file`,_P(n.path))},children:[(0,Z.jsx)(Mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`HdkSiO`})]}),N?(0,Z.jsxs)(lo,{children:[(0,Z.jsxs)(Za,{disabled:a,children:[(0,Z.jsx)(ho,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(Ao,{children:(0,Z.jsx)(Dq,{parentDir:_P(n.path),onSelectTemplate:e=>{U(),m(_P(n.path),e)},ItemComponent:go})})]}):null,(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{U(),p(`folder`,_P(n.path))},children:[(0,Z.jsx)($l,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`96G6Re`})]}),(0,Z.jsx)(Xa,{}),(0,Z.jsx)(IJ,{item:n,workspace:o,onClose:G}),(0,Z.jsx)(Xq,{input:V,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(lo,{children:[(0,Z.jsxs)(Za,{children:[(0,Z.jsx)(Ne,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ao,{children:[(0,Z.jsx)(go,{disabled:!o,onSelect:()=>{o&&(G(),gJ(A_(o.contentDir,kP(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(go,{onSelect:()=>{G(),gJ(kP(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(Xa,{}),(0,Z.jsx)(Co,{checked:k,onCheckedChange:q,disabled:!A,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`XcGbim`})}),Y||te?(0,Z.jsx)(Xa,{}):null,Y?(0,Z.jsxs)(go,{onSelect:()=>{G(),_(n.path)},children:[(0,Z.jsx)(Gu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,te?(0,Z.jsxs)(go,{onSelect:()=>{G(),v(n.path)},children:[(0,Z.jsx)(Zl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,(0,Z.jsx)(Xa,{}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{C.kind!==`asset`&&(G(),h(C))},children:[(0,Z.jsx)(Yt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{U(),l.startRenaming(n.path)},children:[(0,Z.jsx)(L,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)(go,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u||!T)return;G();let e=$K(T),t=ko(u.current()),n=mo(t,e);if(n===t)return;u.patch(_o(n));let r=T.path.split(`/`).pop()||T.path;Ls.success(S({id:`4xtLTl`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(rt,{"aria-hidden":`true`}),O]}),(0,Z.jsxs)(go,{variant:`destructive`,disabled:a,onSelect:()=>{G(),g(I)},children:[(0,Z.jsx)(_e,{"aria-hidden":`true`}),z]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(IJ,{item:n,workspace:o,onClose:G}),!b&&(0,Z.jsx)(Xq,{input:V,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(lo,{children:[(0,Z.jsxs)(Za,{children:[(0,Z.jsx)(Ne,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ao,{children:[(0,Z.jsx)(go,{disabled:!o,onSelect:()=>{o&&(G(),gJ(A_(o.contentDir,kP(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(go,{onSelect:()=>{G(),gJ(kP(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(Xa,{}),b?null:(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{G(),h(C)},children:[(0,Z.jsx)(Yt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{U(),l.startRenaming(n.path)},children:[(0,Z.jsx)(L,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),T?(0,Z.jsxs)(go,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u)return;G();let e=$K(T),t=ko(u.current()),n=mo(t,e);if(n===t)return;u.patch(_o(n));let r=T.path.split(`/`).pop()||T.path;Ls.success(S({id:`OD0FCX`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(rt,{"aria-hidden":`true`}),O]}):null,(0,Z.jsxs)(go,{variant:`destructive`,disabled:a,onSelect:()=>{G(),g(I)},children:[(0,Z.jsx)(_e,{"aria-hidden":`true`}),z]})]})}),t[21]=S,t[22]=a,t[23]=E,t[24]=A,t[25]=G,t[26]=U,t[27]=z,t[28]=I,t[29]=N,t[30]=q,t[31]=c,t[32]=V,t[33]=O,t[34]=b,t[35]=w,t[36]=n,t[37]=l,t[38]=u,t[39]=T,t[40]=v,t[41]=m,t[42]=g,t[43]=h,t[44]=_,t[45]=p,t[46]=k,t[47]=te,t[48]=Y,t[49]=C,t[50]=o,t[51]=re):re=t[51];let ie;return t[52]!==X||t[53]!==re?(ie=(0,Z.jsxs)(po,{open:!0,modal:!1,onOpenChange:X,children:[ne,re]}),t[52]=X,t[53]=re,t[54]=ie):ie=t[54],ie}async function GJ(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:Vq});if(Hq(i)){let e=await Gq(i);return{kind:`entries`,entries:ss(e.entries),truncated:e.truncated}}let a=await j(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=Wr.safeParse(a.body);return o.success?{kind:`entries`,entries:ss(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof Uq?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function KJ(e){let t=(0,$.c)(352),{ref:n}=e,{_:r,i18n:a}=i(),{activeDocName:o,activeTarget:c,closeTabs:l,closeDocument:u,closeAndClearForRename:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,openTarget:h,prewarm:g,remapTabsForRename:_}=yt(),{notifySidebarFileSelected:v}=pM(),{resolvedTheme:y}=Ar(),{addPage:b,pageMeta:x}=Ts(),S;t[0]===x?S=t[1]:(S=function(e,t){return Ms(e,t??x.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=x,t[1]=S);let C=S,w;t[2]!==C||t[3]!==v||t[4]!==h?(w=function(e,t){h(C(e,t),{tabBehavior:`replace-active`}),_s(ls(e)),v()},t[2]=C,t[3]=v,t[4]=h,t[5]=w):w=t[5];let T=w,E;t[6]!==v||t[7]!==h?(E=function(e){let t=ds(e);h({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),_s(t),v()},t[6]=v,t[7]=h,t[8]=E):E=t[8];let D=E,O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[9]=O):O=t[9];let[k,A]=(0,Q.useState)(O),[M,N]=(0,Q.useState)(!0),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=zm(),z=(0,Q.useRef)(null),[V,H]=(0,Q.useState)(null),[U,W]=(0,Q.useState)(null),[G,K]=(0,Q.useState)(null),[q,J]=(0,Q.useState)(null),{conflicts:ee}=ea(),[Y,te]=(0,Q.useState)(null),[X,ne]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(!1),ae=(0,Q.useRef)(re),oe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(oe=new Set,t[10]=oe):oe=t[10];let se=(0,Q.useRef)(oe),ce=(0,Q.useRef)(k),le=(0,Q.useRef)(x),ue;t[11]!==k||t[12]!==D||t[13]!==T||t[14]!==v||t[15]!==h?(ue=function(e,t){let n=t===void 0?k:t,r=mq(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,yP(e));return}if(r.kind===`asset`){h({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),_s(r.hash),v();return}if(r.kind===`folder`){D(r.path);return}let i=n.find(e=>Ps(e)&&e.docName===r.path);T(r.path,i?.size)},t[11]=k,t[12]=D,t[13]=T,t[14]=v,t[15]=h,t[16]=ue):ue=t[16];let de=ue,pe;t[17]!==v||t[18]!==h?(pe=function(e,t){h({kind:`asset`,target:e,assetPath:e,mediaKind:(t??ce.current).find(t=>os(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),_s(gs(e)),v()},t[17]=v,t[18]=h,t[19]=pe):pe=t[19];let me=pe,he=(0,Q.useRef)(o),_e;t[20]===k?_e=t[21]:(_e=new Set(k.filter(os).map(yY)),t[20]=k,t[21]=_e);let ve=_e,ye=(0,Q.useRef)(ve),be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=[],t[22]=be):be=t[22];let xe=(0,Q.useRef)(be),Se=(0,Q.useRef)(null),Ce=(0,Q.useRef)(vY),we=(0,Q.useRef)(null),Te=(0,Q.useRef)(null),Ee=(0,Q.useRef)(!1),De=(0,Q.useRef)(!1),Oe=(0,Q.useRef)(null),ke;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ke={row:null,root:null},t[23]=ke):ke=t[23];let Ae=(0,Q.useRef)(ke),je=(0,Q.useRef)(_Y),Me=(0,Q.useRef)(null),Ne;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=new Map,t[24]=Ne):Ne=t[24];let Fe=(0,Q.useRef)(Ne),Ie;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=new Set,t[25]=Ie):Ie=t[25];let Le=(0,Q.useRef)(Ie),Re;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Re=new Map,t[26]=Re):Re=t[26];let ze=(0,Q.useRef)(Re),Be=(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)(gY),We=(0,Q.useRef)(hY),Ge=(0,Q.useRef)(!1),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(null),Je=(0,Q.useRef)(mY),Ye=(0,Q.useRef)(pY),Xe=(0,Q.useRef)(fY),Ze=(0,Q.useRef)(dY),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 it=rt,at;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(at=function(e){it(),F(e)},t[30]=at):at=t[30];let ot=at,st;t[31]===r?st=t[32]:(st=function(){if(nt(),Fm()){F(null),L(!0),z.current=setTimeout(()=>{z.current=null,Ke.current?.()},AJ);return}L(!1),F(r({id:`34qyH5`}))},t[31]=r,t[32]=st);let ct=st,lt=(0,Q.useRef)(!0),ut;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ut=()=>{if(lt.current){lt.current=!1;return}Ke.current?.()},t[33]=ut):ut=t[33];let dt;t[34]===R?dt=t[35]:(dt=[R],t[34]=R,t[35]=dt),(0,Q.useEffect)(ut,dt);let ft,pt;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ft=()=>nt,pt=[],t[36]=ft,t[37]=pt):(ft=t[36],pt=t[37]),(0,Q.useEffect)(ft,pt);let mt,ht;t[38]!==k.length||t[39]!==M?(mt=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(TL)?.shadowRoot;if(!e)return;let t=e,n=function(){Oe.current!==null&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{De.current=!1,Oe.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=xY(e),n=t?.dataset.itemPath;if(!n)return;let r=yq(t.dataset.itemType===`folder`?vP(n):n,ce.current,le.current);r&&(Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!0,e.dataTransfer?.setData(HO,WO(r)))},i=function(e){if(!(e instanceof DragEvent)||!LP(e))return;let t=CY(e);if(!t){mJ(Ae);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),hJ(Ae,t)},a=function(e){if(!(e instanceof DragEvent)||!LP(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||mJ(Ae)},o=function(e){if(!(e instanceof DragEvent)||!LP(e))return;let t=CY(e),n=RP(e);if(!t||n.length===0){mJ(Ae);return}e.preventDefault(),e.stopPropagation(),mJ(Ae),je.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),mJ(Ae),Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!1}},ht=[k.length,M],t[38]=k.length,t[39]=M,t[40]=mt,t[41]=ht):(mt=t[40],ht=t[41]),(0,Q.useEffect)(mt,ht);let{selectedFilePath:gt,selectedFolderPath:_t,navigationPath:vt}=pq(c,m?null:o),bt=gt?pP(gt,k.find(e=>Ps(e)&&e.docName===gt)?.docExt):_t?vP(_t):c?.kind===`asset`?c.assetPath:null,xt=re?null:bt,St=ov().states,{dispatch:Ct}=Y_(),wt;t[42]!==Ct||t[43]!==St?(wt={installStates:St,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Ct},t[42]=Ct,t[43]=St,t[44]=wt):wt=t[44];let Tt=wt,{okignoreBinding:Et,projectLocalBinding:Dt,merged:Ot}=ge(),kt=Ot?.appearance?.sidebar?.showHiddenFiles??!1,At;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>Me.current===null,t[45]=At):At=t[45];let jt=At,Mt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=[],t[46]=Mt):Mt=t[46];let Nt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Nt={set:`complete`,spriteSheet:TJ,byFileExtension:{md:{name:bJ,viewBox:xJ},mdx:{name:bJ,viewBox:xJ}}},t[47]=Nt):Nt=t[47];let Pt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Pt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[48]=Pt):Pt=t[48];let Ft;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ft={canDrag:jt,canDrop:jt,onDropComplete:e=>Ze.current(e),onDropError:uY},t[49]=Ft):Ft=t[49];let It,Lt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(It={canRename:jt,onRename:e=>Ye.current(e),onError:e=>Xe.current(e)},Lt=e=>Je.current(e),t[50]=It,t[51]=Lt):(It=t[50],Lt=t[51]);let Rt;t[52]===r?Rt=t[53]:(Rt={paths:Mt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...NK,icons:Nt,unsafeCSS:NJ,composition:Pt,dragAndDrop:Ft,renaming:It,onSelectionChange:Lt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=ce.current.find(e=>Ps(e)&&pP(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:vJ,title:r(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return PJ(t.path)?{icon:yJ,title:r({id:`i9toLO`})}:null}let n=ce.current.find(e=>ys(e)&&vP(e.path)===vP(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:vJ,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[52]=r,t[53]=Rt);let{model:zt}=MK(Rt),Bt;t[54]===zt?Bt=t[55]:(Bt=function(e){let t=zt.getItem(e)??zt.getItem(vP(e));return t?.isDirectory()?vP(_P(t.getPath())):e},t[54]=zt,t[55]=Bt);let Vt=Bt,Ht,Ut;t[56]===k?(Ht=t[57],Ut=t[58]):(Ut=bP(k),Ht=xP(Ut),t[56]=k,t[57]=Ht,t[58]=Ut);let Wt=Ht,Gt=(0,Q.useRef)(Ut),Kt;t[59]===k?Kt=t[60]:(Kt=CP(k),t[59]=k,t[60]=Kt);let qt=Kt,Jt=(0,Q.useRef)(qt),Yt=_t?wP(vP(_t)).slice(0,-1):wP(xt??vt),Xt=Yt.join(`\0`),Zt;t[61]===zt?Zt=t[62]:(Zt=()=>{let e=new Set;for(let t of Jt.current)Oq(zt.getItem(t))?.isExpanded()&&e.add(t);return e},t[61]=zt,t[62]=Zt);let Qt=Zt,$t;t[63]===Qt?$t=t[64]:($t=e=>{let t=new Set(CP(e??ce.current)),n=Qt();for(let e of xe.current)n.add(e);return[...n].filter(e=>t.has(e))},t[63]=Qt,t[64]=$t);let en=$t,tn;t[65]!==en||t[66]!==zt?(tn=e=>{let t=bP(e??ce.current);zt.resetPaths(t,{initialExpandedPaths:en(e)})},t[65]=en,t[66]=zt,t[67]=tn):tn=t[67];let nn=tn,rn;t[68]!==r||t[69]!==ct?(rn=async function(e){let t=Be.current,n=new AbortController;ze.current.set(e,n);let i=await GJ(_P(e),n.signal,r({id:`8RtNI0`}),r({id:`HlmZBk`}));if(ze.current.get(e)===n&&ze.current.delete(e),n.signal.aborted||t!==Be.current)return;if(i.kind===`network-error`){ct(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,i.cause);return}if(i.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,i.title),ot(i.title);return}let a=Ge.current,o=vs(i.entries,a);Le.current.add(e),A(t=>qq(t,e,o,Fe.current)),F(null),it(),i.truncated&&H(i.entries.length)},t[68]=r,t[69]=ct,t[70]=rn):rn=t[70];let on=rn,sn;t[71]!==Qt||t[72]!==on?(sn=()=>{let e=Qt(),t=He.current;He.current=e;for(let n of e){if(t.has(n)||Le.current.has(n)||ze.current.has(n))continue;let e=_P(n);ce.current.find(t=>ys(t)&&t.path===e)?.hasChildren!==!1&&on(n)}},t[71]=Qt,t[72]=on,t[73]=sn):sn=t[73];let cn=sn,ln;t[74]!==Qt||t[75]!==on?(ln=()=>{for(let e of Qt())Le.current.has(e)||ze.current.has(e)||on(e)},t[74]=Qt,t[75]=on,t[76]=ln):ln=t[76];let un=ln,dn;t[77]!==zt||t[78]!==nn?(dn=(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=>Ps(e)&&e.docName===r);if(n==null||zt.getItem(i)==null)continue;let s=pP(i,t.find(e=>Ps(e)&&e.docName===i)?.docExt??n.docExt);zt.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=sP(e);if(t===``)continue;let n=e.slice(0,-t.length);zt.getItem(n)!=null&&(zt.getItem(e)??zt.move(n,e),o=e,a+=1)}a!==0&&(nn(t),o!=null&&zt.focusPath(o))},t[77]=zt,t[78]=nn,t[79]=dn):dn=t[79];let fn=dn,pn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(pn=e=>{we.current=SP(e)},t[80]=pn):pn=t[80];let mn=pn,hn;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(hn=e=>ye.current.has(e),t[81]=hn):hn=t[81];let gn=hn,_n;t[82]!==r||t[83]!==b||t[84]!==D||t[85]!==T||t[86]!==nn?(_n=async function(e){if(e.kind===`asset`||Me.current!==null)return;let t=()=>{W(null),Me.current=null};Me.current=e.path,W(e.path),F(null);try{let n=await j(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){Ls.error(n.title),nn(),t();return}let i=B(or,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});Ls.error(e),F(e),ks([`files`,`backlinks`,`graph`]),nn(),t();return}for(let e of i.duplicatedDocNames)b(e);A(t=>{let n=JP(t,e,i);return nn(n),mn(n),n}),ks([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?D(i.path):T(i.path)),Ls.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),Ls.error(r({id:`EBVbtP`}),{description:i}),nn(),t()}},t[82]=r,t[83]=b,t[84]=D,t[85]=T,t[86]=nn,t[87]=_n):_n=t[87];let vn=_n,yn=(0,Q.useRef)(vn),bn;t[88]===vn?bn=t[89]:(bn=()=>{yn.current=vn},t[88]=vn,t[89]=bn),(0,Q.useEffect)(bn);let xn=function(e){let t=dJ(e);if(!t||fJ(t))return!1;let n=zt.getFocusedPath()??zt.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||gn(n))return!1;let r=fJ(n);if(!r)return!1;let i=vP(t);if(!Jt.current.includes(i))return!1;let a=`${t}${r}`;return Gt.current.includes(a)?!1:($n({sourcePath:n,destinationPath:a,isFolder:!1}),zt.move(n,a),!0)},Sn;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Sn=e=>{let t=e??Se.current;!t||Se.current!==t||(t.disposeCommitListener(),Se.current=null)},t[90]=Sn):Sn=t[90];let Cn=Sn,wn;t[91]!==r||t[92]!==Cn||t[93]!==u||t[94]!==l||t[95]!==nn?(wn=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;Cn(e),i&&W(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 j(t,r({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=r({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});i?Ls.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(W(null),nn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;Ls.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(W(null),nn());return}i&&(e.kind===`file`?u(e.createdPath):l([Pe(e.createdPath)],{force:!0})),i&&A(t=>{let n=KP(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return mn(n),n}),ks([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&W(null)},t[91]=r,t[92]=Cn,t[93]=u,t[94]=l,t[95]=nn,t[96]=wn):wn=t[96];let Tn=wn,En,Dn;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(En=()=>()=>{let e=Se.current;e&&Ce.current(e,{restoreLocation:!1,updateUi:!1}).catch(lY)},Dn=[],t[97]=En,t[98]=Dn):(En=t[97],Dn=t[98]),(0,Q.useEffect)(En,Dn);let On;t[99]!==r||t[100]!==ct?(On=()=>{let e=!0,t=null,n=Bq(async function(){t?.abort();let n=new AbortController;t=n,Be.current+=1;for(let e of ze.current.values())e.abort();ze.current.clear(),Le.current.clear();try{let t=await fetch(`/api/documents?showAll=true&dir=&depth=1`,{signal:n.signal,headers:Vq});if(Hq(t)){let{entries:n,truncated:r}=await Gq(t);if(!e)return;let i=Ge.current,a=vs(ss(n),i);A(e=>qq(e,``,a,Fe.current)),F(null),it(),H(r?n.length:null),We.current()}else{let n=await j(t,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)ot(n.title),H(null);else{let e=Wr.safeParse(n.body);if(!e.success)ot(r({id:`HlmZBk`})),H(null);else{let t=Ge.current,n=vs(ss(e.data.documents),t);A(e=>qq(e,``,n,Fe.current)),F(null),it(),H(e.data.truncated===!0?e.data.documents.length:null),We.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof Uq?ot(r.message):ct()),console.warn(`[FileTree] fetch failed:`,r)}e&&N(!1)},()=>t?.abort());Ke.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=xs(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Ke.current=null,n.dispose();for(let e of ze.current.values())e.abort();ze.current.clear(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},t[99]=r,t[100]=ct,t[101]=On):On=t[101];let kn;t[102]===r?kn=t[103]:(kn=[r],t[102]=r,t[103]=kn),(0,Q.useEffect)(On,kn);let An=(0,Q.useRef)(!0),jn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(jn=()=>{if(An.current){An.current=!1;return}Ke.current?.()},t[104]=jn):jn=t[104];let Mn;t[105]===kt?Mn=t[106]:(Mn=[kt],t[105]=kt,t[106]=Mn),(0,Q.useEffect)(jn,Mn);let Nn,Pn;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Nn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=B(Kr,n,`workspace`,null);r&&ne({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(cY),()=>{e=!1}},Pn=[],t[107]=Nn,t[108]=Pn):(Nn=t[107],Pn=t[108]),(0,Q.useEffect)(Nn,Pn);let Fn;t[109]!==en||t[110]!==zt||t[111]!==Wt?(Fn=()=>{if(we.current===Wt){we.current=null;return}zt.resetPaths(Gt.current,{initialExpandedPaths:en()})},t[109]=en,t[110]=zt,t[111]=Wt,t[112]=Fn):Fn=t[112];let In;t[113]!==zt||t[114]!==Wt?(In=[zt,Wt],t[113]=zt,t[114]=Wt,t[115]=In):In=t[115],(0,Q.useEffect)(Fn,In),Aq(zt,xt,Xt,Ee,Wt);let Ln;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=()=>{ie(!1)},t[116]=Ln):Ln=t[116];let Rn;t[117]===bt?Rn=t[118]:(Rn=[bt],t[117]=bt,t[118]=Rn),(0,Q.useEffect)(Ln,Rn);let zn,Bn;t[119]===re?(zn=t[120],Bn=t[121]):(zn=()=>{ae.current=re;for(let e of se.current)e()},Bn=[re],t[119]=re,t[120]=zn,t[121]=Bn),(0,Q.useEffect)(zn,Bn);let Vn;t[122]!==xt||t[123]!==M||t[124]!==zt?(Vn=()=>{M||!xt||dq(zt)},t[122]=xt,t[123]=M,t[124]=zt,t[125]=Vn):Vn=t[125];let Hn;t[126]!==Xt||t[127]!==xt||t[128]!==M||t[129]!==zt||t[130]!==Wt?(Hn=[xt,Xt,Wt,M,zt],t[126]=Xt,t[127]=xt,t[128]=M,t[129]=zt,t[130]=Wt,t[131]=Hn):Hn=t[131],(0,Q.useEffect)(Vn,Hn);let Un,Wn;t[132]===zt?(Un=t[133],Wn=t[134]):(Un=()=>zt.subscribe(()=>{if(!zt.isSearchOpen())for(let e of xe.current){let t=Oq(zt.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Wn=[zt],t[132]=zt,t[133]=Un,t[134]=Wn),(0,Q.useEffect)(Un,Wn);let Gn,qn;t[135]===zt?(Gn=t[136],qn=t[137]):(Gn=()=>zt.subscribe(()=>Ue.current()),qn=[zt],t[135]=zt,t[136]=Gn,t[137]=qn),(0,Q.useEffect)(Gn,qn);let Jn,Xn;t[138]===zt?(Jn=t[139],Xn=t[140]):(Jn=()=>zt.onMutation(`remove`,e=>{let t=Se.current;!t||e.path!==t.renamePath||Ce.current(t)}),Xn=[zt],t[138]=zt,t[139]=Jn,t[140]=Xn),(0,Q.useEffect)(Jn,Xn);let Zn;t[141]!==b||t[142]!==d||t[143]!==f||t[144]!==me||t[145]!==D||t[146]!==T||t[147]!==p||t[148]!==fn||t[149]!==_?(Zn=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 ce.current){if(Ps(e)){let t=o.find(t=>t.fromPath===pP(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(os(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&lP(t)&&u.set(e.path,mP(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(Qe.current?.kind===`folder`?Qe.current.folderPath:null),g=h?an(h,a):null,v=r?.assetPath??(Qe.current?.kind===`asset`?Qe.current.assetPath:null),y=v?u.get(v)??null:null,x=m?null:y??YP(c,e),S=m??(v?y?null:o.find(e=>e.fromPath===v)?.toPath??an(v,a):null);fe(e);let C=[...XP(e,f(),p),...l.keys()];await Promise.all(C.map(e=>d(e)));for(let t of e)b(t.toDocName);for(let e of u.values())b(e);_(e,a,o);let w=null;A(t=>{let n=GP(t,e,a,o,s);return w=n,fn(t,n,e,o),mn(n),n}),h&&g&&g!==h?D(g):x&&x!==c?(T(x),pJ(x)):S&&(m||S!==v)&&me(S,w??ce.current),ks([`files`,`backlinks`,`graph`])},t[141]=b,t[142]=d,t[143]=f,t[144]=me,t[145]=D,t[146]=T,t[147]=p,t[148]=fn,t[149]=_,t[150]=Zn):Zn=t[150];let Qn=Zn;async function $n(e){let t=!e.isFolder&&gn(e.sourcePath),n=t?e.sourcePath:AP(e.sourcePath,e.isFolder);W(n),F(null);try{let i=uP(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!lP(i.destinationPath),o=t||a?i.destinationPath:AP(i.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:_P(n),toPath:_P(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:mP(n),toPath:o},c={docName:he.current,folderPath:Qe.current?.kind===`folder`?Qe.current.folderPath:null,assetPath:Qe.current?.kind===`asset`?Qe.current.assetPath:null},l=await j(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`gijbne`}));if(!l.ok){Ls.error(l.title),nn();let e=Se.current;e&&e.renamePath===n?await Tn(e):Cn(),W(null);return}let u=B(mi,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await Qn(u.renamed,e.isFolder?[{fromPath:_P(n),toPath:_P(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=sP(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),Ls.error(r({id:`dDpCOp`}))}Cn(),W(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});Ls.error(t),F(t),nn();let i=Se.current;i&&i.renamePath===n?await Tn(i):Cn(),W(null)}}let er;t[151]!==r||t[152]!==Qn||t[153]!==nn?(er=async function(e){let t=e.draggedPaths.map(t=>{let n=NP(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(sY);if(t.length!==0){W(t[0]?.sourcePath??null),F(null);try{let e=[],n=[],i=[],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&&gn(a.sourcePath),s=t?{kind:`folder`,fromPath:_P(a.sourcePath),toPath:_P(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:mP(a.sourcePath),toPath:mP(a.destinationTreePath)},c=await j(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){Ls.error(c.title),nn(),W(null);return}let l=B(mi,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:_P(a.sourcePath),toPath:_P(a.destinationTreePath)})}try{await Qn(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),Ls.error(r({id:`8OxKZy`}))}W(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Ls.error(r({id:`HIb0vl`})),nn(),W(null)}}},t[151]=r,t[152]=Qn,t[153]=nn,t[154]=er):er=t[154];let nr=er,rr;t[155]!==r||t[156]!==b||t[157]!==nn?(rr=async function(e,t,n){if(e.length===0||Me.current!==null)return;let i=()=>{Me.current=null,W(null)};Me.current=n,W(n),F(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),e.append(`parentDocName`,FP(t,n.name||`upload`));try{let i=await j(await fetch(`/api/upload`,{method:`POST`,body:e}),r({id:`4Gz2wC`}));if(!i.ok){s+=1,Ls.error(i.title,{description:n.name});continue}let c=B(vi,i.body,`upload:drop`,null);if(c===null){s+=1,Ls.error(r({id:`4Gz2wC`}),{description:n.name});continue}let l=IP(t,c);if(c.deduped===!0){s+=1,Ls.error(r({id:`4sKwf6`}),{description:l});continue}o+=1;let u=zP(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),Ls.error(t instanceof TypeError?r({id:`HIb0vl`}):r({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)Ps(e)&&b(e.docName);A(e=>{let t=new Set(e.map(hP)),n=!1,r=[...e];for(let e of a){let i=hP(e);Fe.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(nn(r),mn(r),r):e})}o>0&&(ks([`files`,`backlinks`,`graph`]),Ke.current?.(),Ls.success(Is._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||r({id:`RSqaSd`})})),s>0&&F(o>0?Is._({id:`yH7T4q`,values:{failedCount:s}}):r({id:`4Gz2wC`})),i()}catch(e){let t=e,n=r({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),Ls.error(n),F(n),i()}},t[155]=r,t[156]=b,t[157]=nn,t[158]=rr):rr=t[158];let ir=rr,ar;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(ar=function(e){te({parentDir:e})},t[159]=ar):ar=t[159];let sr=ar,cr;t[160]!==r||t[161]!==b||t[162]!==Tn||t[163]!==Cn||t[164]!==zt||t[165]!==D||t[166]!==T||t[167]!==nn||t[168]!==Ut?(cr=async function(e,t,n){if(Me.current)return;let i=Se.current;i&&Cn(i);try{let i=jP(e,t,[...Ut,...Jt.current]);W(i.renamePath),Me.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=MP(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await j(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){Ls.error(a.title),W(null),Me.current=null;return}let s=mP(e),c=B(gi,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};b(c),A(e=>{if(e.some(e=>Ps(e)&&e.docName===c))return e;let t=[...e,l];return mn(t),Fe.current.set(hP(l),Date.now()),t}),ks([`files`,`backlinks`,`graph`]),T(c)}else{let e=_P(i.addPath),t=await j(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){Ls.error(t.title),W(null),Me.current=null;return}o=B(Kn,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};A(e=>{if(e.some(e=>ys(e)&&e.path===o))return e;let t=[...e,n];return mn(t),Fe.current.set(hP(n),Date.now()),t}),ks([`files`]),D(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=Se.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>Cn(t))};document.addEventListener(`keydown`,c,!0),Se.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},W(null),Me.current=null,zt.add(i.addPath),zt.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Ls.error(r({id:`S6l5dv`}));let t=Se.current;t?await Tn(t):Cn(),W(null),Me.current=null,nn()}},t[160]=r,t[161]=b,t[162]=Tn,t[163]=Cn,t[164]=zt,t[165]=D,t[166]=T,t[167]=nn,t[168]=Ut,t[169]=cr):cr=t[169];let lr=cr,ur;t[170]===zt?ur=t[171]:(ur=function(e){let t=vP(e);(0,Q.startTransition)(()=>{for(let e of Jt.current)if(e===t||e.startsWith(t)){let t=Oq(zt.getItem(e));t&&t.expand()}})},t[170]=zt,t[171]=ur);let fr=ur,pr;t[172]===zt?pr=t[173]:(pr=function(e){let t=vP(e),n=new Set(xe.current);(0,Q.startTransition)(()=>{for(let e of[...Jt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=Oq(zt.getItem(e));t&&t.collapse()}})},t[172]=zt,t[173]=pr);let mr=pr,hr;t[174]!==de||t[175]!==Yt||t[176]!==o||t[177]!==c||t[178]!==ve||t[179]!==U||t[180]!==Tn||t[181]!==cn||t[182]!==k||t[183]!==qt||t[184]!==nr||t[185]!==$n||t[186]!==Vt||t[187]!==x||t[188]!==xn||t[189]!==un||t[190]!==kt||t[191]!==Ut||t[192]!==ir?(hr=()=>{ce.current=k,le.current=x,he.current=o,Qe.current=c,ye.current=ve,Me.current=U,Ge.current=kt,Gt.current=Ut,Jt.current=qt,xe.current=Yt,Ue.current=cn,We.current=un,Ce.current=Tn,je.current=(e,t,n)=>{ir(e,t,n)},Je.current=e=>{if(Ee.current||De.current||e.length!==1)return;let t=e[0];t&&(ie(!1),de(Vt(t),k))},Xe.current=e=>{xn(e)||Ls.error(e)},Ye.current=$n,Ze.current=nr},t[174]=de,t[175]=Yt,t[176]=o,t[177]=c,t[178]=ve,t[179]=U,t[180]=Tn,t[181]=cn,t[182]=k,t[183]=qt,t[184]=nr,t[185]=$n,t[186]=Vt,t[187]=x,t[188]=xn,t[189]=un,t[190]=kt,t[191]=Ut,t[192]=ir,t[193]=hr):hr=t[193],(0,Q.useLayoutEffect)(hr);let gr,_r;t[194]===zt?(gr=t[195],_r=t[196]):(gr=()=>{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||VJ(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=zt.getFocusedPath()??zt.getSelectedPaths()[0]??null;if(!t)return;let n=zt.getItem(t)??zt.getItem(vP(t)),r=n?.isDirectory()?vP(_P(n.getPath())):t;if(ye.current.has(r))return;yn.current(LJ(r,ce.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Jt.current,...Gt.current]);Ee.current=!0;for(let e of u)e&&zt.getItem(e)?.select();queueMicrotask(()=>{Ee.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},_r=[zt],t[194]=zt,t[195]=gr,t[196]=_r),(0,Q.useEffect)(gr,_r);let vr,yr;t[197]!==k.length||t[198]!==M?(vr=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(TL)?.shadowRoot;if(!e)return;let t=oY,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()},yr=[M,k.length],t[197]=k.length,t[198]=M,t[199]=vr,t[200]=yr):(vr=t[199],yr=t[200]),(0,Q.useEffect)(vr,yr);let br,xr;t[201]!==k.length||t[202]!==M?(br=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(TL)?.shadowRoot;if(!e)return;let t=()=>HK(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()},xr=[M,k.length],t[201]=k.length,t[202]=M,t[203]=br,t[204]=xr):(br=t[203],xr=t[204]),(0,Q.useEffect)(br,xr);let Sr,Cr;t[205]!==k.length||t[206]!==M?(Sr=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(TL)?.shadowRoot;if(!e)return;let t=()=>oq(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Cr=[M,k.length],t[205]=k.length,t[206]=M,t[207]=Sr,t[208]=Cr):(Sr=t[207],Cr=t[208]),(0,Q.useEffect)(Sr,Cr);let wr;t[209]===Symbol.for(`react.memo_cache_sentinel`)?(wr={folderCount:0,expandedCount:0},t[209]=wr):wr=t[209];let Tr=(0,Q.useRef)(wr),Er=(0,Q.useRef)(lr),Dr=(0,Q.useRef)(sr),Or;t[210]===lr?Or=t[211]:(Or=()=>{Er.current=lr,Dr.current=sr},t[210]=lr,t[211]=Or),(0,Q.useEffect)(Or);let kr,jr;t[212]===zt?(kr=t[213],jr=t[214]):(kr=()=>({startCreating(e,t){Er.current(e,t)},startCreatingFromTemplate(e){Dr.current(e)},createFromTemplate(e,t){Er.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Jt.current){let t=Oq(zt.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(xe.current);(0,Q.startTransition)(()=>{for(let t of[...Jt.current].reverse()){if(e.has(t))continue;let n=Oq(zt.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Jt.current,t=0;for(let n of e)Oq(zt.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Tr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Tr.current=i,i},isCreationTargetCleared(){return ae.current},subscribe(e){se.current.add(e);let t=zt.subscribe(e);return()=>{se.current.delete(e),t()}}}),jr=[zt],t[212]=zt,t[213]=kr,t[214]=jr),(0,Q.useImperativeHandle)(n,kr,jr);let Mr;t[215]!==Cn||t[216]!==d||t[217]!==l||t[218]!==zt?(Mr=async function(e,t,n){let r=HJ(e,ce.current,Jt.current),i=Se.current;i&&e.some(e=>UJ(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Cn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(aY).map(iY)]);l([...[...a].map(rY),...[...o].map(nY),...[...s].map(tY)],{force:!0}),await Promise.all([...a].map(e=>d(e)));for(let t of e){let e=t.kind===`folder`?vP(t.path):t.kind===`asset`?t.path:pP(t.path,t.docExt);zt.getItem(e)&&zt.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}A(e=>{let t=KP(e,[...a],void 0,[...s]);for(let e of o)t=KP(t,[],e);return mn(t),t}),ks([`files`,`backlinks`,`graph`])},t[215]=Cn,t[216]=d,t[217]=l,t[218]=zt,t[219]=Mr):Mr=t[219];let Nr=Mr,Pr;t[220]!==r||t[221]!==Nr?(Pr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;W(a.path);let o=await j(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!o.ok)return i.length>0&&await Nr(i,t,n),Ls.error(o.title),!1;let s=B(dr,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await Nr(i,t,n),!0},t[220]=r,t[221]=Nr,t[222]=Pr):Pr=t[222];let Fr=Pr,Ir;t[223]===Symbol.for(`react.memo_cache_sentinel`)?(Ir=async function(e,t,n){let r=[],i=[];for(let a of e){W(a.path);let e=ZP(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:xq(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[223]=Ir):Ir=t[223];let Lr=Ir,Rr;t[224]===r?Rr=t[225]:(Rr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await j(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),i.push({target:a,reason:o.title});continue}let s=B(Yn,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length;Ls.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`vEJDlt`})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[224]=r,t[225]=Rr);let zr=Rr,Br;t[226]!==r||t[227]!==ee||t[228]!==Nr||t[229]!==Fr||t[230]!==zr||t[231]!==nn||t[232]!==X?(Br=async function(e){let t=e.map(e=>qP(e,ce.current)),n=t[0];if(!n)return;let i=ee.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(eY),t=i.length>e.length?`, +${i.length-e.length} more`:``;Ls.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}W(n.path),K(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&X){let{trashed:e,failed:n}=await Lr(t,a,X);if(e.length>0){let t=await zr(e);t?await Nr(e,t.deletedDocNames,t.deletedFolderPaths):await Nr(e,e.filter($J).map(QJ),e.filter(ZJ).map(XJ))}n.length>0&&J({failed:n,originalTargets:[...t]}),W(null)}else{let e=await Fr(t);W(null),e||nn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),Ls.error(r({id:`0eHrMb`}),{description:n}),W(null),nn()}},t[226]=r,t[227]=ee,t[228]=Nr,t[229]=Fr,t[230]=zr,t[231]=nn,t[232]=X,t[233]=Br):Br=t[233];let Vr=Br,Hr;t[234]!==r||t[235]!==Fr||t[236]!==nn||t[237]!==q?(Hr=async function(){if(!q)return;let e=new Set(q.failed.map(YJ)),t=q.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(J(null),t.length!==0){W(t[0]?.path??null);try{let e=await Fr(t);W(null),e||nn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),Ls.error(r({id:`0eHrMb`}),{description:n}),W(null),nn()}}},t[234]=r,t[235]=Fr,t[236]=nn,t[237]=q,t[238]=Hr):Hr=t[238];let Ur=Hr,Gr;t[239]!==Vr||t[240]!==q?(Gr=async function(){if(!q)return;let e=new Set(q.failed.map(JJ)),t=q.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));J(null),await Vr(t)},t[239]=Vr,t[240]=q,t[241]=Gr):Gr=t[241];let qr=Gr,Jr=(0,Q.useRef)(Vr),Yr;t[242]===Vr?Yr=t[243]:(Yr=()=>{Jr.current=Vr},t[242]=Vr,t[243]=Yr),(0,Q.useEffect)(Yr);let Xr,Zr;t[244]===Symbol.for(`react.memo_cache_sentinel`)?(Xr=()=>Fq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ce.current.find(e=>Ps(e)&&e.docName===t);Jr.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Jr.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){Jr.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}))}),Zr=[],t[244]=Xr,t[245]=Zr):(Xr=t[244],Zr=t[245]),(0,Q.useEffect)(Xr,Zr);let Qr,$r;t[246]===Symbol.for(`react.memo_cache_sentinel`)?(Qr=()=>zq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ce.current.find(e=>Ps(e)&&e.docName===t);yn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){yn.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}))}),$r=[],t[246]=Qr,t[247]=$r):(Qr=t[246],$r=t[247]),(0,Q.useEffect)(Qr,$r);let ei,ti;t[248]===zt?(ei=t[249],ti=t[250]):(ei=()=>Lq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=pP(t,ce.current.find(e=>Ps(e)&&e.docName===t)?.docExt);zt.startRenaming(n);return}if(e.kind===`folder`){zt.startRenaming(e.folderPath);return}if(e.kind===`asset`){zt.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),ti=[zt],t[248]=zt,t[249]=ei,t[250]=ti),(0,Q.useEffect)(ei,ti);let ni;t[251]===Symbol.for(`react.memo_cache_sentinel`)?(ni=function(){let e=Te.current;e&&lJ(e),Te.current=null},t[251]=ni):ni=t[251];let ri=ni,ii;t[252]===g?ii=t[253]:(ii=function(e){let t=bY(e.nativeEvent);if(!t||t.endsWith(`/`)){ri();return}let n=mP(t),r=ce.current.find(e=>hP(e)===t);if(r&&os(r)){ri();return}if(r&&Ps(r)&&tr(r.size)){ri();return}Te.current!==n&&(ri(),Te.current=n,cJ(n,e=>g(e)))},t[252]=g,t[253]=ii);let ai=ii,oi;t[254]!==de||t[255]!==zt||t[256]!==D?(oi=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=xY(e.nativeEvent);if(!t){wY(e.nativeEvent)&&ie(!0);return}if(t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?vP(n):n;if(zt.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=_P(r);if(window.location.hash===ds(e))return;queueMicrotask(()=>D(e));return}let i=mP(r);window.location.hash!==ls(i)&&queueMicrotask(()=>de(r))},t[254]=de,t[255]=zt,t[256]=D,t[257]=oi):oi=t[257];let si=oi,ci;t[258]===Symbol.for(`react.memo_cache_sentinel`)?(ci=function(e){LP(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,et(!0))},t[258]=ci):ci=t[258];let li=ci,ui;t[259]===Symbol.for(`react.memo_cache_sentinel`)?(ui=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||et(!1)},t[259]=ui):ui=t[259];let di=ui,fi;t[260]===ir?fi=t[261]:(fi=function(e){if(!LP(e.nativeEvent))return;let t=RP(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),et(!1),ir(t,``,kJ))},t[260]=ir,t[261]=fi);let pi=fi;if(M){let e;return t[262]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(EY,{}),t[262]=e):e=t[262],e}let hi;t[263]!==r||t[264]!==I||t[265]!==R?(hi=I?r(R?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[263]=r,t[264]=I,t[265]=R,t[266]=hi):hi=t[266];let _i=hi;if(k.length===0){if(_i!==null){let e;return t[267]===_i?e=t[268]:(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:_i})}),t[267]=_i,t[268]=e),e}if(P){let e;return t[269]===P?e=t[270]:(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[269]=P,t[270]=e),e}let e;t[271]===r?e=t[272]:(e=r({id:`5ZB7XC`}),t[271]=r,t[272]=e);let n=$e&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,i;t[273]===n?i=t[274]:(i=Oi(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[273]=n,t[274]=i);let a;t[275]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(s,{id:`xiv-dW`})}),t[275]=a):a=t[275];let o;t[276]===lr?o=t[277]:(o=()=>lr(`file`,``),t[276]=lr,t[277]=o);let c;t[278]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(s,{id:`6ibbCg`}),t[278]=c):c=t[278];let l;t[279]===o?l=t[280]:(l=(0,Z.jsx)(Ai,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:c}),t[279]=o,t[280]=l);let u;return t[281]!==pi||t[282]!==e||t[283]!==i||t[284]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":e,className:i,onDragOver:li,onDragLeave:di,onDrop:pi,children:[a,l]}),t[281]=pi,t[282]=e,t[283]=i,t[284]=l,t[285]=u):u=t[285],u}let yi=U!==null,bi=G?.targets[0]??null,xi=null;if(V!==null){let e;if(t[286]!==a.locale||t[287]!==V){let n=new Intl.NumberFormat(a.locale).format(V);e=Is._({id:`LuoJWu`,values:{truncatedShownCount:V,formattedCount:n}}),t[286]=a.locale,t[287]=V,t[288]=e}else e=t[288];xi=e}let Si;t[289]!==P||t[290]!==_i||t[291]!==xi?(Si=(P||_i!==null||xi!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[_i===null?P&&(0,Z.jsx)(OY,{kind:`error`,children:P}):(0,Z.jsx)(OY,{kind:`reconnecting`,children:_i}),xi!==null&&(0,Z.jsx)(OY,{kind:`info`,children:xi})]}),t[289]=P,t[290]=_i,t[291]=xi,t[292]=Si):Si=t[292];let Ci;t[293]===y?Ci=t[294]:(Ci=LK(y),t[293]=y,t[294]=Ci);let wi=re?``:void 0,Ti;t[295]===wi?Ti=t[296]:(Ti={[MJ]:wi},t[295]=wi,t[296]=Ti);let Ei;t[297]!==yi||t[298]!==ve||t[299]!==mr||t[300]!==k||t[301]!==fr||t[302]!==qt||t[303]!==vn||t[304]!==Tt||t[305]!==Ot||t[306]!==zt||t[307]!==Et||t[308]!==Dt||t[309]!==lr||t[310]!==X?(Ei=(e,t)=>(0,Z.jsx)(WJ,{item:e,context:t,anyActionBusy:yi,workspace:X,handoff:Tt,model:zt,okignoreBinding:Et,projectLocalBinding:Dt,mergedConfig:Ot,onStartCreating:lr,onCreateFromTemplate:(e,t)=>lr(`file`,e,{template:t}),onDuplicate:vn,onDelete:e=>K({targets:e}),onExpandSubtree:fr,onCollapseSubtree:mr,folderTreePaths:qt,isAsset:ve.has(e.path),documents:k}),t[297]=yi,t[298]=ve,t[299]=mr,t[300]=k,t[301]=fr,t[302]=qt,t[303]=vn,t[304]=Tt,t[305]=Ot,t[306]=zt,t[307]=Et,t[308]=Dt,t[309]=lr,t[310]=X,t[311]=Ei):Ei=t[311];let Di;t[312]!==si||t[313]!==ai||t[314]!==zt||t[315]!==Si||t[316]!==Ci||t[317]!==Ti||t[318]!==Ei?(Di=(0,Z.jsx)(`div`,{ref:qe,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(jK,{header:Si,model:zt,style:Ci,...Ti,onClickCapture:si,onMouseMove:ai,onMouseLeave:ri,renderContextMenu:Ei})}),t[312]=si,t[313]=ai,t[314]=zt,t[315]=Si,t[316]=Ci,t[317]=Ti,t[318]=Ei,t[319]=Di):Di=t[319];let ki=!!G,ji;t[320]===U?ji=t[321]:(ji=e=>{!e&&!U&&K(null)},t[320]=U,t[321]=ji);let Mi;t[322]!==r||t[323]!==U||t[324]!==G||t[325]!==Vr||t[326]!==bi?(Mi=G&&bi&&(0,Z.jsx)(va,{...(()=>{let e=_q(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,G.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(qJ)}):null};let t=G.targets.length,n=bi.name;return{itemName:t===1?bi.kind===`folder`?`${bi.name}/`:bi.kind===`file`?`${bi.name}${bi.docExt??`.md`}`:bi.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):bi.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:U!==null,onDelete:()=>Vr(G.targets)}),t[322]=r,t[323]=U,t[324]=G,t[325]=Vr,t[326]=bi,t[327]=Mi):Mi=t[327];let Ni;t[328]!==ki||t[329]!==ji||t[330]!==Mi?(Ni=(0,Z.jsx)(Xo,{open:ki,onOpenChange:ji,children:Mi}),t[328]=ki,t[329]=ji,t[330]=Mi,t[331]=Ni):Ni=t[331];let Pi=!!q,Fi;t[332]===U?Fi=t[333]:(Fi=e=>{!e&&!U&&J(null)},t[332]=U,t[333]=Fi);let Ii;t[334]!==U||t[335]!==Ur||t[336]!==qr||t[337]!==q?(Ii=q&&(0,Z.jsx)(Tq,{failedTargets:q.failed,isSubmitting:U!==null,onDeletePermanently:Ur,onRetry:qr,onCancel:()=>J(null)}),t[334]=U,t[335]=Ur,t[336]=qr,t[337]=q,t[338]=Ii):Ii=t[338];let Li;t[339]!==Pi||t[340]!==Fi||t[341]!==Ii?(Li=(0,Z.jsx)(Xo,{open:Pi,onOpenChange:Fi,children:Ii}),t[339]=Pi,t[340]=Fi,t[341]=Ii,t[342]=Li):Li=t[342];let Ri=Y!==null,zi;t[343]===Symbol.for(`react.memo_cache_sentinel`)?(zi=e=>{e||te(null)},t[343]=zi):zi=t[343];let Bi=Y?.parentDir??``,Vi;t[344]!==Ri||t[345]!==Bi?(Vi=(0,Z.jsx)(_g,{open:Ri,onOpenChange:zi,kind:`file`,initialDir:Bi,defaultToTemplate:!0}),t[344]=Ri,t[345]=Bi,t[346]=Vi):Vi=t[346];let Hi;return t[347]!==Di||t[348]!==Ni||t[349]!==Li||t[350]!==Vi?(Hi=(0,Z.jsxs)(Z.Fragment,{children:[Di,Ni,Li,Vi]}),t[347]=Di,t[348]=Ni,t[349]=Li,t[350]=Vi,t[351]=Hi):Hi=t[351],Hi}function qJ(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:vq(e)},`${e.kind}:${e.path}`)}function JJ(e){return`${e.kind}:${e.path}`}function YJ(e){return`${e.kind}:${e.path}`}function XJ(e){return e.path}function ZJ(e){return e.kind===`folder`}function QJ(e){return e.path}function $J(e){return e.kind===`file`}function eY(e){return e.file}function tY(e){return vt(e)}function nY(e){return Pe(e)}function rY(e){return it(e)}function iY(e){return e.path}function aY(e){return e.kind===`asset`}function oY(e){return e.endsWith(`/`)?e.slice(0,-1):e}function sY(e){return!!e}function cY(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function lY(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function uY(e){Ls.error(e)}function dY(){}function fY(e){return Ls.error(e)}function pY(){}function mY(){}function hY(){}function gY(){}function _Y(){}async function vY(){}function yY(e){return hP(e)}function bY(e){return xY(e)?.dataset.itemPath??null}function xY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function SY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function CY(e){let t=xY(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=PP(e,n);return{parentDir:r,row:t,root:null,busyPath:n?vP(r):e}}return wY(e)?{parentDir:``,row:null,root:SY(e),busyPath:kJ}:null}function wY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var TY=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function EY(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=TY.map(DY),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function DY(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(ya,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(ya,{className:`h-3 ${e}`})]},t)}function OY(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?as:n===`reconnecting`?no:Qo,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=Oi(`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=Oi(`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 kY(e){return e?Is._({id:`wTcjov`}):null}function AY(e){let t=(0,$.c)(23),{_:n}=i(),r=Kg(),a=RS();if(r)return null;let{input:o,installStates:c,dispatch:l}=e,u=o===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=kY(u),r;t[12]===c?r=t[13]:(r=e=>c[e.id]?.installed===!0,t[12]=c,t[13]=r);let i=Yg.filter(r),_=i.length>0,v=a!==null;if(!_&&!v){g=null;break bb0}f=oF,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsxs)(lF,{children:[(0,Z.jsx)(Vi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[14]=h):h=t[14],d=uF,p=_?(0,Z.jsxs)(aF,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(fF,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(cF,{disabled:!r,onSelect:()=>{o&&l(t.id,o)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(FS,{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,m=v?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(pF,{}):null,(0,Z.jsxs)(aF,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(fF,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),zS.map(t=>{let{displayName:r}=Ci[t];return(0,Z.jsxs)(cF,{onSelect:()=>{o!==null&&a.launchInTerminal(o,t)},disabled:u,"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)(FS,{id:BS(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}t[0]=n,t[1]=l,t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[15]!==d||t[16]!==p||t[17]!==m?(_=(0,Z.jsxs)(d,{children:[p,m]}),t[15]=d,t[16]=p,t[17]=m,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==h||t[21]!==_?(v=(0,Z.jsxs)(f,{children:[h,_]}),t[19]=f,t[20]=h,t[21]=_,t[22]=v):v=t[22],v}var jY=(e,t,n)=>Xu(e,t,n,`ProjectSwitcher`);function MY(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h=NM(),g=typeof window<`u`&&window.okDesktop!=null,_=(0,Q.useRef)(!1),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{u(e),e||f(``)},t[1]=v):v=t[1];let y=v,b;t[2]!==r||t[3]!==n.project||t[4]!==l?(b=()=>{if(!l)return;let e=!1;return jY(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=l,t[5]=b):b=t[5];let x;t[6]!==r||t[7]!==n||t[8]!==l?(x=[l,n,r],t[6]=r,t[7]=n,t[8]=l,t[9]=x):x=t[9],(0,Q.useEffect)(b,x);let S;t[10]!==r||t[11]!==n.project?(S=e=>{u(!1),jY(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=S):S=t[12];let C=S,w;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(w=()=>{u(!1),jY(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=w):w=t[16];let T=w,E;t[17]!==r||t[18]!==n.navigator?(E=()=>{u(!1),jY(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=E):E=t[19];let D=E,O;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{u(!1),m(!0)},t[20]=O):O=t[20];let k=O,j=n.config.projectPath,M,N,P,F,I,L,R,z,B,V,H;if(t[21]!==r||t[22]!==h||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==j||t[26]!==l||t[27]!==C||t[28]!==o||t[29]!==d){let e;t[41]===j?e=t[42]:(e=e=>e.path!==j,t[41]=j,t[42]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;N=po,R=l,z=y,B=!1;let u=h!==null&&`h-auto py-1.5`,p;t[43]===u?p=t[44]:(p=Oi(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,u),t[43]=u,t[44]=p);let m;t[45]===r?m=t[46]:(m=r({id:`zZ_I5K`}),t[45]=r,t[46]=m);let v;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(v=g?()=>{_.current=!0}:void 0,t[47]=v):v=t[47];let b;t[48]===l?b=t[49]:(b=g?()=>{if(_.current){_.current=!1;return}y(!l)}:void 0,t[48]=l,t[49]=b);let x;t[50]===n.config.projectName?x=t[51]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=x);let S;t[52]===h?S=t[53]:(S=h===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(He,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:h})]}),t[52]=h,t[53]=S);let w;t[54]!==x||t[55]!==S?(w=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x,S]}),t[54]=x,t[55]=S,t[56]=w):w=t[56];let T;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(zl,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=T):T=t[57],t[58]!==n.config.projectPath||t[59]!==p||t[60]!==m||t[61]!==b||t[62]!==w?(V=(0,Z.jsx)(eo,{asChild:!0,children:(0,Z.jsxs)(DM,{className:p,"data-testid":`project-switcher-trigger`,"aria-label":m,title:n.config.projectPath,onPointerDown:v,onClick:b,children:[w,T]})}),t[58]=n.config.projectPath,t[59]=p,t[60]=m,t[61]=b,t[62]=w,t[63]=V):V=t[63],M=ro,H=`start`,P=`top`,F=`min-w-[260px]`,I=`project-switcher-menu`,L=i.length===0?(0,Z.jsx)(To,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(wT,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(kT,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:NY,"data-testid":`project-switcher-search`}),(0,Z.jsx)(ET,{children:(0,Z.jsx)(A,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Xa,{}),c.length===0?(0,Z.jsx)(To,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(s,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)(go,{disabled:e.missing,onSelect:()=>C(e.path),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)(`span`,{className:`w-full truncate font-medium text-sm`,title:e.name,children:e.name}),(0,Z.jsxs)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:e.path,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[21]=r,t[22]=h,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=j,t[26]=l,t[27]=C,t[28]=o,t[29]=d,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=R,t[37]=z,t[38]=B,t[39]=V,t[40]=H}else M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35],R=t[36],z=t[37],B=t[38],V=t[39],H=t[40];let U;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Xa,{}),t[64]=U):U=t[64];let W,G;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(ht,{"aria-hidden":`true`,className:`text-muted-foreground`}),G=(0,Z.jsx)(s,{id:`PVUn_c`}),t[65]=W,t[66]=G):(W=t[65],G=t[66]);let K;t[67]===T?K=t[68]:(K=(0,Z.jsxs)(go,{onSelect:T,"data-testid":`project-switcher-open-folder`,children:[W,G]}),t[67]=T,t[68]=K);let q,J;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(xt,{"aria-hidden":`true`,className:`text-muted-foreground`}),J=(0,Z.jsx)(s,{id:`xaDWAI`}),t[69]=q,t[70]=J):(q=t[69],J=t[70]);let ee;t[71]===D?ee=t[72]:(ee=(0,Z.jsxs)(go,{onSelect:D,"data-testid":`project-switcher-switch-project`,children:[q,J]}),t[71]=D,t[72]=ee);let Y;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsxs)(go,{onSelect:k,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(At,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[73]=Y):Y=t[73];let te;t[74]!==M||t[75]!==P||t[76]!==F||t[77]!==I||t[78]!==L||t[79]!==K||t[80]!==ee||t[81]!==H?(te=(0,Z.jsxs)(M,{align:H,side:P,className:F,"data-testid":I,children:[L,U,K,ee,Y]}),t[74]=M,t[75]=P,t[76]=F,t[77]=I,t[78]=L,t[79]=K,t[80]=ee,t[81]=H,t[82]=te):te=t[82];let X;t[83]!==N||t[84]!==R||t[85]!==z||t[86]!==B||t[87]!==V||t[88]!==te?(X=(0,Z.jsxs)(N,{open:R,onOpenChange:z,modal:B,children:[V,te]}),t[83]=N,t[84]=R,t[85]=z,t[86]=B,t[87]=V,t[88]=te,t[89]=X):X=t[89];let ne;t[90]!==n||t[91]!==p?(ne=(0,Z.jsx)(Kf,{open:p,onOpenChange:m,bridge:n}),t[90]=n,t[91]=p,t[92]=ne):ne=t[92];let re;return t[93]!==X||t[94]!==ne?(re=(0,Z.jsxs)(Z.Fragment,{children:[X,ne]}),t[93]=X,t[94]=ne,t[95]=re):re=t[95],re}function NY(e){return e.stopPropagation()}function PY(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})),sr(`sidebarSearchPill`)}function FY(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Oi(`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)(A,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(s,{id:`A1taO8`})}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Se,{className:`text-foreground/70`,children:Sc(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(Ai,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function IY(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:a}=i(),o=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,s;t[0]!==a||t[1]!==n.dismissible||t[2]!==r?(s=n.dismissible===!1?null:(0,Z.jsx)(Ai,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":a({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(Rs,{"aria-hidden":`true`,className:`size-3`})}),t[0]=a,t[1]=n.dismissible,t[2]=r,t[3]=s):s=t[3];let c=s,l=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${o}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let a;t[6]!==c||t[7]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,c]}),t[6]=c,t[7]=i,t[8]=a):a=t[8];let s;t[9]!==l||t[10]!==n.action?(s=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=l,t[10]=n.action,t[11]=s):s=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==l||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:u,children:n.secondaryAction.label}),t[14]=l,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==s||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[s,d]}),t[18]=s,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==a||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[a,f]}),t[21]=e,t[22]=r,t[23]=a,t[24]=f,t[25]=p):p=t[25],p}let u=`update-notice-${n.id}`,d=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${o}`,f;t[26]===n.body?f=t[27]:(f=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=f);let p;t[28]!==l||t[29]!==n.action?(p=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=l,t[29]=n.action,t[30]=p):p=t[30];let m;return t[31]!==c||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":u,className:d,children:[f,p,c]}),t[31]=c,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m):m=t[36],m}function LY(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 RY(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(yh,vh,vh),n;e[0]===t?n=e[1]:(n=LY(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),_h(r.id)},e[2]=r,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(IY,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function zY(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?A_(n.contentDir,j_(t),n.pathSeparator):e?.kind===`folder`?A_(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?A_(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function BY(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?j_(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function VY(e,t,n){return e===null?N_({workspace:n}):e.kind===`folder`?n?I_({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?M_({docName:t,workspace:n}):null}var HY={folderCount:0,expandedCount:0},UY=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function WY(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(UY)!==null}function GY(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(f,{name:`file-sidebar`,children:(0,Z.jsx)(qY,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var KY=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)($s,{asChild:!0,children:(0,Z.jsx)(Ai,{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)(tc,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(ic,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function qY(e){let t=(0,$.c)(178),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=yt(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:Fs(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,h=typeof window<`u`&&window.okDesktop!=null,{state:g,toggleSidebar:_}=pM(),v=Kg(),y=g===`expanded`,b=h&&g===`collapsed`,[x,S]=(0,Q.useState)(HY),C,w;t[3]===a?(C=t[4],w=t[5]):(C=()=>{if(a===null)return;let e=()=>{S(a.getFolderState()),p(a.isCreationTargetCleared())};return e(),a.subscribe(e)},w=[a],t[3]=a,t[4]=C,t[5]=w),(0,Q.useEffect)(C,w);let T,E;t[6]===a?(T=t[7],E=t[8]):(T=()=>{if(a!==null)return uw(e=>{let t=e.initialDir??``;if(e.template){a.createFromTemplate(e.template.folder,e.template.name);return}a.startCreating(`file`,t)})},E=[a],t[6]=a,t[7]=T,t[8]=E),(0,Q.useEffect)(T,E);let D=x.folderCount>0,O=D&&x.expandedCount===x.folderCount,k=x.expandedCount===0,A=ao(``),j=ao(m===``?null:m),M=m===``?A:j,N=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,P=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,F=typeof window<`u`?window.okDesktop:void 0,I=ja(),L=ov().states,{dispatch:R}=Y_(),z;t[9]===I?z=t[10]:(z=N_({workspace:I}),t[9]=I,t[10]=z);let B=z,{projectLocalBinding:V,merged:H}=ge(),U=H?.appearance?.sidebar?.showHiddenFiles??!1,W=D&&!O,G=D&&!k,K=W||G,q=YY,J;t[11]!==a||t[12]!==I?(J=()=>{I&&a?.startCreating(`file`,``)},t[11]=a,t[12]=I,t[13]=J):J=t[13];let ee=J,Y;t[14]!==a||t[15]!==I?(Y=e=>{I&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=I,t[16]=Y):Y=t[16];let te=Y,X;t[17]!==a||t[18]!==I?(X=()=>{I&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=I,t[19]=X):X=t[19];let ne=X,re;t[20]===I?re=t[21]:(re=()=>{!I||!F||F.shell.showItemInFolder(I.contentDir)},t[20]=I,t[21]=re);let ie=re,ae;t[22]!==r||t[23]!==I?(ae=async()=>{if(I)try{await navigator.clipboard.writeText(I.contentDir),Ls.success(r({id:`6_ZOw4`}),{description:I.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),Ls.error(r({id:`vfRlCI`}))}},t[22]=r,t[23]=I,t[24]=ae):ae=t[24];let oe=ae,se;t[25]!==r||t[26]!==V?(se=e=>{if(V===null)return;let t=V.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,ni(t.error)),Ls.error(r({id:`P47EWZ`}),{description:ni(t.error)}))},t[25]=r,t[26]=V,t[27]=se):se=t[27];let ce=se,le;t[28]===a?le=t[29]:(le=()=>{a?.expandAll()},t[28]=a,t[29]=le);let ue=le,fe;t[30]===a?fe=t[31]:(fe=()=>{a?.collapseAll()},t[30]=a,t[31]=fe);let pe=fe,me,he;t[32]!==G||t[33]!==W||t[34]!==U||t[35]!==g?(me=()=>{F&&F.editor.notifyViewMenuStateChanged({showHiddenFiles:U,canExpandAll:W,canCollapseAll:G,sidebarVisible:g===`expanded`})},he=[F,U,W,G,g],t[32]=G,t[33]=W,t[34]=U,t[35]=g,t[36]=me,t[37]=he):(me=t[36],he=t[37]),(0,Q.useEffect)(me,he);let _e,ve;t[38]!==r||t[39]!==c||t[40]!==l||t[41]!==R||t[42]!==L||t[43]!==m||t[44]!==V||t[45]!==U||t[46]!==_||t[47]!==a||t[48]!==I?(_e=()=>{if(F)return F.onMenuAction(e=>{switch(e){case`new-doc`:if(!I||!a)return;a.startCreating(`file`,m);return;case`new-folder`:if(!I||!a)return;a.startCreating(`folder`,m);return;case`new-from-template`:if(!I||!a)return;a.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;Iq(l);return;case`duplicate`:if(!l)return;Rq(l);return;case`move-to-trash`:if(!l)return;Pq(l);return;case`reveal-in-finder`:{if(!F||!I)return;let e=zY(l,c,I);F.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=Yg.filter(e=>L[e.id]?.installed===!0);if(e.length===0){Ls.error(r({id:`LKOLNn`}));return}let t=VY(l,c,I);if(!t)return;let[n]=e;if(!n)return;R(n.id,t);return}case`copy-full-path`:{if(!I)return;let e=zY(l,c,I);navigator.clipboard.writeText(e).then(()=>Ls.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ls.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=BY(l,c);if(e===``){Ls.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>Ls.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),Ls.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(V===null)return;let e=V.patch({appearance:{sidebar:{showHiddenFiles:!U}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,ni(e.error)),Ls.error(r({id:`P47EWZ`}),{description:ni(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`toggle-sidebar`:_();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}})},ve=[F,a,I,l,c,m,V,U,L,R,_,r],t[38]=r,t[39]=c,t[40]=l,t[41]=R,t[42]=L,t[43]=m,t[44]=V,t[45]=U,t[46]=_,t[47]=a,t[48]=I,t[49]=_e,t[50]=ve):(_e=t[49],ve=t[50]),(0,Q.useEffect)(_e,ve);let ye=h&&y&&`motion-safe:delay-100`,be=b&&`opacity-0`,xe;t[51]!==ye||t[52]!==be?(xe=Oi(`flex-row h-12 items-center py-0 px-3`,`justify-between`,h&&`overflow-x-clip`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,ye,be,h&&`[-webkit-app-region:drag]`),t[51]=ye,t[52]=be,t[53]=xe):xe=t[53];let Se;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Se=h?(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[54]=Se):Se=t[54];let Ce;t[55]===y?Ce=t[56]:(Ce=y&&!h?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(s,{id:`sER-bs`})}):null,t[55]=y,t[56]=Ce);let we;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(we=Oi(`flex items-center gap-1`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[57]=we):we=t[57];let Te;t[58]!==r||t[59]!==O||t[60]!==D||t[61]!==k||t[62]!==a?(Te=D?(0,Z.jsxs)(po,{children:[(0,Z.jsx)(eo,{asChild:!0,children:(0,Z.jsx)(KY,{icon:cu,label:r({id:`Rq1vFD`})})}),(0,Z.jsxs)(ro,{align:`end`,children:[O?null:(0,Z.jsxs)(go,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(Gu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}),k?null:(0,Z.jsxs)(go,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(Zl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]})]})]}):null,t[58]=r,t[59]=O,t[60]=D,t[61]=k,t[62]=a,t[63]=Te):Te=t[63];let Ee;t[64]===r?Ee=t[65]:(Ee=r({id:`HdkSiO`}),t[64]=r,t[65]=Ee);let De;t[66]!==m||t[67]!==a?(De=()=>a?.startCreating(`file`,m),t[66]=m,t[67]=a,t[68]=De):De=t[68];let Oe;t[69]!==Ee||t[70]!==De?(Oe=(0,Z.jsx)(KY,{icon:Mu,label:Ee,onClick:De}),t[69]=Ee,t[70]=De,t[71]=Oe):Oe=t[71];let ke;t[72]!==r||t[73]!==P||t[74]!==m||t[75]!==a?(ke=P?(0,Z.jsxs)(po,{children:[(0,Z.jsx)(eo,{asChild:!0,children:(0,Z.jsx)(KY,{icon:ho,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(ro,{align:`end`,children:(0,Z.jsx)(Dq,{parentDir:m,onSelectTemplate:e=>a?.createFromTemplate(m,e),ItemComponent:go})})]}):null,t[72]=r,t[73]=P,t[74]=m,t[75]=a,t[76]=ke):ke=t[76];let Ae;t[77]===r?Ae=t[78]:(Ae=r({id:`96G6Re`}),t[77]=r,t[78]=Ae);let je;t[79]!==m||t[80]!==a?(je=()=>a?.startCreating(`folder`,m),t[79]=m,t[80]=a,t[81]=je):je=t[81];let Me;t[82]!==Ae||t[83]!==je?(Me=(0,Z.jsx)(KY,{icon:$l,label:Ae,onClick:je}),t[82]=Ae,t[83]=je,t[84]=Me):Me=t[84];let Pe;t[85]!==Te||t[86]!==Oe||t[87]!==ke||t[88]!==Me?(Pe=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:we,children:[Te,Oe,ke,Me]}),t[85]=Te,t[86]=Oe,t[87]=ke,t[88]=Me,t[89]=Pe):Pe=t[89];let Fe;t[90]!==xe||t[91]!==Ce||t[92]!==Pe?(Fe=(0,Z.jsxs)(xM,{"data-electron-drag":h?``:void 0,className:xe,children:[Se,Ce,Pe]}),t[90]=xe,t[91]=Ce,t[92]=Pe,t[93]=Fe):Fe=t[93];let Ie=h&&y&&`motion-safe:delay-100`,Le=b&&`opacity-0`,Re;t[94]!==Ie||t[95]!==Le?(Re=Oi(`px-2 pb-2`,h&&`[-webkit-app-region:no-drag]`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ie,Le),t[94]=Ie,t[95]=Le,t[96]=Re):Re=t[96];let ze;t[97]===g?ze=t[98]:(ze=[g],t[97]=g,t[98]=ze);let Be;t[99]===n?Be=t[100]:(Be=(0,Z.jsx)(FY,{onClick:n}),t[99]=n,t[100]=Be);let Ve;t[101]!==ze||t[102]!==Be?(Ve=(0,Z.jsx)(de,{fallbackRender:JY,onError:PY,resetKeys:ze,children:Be}),t[101]=ze,t[102]=Be,t[103]=Ve):Ve=t[103];let He;t[104]!==Re||t[105]!==Ve?(He=(0,Z.jsx)(`div`,{className:Re,children:Ve}),t[104]=Re,t[105]=Ve,t[106]=He):He=t[106];let Ue;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsxs)(CM,{children:[(0,Z.jsx)(uI,{}),(0,Z.jsx)(KJ,{ref:o})]}),t[107]=Ue):Ue=t[107];let We;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsxs)(SM,{className:`px-0`,children:[(0,Z.jsx)(RY,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(wM,{children:(0,Z.jsx)(TM,{children:(0,Z.jsx)(MY,{bridge:window.okDesktop})})}):null]}),t[108]=We):We=t[108];let Ge=!(v&&g===`collapsed`),Ke;t[109]===Ge?Ke=t[110]:(Ke=(0,Z.jsx)(yM,{enableToggle:!1,enableDrag:Ge}),t[109]=Ge,t[110]=Ke);let qe;t[111]!==Fe||t[112]!==He||t[113]!==Ke?(qe=(0,Z.jsx)(iF,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:q,children:[Fe,He,Ue,We,Ke]})}),t[111]=Fe,t[112]=He,t[113]=Ke,t[114]=qe):qe=t[114];let Je=!I,Ye,Xe;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(Mu,{"aria-hidden":`true`}),Xe=(0,Z.jsx)(s,{id:`HdkSiO`}),t[115]=Ye,t[116]=Xe):(Ye=t[115],Xe=t[116]);let Ze;t[117]!==ee||t[118]!==Je?(Ze=(0,Z.jsxs)(cF,{disabled:Je,onSelect:ee,"data-testid":`empty-space-menu-new-file`,children:[Ye,Xe]}),t[117]=ee,t[118]=Je,t[119]=Ze):Ze=t[119];let Qe;t[120]!==te||t[121]!==N||t[122]!==I?(Qe=N?(0,Z.jsxs)(oF,{children:[(0,Z.jsxs)(lF,{disabled:!I,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(ho,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(uF,{children:(0,Z.jsx)(Dq,{parentDir:``,onSelectTemplate:te,ItemComponent:cF})})]}):null,t[120]=te,t[121]=N,t[122]=I,t[123]=Qe):Qe=t[123];let $e=!I,et,tt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)($l,{"aria-hidden":`true`}),tt=(0,Z.jsx)(s,{id:`96G6Re`}),t[124]=et,t[125]=tt):(et=t[124],tt=t[125]);let nt;t[126]!==ne||t[127]!==$e?(nt=(0,Z.jsxs)(cF,{disabled:$e,onSelect:ne,"data-testid":`empty-space-menu-new-folder`,children:[et,tt]}),t[126]=ne,t[127]=$e,t[128]=nt):nt=t[128];let rt;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(pF,{}),t[129]=rt):rt=t[129];let it;t[130]!==r||t[131]!==ie||t[132]!==I?(it=F?(0,Z.jsxs)(cF,{disabled:!I,onSelect:ie,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(I?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(ht,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[130]=r,t[131]=ie,t[132]=I,t[133]=it):it=t[133];let at;t[134]!==R||t[135]!==B||t[136]!==L?(at=(0,Z.jsx)(AY,{input:B,installStates:L,dispatch:R}),t[134]=R,t[135]=B,t[136]=L,t[137]=at):at=t[137];let ot=!I,st;t[138]!==r||t[139]!==I?(st=r(I?{id:`Up2_7p`}:{id:`U8CD-l`}),t[138]=r,t[139]=I,t[140]=st):st=t[140];let ct;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(Ne,{"aria-hidden":`true`}),t[141]=ct):ct=t[141];let lt;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[142]=lt):lt=t[142];let ut;t[143]===I?ut=t[144]:(ut=I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[143]=I,t[144]=ut);let dt;t[145]!==oe||t[146]!==ot||t[147]!==st||t[148]!==ut?(dt=(0,Z.jsxs)(cF,{disabled:ot,onSelect:oe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":st,children:[ct,lt,ut]}),t[145]=oe,t[146]=ot,t[147]=st,t[148]=ut,t[149]=dt):dt=t[149];let ft;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(pF,{}),t[150]=ft):ft=t[150];let pt=V===null,mt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(s,{id:`XcGbim`}),t[151]=mt):mt=t[151];let gt;t[152]!==ce||t[153]!==U||t[154]!==pt?(gt=(0,Z.jsx)(dF,{checked:U,onCheckedChange:ce,disabled:pt,"data-testid":`empty-space-menu-show-hidden-files`,children:mt}),t[152]=ce,t[153]=U,t[154]=pt,t[155]=gt):gt=t[155];let _t;t[156]===K?_t=t[157]:(_t=K?(0,Z.jsx)(pF,{}):null,t[156]=K,t[157]=_t);let vt;t[158]!==ue||t[159]!==W?(vt=W?(0,Z.jsxs)(cF,{onSelect:ue,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Gu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[158]=ue,t[159]=W,t[160]=vt):vt=t[160];let bt;t[161]!==pe||t[162]!==G?(bt=G?(0,Z.jsxs)(cF,{onSelect:pe,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Zl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[161]=pe,t[162]=G,t[163]=bt):bt=t[163];let xt;t[164]!==Ze||t[165]!==Qe||t[166]!==nt||t[167]!==it||t[168]!==at||t[169]!==dt||t[170]!==gt||t[171]!==_t||t[172]!==vt||t[173]!==bt?(xt=(0,Z.jsxs)(sF,{children:[Ze,Qe,nt,rt,it,at,dt,ft,gt,_t,vt,bt]}),t[164]=Ze,t[165]=Qe,t[166]=nt,t[167]=it,t[168]=at,t[169]=dt,t[170]=gt,t[171]=_t,t[172]=vt,t[173]=bt,t[174]=xt):xt=t[174];let St;return t[175]!==qe||t[176]!==xt?(St=(0,Z.jsx)(_M,{variant:`inset`,children:(0,Z.jsxs)(rF,{children:[qe,xt]})}),t[175]=qe,t[176]=xt,t[177]=St):St=t[177],St}function JY(){return null}function YY(e){WY(e.target)&&(e.preventDefault(),e.stopPropagation())}function XY(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 ZY(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function QY(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 $Y={phase:`loading`};function eX(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function tX(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function nX(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=QY(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 rX(e){return e!==null&&e.kind===`project-branch-switch`}function iX(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,a=r===void 0?gp:r,{_:o}=i(),c=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,uX),[l,u]=(0,Q.useState)($Y),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(!1),p;t[0]===c?p=t[1]:(p=rX(c)?c:null,t[0]=c,t[1]=p);let m=p,h;t[2]!==o||t[3]!==m?.share.target.kind?(h=m?.share.target.kind===`folder`?o({id:`ugoTXs`}):o({id:`XH30C4`}),t[2]=o,t[3]=m?.share.target.kind,t[4]=h):h=t[4];let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{u($Y),d.current=!1,f.current=!1},t[5]=_):_=t[5];let v;t[6]===c?v=t[7]:(v=[c],t[6]=c,t[7]=v),(0,Q.useEffect)(_,v);let y;t[8]!==m||t[9]!==n?(y=()=>{m&&(d.current||(d.current=!0,n.project.fetchBranchInfo({projectPath:m.projectPath,branch:m.share.branch,kind:m.share.target.kind,path:sn(m.share.target)}).then(e=>{u(t=>eX(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),u(lX)})))},t[8]=m,t[9]=n,t[10]=y):y=t[10];let b;t[11]===m?b=t[12]:(b=[m],t[11]=m,t[12]=b),(0,Q.useEffect)(y,b);let x;t[13]!==o||t[14]!==m||t[15]!==l.phase||t[16]!==n||t[17]!==a||t[18]!==g?(x=()=>{if(l.phase!==`awaiting-cc1-recycle`||!m)return;let e=m.share.branch;if(!e){a.dismiss();return}if(f.current)return;f.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:m.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(td({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:m.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:m.share.target.kind,path:sn(m.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),Ls.error(o({id:`gQV-9w`,values:{targetNoun:g}}))}),a.dismiss();return}console.log(td({branch_dialog_action:`branch-switch-timeout`,branch:e})),Ls.error(o({id:`LBwUR6`,values:{targetNoun:g}})),a.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),Ls.error(o({id:`Jw6EC4`,values:{targetNoun:g}})),a.dismiss())}),()=>{t=!0}},t[13]=o,t[14]=m,t[15]=l.phase,t[16]=n,t[17]=a,t[18]=g,t[19]=x):x=t[19];let S;if(t[20]!==m||t[21]!==l.phase?(S=[l.phase,m],t[20]=m,t[21]=l.phase,t[22]=S):S=t[22],(0,Q.useEffect)(x,S),!m)return null;let{share:C,projectPath:w,currentBranch:T}=m,E=C.branch,D;t[23]!==o||t[24]!==l.info||t[25]!==l.phase||t[26]!==n.project||t[27]!==w||t[28]!==C.target||t[29]!==E||t[30]!==a?(D=function(){l.phase===`ready`&&XY(l.info).switchEnabled&&(console.log(td({branch_dialog_action:`switch`,branch_action:`switch`,branch:E})),u(e=>tX(e,sn(C.target))),n.project.runCheckout({projectPath:w,branch:E}).then(e=>{let t=null,n=!1;u(r=>{let{state:i,sideEffect:a}=nX(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?Ls.error(o({id:`NJyQi_`,values:{shareBranch:E}})):t===`fetch-failed`?Ls.error(o({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&Ls.error(o({id:`c863eW`,values:{shareBranch:E}})),n&&a.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),u(cX),Ls.error(o({id:`c863eW`,values:{shareBranch:E}}))}))},t[23]=o,t[24]=l.info,t[25]=l.phase,t[26]=n.project,t[27]=w,t[28]=C.target,t[29]=E,t[30]=a,t[31]=D):D=t[31];let O=D,k;t[32]!==o||t[33]!==n.project||t[34]!==w||t[35]!==C.target||t[36]!==E||t[37]!==a||t[38]!==g?(k=function(){console.log(td({branch_dialog_action:`open-current`,branch:E})),n.project.open({path:w,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:sn(C.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),Ls.error(o({id:`b5aNbi`,values:{targetNoun:g}}))}),a.dismiss()},t[32]=o,t[33]=n.project,t[34]=w,t[35]=C.target,t[36]=E,t[37]=a,t[38]=g,t[39]=k):k=t[39];let A=k,j;t[40]!==o||t[41]!==l.otherWorktreePath||t[42]!==l.phase||t[43]!==n.project||t[44]!==C.target||t[45]!==E||t[46]!==a?(j=function(){if(l.phase!==`branch-in-other-worktree`)return;let e=l.otherWorktreePath;console.log(td({branch_dialog_action:`pivot-to-other-worktree`,branch:E})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:C.target.kind,path:sn(C.target)},pendingBranch:E}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),Ls.error(o({id:`LdABLa`,values:{target:e}}))}),a.dismiss()},t[40]=o,t[41]=l.otherWorktreePath,t[42]=l.phase,t[43]=n.project,t[44]=C.target,t[45]=E,t[46]=a,t[47]=j):j=t[47];let M=j,N;t[48]===a?N=t[49]:(N=function(){console.log(td({branch_dialog_action:`cancel`})),a.dismiss()},t[48]=a,t[49]=N);let P=N,F,I,L,R,z,B,V,H,U,W,G,K,q,J,ee,Y,te;if(t[50]!==o||t[51]!==l.info||t[52]!==l.otherWorktreePath||t[53]!==l.phase||t[54]!==P||t[55]!==T||t[56]!==C.branch||t[57]!==C.owner||t[58]!==C.repo||t[59]!==C.target||t[60]!==E||t[61]!==g){te=l.phase===`ready`||l.phase===`switching`?XY(l.info):null;let e;t[79]!==l.info||t[80]!==l.phase||t[81]!==T?(e=l.phase===`ready`||l.phase===`switching`?ZY(l.info):T??`HEAD`,t[79]=l.info,t[80]=l.phase,t[81]=T,t[82]=e):e=t[82];let n=e;B=l.phase===`switching`||l.phase===`awaiting-cc1-recycle`;let r;t[83]===o?r=t[84]:(r=o({id:`OuY8t9`}),t[83]=o,t[84]=r),R=r;let i;t[85]!==o||t[86]!==E?(i=o({id:`_BthEY`,values:{shareBranch:E}}),t[85]=o,t[86]=E,t[87]=i):i=t[87],z=i;let a=l.phase===`loading`,c=l.phase===`error`;L=Xo,ee=!0,t[88]===P?Y=t[89]:(Y=e=>{e||P()},t[88]=P,t[89]=Y),I=Ko,W=`sm:max-w-xl`,G=`share-branch-switch-dialog`,K=sX,q=oX;let u;t[90]===g?u=t[91]:(u=(0,Z.jsx)(Go,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:g}})}),t[90]=g,t[91]=u);let d=C.owner,f=C.repo,p;t[92]===C.target?p=t[93]:(p=sn(C.target),t[92]=C.target,t[93]=p);let m;t[94]!==C.owner||t[95]!==C.repo||t[96]!==p?(m=(0,Z.jsx)(Wo,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`f8jU-L`,values:{0:d,1:f,2:p}})}),t[94]=C.owner,t[95]=C.repo,t[96]=p,t[97]=m):m=t[97],t[98]!==u||t[99]!==m?(J=(0,Z.jsxs)(Yo,{children:[u,m]}),t[98]=u,t[99]=m,t[100]=J):J=t[100],F=qo;let h=C.owner,_=C.repo,v;t[101]===C.target?v=t[102]:(v=sn(C.target),t[101]=C.target,t[102]=v),t[103]!==C.branch||t[104]!==C.owner||t[105]!==C.repo||t[106]!==C.target.kind||t[107]!==v?(V=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(cp,{owner:h,repo:_,path:v,kind:C.target.kind,branch:C.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=C.branch,t[104]=C.owner,t[105]=C.repo,t[106]=C.target.kind,t[107]=v,t[108]=V):V=t[108],H=l.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(s,{id:`yjExfe`,values:{shareBranch:E},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:l.otherWorktreePath})]}):a?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Te,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`w4hMYl`})}):te?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XnoA1k`,values:{targetNoun:g,shareBranch:E},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):te?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`sZ2IOu`,values:{targetNoun:g,shareBranch:E,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_902BE`,values:{targetNoun:g,shareBranch:E,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),U=te&&!te.switchEnabled&&te.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(s,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:te.conflictingFiles.map(aX)})]}):null,t[50]=o,t[51]=l.info,t[52]=l.otherWorktreePath,t[53]=l.phase,t[54]=P,t[55]=T,t[56]=C.branch,t[57]=C.owner,t[58]=C.repo,t[59]=C.target,t[60]=E,t[61]=g,t[62]=F,t[63]=I,t[64]=L,t[65]=R,t[66]=z,t[67]=B,t[68]=V,t[69]=H,t[70]=U,t[71]=W,t[72]=G,t[73]=K,t[74]=q,t[75]=J,t[76]=ee,t[77]=Y,t[78]=te}else F=t[62],I=t[63],L=t[64],R=t[65],z=t[66],B=t[67],V=t[68],H=t[69],U=t[70],W=t[71],G=t[72],K=t[73],q=t[74],J=t[75],ee=t[76],Y=t[77],te=t[78];let X;t[109]===B?X=t[110]:(X=B?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Te,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CU3AiE`})]}):null,t[109]=B,t[110]=X);let ne;t[111]!==F||t[112]!==V||t[113]!==H||t[114]!==U||t[115]!==X?(ne=(0,Z.jsxs)(F,{children:[V,H,U,X]}),t[111]=F,t[112]=V,t[113]=H,t[114]=U,t[115]=X,t[116]=ne):ne=t[116];let re;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(s,{id:`dEgA5A`}),t[117]=re):re=t[117];let ie;t[118]===P?ie=t[119]:(ie=(0,Z.jsx)(Ai,{variant:`ghost`,className:`font-mono uppercase`,onClick:P,"data-testid":`share-branch-switch-cancel`,children:re}),t[118]=P,t[119]=ie);let ae;t[120]!==l.phase||t[121]!==A||t[122]!==M||t[123]!==O||t[124]!==R||t[125]!==z||t[126]!==B||t[127]!==te?(ae=l.phase===`branch-in-other-worktree`?(0,Z.jsx)(Ai,{onClick:M,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(s,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[te?.openCurrentEnabled?(0,Z.jsxs)(Ai,{variant:`outline`,className:`font-mono uppercase`,onClick:A,disabled:B,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(fu,{className:`size-3.5`,"aria-hidden":!0}),R]}):null,(0,Z.jsx)(Ai,{onClick:O,disabled:!te?.switchEnabled||B,"aria-disabled":!te?.switchEnabled||B,"aria-describedby":te&&!te.switchEnabled&&te.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:B?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),z]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(He,{className:`size-3.5`,"aria-hidden":!0}),z]})})]}),t[120]=l.phase,t[121]=A,t[122]=M,t[123]=O,t[124]=R,t[125]=z,t[126]=B,t[127]=te,t[128]=ae):ae=t[128];let oe;t[129]!==ie||t[130]!==ae?(oe=(0,Z.jsxs)(Jo,{className:`sm:justify-between`,children:[ie,ae]}),t[129]=ie,t[130]=ae,t[131]=oe):oe=t[131];let se;t[132]!==I||t[133]!==W||t[134]!==G||t[135]!==K||t[136]!==q||t[137]!==J||t[138]!==ne||t[139]!==oe?(se=(0,Z.jsxs)(I,{className:W,"data-testid":G,onInteractOutside:K,onPointerDownOutside:q,children:[J,ne,oe]}),t[132]=I,t[133]=W,t[134]=G,t[135]=K,t[136]=q,t[137]=J,t[138]=ne,t[139]=oe,t[140]=se):se=t[140];let ce;return t[141]!==L||t[142]!==ee||t[143]!==Y||t[144]!==se?(ce=(0,Z.jsx)(L,{open:ee,onOpenChange:Y,children:se}),t[141]=L,t[142]=ee,t[143]=Y,t[144]=se,t[145]=ce):ce=t[145],ce}function aX(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function oX(e){e.preventDefault()}function sX(e){e.preventDefault()}function cX(e){return nX(e,null).state}function lX(e){return eX(e,null)}function uX(){return null}function dX(){let e=(0,$.c)(17),t=Pn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=yt(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Ze,i=new kt({url:n,name:ii,document:e,onStateless:e=>{let{payload:t}=e;xe(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:_X,onConfigValidationRejected:gX,onConfigIgnoreNestedError:hX,onUnknown:mX})},onClose:pX,onDisconnect:fX}),a=xs(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`,()=>{ks([`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 fX(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function pX(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function mX(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function hX(e){xo(e)}function gX(e){Eo(e)}function _X(e){ks([e.ch])}var vX=`#install-claude-desktop`;function yX(e){return e===`#settings`||e===vX}function bX(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function xX(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=yt(),{openTargetTransition:i}=Mt(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=Ts(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=bX(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(yX(window.location.hash))return;let e=is(window.location.hash);if(e){let t=nr(e.split(`.`).pop()??``);lt(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}if(fs(window.location.hash)){lt(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let n=Es(window.location.hash);if(!n){lt(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){lt(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=Cs(n,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(r.kind===`missing`&&/\/+$/.test(n.trim())){lt(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=Os(js(r),c);lt(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function SX(){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)(CX,t),null}function CX(){let e=EX;if(!e(window.location.hash))return;let t=new AbortController;return N(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(TX))}).catch(wX),()=>t.abort()}function wX(){}function TX(){}function EX(e){return!yX(e)&&!is(e)&&!Es(e)&&(e===``||e===`#`||e===`#/`)}function DX(){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)(OX,t),null}function OX(){let e=function(e){let t=e.target;n_({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=t_))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function kX(){let e=(0,$.c)(4),{activeTarget:t}=yt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function AX(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=yt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Fs(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;hg({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)(_g,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function jX(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=yt(),i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(M,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function MX(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(f,{name:`app`,children:(0,Z.jsx)(Bt,{children:(0,Z.jsx)(jX,{children:(0,Z.jsx)(Zg,{children:(0,Z.jsx)(NX,{})})})})}),e[0]=t):t=e[0],t}function NX(){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=e_(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:PX}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Dv,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(dX,{}),u=(0,Z.jsx)(xX,{}),d=(0,Z.jsx)(SX,{}),f=(0,Z.jsx)(kX,{}),p=(0,Z.jsx)(AX,{}),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)(DX,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(Ov,{bridge:t}):null,h=(0,Z.jsx)(ip,{}),g=t?(0,Z.jsx)(iX,{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)(yv,{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)(GY,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(bM,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(oI,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(LS,{value:s,children:(0,Z.jsxs)(mM,{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)(As,{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 PX(e,t){iI(W_(e,t),t)}ml(),Rp({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Zp(),Cm()&&km(),bh(),Rm(),typeof window<`u`&&$p({bridge:window.okDesktop}),typeof window<`u`&&um({bridge:window.okDesktop}),typeof window<`u`&&bc({bridge:window.okDesktop}),typeof window<`u`&&hc({bridge:window.okDesktop}),typeof window<`u`&&nm({bridge:window.okDesktop}),typeof window<`u`&&_p({bridge:window.okDesktop}),Hm();var FX=new Cl({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),IX=document.getElementById(`root`);if(!IX)throw Error(`Root element not found`);var LX=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Fl.createRoot)(IX).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:Is,children:(0,Z.jsx)(En,{client:FX,children:(0,Z.jsxs)(xi,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(rc,{children:LX&&window.okDesktop?(0,Z.jsx)(jp,{bridge:window.okDesktop}):(0,Z.jsx)(MX,{})}),(0,Z.jsx)(Ip,{richColors:!0,closeButton:!0})]})})})}));
|