@inkeep/open-knowledge 0.27.0-beta.2 → 0.27.0-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-ZpA-rcTF.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-C60Y8z32.mjs +1 -0
- package/dist/{init-N93t43dU.mjs → init-Cw5lSFda.mjs} +3 -3
- package/dist/loader-AzVlDL9Q.mjs +1 -0
- package/dist/{loader-CuQWfzhB.mjs → loader-BB3StuVP.mjs} +2 -2
- package/dist/preview-DiEuCxlc.mjs +1 -0
- package/dist/{preview-CSnALfS9.mjs → preview-VQLx0qR6.mjs} +2 -2
- package/dist/public/assets/{index-CTjU4rqA.js → index-BFz0okIV.js} +1 -1
- package/dist/public/index.html +1 -1
- package/dist/{repair-launch-json-DGqnN4vj.mjs → repair-launch-json-DjbHjime.mjs} +2 -2
- package/dist/{repair-mcp-configs-DqOZs-Qp.mjs → repair-mcp-configs-Zo0iqRkn.mjs} +2 -2
- package/dist/{src-CoN1oJJx.mjs → src-DFyp-u5J.mjs} +2 -2
- package/dist/start-yAdBlXBN.mjs +1 -0
- package/dist/{start-CmiUclNB.mjs → start-yTYIxEV0.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-D7CpsA6Y.mjs +0 -2
- package/dist/init-BHjfxyYk.mjs +0 -1
- package/dist/loader-Bh3bMpcC.mjs +0 -1
- package/dist/preview-CTmKoJys.mjs +0 -1
- package/dist/start-Br36Zet1.mjs +0 -1
|
@@ -26,7 +26,7 @@ Error generating stack: `+e.message+`
|
|
|
26
26
|
`).trim();return i.length===0||i.length>YC||i.includes(`
|
|
27
27
|
`)?null:i}function ew(e){let t=Xe(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function tw(e,t){return e.current===t.current&&e.total===t.total}function nw(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(JC)}function rw(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=ge(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 iw(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=ZC(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)(JC),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(ow))},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(aw)},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(JC);return}if(!u.open||r){i.commands.clearFindMatches(),p(JC);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=ew(i);p(t=>tw(t,e)?t:e)},XC);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=Xe(i.state),t=ew(i);p(e=>tw(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=$C(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(jl(t,`find`)){t.preventDefault(),u.open?nw(i,d,p):e(!1);return}if(jl(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=jl(t,`find-next`),n=jl(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&rw(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),nw(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=Xe(i.state),t=ew(i);p(e=>tw(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(){nw(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()&&rw(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()&&rw(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)&&rw(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)&&rw(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,ee,te,K;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),ee=e=>d(t=>({...t,replaceOpen:e})),te=e=>d(t=>({...t,caseSensitive:e})),K=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=ee,t[66]=te,t[67]=K):(W=t[63],G=t[64],ee=t[65],te=t[66],K=t[67]);let ne;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?(ne=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(qC,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:ee,onCaseSensitiveChange:te,onWholeWordChange:K,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]=ne):ne=t[80],ne}function aw(e){return{...e,open:!1,activeIndex:0}}function ow(e){return{...e,activeIndex:0}}var sw=300;function cw(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(eu),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(eu);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(iu(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,sw)};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 lw(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function uw(e){let t=(0,$.c)(8),{poolEntries:n}=gt(),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=()=>lw(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(lw(i));let t=()=>s(lw(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 dw(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>cu(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(lu,r)}var fw=`ok-doc-panel-width-v1`;function pw(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function mw(e){try{let t=(e??localStorage).getItem(fw);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?pw(n):320}catch{return 320}}function hw(e,t){try{(t??localStorage).setItem(fw,String(pw(e)))}catch{}}function gw(){try{return typeof localStorage>`u`?320:mw()}catch{return 320}}var _w=1024,vw=1280,yw={left:_w,right:vw};function bw(e,t,n){return e==null?t>=yw[n]?`above`:`below`:`embedded`}function xw(e){return e===`above`?`open`:`collapsed`}var Sw=`ok-sidebar-pins-v2`;function Cw(e){return e===`open`||e===`collapsed`}function ww(e){return e===`above`||e===`below`||e===`embedded`}function Tw(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!ww(e)||!Cw(t[e]))return!1;return!0}function Ew(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return Tw(n.left)&&(r.left=n.left),Tw(n.right)&&(r.right=n.right),r}function Dw(e){try{let t=(e??localStorage).getItem(Sw);return t==null?{}:Ew(t)}catch{return{}}}function Ow(e,t){try{t.setItem(Sw,JSON.stringify(e))}catch{}}function kw(e,t,n){return n[e]?.[t]??xw(t)}function Aw(e,t,n,r){let i=r??localStorage,a=Dw(i);return a[e]={...a[e],[t]:n},Ow(a,i),a}var jw=`ok-terminal-width-v1`;function Mw(e){return Number.isFinite(e)?e<320?320:Math.round(e):480}function Nw(e){try{let t=(e??localStorage).getItem(jw);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?Mw(n):480}catch{return 480}}function Pw(e,t){try{(t??localStorage).setItem(jw,String(Mw(e)))}catch{}}function Fw(){try{return typeof localStorage>`u`?480:Nw()}catch{return 480}}function Iw(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(`connecting`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(`connecting`);return}let t=e.configuration.websocketProvider.status;e.isSynced?r(`synced`):r(t===`connected`?`connected`:t===`disconnected`?`disconnected`:`connecting`);let n=e=>{let{status:t}=e;r(t===`connected`?Lw:t===`disconnected`?`disconnected`:`connecting`)},i=e=>{let{state:t}=e;r(t?`synced`:`connected`)},a=()=>r(`disconnected`);return e.on(`status`,n),e.on(`synced`,i),e.on(`disconnect`,a),()=>{e.off(`status`,n),e.off(`synced`,i),e.off(`disconnect`,a)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function Lw(e){return e===`synced`?`synced`:`connected`}function Rw(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function zw(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=tn(),a,o;t[0]!==i||t[1]!==n?(a=Rw(n),o=i({id:`hnq8fP`,values:{label:a}}),t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s=o,c=`composer-context-chip-file-${n}`,l;t[4]===r?l=t[5]:(l=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r())},t[4]=r,t[5]=l);let u;t[6]===n?u=t[7]:(u=(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 inline-flex size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,children:(0,Z.jsx)(Xt,{path:n,className:`size-3`,showExtensionBadge:!1})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(vs,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=d):d=t[8];let f;t[9]!==r||t[10]!==s||t[11]!==l||t[12]!==u?(f=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s,onClick:r,onKeyDown:l,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[u,d]}),t[9]=r,t[10]=s,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===a?p=t[15]:(p=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),t[14]=a,t[15]=p);let m;return t[16]!==n||t[17]!==c||t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`span`,{"data-testid":c,title:n,className:`group/chip inline-flex max-w-[14rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[f,p]}),t[16]=n,t[17]=c,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function Bw(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=Y(`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)(zw,{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 Vw(e){let t=(0,$.c)(35),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets:a,selectedTargetId:o,onSelectTarget:s,terminal:c,terminals:l,menuEmptyState:u,onMenuOpenChange:d,menuAlign:f,triggerAriaLabel:p,testIds:m}=e,h=i===void 0?!1:i,g=f===void 0?`end`:f,{_}=tn(),v=a.length>0,y=l&&l.length>0?l:null,b=y!=null||c!=null,x=v||b,S;t[0]===m?S=t[1]:(S=e=>typeof m.terminal==`function`?m.terminal(e):m.terminal,t[0]=m,t[1]=S);let C=S,w;t[2]!==r||t[3]!==n||t[4]!==h||t[5]!==m.primary?(w=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:h,onClick:r,"data-testid":m.primary,children:n}),t[2]=r,t[3]=n,t[4]=h,t[5]=m.primary,t[6]=w):w=t[6];let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ki,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=T):T=t[7];let E;t[8]!==m.trigger||t[9]!==p?(E=(0,Z.jsx)(_c,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon`,"aria-label":p,"data-testid":m.trigger,children:T})}),t[8]=m.trigger,t[9]=p,t[10]=E):E=t[10];let D;t[11]!==_||t[12]!==y||t[13]!==x||t[14]!==a||t[15]!==u||t[16]!==s||t[17]!==o||t[18]!==v||t[19]!==b||t[20]!==c||t[21]!==C||t[22]!==m?(D=x?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsxs)(bc,{"aria-label":_({id:`ALhMYW`}),children:[(0,Z.jsx)(Ac,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),y?y.map(e=>(0,Z.jsxs)(yc,{onSelect:e.onSelect,"data-testid":C(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(la,{id:ca(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Gi,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):c?(0,Z.jsxs)(yc,{onSelect:c.onSelect,"data-testid":C(`claude`),"aria-label":_({id:`AcK_r0`}),children:[(0,Z.jsx)(la,{id:ca(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`fcgvCA`})}),c.selected?(0,Z.jsx)(Gi,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,v?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsx)(Mc,{}):null,(0,Z.jsxs)(bc,{"aria-label":_({id:`BBqGS9`}),children:[(0,Z.jsx)(Ac,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(yc,{onSelect:()=>s(e),"data-testid":m.option(e.id),children:[(0,Z.jsx)(la,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),o===e.id?(0,Z.jsx)(Gi,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):u,t[11]=_,t[12]=y,t[13]=x,t[14]=a,t[15]=u,t[16]=s,t[17]=o,t[18]=v,t[19]=b,t[20]=c,t[21]=C,t[22]=m,t[23]=D):D=t[23];let O;t[24]!==g||t[25]!==D||t[26]!==m.menu?(O=(0,Z.jsx)(xc,{align:g,className:`min-w-[200px]`,"data-testid":m.menu,children:D}),t[24]=g,t[25]=D,t[26]=m.menu,t[27]=O):O=t[27];let k;t[28]!==d||t[29]!==E||t[30]!==O?(k=(0,Z.jsxs)(Dc,{onOpenChange:d,children:[E,O]}),t[28]=d,t[29]=E,t[30]=O,t[31]=k):k=t[31];let A;return t[32]!==w||t[33]!==k?(A=(0,Z.jsxs)(vx,{children:[w,k]}),t[32]=w,t[33]=k,t[34]=A):A=t[34],A}var Hw=`ok-onboarding-card-v1`,Uw={initialized:!1,steps:{file:!1,askedAi:!1},dismissed:!1,completed:!1};function Ww(e){return e===!0}function Gw(e){if(typeof e!=`object`||!e)return Uw;let t=e,n=typeof t.steps==`object`&&t.steps!==null?t.steps:{};return{initialized:Ww(t.initialized),steps:{file:Ww(n.file),askedAi:Ww(n.askedAi)},dismissed:Ww(t.dismissed),completed:Ww(t.completed)}}function Kw(e){try{let t=(e??localStorage).getItem(Hw);return t==null?Uw:Gw(JSON.parse(t))}catch(e){return console.warn(`[onboarding-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),Uw}}function qw(e,t){try{(t??localStorage).setItem(Hw,JSON.stringify(e))}catch(e){console.warn(`[onboarding-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function Jw(e){let t=Kw(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,qw(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},activate(){t.initialized||a({...t,initialized:!0})},markStepComplete(e){t.steps[e]||a({...t,steps:{...t.steps,[e]:!0}})},dismiss(){t.dismissed||a({...t,dismissed:!0})},markCompleted(){t.completed||a({...t,completed:!0})},install(){r||(r=!0,t=Kw(e),i())}}}var Yw=Jw();function Xw(e){let t=e===void 0?Yw:e;return(0,Q.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function Zw(){Yw.install()}function Qw(e){return Zc(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function $w(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=Vn.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return Qw(n.data.documents)}async function eT(e=Yw){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await $w()>=1&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function tT(e=Yw){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var nT=5200,rT=500,iT=/\.(md|mdx)$/i;function aT(e,t){return iT.test(e)?e:t?`${e}${t}`:aa(e)}function oT(e){return iT.test(e)?e.replace(iT,``):null}function sT(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function cT(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(lT),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 lT(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function uT(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),nT);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(dT),o(!0)},rT);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 dT(e){return e+1}function fT(e){let t=(0,$.c)(156),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=tn(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=cT(),m=ta(),{pageMeta:h}=Zi(),{states:g}=ha(),{dispatch:_}=Ca(),v=xa(),[y]=(0,Q.useState)(CT),[b,x]=(0,Q.useState)(null),S=Zg(),[C,w]=(0,Q.useState)(!0),[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),[k]=(0,Q.useState)(ST),A,j;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(A=()=>{if(u||n==null)return;let e=document.documentElement,t=bT,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=P(n),t=O.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=O.current;if(c||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+56}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},j=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=A,t[5]=j):(A=t[4],j=t[5]),(0,Q.useEffect)(A,j);let M=(0,Q.useRef)(c),N=(0,Q.useRef)(s),F;t[6]!==c||t[7]!==s?(F=()=>{M.current=c,N.current=s},t[6]=c,t[7]=s,t[8]=F):F=t[8],(0,Q.useEffect)(F);let I,L;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>au(()=>{M.current?N.current?.():D.current?.focus()}),L=[],t[9]=I,t[10]=L):(I=t[9],L=t[10]),(0,Q.useEffect)(I,L);let R;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(R=[],t[11]=R):R=t[11],(0,Q.useEffect)(vT,R);let z=(0,Q.useRef)(c),B,V;t[12]===c?(B=t[13],V=t[14]):(B=()=>{let e=z.current;z.current=c,e&&!c&&D.current?.focus()},V=[c],t[12]=c,t[13]=B,t[14]=V),(0,Q.useEffect)(B,V);let H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=[],t[15]=H):H=t[15];let[U,W]=(0,Q.useState)(H),[G,ee]=(0,Q.useState)(_T),te;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(te=[],t[16]=te):te=t[16];let[K,ne]=(0,Q.useState)(te),re;t[17]!==n||t[18]!==u||t[19]!==h?(re=u||n==null?``:aT(n,h.get(n)?.docExt),t[17]=n,t[18]=u,t[19]=h,t[20]=re):re=t[20];let ie=re,ae,oe;t[21]!==ie||t[22]!==G||t[23]!==u||t[24]!==C?(ae=()=>{u||C||W(e=>{if(G.has(ie))return e;let t=oT(ie),n=t===null?e:e.filter(e=>e===ie||oT(e)!==t);return n.includes(ie)?n.length===e.length?e:n:[...n,ie]})},oe=[u,C,ie,G],t[21]=ie,t[22]=G,t[23]=u,t[24]=C,t[25]=ae,t[26]=oe):(ae=t[25],oe=t[26]),(0,Q.useEffect)(ae,oe);let se;t[27]!==G||t[28]!==u||t[29]!==i||t[30]!==K||t[31]!==U?(se=u?i&&!G.has(i)&&!K.includes(i)?[i]:[]:U.filter(e=>!G.has(e)&&!K.includes(e)),t[27]=G,t[28]=u,t[29]=i,t[30]=K,t[31]=U,t[32]=se):se=t[32];let ce=se,le=Vi(d,f),ue=Vi(d,`frontmatter`),[q,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(!1),me,he;t[33]===le?(me=t[34],he=t[35]):(me=()=>{le&&de(le)},he=[le],t[33]=le,t[34]=me,t[35]=he),(0,Q.useEffect)(me,he);let ge,_e;t[36]===ue?(ge=t[37],_e=t[38]):(ge=()=>{ue&&de(ue)},_e=[ue],t[36]=ue,t[37]=ge,t[38]=_e),(0,Q.useEffect)(ge,_e);let ve=b??y,ye;t[39]!==ve||t[40]!==v?(ye=v===null?null:o_(ve),t[39]=ve,t[40]=v,t[41]=ye):ye=t[41];let be=ye,xe;t[42]!==ve||t[43]!==S||t[44]!==v?(xe=v!==null&&ve===null?d_(null,S):null,t[42]=ve,t[43]=S,t[44]=v,t[45]=xe):xe=t[45];let Se=be??xe,Ce=Se!==null,we;t[46]!==ve||t[47]!==Ce||t[48]!==g?(we=Ce?null:u_(g,ve),t[46]=ve,t[47]=Ce,t[48]=g,t[49]=we):we=t[49];let Te=we,Ee=!T&&(!C||q!==null)&&(Ce||Te!==null),De;t[50]===g?De=t[51]:(De=ra.filter(e=>g[e.id]?.installed===!0),t[50]=g,t[51]=De);let Oe=De,ke;t[52]===g?ke=t[53]:(ke=ra.some(e=>g[e.id]?.installed==null),t[52]=g,t[53]=ke);let Ae=ke,je=v===null?void 0:mr.map(e=>{let{displayName:t}=ui[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:Se===e,onSelect:()=>Be(e)}}),Me;t[54]===l?Me=t[55]:(Me=l({id:`KYSocE`}),t[54]=l,t[55]=Me);let Ne;t[56]===l?Ne=t[57]:(Ne=l({id:`7Ongq0`}),t[56]=l,t[57]=Ne);let Pe;t[58]===l?Pe=t[59]:(Pe=l({id:`HPTPGr`}),t[58]=l,t[59]=Pe);let Fe;t[60]===l?Fe=t[61]:(Fe=l({id:`qiRoLb`}),t[60]=l,t[61]=Fe);let Ie;t[62]!==Me||t[63]!==Ne||t[64]!==Pe||t[65]!==Fe?(Ie=[Me,Ne,Pe,Fe],t[62]=Me,t[63]=Ne,t[64]=Pe,t[65]=Fe,t[66]=Ie):Ie=t[66];let Le=uT(Ie,!p&&C&&!c),Re;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Re=e=>{x(e.id),l_(e.id)},t[67]=Re):Re=t[67];let ze=Re,Be=e=>{let t=a_(e);x(t),l_(t)},Ve;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=()=>{D.current?.clear(),de(null),pe(!1),W([]),ee(new Set),gx()},t[68]=Ve):Ve=t[68];let He=Ve,Ue;t[69]!==l||t[70]!==_||t[71]!==Te||t[72]!==Se||t[73]!==v?(Ue=e=>{if(e===null){_s.error(l({id:`y8B54M`}));return}if(Se!==null&&v!==null){try{v.launchInTerminal(e,Se)}catch{_s.error(l({id:`jBVUXo`}));return}tT(),He();return}Te!==null&&(E(!0),_(Te.id,e).then(gT).finally(()=>{E(!1),He()}))},t[69]=l,t[70]=_,t[71]=Te,t[72]=Se,t[73]=v,t[74]=Ue):Ue=t[74];let We=Ue,Ge;t[75]!==ie||t[76]!==Ee||t[77]!==We||t[78]!==n||t[79]!==ce||t[80]!==u||t[81]!==i||t[82]!==h||t[83]!==q||t[84]!==m?(Ge=()=>{if(!Ee)return;let{instruction:e,mentions:t}=D.current?.getContent()??{instruction:``,mentions:[]};if(u){We(da({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...ce,...t])].filter(e=>e!==i)}));return}let r=q?mu(q):void 0,a=q?.docName??null,o=q?a:ce.includes(ie)?n??null:null,s=o===null?null:aT(o,h.get(o)?.docExt),c=[...new Set([...ce,...t])].filter(e=>e!==s);We(da({docName:o,...s===null?{}:{docRelativePath:s},workspace:m,instruction:e,mentions:c,selection:r}))},t[75]=ie,t[76]=Ee,t[77]=We,t[78]=n,t[79]=ce,t[80]=u,t[81]=i,t[82]=h,t[83]=q,t[84]=m,t[85]=Ge):Ge=t[85];let Ke=Ge;if(c)return null;let qe=``,Je=``;if(q){let e;t[86]!==h||t[87]!==q?(e=hu(q,aT(q.docName,h.get(q.docName)?.docExt).split(`/`).pop()??``),t[86]=h,t[87]=q,t[88]=e):e=t[88],qe=e;let n;t[89]===q.markdown?n=t[90]:(n=gu(q.markdown),t[89]=q.markdown,t[90]=n),Je=n}let Ye;t[91]!==l||t[92]!==u||t[93]!==o?(Ye=u?null:(0,Z.jsx)(X,{type:`button`,variant:`outline`,"aria-label":l({id:`EWX92Z`}),onClick:()=>o?.(),"data-testid":`ask-ai-collapse`,className:`-top-2.5 -translate-x-1/2 absolute left-1/2 z-10 h-5 w-10 rounded-md p-0 text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100`,children:(0,Z.jsx)(Ki,{className:`size-3.5`,"aria-hidden":!0})}),t[91]=l,t[92]=u,t[93]=o,t[94]=Ye):Ye=t[94];let Xe;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=e=>ee(t=>{let n=new Set(t);return n.add(e),n}),t[95]=Xe):Xe=t[95];let Ze;t[96]!==l||t[97]!==qe||t[98]!==Je||t[99]!==q||t[100]!==fe?(Ze=q?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:qe,className:`group/chip inline-flex max-w-[16rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{de(null),pe(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Ff,{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)(vs,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"aria-expanded":fe,"aria-label":l(fe?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>pe(hT),"data-testid":`composer-selection-peek`,className:`h-auto min-h-0 min-w-0 shrink justify-start px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:qe})})]}),fe&&Je!==``?(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:Je}):null]}):null,t[96]=l,t[97]=qe,t[98]=Je,t[99]=q,t[100]=fe,t[101]=Ze):Ze=t[101];let Qe;t[102]!==ce||t[103]!==Ze?(Qe=(0,Z.jsx)(Bw,{files:ce,onRemoveFile:Xe,children:Ze}),t[102]=ce,t[103]=Ze,t[104]=Qe):Qe=t[104];let $e;t[105]===l?$e=t[106]:($e=l({id:`xWEvuo`}),t[105]=l,t[106]=$e);let et;t[107]!==k||t[108]!==Ke||t[109]!==$e?(et=(0,Z.jsx)(Lx,{ref:D,ariaLabel:$e,onEmptyChange:w,onContentChange:hx,onMentionsChange:ne,onSubmit:Ke,initialDoc:k,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),t[107]=k,t[108]=Ke,t[109]=$e,t[110]=et):et=t[110];let tt;t[111]!==C||t[112]!==p||t[113]!==Le?(tt=C?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:Y(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!p&&`transition-opacity duration-500 ease-in-out`,Le.visible?`opacity-100`:`opacity-0`),children:Le.text}):null,t[111]=C,t[112]=p,t[113]=Le,t[114]=tt):tt=t[114];let nt;t[115]!==et||t[116]!==tt?(nt=(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[et,tt]}),t[115]=et,t[116]=tt,t[117]=nt):nt=t[117];let rt;t[118]!==Te||t[119]!==Se?(rt=Se===null?Te?(0,Z.jsx)(la,{id:Te.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(la,{id:ca(Se),className:`size-4`,"aria-hidden":!0}),t[118]=Te,t[119]=Se,t[120]=rt):rt=t[120];let it;t[121]!==Te||t[122]!==Se?(it=(0,Z.jsx)(`span`,{children:Se===null?Te?(0,Z.jsx)(J,{id:`nUNZL4`,values:{0:Te.displayName}}):(0,Z.jsx)(J,{id:`F-vBv0`}):(0,Z.jsx)(J,{id:`ti6aF_`,values:{0:ui[Se].displayName}})}),t[121]=Te,t[122]=Se,t[123]=it):it=t[123];let at;t[124]===T?at=t[125]:(at=T?(0,Z.jsx)(ts,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[124]=T,t[125]=at);let ot;t[126]!==rt||t[127]!==it||t[128]!==at?(ot=(0,Z.jsxs)(Z.Fragment,{children:[rt,it,at]}),t[126]=rt,t[127]=it,t[128]=at,t[129]=ot):ot=t[129];let st=!Ee,ct=Ce?null:Te?.id??null,lt;t[130]===Ae?lt=t[131]:(lt=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:Ae?(0,Z.jsx)(J,{id:`EcR0fl`}):(0,Z.jsx)(J,{id:`l6OXqI`})}),t[130]=Ae,t[131]=lt);let ut;t[132]===l?ut=t[133]:(ut=l({id:`nskygk`}),t[132]=l,t[133]=ut);let dt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(dt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:mT,terminal:pT},t[134]=dt):dt=t[134];let ft;t[135]!==je||t[136]!==ze||t[137]!==Oe||t[138]!==Ke||t[139]!==ot||t[140]!==st||t[141]!==ct||t[142]!==lt||t[143]!==ut?(ft=(0,Z.jsx)(Vw,{primary:ot,onPrimary:Ke,primaryDisabled:st,installedTargets:Oe,selectedTargetId:ct,onSelectTarget:ze,terminals:je,menuEmptyState:lt,triggerAriaLabel:ut,testIds:dt}),t[135]=je,t[136]=ze,t[137]=Oe,t[138]=Ke,t[139]=ot,t[140]=st,t[141]=ct,t[142]=lt,t[143]=ut,t[144]=ft):ft=t[144];let pt;t[145]!==nt||t[146]!==ft?(pt=(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[nt,ft]}),t[145]=nt,t[146]=ft,t[147]=pt):pt=t[147];let mt;t[148]!==Ye||t[149]!==Qe||t[150]!==pt?(mt=(0,Z.jsxs)(`div`,{ref:O,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:[Ye,Qe,pt]}),t[148]=Ye,t[149]=Qe,t[150]=pt,t[151]=mt):mt=t[151];let ht=mt;if(u){let e;return t[152]===ht?e=t[153]:(e=(0,Z.jsx)(`div`,{className:`shrink-0 pt-2 pb-3`,"data-testid":`bottom-composer`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-6`,children:ht})}),t[152]=ht,t[153]=e),e}let gt;return t[154]===ht?gt=t[155]:(gt=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-[var(--conflict-footer-height,0px)] z-20 editor-content-aligned bg-gradient-to-t from-background from-65% via-background to-transparent pt-10 pb-2`,"data-testid":`bottom-composer`,children:ht}),t[154]=ht,t[155]=gt),gt}function pT(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function mT(e){return`ask-ai-agent-option-${e}`}function hT(e){return!e}function gT(e){e.ok&&tT()}function _T(){return new Set}function vT(){let e=yT;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function yT(e){jl(e,`open-ask-ai`)&&(sT(e.target)||(e.preventDefault(),uu()))}function bT(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(xT);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 xT(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function ST(){return mx().doc??void 0}function CT(){return c_()}function wT(e){return!e.terminalVisible&&!e.isEmbedded&&e.activeDocName!==null}function TT(e){return!e.terminalVisible&&!e.isEmbedded}function ET(e,t={}){let n=rt(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var DT=200,OT=`Outside any block`;function kT(e){let t=(0,$.c)(5),{editor:n}=e,r=Yt(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?AT(n,r):o.current?OT:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},DT),()=>{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 AT(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=ET(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=ET(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}`}}var jT=!1;function MT(e,t,n,r){let i=e[t];if(typeof i!=`function`){console.warn(`[cold-mount-instrumentation] target missing method "${t}"`);return}e[t]=function(...e){let t=performance.now(),a,o=!1;try{return a=i.apply(this,e),o=!0,a}finally{let e=performance.now()-t,i;if(o&&r)try{i=r(this,a,t,e)}catch(e){i={"instrumentation-error":e instanceof Error?e.message:String(e)}}try{ml(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function NT(e){return e?.doc?typeof e.doc.nodeSize==`number`?e.doc.nodeSize:e.doc.content&&typeof e.doc.content.size==`number`?e.doc.content.size:null:null}var PT=0,FT=0,IT=0,LT=0,RT=null,zT=[`linkResolutionDecoration$`],BT=new WeakSet,VT=new WeakSet;function HT(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function UT(){return!1}function WT(){return!UT()}function GT(e,t){if(WT())return t;let n=`ok/cold/nodeview-factory-${HT(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;ml(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function KT(e){if(WT())return;let t=e.state.plugins;for(let e of t){if(VT.has(e))continue;let t=e.spec?.key?.key;if(!t||!zT.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){VT.add(e);continue}let i=`ok/cold/decoration-${HT(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;ml(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},VT.add(e)}}function qT(e){if(WT())return;let t=e._props?.nodeViews;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(typeof n!=`function`||n.__okWrapped===!0)continue;let r=GT(e,n);r.__okWrapped=!0,t[e]=r}}function JT(e){return WT()?e:e.map(e=>{let t=e.name??`unknown`,n=HT(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;ml(`ok/cold/ext-${n}-on-before-create`,{ext:t,hook:`onBeforeCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;ml(`ok/cold/ext-${n}-on-create`,{ext:t,hook:`onCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onUpdate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;ml(`ok/cold/ext-${n}-on-update`,{ext:t,hook:`onUpdate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onDestroy(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;ml(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function YT(){if(!jT){jT=!0,MT(_r.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return WT()||(RT=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:NT(i.editorState),durationMs:r}}),MT(_r.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!WT()&&!BT.has(e)&&t.view&&(KT(t.view),qT(t.view),BT.add(e)),{docSize:NT(t.editorState)}}),MT(_r.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{LT+=1;let i=e;return!WT()&&i.view&&qT(i.view),{docSize:NT(i.view),seq:LT,durationMs:r}}),MT(ri.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(FT+=1,{seq:FT,docSize:NT(e.state),durationMs:r})),MT(ri.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(IT+=1,{seq:IT,docSize:NT(e.state),durationMs:r})),MT(fe.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{PT+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:PT,topLevelYElements:a,durationMs:r}}),MT(at.prototype,`init`,`ok/cold/ec-init`,e=>({editorPresent:!!e.props?.editor}));try{typeof PerformanceObserver<`u`&&new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=t.name;if((e===`first-paint`||e===`first-contentful-paint`)&&(ml(e===`first-paint`?`ok/cold/paint-fp`:`ok/cold/paint-fcp`,{entryType:t.entryType,startTime:Math.round(t.startTime*1e3)/1e3},{startTime:t.startTime,duration:0}),!WT()&&e===`first-paint`&&RT!==null)){let e=RT,n=Math.max(0,t.startTime-e);ml(`ok/cold/append-to-paint`,{paintEntryType:t.entryType,durationMs:Math.round(n*1e3)/1e3,paintAt:Math.round(t.startTime*1e3)/1e3},{startTime:e,duration:n}),RT=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}function XT(){let[e]=(0,Q.useState)(zn);return e}function ZT({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:mi(e.display_name),color:Sr(e.id,Zn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Sr(e.id,Zn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function QT(e,t){return e>t}function $T(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 eE=3,tE=6e4;function nE(e,t){let n=0;for(let r of e)t-r<tE&&(n+=1);return n<eE}var rE=new Map;function iE(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 aE(e){let t=L.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function oE(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=L.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){ml.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=>{QT(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!QT(i,a)||l!==null&&aE(l.state))return;o=!0;let e=Date.now();for(let[t,n]of rE)n.every(t=>e-t>=tE)&&rE.delete(t);let t=(rE.get(n)??[]).filter(t=>e-t<tE);if(!nE(t,e)){rE.set(n,t),ml.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),rE.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,ml.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==L&&iE(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new Kr({state:{init:()=>null,apply:e=>($T(e.getMeta(L))&&(a=i,o&&ml.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!QT(i,a)||aE(t)?!0:e.getMeta(L)!==void 0,view:e=>{let r=t.doc;return r==null?(ml.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 sE(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 cE=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&&Hr(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(Zs(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(qs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ys(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Js(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Gs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Xs(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Us(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Ws(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=Ar(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Er){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 er){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():sE(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Ks(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()}},lE=e=>new Kr({key:typeof e.pluginKey==`string`?new Rr(e.pluginKey):e.pluginKey,view:t=>new cE({view:t,...e})});Xn.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[lE({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 uE=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 xr(e,{textSerializers:ur(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Zs(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(qs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ys(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Js(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Gs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Xs(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Us(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Ws(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=Ar(this.view,e.from,e.to);Ks({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()}},dE=e=>new Kr({key:typeof e.pluginKey==`string`?new Rr(e.pluginKey):e.pluginKey,view:t=>new uE({view:t,...e})});Xn.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?[dE({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 fE(e,t){return e??new Rr(t)}var pE=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,mE=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),hE=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(`.`)),gE=new Set([`children`,`className`,`style`]),_E=new Set([`tabIndex`]),vE=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),yE={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function bE(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function xE(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function SE(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||vE.has(e)}function CE(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function wE(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:yE[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function TE(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 EE(e){return _E.has(e)}function DE(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function OE(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 kE(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||hE.has(e)?String(t):`${t}px`}function AE(e,t){mE.has(t)||e.style.removeProperty(CE(t))}function jE(e,t,n){mE.has(t)||e.style.setProperty(CE(t),kE(t,n))}function ME(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(gE.has(r)||!SE(r)||bE(r,t[r])||bE(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=xE(r);if(a==null||a===!1){EE(r)&&OE(e,r),e.removeAttribute(o);return}if(a===!0){EE(r)&&DE(e,r,!0),e.setAttribute(o,``);return}if(EE(r)){DE(e,r,a);return}e.setAttribute(o,String(a))})}function NE(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function PE(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){AE(e,t);return}jE(e,t,a)}})}function FE(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(!bE(t,n))return;let{eventName:i,options:a}=wE(t),o=t=>{n(TE(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function IE(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);pE(()=>{let i=n.current;return NE(e,i.className,t.className),PE(e,i.style,t.style),ME(e,i,t),r.current=FE(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 LE=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)(fE(e,`bubbleMenu`)).current;IE(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=H(),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=lE({...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,yd.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)(fE(e,`floatingMenu`)).current;IE(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=H(),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=dE({...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,yd.createPortal)(s,u.current)});var RE=[{name:`paragraph`,label:`Text`,icon:ff,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:we,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:ye,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:xe,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:de,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:T,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:_e,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:f,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:Cf,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function zE(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:BE},t[0]=n,t[1]=r);let{current:i,activeStates:a}=S(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)(Ki,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(_c,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=RE.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(yc,{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)(xc,{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)(Dc,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function BE(e){let t=Object.fromEntries(RE.map(t=>[t.name,t.isActive(e.editor)]));return{current:RE.find(e=>t[e.name])??RE[0],activeStates:t}}var VE=`open-knowledge:active-terminal-input`;function HE(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(VE,{detail:e}))}function UE(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;typeof n==`string`&&e(n)};return t.addEventListener(VE,n),()=>t.removeEventListener(VE,n)}function WE(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function GE(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r;if(pa())return null;let a;return t[0]!==n||t[1]!==i?(a=(0,Z.jsx)(KE,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}function KE(e){let t=(0,$.c)(11),{editor:n,shortcutEnabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=ni(),t[0]=i):i=t[0];let a=i,o,s;t[1]===r?(o=t[2],s=t[3]):(o=()=>{if(!a)return;let e=e=>{r&&jl(e,`edit-with-ai`)&&(WE(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),uu()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},s=[r,a],t[1]=r,t[2]=o,t[3]=s),(0,Q.useEffect)(o,s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Xa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[4]=c):c=t[4];let l;t[5]===n?l=t[6]:(l=()=>{let e=ht(n),t=yu(n);requestAnimationFrame(()=>{if(e===null||t.trim()===``){uu();return}HE(Qr({relativePath:aa(e),instruction:``,selectionMarkdown:t,target:`claude-code`}))})},t[5]=n,t[6]=l);let u,d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(is,{className:`size-3.5`,"aria-hidden":`true`}),d=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`xWEvuo`})}),t[7]=u,t[8]=d):(u=t[7],d=t[8]);let f;return t[9]===l?f=t[10]:(f=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:l,children:[u,d]})]}),t[9]=l,t[10]=f),f}function qE(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 JE(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:ft(typeof n.src==`string`?n.src:``)}function YE(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 XE(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=tn(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:ZE},t[0]=n,t[1]=i),S(i)===null)return null;let a;t[2]===r?a=t[3]:(a=r({id:`WcWS__`}),t[2]=r,t[3]=a);let o;t[4]===n?o=t[5]:(o=e=>{e.preventDefault();let t=qE(n);t&&YE(t,JE(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(vo,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a,className:`text-accent-foreground`,onMouseDown:o,children:s})}),t[7]=a,t[8]=o,t[9]=c):c=t[9];let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`WcWS__`})}),t[10]=l):l=t[10];let u;return t[11]===c?u=t[12]:(u=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(As,{children:[c,l]})}),t[11]=c,t[12]=u),u}function ZE(e){return qE(e.editor)}function QE(e){return qE(e)!==null}function $E(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function eD(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 tD(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function nD(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=tn(),i;t[0]===n?i=t[1]:(i={editor:n,selector:rD},t[0]=n,t[1]=i);let a=S(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!$E(n)||n.state.selection.empty||tD(n)||eD(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=Ur(br(n.state.doc)),o=Cr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(o,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=a,t[3]=n,t[4]=o):o=t[4];let s=o,c;t[5]===r?c=t[6]:(c=r({id:`sIGbBZ`}),t[5]=r,t[6]=c);let l;t[7]===s?l=t[8]:(l=e=>{e.preventDefault(),s()},t[7]=s,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ae,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==c||t[12]!==l?(d=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":c,onMouseDown:l,disabled:a,children:u})}),t[10]=a,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;t[14]===r?f=t[15]:(f=r({id:`sIGbBZ`}),t[14]=r,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:f}),t[16]=f,t[17]=p);let m;return t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(As,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function rD(e){let t=e.editor;return!!(!$E(t)||t.state.selection.empty||tD(t)||eD(t))}var iD=`img, .ok-embed, .ok-video`,aD=220,oD=`cubic-bezier(0.23, 1, 0.32, 1)`,sD=`ok-image-align-flip`,cD=.5;function lD(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function uD(){return typeof requestAnimationFrame==`function`}function dD(e){return e?e.querySelector(iD):null}function fD(e,t){if(lD()||!uD()){t();return}let n=dD(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=dD(e);if(!t)return;for(let e of t.getAnimations())e.id===sD&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<cD)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:aD,easing:oD,fill:`none`});i.id=sD})}var pD=[{value:`left`,label:`Align left`,icon:Pf},{value:`center`,label:`Align center`,icon:Mf},{value:`right`,label:`Align right`,icon:Nf}];function mD(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Ht.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function hD(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:gD},t[0]=n,t[1]=r);let i=S(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=pD.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(!Ht.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(Er.create(u.doc,s)),fD(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Os,{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 gD(e){return mD(e.editor)}function _D(e){return mD(e)!==null}var vD=[{name:`bold`,icon:_d,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:qd,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Lf,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:kf,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:nt,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Gd,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function yD(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:bD},t[0]=n,t[1]=r);let i=S(r),a;t[2]!==i||t[3]!==n?(a=vD.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(Os,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(F,{"aria-label":Ml(e.shortcutId),children:Al(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 bD(e){return Object.fromEntries(vD.map(t=>[t.name,t.isActive(e.editor)]))}function xD(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=tn(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=(0,Q.useRef)(null),{folderPaths:l,loading:u,pages:d}=Zi(),f;t[0]===n?f=t[1]:(f=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=n.getAttributes(`link`).href??``,t[2]=n,t[3]=m);let h=m,g;t[4]===n?g=t[5]:(g=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=g);let _=g,v,y;t[6]===n?(v=t[7],y=t[8]):(v=()=>{let e=function(){n.state.selection.empty&&a(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},y=[n],t[6]=n,t[7]=v,t[8]=y),(0,Q.useEffect)(v,y);let b,x;t[9]===i?(b=t[10],x=t[11]):(b=()=>{i&&requestAnimationFrame(()=>c.current?.focus())},x=[i],t[9]=i,t[10]=b,t[11]=x),(0,Q.useEffect)(b,x);let S;t[12]!==n||t[13]!==p||t[14]!==o?(S=function(){o.trim()?n.chain().focus().setLink({href:o.trim()}).run():p&&n.chain().focus().unsetLink().run(),a(!1)},t[12]=n,t[13]=p,t[14]=o,t[15]=S):S=t[15];let C=S,w;t[16]===n?w=t[17]:(w=function(){n.chain().focus().unsetLink().run(),a(!1)},t[16]=n,t[17]=w);let T=w,E;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){s(ie(e.path,null))},t[18]=E):E=t[18];let D=E,O;t[19]!==C||t[20]!==n?(O=function(e){e.key===`Enter`&&(e.preventDefault(),C()),e.key===`Escape`&&(e.preventDefault(),a(!1),n.chain().focus().run())},t[19]=C,t[20]=n,t[21]=O):O=t[21];let k=O;if(i){let e;t[22]===r?e=t[23]:(e=r({id:`ZsGpr_`}),t[22]=r,t[23]=e);let n;t[24]===r?n=t[25]:(n=r({id:`roAe2K`}),t[24]=r,t[25]=n);let i;t[26]!==l||t[27]!==k||t[28]!==u||t[29]!==d||t[30]!==e||t[31]!==n||t[32]!==o?(i=(0,Z.jsx)(ot,{ref:c,type:`text`,placeholder:e,value:o,pages:d,folderPaths:l,loading:u,onValueChange:s,onSuggestionSelect:D,onKeyDown:k,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[26]=l,t[27]=k,t[28]=u,t[29]=d,t[30]=e,t[31]=n,t[32]=o,t[33]=i):i=t[33];let a;t[34]===r?a=t[35]:(a=r({id:`tP5DDk`}),t[34]=r,t[35]=a);let f;t[36]===C?f=t[37]:(f=()=>{C()},t[36]=C,t[37]=f);let m;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Ad,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=m):m=t[38];let g;t[39]!==a||t[40]!==f?(g=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:f,children:m}),t[39]=a,t[40]=f,t[41]=g):g=t[41];let _;t[42]!==i||t[43]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,g]}),t[42]=i,t[43]=g,t[44]=_):_=t[44];let v;t[45]!==r||t[46]!==h||t[47]!==p||t[48]!==T?(v=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),Qt(h)},children:(0,Z.jsx)(Pi,{className:`size-3.5`})})}),(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`2vIPtm`})})]}),(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),T()},children:(0,Z.jsx)(Do,{className:`size-3.5`})})}),(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`484LKL`})})]})]}),t[45]=r,t[46]=h,t[47]=p,t[48]=T,t[49]=v):v=t[49];let y;return t[50]!==_||t[51]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[_,v]}),t[50]=_,t[51]=v,t[52]=y):y=t[52],y}let A;t[53]===r?A=t[54]:(A=r({id:`p0Iq25`}),t[53]=r,t[54]=A);let j=p?`bg-accent text-primary`:`text-accent-foreground`,M;t[55]===_?M=t[56]:(M=e=>{e.preventDefault(),s(_()),a(!0)},t[55]=_,t[56]=M);let N;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Yd,{className:`size-3.5`}),t[57]=N):N=t[57];let P;t[58]!==A||t[59]!==j||t[60]!==M?(P=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":A,className:j,onMouseDown:M,children:N})}),t[58]=A,t[59]=j,t[60]=M,t[61]=P):P=t[61];let I;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(J,{id:`yzF66j`}),t[62]=I):I=t[62];let L;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsxs)(Os,{side:`bottom`,sideOffset:8,children:[I,(0,Z.jsx)(F,{children:Al(`command-palette`)})]}),t[63]=L):L=t[63];let R;return t[64]===P?R=t[65]:(R=(0,Z.jsxs)(As,{children:[P,L]}),t[64]=P,t[65]=R),R}function SD({editor:e}){if(Xe(e.state).query||e.isActive(`codeBlock`))return!1;if(_D(e)||QE(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 CD(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:OD},t[0]=n,t[1]=l);let u=S(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:DD},t[2]=n,t[3]=d);let f=S(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Ar(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=Hs(e,t,()=>{Ks(e,t,{placement:`top`,strategy:`fixed`,middleware:[Ys(8),Zs(),qs({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(ED)}))},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(TD)},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)(hD,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(XE,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(zE,{editor:n}),(0,Z.jsx)(Xa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(yD,{editor:n},o),(0,Z.jsx)(Xa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(xD,{editor:n},`${o}-link`),(0,Z.jsx)(nD,{editor:n},`${o}-footnote`),(0,Z.jsx)(GE,{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)(LE,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:wD,shouldShow:SD,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 wD(){return document.body}function TD(e){return e+1}function ED(){}function DD(e){return QE(e.editor)}function OD(e){return _D(e.editor)}var kD=56,AD=`0 2px 4px rgba(0, 0, 0, 0.08)`,jD=150,MD=globalThis.ScrollTimeline;function ND(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+kD);return{startOffset:o,endOffset:o+a,maxShift:a}}var PD=new WeakMap;function FD(e){let t=PD.get(e);if(t){for(let e of t.animations)e.cancel();PD.delete(e)}}function ID(e){for(let t of Array.from(e.cells))FD(t)}var LD=e=>e.cellIndex===0?`3`:`2`;function RD(e,t){return zD(e,t,e=>({transform:`translateY(${e}px)`}))}function zD(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 BD(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 VD(e,t,n){return BD(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:AD})}function HD(e,t){return BD(e,t,{opacity:`0`},{opacity:`1`})}function UD(e,t,n,r){let i=LD(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=PD.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(RD(n,r),s),l=e.animate(VD(n,r,i),s),u=e.animate(HD(n,r),{...s,pseudoElement:`::before`});PD.set(e,{key:a,animations:[c,l,u]})}function WD(e,t){let n=LD(e),r=`in|${t}|${n}`,i=PD.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:AD}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});PD.set(e,{key:r,animations:[a,o]})}function GD(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=ND(a,i,c.top,c.height,l.height);if(!u){ID(s);continue}if(n){if(o<=0){ID(s);continue}for(let e of Array.from(s.cells))UD(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+kD){ID(s);continue}for(let e of Array.from(s.cells))WD(e,d)}}var KD=Xn.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new Kr({key:new Rr(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||GD(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()},jD);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&MD)try{n=new MD({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`))ID(t)}}}})]}});function qD(e,t){return(n,r)=>{let i=r,a=Iu(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function JD(e,t){let n=wu(e);t(n.target,{tabBehavior:`append`}),yl(n.hash)}var YD=5,XD=1;function ZD(e){let t=(0,$.c)(14),{editor:n,axis:r,anchor:i,onClickGesture:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(a),l,u;t[0]===a?(l=t[1],u=t[2]):(l=()=>{c.current=a},u=[a],t[0]=a,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current?.abort(),s.current=null,o.current=null,document.body.style.cursor=``,document.body.style.userSelect=``},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>!(e&&o.current!==null),t[5]=_):_=t[5];let v=_,y;t[6]!==i||t[7]!==r||t[8]!==n?(y=e=>{if(e.button!==0)return;s.current?.abort(),o.current={startX:e.clientX,startY:e.clientY,isDragging:!1,lastTarget:null};let t=new AbortController;s.current=t;let{signal:a}=t,l=e=>{let t=o.current;if(!t)return;if(!t.isDragging){let n=e.clientX-t.startX,r=e.clientY-t.startY;if(Math.hypot(n,r)<YD)return;t.isDragging=!0,m(!0),document.body.style.cursor=`grabbing`,document.body.style.userSelect=`none`}let n=QD(i,r,e.clientX,e.clientY);t.lastTarget=n,g(n)},u=()=>{t.abort(),s.current===t&&(s.current=null),document.body.style.cursor=``,document.body.style.userSelect=``;let e=o.current;o.current=null,m(!1),g(null),e&&(e.isDragging&&e.lastTarget?nO(n,i,r,e.lastTarget.index):e.isDragging||c.current())};document.addEventListener(`pointermove`,l,{signal:a}),document.addEventListener(`pointerup`,u,{signal:a}),document.addEventListener(`pointercancel`,u,{signal:a})},t[6]=i,t[7]=r,t[8]=n,t[9]=y):y=t[9];let b=y,x;return t[10]!==h||t[11]!==p||t[12]!==b?(x={onPointerDown:b,shouldAllowOpen:v,isDragging:p,indicator:h},t[10]=h,t[11]=p,t[12]=b,t[13]=x):x=t[13],x}function QD(e,t,n,r){let i=e.closest(`table`);if(!i)return null;let a=i.getBoundingClientRect();if(t===`row`){let e=Array.from(i.rows);if(e.length===0)return null;for(let t=0;t<e.length;t++){let n=e[t].getBoundingClientRect();if(r<n.top)return{index:XD,rect:eO(a,$D(e,0,n.top))};if(r<=n.bottom){let i=r>=n.top+n.height/2,o=i?t+1:t,s=Math.max(XD,o);return{index:s,rect:eO(a,s===o?i?n.bottom:n.top:$D(e,0,n.top))}}}let t=e[e.length-1].getBoundingClientRect();return{index:e.length,rect:eO(a,t.bottom)}}let o=i.rows[0];if(!o)return null;let s=Array.from(o.cells);if(s.length===0)return null;for(let e=0;e<s.length;e++){let t=s[e].getBoundingClientRect();if(n<t.left)return{index:0,rect:tO(a,t.left)};if(n<=t.right){let r=n>=t.left+t.width/2,i=r?t.right:t.left;return{index:r?e+1:e,rect:tO(a,i)}}}let c=s[s.length-1].getBoundingClientRect();return{index:s.length,rect:tO(a,c.right)}}function $D(e,t,n){let r=e[t];return r?r.getBoundingClientRect().bottom:n}function eO(e,t){return{left:e.left,top:t-1,width:e.width,height:2}}function tO(e,t){return{left:t-1,top:e.top,width:2,height:e.height}}function nO(e,t,n,r){let i=n===`row`?rO(t):t.cellIndex;if(i<0||n===`row`&&(i<XD||r<XD)||r===i||r===i+1)return;let{state:a,view:o}=e,s=iO(a.selection.$from);if(s<0){console.warn(`[table-drag-reorder] no table found at selection depth`);return}let c=a.doc.nodeAt(s);if(!c){console.warn(`[table-drag-reorder] nodeAt returned null at tablePos`,s);return}let l=a.tr;sO(l,s,c,n===`row`?aO(c,i,r):oO(c,i,r)),o.dispatch(l)}function rO(e){let t=e.parentElement,n=t?.closest(`table`);return n?Array.prototype.indexOf.call(n.rows,t):-1}function iO(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole===`table`)return e.before(t);return-1}function aO(e,t,n){let r=[];e.forEach(e=>{r.push(e)});let[i]=r.splice(t,1),a=n>t?n-1:n;return r.splice(a,0,i),e.type.create(e.attrs,r,e.marks)}function oO(e,t,n){let r=n>t?n-1:n,i=[];return e.forEach(e=>{let n=[];e.forEach(e=>{n.push(e)});let[a]=n.splice(t,1);n.splice(r,0,a),i.push(e.type.create(e.attrs,n,e.marks))}),e.type.create(e.attrs,i,e.marks)}function sO(e,t,n,r){e.replaceRangeWith(t,t+n.nodeSize,r)}function cO(e){return[...e?[{label:`Toggle header column`,icon:Od,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:Ke,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:ze,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:Do,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Hd,run:e=>e.chain().focus().deleteTable().run()}]}function lO(e){return[...e?[{label:`Toggle header row`,icon:Af,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:Bt,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:Et,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:Do,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Hd,run:e=>e.chain().focus().deleteTable().run()}]}function uO(e){if(!e.isEditable||Xe(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 dO(e){let t=(0,$.c)(37),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(!0),t[0]=l):l=t[0];let u;t[1]!==r||t[2]!==i||t[3]!==n?(u={editor:n,axis:i,anchor:r,onClickGesture:l},t[1]=r,t[2]=i,t[3]=n,t[4]=u):u=t[4];let d=ZD(u),f,p;t[5]!==r||t[6]!==i?(f=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return Hs(r,e,()=>{Ks(r,e,{strategy:`absolute`,placement:t,middleware:[Ys(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(fO)})},p=[r,i],t[5]=r,t[6]=i,t[7]=f,t[8]=p):(f=t[7],p=t[8]),(0,Q.useEffect)(f,p);let m=i===`column`?Md:ao,h;t[9]===d?h=t[10]:(h=e=>{d.shouldAllowOpen(e)&&c(e)},t[9]=d,t[10]=h);let g=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 cursor-grab 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 cursor-grab before:absolute before:-inset-[6px] before:content-[""]`,_=i===`column`?`Column options`:`Row options`,v;t[11]===m?v=t[12]:(v=(0,Z.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[11]=m,t[12]=v);let y;t[13]!==d.onPointerDown||t[14]!==g||t[15]!==_||t[16]!==v?(y=(0,Z.jsx)(_c,{asChild:!0,children:(0,Z.jsx)(X,{variant:`secondary`,onPointerDown:d.onPointerDown,className:g,"aria-label":_,children:v})}),t[13]=d.onPointerDown,t[14]=g,t[15]=_,t[16]=v,t[17]=y):y=t[17];let b=i===`column`?`center`:`start`,x=i===`column`?`bottom`:`right`,S;if(t[18]!==n||t[19]!==a){let e;t[21]===n?e=t[22]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(Mc,{}),(0,Z.jsxs)(yc,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[21]=n,t[22]=e),S=a.map(e),t[18]=n,t[19]=a,t[20]=S}else S=t[20];let C;t[23]!==b||t[24]!==x||t[25]!==S?(C=(0,Z.jsx)(xc,{align:b,side:x,className:`w-auto min-w-44 whitespace-nowrap`,children:S}),t[23]=b,t[24]=x,t[25]=S,t[26]=C):C=t[26];let w;t[27]!==s||t[28]!==C||t[29]!==h||t[30]!==y?(w=(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)(Dc,{open:s,onOpenChange:h,children:[y,C]})}),t[27]=s,t[28]=C,t[29]=h,t[30]=y,t[31]=w):w=t[31];let T;t[32]===d.indicator?T=t[33]:(T=d.indicator&&(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none fixed z-50 bg-primary`,style:{left:d.indicator.rect.left,top:d.indicator.rect.top,width:d.indicator.rect.width,height:d.indicator.rect.height}}),t[32]=d.indicator,t[33]=T);let E;return t[34]!==w||t[35]!==T?(E=(0,Z.jsxs)(Z.Fragment,{children:[w,T]}),t[34]=w,t[35]=T,t[36]=E):E=t[36],E}function fO(){}function pO(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=uO(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=cO(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)(dO,{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=lO(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)(dO,{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 mO(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=L.getState(e.state)?.binding;if(!t){ml.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){ml.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}ml.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return Xn.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new Kr({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var hO=new WeakMap;function gO(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=Tr(e.color),n.textContent=e.name,t.append(n),t}var _O={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},vO=100,yO=100,bO=3,xO=250;function SO(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function CO(e,t){let n=ge(e);if(!n||t.contains(n.dom))return!1;if(!SO(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 wO(){let e=new Yr({extensions:hi});return{mdManager:e,text:Ue({mdManager:e}),html:o({mdManager:e}),paste:jt({mdManager:e}),drop:yt({mdManager:e})}}function TO(e,t){return t?{collaboration:it.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[mO({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:it.configure({document:e.document}),guard:[]}}function EO(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=TO(t,r);return[...wt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),yx.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,Xn.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[qe]}}),Xn.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[E(e,{cursorBuilder:gO})]}}),Xn.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[oE({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,KD]}function DO(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{hO.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=hO.get(e);if(hO.delete(e),r==null)return;let i=performance.now();ml(`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:qD(n.drop,e.onSidebarDrop)},extensions:JT(EO(e))}}function OO(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=DO({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 kO=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(_O),c=XT(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=gt(),p=n.configuration.name??``,[m]=(0,Q.useState)(wO),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new _r(OO({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;ml(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{JD(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=he(p)??crypto.randomUUID();_=Q.use,v=oe({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=()=>()=>{V(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)(AO,{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},AO=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:d,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,y;t[3]!==c||t[4]!==f?(v=()=>{CO(c,f)&&h(jO)},y=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=y):(v=t[5],y=t[6]),(0,Q.useEffect)(v,y);let b;t[7]!==c||t[8]!==n.configuration.name?(b=()=>($e(c,n.configuration.name??null),()=>{$e(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=b):b=t[9];let x;t[10]!==c||t[11]!==n?(x=[c,n],t[10]=c,t[11]=n,t[12]=x):x=t[12],(0,Q.useEffect)(b,x);let S;t[13]!==c||t[14]!==n.configuration.name?(S=()=>{let e=n.configuration.name;if(e)return Se(e,c),()=>Te(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=S):S=t[15];let C;t[16]!==c||t[17]!==n?(C=[c,n],t[16]=c,t[17]=n,t[18]=C):C=t[18],(0,Q.useEffect)(S,C);let w;t[19]!==c||t[20]!==n.configuration.name?(w=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,ru(e,`wysiwyg`,ou(c)),_u(e,`wysiwyg`,vu(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),ru(e,`wysiwyg`,null),_u(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=w):w=t[21];let T;t[22]!==c||t[23]!==n?(T=[c,n],t[22]=c,t[23]=n,t[24]=T):T=t[24],(0,Q.useEffect)(w,T);let E;t[25]!==c||t[26]!==n.configuration.name?(E=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=E):E=t[27];let D;t[28]!==c||t[29]!==n?(D=[c,n],t[28]=c,t[29]=n,t[30]=D):D=t[30],(0,Q.useEffect)(E,D);let O,k;t[31]===c?(O=t[32],k=t[33]):(O=()=>{let e=MO,t=null,n=()=>{if(t||c.isDestroyed)return;let n=ge(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 ge(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},k=[c],t[31]=c,t[32]=O,t[33]=k),(0,Q.useEffect)(O,k);let A,j;t[34]!==i||t[35]!==c?(A=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!ge(c))return;e=!0;let t=U(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})),ml(`ok/editor/selection-restore-failed`,{docName:i,message:n})}ct(i)};if(ge(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},j=[c,i],t[34]=i,t[35]=c,t[36]=A,t[37]=j):(A=t[36],j=t[37]),(0,Q.useEffect)(A,j);let M,N;t[38]!==d||t[39]!==n.document||t[40]!==l?(M=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{d.current=e;let t=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??``))},u=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(d.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},Mr)};c(_O);let f=()=>{if(qr(e),!pr(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(),u()},e)}return}r=n,u()};e.observe(f);let p=()=>{document.visibilityState===`visible`?pr(e,t)&&(t=Date.now(),r=Date.now(),u()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},N=[n.document,d,l],t[38]=d,t[39]=n.document,t[40]=l,t[41]=M,t[42]=N):(M=t[41],N=t[42]),(0,Q.useEffect)(M,N);let P,F;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(P=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<vO){e+=1,t=window.setTimeout(p,yO);return}r=null,o=null,e=0},u=function(e){let t=ge(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=bO,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,xO)))};t=window.setTimeout(o,xO)};function p(){if(!r||i!==a)return;let t=r,n=o;if(!n){l();return}d(t)?(s=n,r=null,o=null,e=0,f(t,n)):l()}let m=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=Dl(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},F=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=P,t[48]=F):(P=t[47],F=t[48]),(0,Q.useEffect)(P,F);let I,L;t[49]===c?(I=t[50],L=t[51]):(I=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=ge(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(tu,e),()=>window.removeEventListener(tu,e)},L=[c],t[49]=c,t[50]=I,t[51]=L),(0,Q.useEffect)(I,L);let R;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(R=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:ZT({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]=R):R=t[58];let z;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(z=[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]=z):z=t[65],(0,Q.useEffect)(R,z);let B,V;t[66]!==c||t[67]!==r?(B=()=>(G(c,r),()=>{G(c,!1)}),V=[c,r],t[66]=c,t[67]=r,t[68]=B,t[69]=V):(B=t[68],V=t[69]),(0,Q.useEffect)(B,V);let H;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(H=!r&&(0,Z.jsx)(CD,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=H):H=t[74];let W;t[75]!==c||t[76]!==r?(W=!r&&(0,Z.jsx)(pO,{editor:c}),t[75]=c,t[76]=r,t[77]=W):W=t[77];let ee;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=ee):ee=t[78];let te;t[79]!==c||t[80]!==m?(te=(0,Z.jsx)(u,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=te):te=t[81];let K;t[82]!==f||t[83]!==te?(K=(0,yd.createPortal)(te,f),t[82]=f,t[83]=te,t[84]=K):K=t[84];let ne;t[85]===c?ne=t[86]:(ne=(0,Z.jsx)(kT,{editor:c}),t[85]=c,t[86]=ne);let re;t[87]===c?re=t[88]:(re=Vt(c),t[87]=c,t[88]=re);let ie;t[89]===re.store?ie=t[90]:(ie=(0,Z.jsx)(Be,{store:re.store}),t[89]=re.store,t[90]=ie);let ae;return t[91]!==H||t[92]!==W||t[93]!==K||t[94]!==ne||t[95]!==ie||t[96]!==l?(ae=(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:[H,W,ee,K,ne,ie]}),t[91]=H,t[92]=W,t[93]=K,t[94]=ne,t[95]=ie,t[96]=l,t[97]=ae):ae=t[97],ae};function jO(e){return e+1}function MO(){return w()}var NO=null;function PO(e){let t=(0,$.c)(3),n=(0,Q.useRef)(null),r,i;return t[0]===e?(r=t[1],i=t[2]):(r=()=>{if(!e)return;let t=n.current;if(!t)return;let r={};NO=r;let i=document.documentElement,a=null,o=()=>{if(NO!==r)return;let e=`${t.offsetHeight}px`;e!==a&&(a=e,i.style.setProperty(`--conflict-footer-height`,e))};o();let s=new ResizeObserver(o);return s.observe(t),()=>{s.disconnect(),NO===r&&(NO=null,i.style.removeProperty(`--conflict-footer-height`))}},i=[e],t[0]=e,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i),n}var FO=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 IO(e,t,n,r,i,a){if(e==r)return[];let o=KO(e,t,n,r,i,a),s=qO(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 FO(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new FO(t,t+o,i,i),new FO(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 FO(t,t,i,i+o),new FO(n,n,i+o+c,a)]}if(c==1||l==1)return[new FO(t,n,i,a)];let u=YO(e,t,n,r,i,a);if(u){let[o,s,c]=u;return IO(e,t,o,r,i,s).concat(IO(e,o+c,n,r,s+c,a))}return BO(e,t,n,r,i,a)}var LO=1e9,RO=0,zO=!1;function BO(e,t,n,r,i,a){let o=n-t,s=a-i;if(LO<1e9&&Math.min(o,s)>LO*16||RO>0&&Date.now()>RO)return Math.min(o,s)>LO*64?[new FO(t,n,i,a)]:XO(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);HO.reset(c),UO.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:UO,f=d?null:HO;for(let p=0;p<c;p++){if(p>LO||RO>0&&!(p&63)&&Date.now()>RO)return XO(e,t,n,r,i,a);let m=HO.advance(p,o,s,c,d,!1,l)||UO.advance(p,o,s,c,f,!0,u);if(m)return WO(e,t,n,t+m[0],r,i,a,i+m[1])}return[new FO(t,n,i,a)]}var VO=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}},HO=new VO,UO=new VO;function WO(e,t,n,r,i,a,o,s){let c=!1;return!dk(e,r)&&++r==n&&(c=!0),!dk(i,s)&&++s==o&&(c=!0),c?[new FO(t,n,a,o)]:IO(e,t,r,i,a,s).concat(IO(e,r,n,i,s,o))}function GO(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function KO(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=GO(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-+!dk(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function qO(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=GO(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-+!dk(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function JO(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;;){dk(e,s)||s++;let u=s+o;if(dk(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=KO(e,u,n,r,i+f+d.length,a),c=qO(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 YO(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=YO(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:JO(e,t,n,r,i,a,Math.floor(o/4),-1)}function XO(e,t,n,r,i,a){zO=!0;let o=n-t,s=a-i,c;if(o<s){let s=JO(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=JO(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new FO(t,n,i,a)];let[l,u,d]=c;return IO(e,t,l,r,i,u).concat(IO(e,l+d,n,r,u+d,a))}function ZO(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 FO(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function QO(e,t,n){for(;;){ZO(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=KO(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new FO(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=qO(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new FO(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 FO(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 FO(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function $O(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=ok(t,a.fromA,l),f=ak(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 FO(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=ak(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new FO(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=ok(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new FO(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=ck(n,a.fromB,a.toB),r,o=t<0?-1:sk(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=ck(t,a.fromA,a.toA),r,o=n<0?-1:sk(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 ZO(e,3),e}var ek;try{ek=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function tk(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function nk(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!tk(n):ek?!lk(n)||t==e.length-1?+!!ek.test(String.fromCharCode(n)):ek.test(e.slice(t,t+2))?2:0:0}function rk(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!tk(n):ek?!uk(n)||t==1?+!!ek.test(String.fromCharCode(n)):ek.test(e.slice(t-2,t))?2:0:0}var ik=8;function ak(e,t,n){if(t==e.length||!rk(e,t))return t;for(let r=t,i=t+n,a=0;a<ik;a++){let t=nk(e,r);if(!t||r+t>i)return r;r+=t}return t}function ok(e,t,n){if(!t||!nk(e,t))return t;for(let r=t,i=t-n,a=0;a<ik;a++){let t=rk(e,r);if(!t||r-t<i)return r;r-=t}return t}function sk(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function ck(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var lk=e=>e>=55296&&e<=56319,uk=e=>e>=56320&&e<=57343;function dk(e,t){return!t||t==e.length||!lk(e.charCodeAt(t-1))||!uk(e.charCodeAt(t))}function fk(e,t,n){let r=n?.override;return r?r(e,t):(LO=(n?.scanLimit??1e9)>>1,RO=n?.timeout?Date.now()+n.timeout:0,zO=!1,QO(e,t,IO(e,0,e.length,t,0,t.length)))}function pk(){return!zO}function mk(e,t,n){return $O(fk(e,t,n),e,t)}var hk=Hl.define({combine:e=>e[0]}),gk=Ul.define(),_k=Hl.define(),vk=Ll.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(gk)&&(e=n.value);for(let n of t.state.facet(_k))e=n(e,t);return e}});function yk(e){let t=e.field(vk,!1);if(!t)return null;let n=e.facet(hk);return{chunks:t,side:n?n.side:null}}var bk=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 Ck(mk(e.toString(),t.toString(),n),e,t,0,0,pk())}static updateA(e,t,n,r,i){return Dk(Ek(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return Dk(Ek(e,r,!1,t.length),e,t,n,i)}};function xk(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 Sk(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 Ck(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=xk(c.fromA+r,c.fromB+i,t,n),[d,f]=Sk(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]=xk(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]=Sk(a.toA+r,a.toB+i,t,n),s++}o.push(new bk(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var wk=1e3;function Tk(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 Ek(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>wk&&([l,d]=Tk(e,a-wk,n,!0)),o<t.length-wk&&([u,f]=Tk(e,o+wk,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 Dk(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=mk(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Ck(h,n,r,d,f,pk()))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 Ok={scanLimit:500},kk=Wl.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=zk(e))}update(e){(e.docChanged||e.viewportChanged||jk(e.startState,e.state)||Mk(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=zk(e.view))}},{decorations:e=>e.deco}),Ak=Pl.low(Jl({class:`cm-changeGutter`,markers:e=>e.plugin(kk)?.gutter||Xl.empty}));function jk(e,t){return e.field(vk,!1)!=t.field(vk,!1)}function Mk(e,t){return e.facet(hk)!=t.facet(hk)}var Nk=Bl.line({class:`cm-changedLine`}),Pk=Bl.mark({class:`cm-changedText`}),Fk=Bl.mark({tagName:`ins`,class:`cm-insertedLine`}),Ik=Bl.mark({tagName:`del`,class:`cm-deletedLine`}),Lk=new class extends ql{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Rk(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,Nk),i.add(o,s,n?Ik:Fk),a&&a.add(o,o,Lk);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,Nk),a&&a.add(u,u,Lk);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,Pk),s<t)c++;else break}u=t}}}function zk(e){let t=e.state.field(vk),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(hk),o=n==`a`,s=new Vl,c=i?new Vl: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))&&Rk(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var Bk=class extends Nl{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}},Vk=Ul.define({map:(e,t)=>e.map(t)}),Hk=Ll.define({create:()=>Bl.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Vk))return e.value;return e.map(t.changes)},provide:e=>Kl.decorations.from(e)}),Uk=.01;function Wk(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 Gk(e,t,n){let r=new Vl,i=new Vl,a=e.state.field(Hk).iter(),o=t.state.field(Hk).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<-Uk?(l-=n,r.add(s,s,Bl.widget({widget:new Bk(-n),block:!0,side:-1}))):n>Uk&&(u+=n,i.add(c,c,Bl.widget({widget:new Bk(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<Uk?r.add(e.state.doc.length,e.state.doc.length,Bl.widget({widget:new Bk(-p),block:!0,side:1})):p>Uk&&i.add(t.state.doc.length,t.state.doc.length,Bl.widget({widget:new Bk(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Wk(m,e.state.field(Hk))||e.dispatch({effects:Vk.of(m)}),Wk(h,t.state.field(Hk))||t.dispatch({effects:Vk.of(h)})}var Kk=Ul.define({map:(e,t)=>t.mapPos(e)}),qk=class extends Nl{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:Kk.of(n)});let{side:r,sibling:i}=e.state.facet(hk);i&&i().dispatch({effects:Kk.of(Jk(n,e.state.field(vk),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Jk(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 Yk=Ll.define({create(e){return Bl.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Kk)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Kl.decorations.from(e)});function Xk({margin:e=3,minSize:t=4}){return Yk.init(n=>Zk(n,e,t))}function Zk(e,t,n){let r=new Vl,i=e.facet(hk).side==`a`,a=e.field(vk),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,Bl.replace({widget:new qk(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Qk=Kl.styleModule.of(new Yl({".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`}})),$k=Kl.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`}}),eA=new Gl,tA=new Gl,nA=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Ok;let t=[Pl.low(kk),$k,Qk,Hk,Kl.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Vk)))&&this.measure()})],n=[hk.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Ak);let r=Il.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Kl.editorAttributes.of({class:`cm-merge-a`}),tA.of(n),t]}),i=[hk.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Ak);let a=Il.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Kl.editorAttributes.of({class:`cm-merge-b`}),tA.of(i),t]});this.chunks=bk.build(r.doc,a.doc,this.diffConf);let o=[vk.init(()=>this.chunks),eA.of(e.collapseUnchanged?Xk(e.collapseUnchanged):[])];r=r.update({effects:Ul.appendConfig.of(o)}).state,a=a.update({effects:Ul.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 Kl({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Kl({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),Fl.empty(e[0].startState.doc.length));this.chunks=t==this.a?bk.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):bk.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:gk.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:gk.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(hk),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(tA.reconfigure([hk.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Ak:[]])),a.push(tA.reconfigure([hk.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Ak:[]]))}if(r){let t=eA.reconfigure(e.collapseUnchanged?Xk(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(){Gk(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=rA(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=rA(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 rA(e){let t=e.nextSibling;return e.remove(),t}var iA=new class extends ql{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},aA=Pl.low(Jl({class:`cm-changeGutter`,markers:e=>e.plugin(kk)?.gutter||Xl.empty,widgetMarker:(e,t)=>t instanceof uA?iA:null}));function oA(e){let t=typeof e.original==`string`?zl.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Ok;return[Pl.low(kk),hA,$k,Kl.editorAttributes.of({class:`cm-merge-b`}),_k.of((e,t)=>{let r=t.effects.find(e=>e.is(sA));return r&&(e=bk.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=bk.updateB(e,t.state.field(cA),t.newDoc,t.changes,n)),e}),hk.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?xA:void 0,side:`b`}),cA.init(()=>t),e.gutter===!1?[]:aA,e.collapseUnchanged?Xk(e.collapseUnchanged):[],vk.init(e=>bk.build(t,e.doc,n))]}var sA=Ul.define(),cA=Ll.define({create:()=>zl.empty,update(e,t){for(let n of t.effects)n.is(sA)&&(e=n.value.doc);return e}}),lA=new WeakMap,uA=class extends Nl{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 dA(e,t,n){let r=lA.get(t.changes);if(r)return r;let i=Bl.widget({block:!0,side:-1,widget:new uA(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(hk),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(),fA(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),pA(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(cA).sliceString(t.fromA,t.endA),u=a&&e.facet(Zl),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
|
|
28
28
|
`){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
|
|
29
|
-
`,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Rl(t,{style:t=>Ql(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return lA.set(t.changes,i),i}function fA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(vk).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(cA);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Fl.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:sA.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function pA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(vk).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(cA).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 mA(e){let t=new Vl;for(let n of e.field(vk)){let r=e.facet(hk).overrideChunk&&_A(e,n);t.add(n.fromB,n.fromB,dA(e,n,!!r))}return t.finish()}var hA=Ll.define({create:e=>mA(e),update(e,t){return t.state.field(vk,!1)==t.startState.field(vk,!1)?e:mA(t.state)},provide:e=>Kl.decorations.from(e)}),gA=new WeakMap;function _A(e,t){let n=gA.get(t);if(n!==void 0)return n;n=null;let r=e.field(cA),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(Bl.widget({widget:new vA(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Pk.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return gA.set(t,n),n}var vA=class extends Nl{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}},yA=new class extends ql{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},bA=Bl.line({class:`cm-inlineChangedLine`});function xA(e,t,n,r){let i=_A(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,yA),n.add(o.from,o.from,bA);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 SA=q({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),CA=D({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),wA=Kl.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 TA({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 EA(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=tn(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=Pn(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C=PO(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?SA:CA,u=[Kl.editable.of(!1),Il.readOnly.of(!0)],g=[du,$l(),...u,l,Kl.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Kl({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=TA({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Kl({doc:d,extensions:[du,$l(),Kl.editable.of(!1),l,wA,Kl.lineWrapping,oA({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Kl.updateListener.of(e=>{let t=yk(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=yk(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new nA({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Kl({doc:d,extensions:[...g,oA({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Kl)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Kl)||Ce(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):Kc._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,yd.createPortal)((0,Z.jsx)(X,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(J,{id:`XyOUTJ`})}),(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(X,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(J,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function DA(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 OA(e,t){return DA(e,`content`,t)}async function kA(e){return DA(e,`mine`)}async function AA(e){return DA(e,`theirs`)}async function jA(e){return DA(e,`delete`)}async function MA(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 NA(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=tn(),{conflicts:i,loading:a}=Ba(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>_l(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=PO(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),MA(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await OA(c,e);t.ok||_s.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),_s.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(EA,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(jA),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(AA),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(EA,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(kA),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(jA),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(EA,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function PA(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Rt(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 FA=`__back-nav__`;function IA(e){return e instanceof Ne||e instanceof bt||e instanceof Oe||e instanceof et||e instanceof Mt||e instanceof C?e.docName:null}function LA(e){return e instanceof Ne||e instanceof bt}function RA(e){if(e instanceof Ne){let t=e.docName;return{title:Kc._({id:`Jejur6`}),summary:Kc._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof bt){let t=e.docName;return{title:Kc._({id:`V7QxyT`}),summary:Kc._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Oe){let t=e.docName;return{title:Kc._({id:`1di5fu`}),summary:Kc._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:Kc._({id:`wvbc1r`}),summary:Kc._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Mt)return{title:Kc._({id:`Gfr4fu`}),summary:Kc._({id:`UW2Fg3`})};if(e instanceof C){let t=e.docName;return{title:Kc._({id:`vv7kpg`}),summary:Kc._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Kc._({id:`W5A0Ly`});return{title:Kc._({id:`29VNqC`}),summary:t}}function zA(e){let t=(0,$.c)(31),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=RA(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f=typeof window<`u`?window.okDesktop:void 0,p=f&&LA(n)?f:null,m,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{d.current?.focus()},h=[],t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(_S,{size:80,variant:`sleeping`}),t[4]=g):g=t[4];let _;t[5]===c?_=t[6]:(_=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=_);let v;t[7]===l?v=t[8]:(v=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=v);let y;t[9]!==_||t[10]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(J,{id:`KDw4GX`}),t[12]=b):b=t[12];let x;t[13]===r?x=t[14]:(x=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:b}),t[13]=r,t[14]=x);let S;t[15]===p?S=t[16]:(S=p?(0,Z.jsx)(X,{variant:`secondary`,onClick:()=>{jg(p).then(VA).catch(BA)},children:(0,Z.jsx)(J,{id:`uaUc6t`})}):null,t[15]=p,t[16]=S);let C;t[17]!==i||t[18]!==u||t[19]!==n||t[20]!==o||t[21]!==a||t[22]!==r?(C=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(IA(n)??i),o(a),r(FA))},children:(0,Z.jsx)(J,{id:`CKyk7Q`})}):null,t[17]=i,t[18]=u,t[19]=n,t[20]=o,t[21]=a,t[22]=r,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C||t[26]!==x?(w=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[x,S,C]}),t[24]=S,t[25]=C,t[26]=x,t[27]=w):w=t[27];let T;return t[28]!==w||t[29]!==y?(T=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[g,y,w]}),t[28]=w,t[29]=y,t[30]=T):T=t[30],T}function BA(){}function VA(e){e.ok||_s.error(e.message,{id:`server-restart-error`,duration:1/0})}function HA(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)(zA,{...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]===FA){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}: ${RA(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)(g,{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 UA(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=zr(t);return{map:n,keys:Jr(t),parseError:r}}function WA(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>UA(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=tr(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=Ze(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=pt(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)(GA,{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)(KA,{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 GA(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 KA(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var qA=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-DCf7FSvm.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([84,1,41,2,42,43,11,44,45,46,47,48,49,50,51,20,15,13,7,16,10,3,52,53,37,12,6,4,54,17,55,56,19,57,58,59,60,31,32,33,34,35,61,62,63,64,36,65,66,67,73,75,18,85,74,86,87,39,82]),import.meta.url)).ManagedArtifactProperties})),JA=gl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function YA(e){let t=e.threshold??JA;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function XA(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var ZA=gl(`ACTIVITY_MOUNT_LIMIT`,3);function QA(){return n(()=>import(`./SourceEditor-Dqc-ofa3.js`),__vite__mapDeps([88,1,41,2,42,43,11,44,45,46,47,48,49,50,51,20,15,13,7,16,10,3,52,53,37,12,6,4,54,17,55,56,19,57,58,59,60,31,32,33,34,35,61,62,63,64,36,65,66,67,89,21,87,83]),import.meta.url)}var $A=(0,Q.lazy)(async()=>({default:(await QA()).SourceEditor}));function ej(e,t,n){if(n<=0)return[];let r=e.filter(e=>!We(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 tj(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Kc._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Kc._({id:`Sc1bKE`,values:{docName:e}}):Kc._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Kc._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Kc._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Kc._({id:`bmC18N`,values:{docName:e}}):Kc._({id:`pAgkuZ`,values:{docName:e}})}:null}function nj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(hl,{name:`activity-pool`,children:(0,Z.jsx)(rj,{...e})}),t[0]=e,t[1]=n),n}function rj(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=gt(),{pages:u,loading:d}=Zi(),f=ej(c,n,ZA),m=(0,Q.useRef)(``),h=f.map(ij).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(m.current===h)return;let e=m.current?m.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)p(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;k(e,t&&t.length>0?t:crypto.randomUUID())}ml(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),m.current=h,K(t)},[h,n]);let y;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(y=e=>(0,Z.jsx)(uj,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!Jn(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let b=f.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function ij(e){return e.docName}function aj(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&&ml(`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&&(ml(`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&&ml(`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 oj(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)(ex,{}),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)($A,{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 sj(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)(rs,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ts,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:cj,children:[(0,Z.jsx)(rs,{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 cj(){return window.location.reload()}function lj(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 uj(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=tj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=uw(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,S;t[5]!==i||t[6]!==_||t[7]!==y?(x=()=>{i&&!_?v(!0):!i&&!y&&b(!0)},S=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=x,t[9]=S):(x=t[8],S=t[9]),(0,Q.useEffect)(x,S);let C=YA({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),w=(0,Q.useRef)(``),T=`${C.isLarge}-${C.renderSource}-${C.renderVisual}`,E,D;t[10]!==n.docName||t[11]!==C.isLarge||t[12]!==C.renderSource||t[13]!==C.renderVisual||t[14]!==T||t[15]!==i||t[16]!==g?(E=()=>{w.current!==T&&(w.current=T,C.isLarge&&ml(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:C.renderSource,renderVisual:C.renderVisual}))},D=[T,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=C.isLarge,t[12]=C.renderSource,t[13]=C.renderVisual,t[14]=T,t[15]=i,t[16]=g,t[17]=E,t[18]=D):(E=t[17],D=t[18]),(0,Q.useEffect)(E,D);let O;t[19]===n.docName?O=t[20]:(O=()=>U(n.docName),t[19]=n.docName,t[20]=O);let[k]=(0,Q.useState)(O),A=k?.html??null,[j,M]=(0,Q.useState)(!1),N,P;t[21]!==n.docName||t[22]!==C.isLarge||t[23]!==C.renderSource||t[24]!==C.renderVisual||t[25]!==j||t[26]!==i||t[27]!==g?(N=()=>{XA({isLarge:C.isLarge,renderSource:C.renderSource,renderVisual:C.renderVisual,hasEmittedFirstToggle:j})&&(ml(`ok/cold/first-toggle`,{docName:n.docName,mountId:he(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),M(!0))},P=[j,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=C.isLarge,t[23]=C.renderSource,t[24]=C.renderVisual,t[25]=j,t[26]=i,t[27]=g,t[28]=N,t[29]=P):(N=t[28],P=t[29]),(0,Q.useEffect)(N,P);let F=r?`visible`:`hidden`,I=`editor:${n.docName}`,L=k?.scrollTop,R;t[30]!==a||t[31]!==n||t[32]!==C.renderSource||t[33]!==C.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]!==A?(R=f?(0,Z.jsx)(sj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(HA,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:A?(0,Z.jsx)(lj,{html:A}):(0,Z.jsx)(ex,{}),children:(0,Z.jsx)(PA,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(NA,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(Jn(n.docName)||ue(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(qA,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(WA,{provider:n.provider}),(0,Z.jsx)(Ui,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[C.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(oj,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,C.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(kO,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=C.renderSource,t[33]=C.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]=A,t[44]=R):R=t[44];let z;t[45]!==r||t[46]!==L||t[47]!==R?(z=(0,Z.jsx)(aj,{isActive:r,initialScrollTop:L,children:R}),t[45]=r,t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;return t[49]!==F||t[50]!==I||t[51]!==z?(B=(0,Z.jsx)(Q.Activity,{mode:F,name:I,children:z}),t[49]=F,t[50]=I,t[51]=z,t[52]=B):B=t[52],B}function dj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function fj(e){let{value:t,unit:n}=dj(e);return n===`rem`?t*16:t}function pj(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var mj=3600*24*7;function hj(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?gj:m,O=g===void 0?mj: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,ee;t[3]===y?(G=t[4],ee=t[5]):(G=()=>{H.current=y},ee=[y],t[3]=y,t[4]=G,t[5]=ee),(0,Q.useEffect)(G,ee);let te=fj(b),K;t[6]===x?K=t[7]:(K=fj(x),t[6]=x,t[7]=K);let ne=K,re;t[8]!==E||t[9]!==k?(re=function(e){E&&(P.current=!0,j.current=H.current?0:fj(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]=re):re=t[10];let ie=re,ae,oe;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ne||t[18]!==te||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ae=()=>{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}=dj(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<=te*w;else if(e<=te){let n=te*(w-1);t=te-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>te*T){a();let t=n(r,M.current,j.current,s),c=Math.max(te,Math.min(ne,t)),u=pj(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(te,Math.min(ne,u)),f=pj(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)}},oe=[i,a,D,te,ne,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]=ne,t[18]=te,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ae,t[25]=oe):(ae=t[24],oe=t[25]),(0,Q.useEffect)(ae,oe);let se;return t[26]===ie?se=t[27]:(se={dragRef:A,isDragging:N,handleMouseDown:ie},t[26]=ie,t[27]=se),se}function gj(){}var _j=3600*24*7,vj=`18rem`,yj=`3rem`,bj=`app-file-sidebar`,xj=`14.625rem`,Sj=`32rem`,Cj=`sidebar_width`,wj=/^\d+(?:\.\d+)?(?:rem|px)$/,Tj=Q.createContext(null);function Ej(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${Cj}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return wj.test(n)?n:e}function Dj(){let e=Q.use(Tj);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Oj(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?vj:c,[u]=Q.useState(Aj),d;t[8]===u?d=t[9]:(d=()=>bw(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>Ej(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=Dw();return kw(`left`,bw(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),Aw(`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(kj)},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: ${_w}px)`),t=()=>{let e=bw(u,window.innerWidth,`left`);p(e),C(kw(`left`,e,Dw())===`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(bj)?.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=>{jl(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":yj,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let ee;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(ee=(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]=ee):ee=t[54];let te;return t[55]!==H||t[56]!==ee?(te=(0,Z.jsx)(Tj.Provider,{value:H,children:ee}),t[55]=H,t[56]=ee,t[57]=te):te=t[57],te}function kj(e){return!e}function Aj(){return Dr()}function jj(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=tn(),{state:f,isDraggingRail:p}=Dj();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Y(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=Y(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=Y(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:bj,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function Mj(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=tn(),{toggleSidebar:o,state:s}=Dj(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Ml(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=bj,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=Y(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(O,{}):(0,Z.jsx)(sf,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function Nj(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=tn(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=Dj(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:xj,maxResizeWidth:Sj,setIsDraggingRail:m,widthCookieName:Cj,widthCookieMaxAge:_j},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=hj(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=Y(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function Pj(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}=Dj(),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=Y(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,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 Fj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ij(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zj(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?vi:`div`,o;t[4]===n?o=t[5]:(o=Y(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Bj(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?vi:`button`,o;t[4]===n?o=t[5]:(o=Y(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Vj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Hj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Uj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Wj=yi(`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 Gj(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?vi:`button`,{state:m}=Dj(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Y(Wj({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)(Ds,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Os,{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)(As,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function Kj(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?vi:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=Y(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function qj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Jj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yj(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?vi:`a`,d;t[6]===n?d=t[7]:(d=Y(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function Xj(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 Zj(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=kr.safeParse(t);return n.success?n.data.currentBranch??null:null}var Qj=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:Xj({fetchBranch:Zj,subscribeToEvent:cl}),$j=Qj.subscribe,eM=Qj.getSnapshot;function tM(){return(0,Q.useSyncExternalStore)($j,eM,eM)}function nM(){let e=(0,$.c)(6),t=tM(),n=ta(),{state:r}=Dj(),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&&Ia(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 rM(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=tn(),u=nM();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=Y(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(is,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(Fe,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(iM,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(J,{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)(J,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function 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)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Os,{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)(Ro,{"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 aM(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=tn(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=Y(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function oM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-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 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=Y(`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 cM(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=Y(`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 lM(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=Y(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Ji,{}),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 uM=1,dM=2,fM=4;function pM(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ei(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:Kt(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>fM?[...u.slice(0,uM).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(uM,-dM)},...u.slice(-dM).map((e,t)=>d(e,u.length-dM+t))]:u.map((e,t)=>d(e,t));a=aM,t[8]===r?c=t[9]:(c=Y(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=oM,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(mM)}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 mM(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(lM,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(sM,{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)(Md,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(sM,{className:`min-w-0`,children:(0,Z.jsx)(cM,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var hM={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`},gM=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`,...hM,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},_M=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)(gM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},vM=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)(gM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function yM(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=tn(),s=n?`source`:`wysiwyg`,c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l;t[2]===o?l=t[3]:(l=o({id:`n7aopT`}),t[2]=o,t[3]=l);let u;t[4]===o?u=t[5]:(u=o({id:`ur2XSb`}),t[4]=o,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ds,{children:(0,Z.jsx)(vM,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(Lc,{value:`wysiwyg`,"aria-label":u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:d}),t[7]=u,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Os,{side:`bottom`,children:(0,Z.jsx)(J,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(As,{children:[f,p]}),t[10]=f,t[11]=m);let h;t[12]===o?h=t[13]:(h=o({id:`xbdtfY`}),t[12]=o,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(_M,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Lc,{value:`source`,"aria-label":h,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:g})})}),t[15]=a,t[16]=h,t[17]=_):_=t[17];let v;t[18]===a?v=t[19]:(v=(0,Z.jsx)(Os,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`G-JBA1`}):(0,Z.jsx)(J,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(As,{children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==c||t[26]!==l||t[27]!==m?(b=(0,Z.jsxs)(zc,{type:`single`,value:s,onValueChange:c,"aria-label":l,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[m,y]}),t[23]=y,t[24]=s,t[25]=c,t[26]=l,t[27]=m,t[28]=b):b=t[28],b}var bM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-Cwen9r7n.js`);return{SkillEditorActions:e}},__vite__mapDeps([90,1,10,3,11,6,7,13,75,20,15,16,12,17,55,56,18,58,60,34,59,80,76,61,53,64,81,69,37,66]),import.meta.url)).SkillEditorActions}));function xM(e){let t=(0,$.c)(82),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=tn(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Al(`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,k;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=Ml(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?ei(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?ue(n):null,t[28]=n,t[29]=m);let A=m,j;t[30]!==p||t[31]!==A?(j=p?.kind===`skill`?{scope:p.scope,name:p.name}:A?{scope:`project`,name:A}:null,t[30]=p,t[31]=A,t[32]=j):j=t[32];let M=j;b=`editor-toolbar`,x=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[33]!==n||t[34]!==M?(N=M?null:(0,Z.jsx)(pM,{docName:n}),t[33]=n,t[34]=M,t[35]=N):N=t[35];let P;t[36]===N?P=t[37]:(P=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:N}),t[36]=N,t[37]=P);let F;t[38]!==r||t[39]!==a||t[40]!==i?(F=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(yM,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[38]=r,t[39]=a,t[40]=i,t[41]=F):F=t[41],t[42]!==P||t[43]!==F?(S=(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:[P,F]})}),t[42]=P,t[43]=F,t[44]=S):S=t[44];let I=d&&`pr-9`;t[45]===I?_=t[46]:(_=Y(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,I),t[45]=I,t[46]=_),t[47]===M?v=t[48]:(v=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(bM,{scope:M.scope,name:M.name})}):null,t[47]=M,t[48]=v),t[49]!==f||t[50]!==s||t[51]!==o?(y=o&&(0,Z.jsxs)(As,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Ds,{children:(0,Z.jsx)(Zd,{})})}),(0,Z.jsx)(Os,{side:`bottom`,children:(0,Z.jsx)(J,{id:`81H_23`})})]}),t[49]=f,t[50]=s,t[51]=o,t[52]=y):y=t[52],g=As,h=X,C=``,w=`ghost`,T=`icon`,E=l,D=!c,O=`doc-panel`,k=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k}else 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=t[24],k=t[25];let A;t[53]===c?A=t[54]:(A=(0,Z.jsx)(Ds,{children:c?(0,Z.jsx)(lf,{}):(0,Z.jsx)(cf,{})}),t[53]=c,t[54]=A);let j;t[55]!==h||t[56]!==A||t[57]!==C||t[58]!==w||t[59]!==T||t[60]!==E||t[61]!==D||t[62]!==O||t[63]!==k?(j=(0,Z.jsx)(h,{"data-doc-panel-toggle":C,variant:w,size:T,onClick:E,"aria-expanded":D,"aria-controls":O,"aria-label":k,asChild:!0,children:A}),t[55]=h,t[56]=A,t[57]=C,t[58]=w,t[59]=T,t[60]=E,t[61]=D,t[62]=O,t[63]=k,t[64]=j):j=t[64];let M;t[65]===c?M=t[66]:(M=(0,Z.jsx)(Os,{side:`bottom`,children:c?(0,Z.jsx)(J,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(J,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[65]=c,t[66]=M);let N;t[67]!==g||t[68]!==j||t[69]!==M?(N=(0,Z.jsxs)(g,{children:[j,M]}),t[67]=g,t[68]=j,t[69]=M,t[70]=N):N=t[70];let P;t[71]!==_||t[72]!==v||t[73]!==y||t[74]!==N?(P=(0,Z.jsxs)(`div`,{className:_,children:[v,y,N]}),t[71]=_,t[72]=v,t[73]=y,t[74]=N,t[75]=P):P=t[75];let F;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[76]=F):F=t[76];let I;return t[77]!==b||t[78]!==x||t[79]!==S||t[80]!==P?(I=(0,Z.jsxs)(`div`,{"data-testid":b,className:x,children:[S,P,F]}),t[77]=b,t[78]=x,t[79]=S,t[80]=P,t[81]=I):I=t[81],I}function SM(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function CM(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var wM=`ok-terminal-height-v1`,TM=1/3,EM=.5;function DM(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*EM))}function OM(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*TM)}function kM(e,t){let n=DM(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(OM(t),n)}function AM(){return typeof window>`u`?0:window.innerHeight}function jM(e,t){try{let n=e??localStorage,r=t??AM(),i=n.getItem(wM);if(i==null)return kM(OM(r),r);let a=Number.parseInt(i,10);return kM(Number.isFinite(a)?a:OM(r),r)}catch{return 240}}function MM(e,t,n){try{let r=t??localStorage,i=n??AM();r.setItem(wM,String(kM(e,i)))}catch{}}function NM(){try{return typeof localStorage>`u`?240:jM()}catch{return 240}}function PM(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=tn(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`0SBTff`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=Y(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(qi,{"aria-hidden":`true`}):(0,Z.jsx)(Fe,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(Os,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(As,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var FM=`terminal-dock-panel`;function IM(e){let t=(0,$.c)(44),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c}=e,l=a===void 0?`bottom`:a,{resolvedTheme:u}=Pn(),d=Lb(),[f,p]=(0,Q.useState)(!r),m;t[0]===u?m=t[1]:(m=Cu(u),t[0]=u,t[1]=m);let h=m.background,g=r&&l===`bottom`,_=!r&&l===`bottom`&&c!=null,[v]=(0,Q.useState)(LM),y=(0,Q.useRef)(v),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(e){C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{MM(e),C.current=null},100)},t[2]=w):w=t[2];let T=w,E=(0,Q.useRef)(null),D,O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{C.current!=null&&clearTimeout(C.current),E.current!=null&&(window.removeEventListener(`pointerup`,E.current),E.current=null)},O=[],t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A;t[5]!==g||t[6]!==d?(k=()=>{let e=d.current;e!=null&&(g?e.resize(`${y.current}px`):e.collapse())},A=[g,d],t[5]=g,t[6]=d,t[7]=k,t[8]=A):(k=t[7],A=t[8]),(0,Q.useEffect)(k,A);let j=b||void 0,M;t[9]!==c||t[10]!==_?(M=_&&c?(0,Z.jsx)(PM,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[9]=c,t[10]=_,t[11]=M):M=t[11];let N;t[12]!==n||t[13]!==s||t[14]!==M?(N=(0,Z.jsx)(zC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,M]})}),t[12]=n,t[13]=s,t[14]=M,t[15]=N):N=t[15];let P=!g,F;t[16]===g?F=t[17]:(F=()=>{if(!g)return;x(!0),S.current=!0;let e=()=>{x(!1),S.current=!1,window.removeEventListener(`pointerup`,e),E.current=null};E.current=e,window.addEventListener(`pointerup`,e)},t[16]=g,t[17]=F);let I;t[18]!==g||t[19]!==P||t[20]!==F?(I=(0,Z.jsx)(BC,{withHandle:g,disabled:P,onPointerDown:F}),t[18]=g,t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]===h?L=t[23]:(L={backgroundColor:h},t[22]=h,t[23]=L);let R=g?`${v}px`:0,z;t[24]!==i||t[25]!==r?(z=e=>{let t=e.asPercentage===0;p(t),S.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(y.current=e.inPixels,T(e.inPixels)))},t[24]=i,t[25]=r,t[26]=z):z=t[26];let B=!b&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,V;t[27]===B?V=t[28]:(V=Y(`flex flex-col`,B),t[27]=B,t[28]=V);let H;t[29]===o?H=t[30]:(H=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[29]=o,t[30]=H);let U;t[31]!==f||t[32]!==d||t[33]!==L||t[34]!==R||t[35]!==z||t[36]!==V||t[37]!==H?(U=(0,Z.jsx)(zC,{id:FM,style:L,panelRef:d,defaultSize:R,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:z,inert:f,className:V,children:H}),t[31]=f,t[32]=d,t[33]=L,t[34]=R,t[35]=z,t[36]=V,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==N||t[40]!==I||t[41]!==U||t[42]!==j?(W=(0,Z.jsxs)(RC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":j,children:[N,I,U]}),t[39]=N,t[40]=I,t[41]=U,t[42]=j,t[43]=W):W=t[43],W}function LM(){return NM()}var RM=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-Bu-aPWfE.js`),__vite__mapDeps([40,1,2,41,42,43,11,44,45,46,47,48,49,50,51,20,15,13,7,16,10,3,52,53,37,12,6,4,54,17,55,56,19,57,58,59,60,31,32,33,34,35,61,62,63,64,36,65,66,67,68,69]),import.meta.url)).ActivityModeContent})),zM=`300px`,BM=`600px`,VM=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function HM(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(WM,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(UM,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(hl,{name:`editor-area`,children:(0,Z.jsxs)(Ri,{children:[n,r]})}),t[3]=n,t[4]=i),i}function UM(){let e=(0,$.c)(5),t=za(),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)(NC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function WM(e){let t=(0,$.c)(243),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u,onRevealTerminal:d}=e,f=s===void 0?!1:s,p=l===void 0?`right`:l,{_:m}=tn(),{resolvedTheme:h}=Pn(),g;t[0]===h?g=t[1]:(g=Cu(h),t[0]=h,t[1]=g);let _=g.background,{activeDocName:v,activeProvider:y,activeTarget:b,recycleDocument:x,docPanelMode:S,docPanelAgentId:C,docPanelExpandSignal:w}=gt(),{openDocumentTransition:T}=kt(),{requestAddProperty:E}=Fi(),D=cw(y,v),O=dw(v,n===`source`?`source`:`wysiwyg`),k=Iw(y),A=k===`connected`||k===`synced`,j=uw(v)===`conflict`,[M,N]=(0,Q.useState)(!1),P,F;t[2]!==y||t[3]!==M?(P=()=>{y!=null&&!M&&N(!0)},F=[y,M],t[2]=y,t[3]=M,t[4]=P,t[5]=F):(P=t[4],F=t[5]),(0,Q.useEffect)(P,F);let I=(0,Q.useDeferredValue)(v),L=b?.kind===`missing`,R=!!v&&b?.kind!==`folder`,B;t[6]!==m||t[7]!==L?(B=L?m({id:`K-a33w`}):void 0,t[6]=m,t[7]=L,t[8]=B):B=t[8];let V=B,H=(0,Q.useSyncExternalStore)(wi.subscribe,wi.getSnapshot,wi.getSnapshot),U;t[9]!==b||t[10]!==H?(U=Oi(b,H),t[9]=b,t[10]=H,t[11]=U):U=t[11];let W=U,[G]=(0,Q.useState)(YM),ee=G!==null,te;t[12]===G?te=t[13]:(te=()=>bw(G,window.innerWidth,`right`),t[12]=G,t[13]=te);let[K,ne]=(0,Q.useState)(te),re=(0,Q.useRef)(K),ie,ae;t[14]===K?(ie=t[15],ae=t[16]):(ae=()=>{re.current=K},ie=[K],t[14]=K,t[15]=ie,t[16]=ae),(0,Q.useEffect)(ae,ie);let oe=Lb(),se=Lb(),ce;t[17]===K?ce=t[18]:(ce=()=>kw(`right`,K,Dw())===`collapsed`,t[17]=K,t[18]=ce);let[le]=(0,Q.useState)(ce),[ue,q]=(0,Q.useState)(le),de=(0,Q.useRef)(ue),[fe,pe]=(0,Q.useState)(null),[me,he]=(0,Q.useState)(null),[ge,_e]=(0,Q.useState)(null),ve=p===`right`,ye=ve?`right`:`bottom`,be=o!=null&&ve&&f,xe=o!=null&&!f&&d!=null,Se=xe&&!ve,Ce=xe&&ve,we=ve&&f&&fe!=null,Te=we?fe:me,Ee=(ve?we:f)&&Te!=null,De,Oe;t[19]!==Te||t[20]!==u||t[21]!==ye||t[22]!==ge||t[23]!==Ee?(De=()=>{u?.({container:Te,isShowing:Ee,dockPosition:ye,editorRegion:ge})},Oe=[u,Te,Ee,ye,ge],t[19]=Te,t[20]=u,t[21]=ye,t[22]=ge,t[23]=Ee,t[24]=De,t[25]=Oe):(De=t[24],Oe=t[25]),(0,Q.useEffect)(De,Oe);let ke,Ae;t[26]===ue?(ke=t[27],Ae=t[28]):(ke=()=>{de.current=ue},Ae=[ue],t[26]=ue,t[27]=ke,t[28]=Ae),(0,Q.useEffect)(ke,Ae);let[je,Me]=(0,Q.useState)(!1),Ne=(0,Q.useRef)(!1),[Pe]=(0,Q.useState)(JM),Fe=(0,Q.useRef)(Pe),Ie=(0,Q.useRef)(null),Re;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(e){Ie.current!=null&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>{hw(e),Ie.current=null},100)},t[29]=Re):Re=t[29];let ze=Re,[Be]=(0,Q.useState)(qM),Ve=(0,Q.useRef)(Be),[He,Ue]=(0,Q.useState)(!1),We=(0,Q.useRef)(!1),Ge=(0,Q.useRef)(null),Ke;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=function(e){Ge.current!=null&&clearTimeout(Ge.current),Ge.current=setTimeout(()=>{Pw(e),Ge.current=null},100)},t[30]=Ke):Ke=t[30];let qe=Ke,Je,Ye;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Je=()=>()=>{Ie.current!=null&&clearTimeout(Ie.current),Ge.current!=null&&clearTimeout(Ge.current)},Ye=[],t[31]=Je,t[32]=Ye):(Je=t[31],Ye=t[32]),(0,Q.useEffect)(Je,Ye);let[Xe,Ze]=(0,Q.useState)(null),Qe=(0,Q.useRef)(null),$e=Mb(),et=(0,Q.useRef)(be),tt,nt;t[33]===be?(tt=t[34],nt=t[35]):(tt=()=>{et.current=be},nt=[be],t[33]=be,t[34]=tt,t[35]=nt),(0,Q.useEffect)(tt,nt);let rt;t[36]!==oe||t[37]!==se?(rt=function(){for(let e of[oe,se]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=Qe.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[36]=oe,t[37]=se,t[38]=rt):rt=t[38];let it=rt,at;t[39]!==$e||t[40]!==it?(at=function(e){if(Ne.current||We.current)return;let t=$e.current;if(t!=null)try{let n=it();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(KM);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:Fe.current),`terminal-column`in r&&(o[`terminal-column`]=Ve.current),Object.keys(o).length===0)return;let s=CM({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[39]=$e,t[40]=it,t[41]=at):at=t[41];let ot=at,st=(0,Q.useRef)(ot),ct;t[42]===ot?ct=t[43]:(ct=()=>{st.current=ot},t[42]=ot,t[43]=ct),(0,Q.useEffect)(ct);let lt;t[44]!==ot||t[45]!==oe?(lt=function(){et.current?ot(!1):oe.current?.expand()},t[44]=ot,t[45]=oe,t[46]=lt):lt=t[46];let ut=lt,dt;t[47]!==ot||t[48]!==ue||t[49]!==oe?(dt=function(){if(oe.current==null)return;let e=re.current;ue?(Aw(`right`,e,`open`),et.current?ot(!1):oe.current?.expand()):(Aw(`right`,e,`collapsed`),et.current?ot(!0):oe.current?.collapse())},t[47]=ot,t[48]=ue,t[49]=oe,t[50]=dt):dt=t[50];let ft=dt,pt,mt;t[51]!==ot||t[52]!==G||t[53]!==oe?(pt=()=>{let e=window.matchMedia(`(min-width: ${vw}px)`),t=()=>{let e=bw(G,window.innerWidth,`right`);ne(e);let t=kw(`right`,e,Dw())===`collapsed`;q(t),et.current?ot(t):t?oe.current?.collapse():oe.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},mt=[G,oe,ot],t[51]=ot,t[52]=G,t[53]=oe,t[54]=pt,t[55]=mt):(pt=t[54],mt=t[55]),(0,Q.useEffect)(pt,mt);let ht,_t;t[56]!==Xe||t[57]!==ee?(ht=()=>{if(Xe==null||ee)return;let e=new ResizeObserver(()=>{st.current(de.current)});return e.observe(Xe),()=>e.disconnect()},_t=[Xe,ee],t[56]=Xe,t[57]=ee,t[58]=ht,t[59]=_t):(ht=t[58],_t=t[59]),(0,Q.useEffect)(ht,_t);let vt,yt;t[60]!==ut||t[61]!==a?(vt=()=>{let e=e=>{a(e),ut()},t=th();return t&&e(t),rh(t=>{th(),e(t)})},yt=[a,ut],t[60]=ut,t[61]=a,t[62]=vt,t[63]=yt):(vt=t[62],yt=t[63]),(0,Q.useEffect)(vt,yt);let bt,xt;t[64]!==w||t[65]!==ut?(bt=()=>{w!==0&&ut()},xt=[w,ut],t[64]=w,t[65]=ut,t[66]=bt,t[67]=xt):(bt=t[66],xt=t[67]),(0,Q.useEffect)(bt,xt);let St=(0,Q.useRef)(be),Ct,wt;t[68]!==ue||t[69]!==be?(Ct=()=>{if(St.current===be)return;St.current=be;let e=ue;queueMicrotask(()=>{st.current(e)})},wt=[be,ue],t[68]=ue,t[69]=be,t[70]=Ct,t[71]=wt):(Ct=t[70],wt=t[71]),(0,Q.useLayoutEffect)(Ct,wt);let Tt,Et;t[72]===ue?(Tt=t[73],Et=t[74]):(Tt=()=>{if(!ue||!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()},Et=[ue],t[72]=ue,t[73]=Tt,t[74]=Et),(0,Q.useLayoutEffect)(Tt,Et);let Dt,Ot;t[75]===ue?(Dt=t[76],Ot=t[77]):(Dt=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ue})},Ot=[ue],t[75]=ue,t[76]=Dt,t[77]=Ot),(0,Q.useEffect)(Dt,Ot);let At,jt;t[78]===ft?(At=t[79],jt=t[80]):(At=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&ft()})},jt=[ft],t[78]=ft,t[79]=At,t[80]=jt),(0,Q.useEffect)(At,jt);let Mt,Nt;t[81]===ft?(Mt=t[82],Nt=t[83]):(Mt=()=>{if(window.okDesktop!=null)return;let e=e=>{jl(e,`toggle-document-panel`)&&(e.preventDefault(),ft())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Nt=[ft],t[81]=ft,t[82]=Mt,t[83]=Nt),(0,Q.useEffect)(Mt,Nt);let Pt=(0,Q.useRef)(null),[Ft,It]=(0,Q.useState)(null),[Lt,Rt]=(0,Q.useState)(!1),zt=b?.kind===`large-file`?b.docName:v,Bt,Vt;t[84]===zt?(Bt=t[85],Vt=t[86]):(Bt=()=>{if(zt&&zt!==Pt.current){let e=Pt.current;Pt.current=zt,It(e)}},Vt=[zt],t[84]=zt,t[85]=Bt,t[86]=Vt),(0,Q.useEffect)(Bt,Vt);let Ht;t[87]===T?Ht=t[88]:(Ht=function(e){let t=El(e);window.location.hash===t?T(e):window.location.hash=t},t[87]=T,t[88]=Ht);let Ut=Ht,Wt,Gt=null;if(b?.kind===`large-file`){let e;t[89]!==Ut||t[90]!==Ft?(e=Ft?{previousDocName:Ft,onNavigateBack:Ut}:void 0,t[89]=Ut,t[90]=Ft,t[91]=e):e=t[91];let n;t[92]!==b.docName||t[93]!==b.limit||t[94]!==b.size||t[95]!==e?(n=(0,Z.jsx)(hC,{docName:b.docName,size:b.size,limit:b.limit,backNav:e}),t[92]=b.docName,t[93]=b.limit,t[94]=b.size,t[95]=e,t[96]=n):n=t[96],Wt=n}else if(b?.kind===`folder`){let e;t[97]!==ee||t[98]!==f?(e=TT({terminalVisible:f,isEmbedded:ee}),t[97]=ee,t[98]=f,t[99]=e):e=t[99];let n=e,r;t[100]===b.folderPath?r=t[101]:(r=(0,Z.jsx)(dC,{folderPath:b.folderPath}),t[100]=b.folderPath,t[101]=r);let i;t[102]!==b.folderPath||t[103]!==n?(i=n?(0,Z.jsx)(fT,{folderPath:b.folderPath}):null,t[102]=b.folderPath,t[103]=n,t[104]=i):i=t[104];let a;if(t[105]!==r||t[106]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[105]=r,t[106]=i,t[107]=a):a=t[107],Wt=a,S===`agent`&&C!==null){let e;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(BC,{withHandle:!0}),t[108]=e):e=t[108];let n;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(zC,{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)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(RM,{showBackButton:!1})})})]}),t[109]=n):n=t[109],Gt=n}}else if(b?.kind===`asset`){let e;t[110]!==b.assetPath||t[111]!==b.mediaKind?(e=(0,Z.jsx)($b,{assetPath:b.assetPath,mediaKind:b.mediaKind},b.assetPath),t[110]=b.assetPath,t[111]=b.mediaKind,t[112]=e):e=t[112],Wt=e}else if(b?.kind===`skill-file`){let e=`${b.scope}/${b.name}/${b.path}`,n;t[113]!==b.name||t[114]!==b.path||t[115]!==b.scope||t[116]!==e?(n=(0,Z.jsx)(wC,{scope:b.scope,name:b.name,path:b.path},e),t[113]=b.name,t[114]=b.path,t[115]=b.scope,t[116]=e,t[117]=n):n=t[117],Wt=n}else if(W){let e;t[118]===W?e=t[119]:(e=(0,Z.jsx)(vC,{nav:W},W.path),t[118]=W,t[119]=e),Wt=e}else if(!y||!v)if((typeof window<`u`?Tl(window.location.hash):null)!==null)if(o!=null&&M){let e;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ex,{}),t[120]=e):e=t[120],Wt=e;let n;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(BC,{withHandle:!0,disabled:!0}),t[121]=n):n=t[121];let r=le?0:`${Pe}px`,i;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[122]=i):i=t[122];let a;t[123]===r?a=t[124]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(zC,{id:`doc-panel`,defaultSize:r,minSize:zM,maxSize:BM,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[123]=r,t[124]=a),Gt=a}else{let e;return t[125]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ex,{}),t[125]=e):e=t[125],e}else{let e=f?ye:null,n;t[126]===e?n=t[127]:(n=(0,Z.jsx)(MS,{terminalDock:e}),t[126]=e,t[127]=n),Wt=n}else{let e=n===`source`,o=!A,s=ue,c;t[128]!==v||t[129]!==E?(c=function(){v&&E(v)},t[128]=v,t[129]=E,t[130]=c):c=t[130];let l=c,u;t[131]!==v||t[132]!==ee||t[133]!==f?(u=wT({terminalVisible:f,isEmbedded:ee,activeDocName:v}),t[131]=v,t[132]=ee,t[133]=f,t[134]=u):u=t[134];let d=u,p=I??v,m=Ft??void 0,h;t[135]!==V||t[136]!==e||t[137]!==Ut||t[138]!==x||t[139]!==p||t[140]!==m?(h=(0,Z.jsx)(nj,{activeDocName:p,isSourceMode:e,editorPlaceholder:V,previousDocName:m,onNavigateBack:Ut,onRecycle:x}),t[135]=V,t[136]=e,t[137]=Ut,t[138]=x,t[139]=p,t[140]=m,t[141]=h):h=t[141];let g;t[142]!==v||t[143]!==e?(g=(0,Z.jsx)(iw,{activeDocName:v,isSourceMode:e}),t[142]=v,t[143]=e,t[144]=g):g=t[144];let _;t[145]!==v||t[146]!==I?(_=SM({activeDocName:v,deferredActiveDocName:I,mountResolved:v!==null&&z(v),syncResolved:v!==null&&Le(v)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(ex,{}),v===null?null:(0,Z.jsx)(gC,{docName:v})]}):null,t[145]=v,t[146]=I,t[147]=_):_=t[147];let y;t[148]!==h||t[149]!==g||t[150]!==_?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_]}),t[148]=h,t[149]=g,t[150]=_,t[151]=y):y=t[151];let b;t[152]!==v||t[153]!==j||t[154]!==s||t[155]!==e||t[156]!==r||t[157]!==l||t[158]!==Ce||t[159]!==o||t[160]!==ft?(b=!j&&(0,Z.jsx)(xM,{activeDocName:v,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:ft,reserveRightGutter:Ce&&s}),t[152]=v,t[153]=j,t[154]=s,t[155]=e,t[156]=r,t[157]=l,t[158]=Ce,t[159]=o,t[160]=ft,t[161]=b):b=t[161];let C;t[162]!==v||t[163]!==Lt||t[164]!==e||t[165]!==d?(C=d?(0,Z.jsx)(fT,{docName:v,surface:e?`source`:`wysiwyg`,dismissed:Lt,onDismiss:()=>Rt(!0),onReopen:()=>Rt(!1)}):null,t[162]=v,t[163]=Lt,t[164]=e,t[165]=d,t[166]=C):C=t[166];let w;t[167]!==y||t[168]!==b||t[169]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,b,C]}),t[167]=y,t[168]=b,t[169]=C,t[170]=w):w=t[170];let T;t[171]!==Lt||t[172]!==d?(T=d&&Lt?{onReopen:()=>Rt(!1)}:null,t[171]=Lt,t[172]=d,t[173]=T):T=t[173];let k;t[174]!==Se||t[175]!==O||t[176]!==R||t[177]!==D||t[178]!==T?(k=(0,Z.jsx)(rM,{stats:D,selectionStats:O,showStats:R,composerBadge:T,reserveRightGutter:Se}),t[174]=Se,t[175]=O,t[176]=R,t[177]=D,t[178]=T,t[179]=k):k=t[179];let M;t[180]!==w||t[181]!==k?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,k]}),t[180]=w,t[181]=k,t[182]=M):M=t[182],Wt=M;let N=be&&ue,P=!ue,F;t[183]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{Me(!0),Ne.current=!0;let e=()=>{Me(!1),Ne.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[183]=F):F=t[183];let L;t[184]!==ue||t[185]!==P?(L=(0,Z.jsx)(BC,{withHandle:P,disabled:ue,onPointerDown:F}),t[184]=ue,t[185]=P,t[186]=L):L=t[186];let B=le?0:`${Pe}px`,H=N?`0px`:zM,U;t[187]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{q(e.asPercentage===0),e.inPixels>0&&Ne.current&&(Fe.current=e.inPixels,ze(e.inPixels))},t[187]=U):U=t[187];let W=!je&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[188]===W?G=t[189]:(G=Y(`flex flex-col bg-muted/20`,W),t[188]=W,t[189]=G);let te;t[190]!==v||t[191]!==i||t[192]!==S||t[193]!==e||t[194]!==a?(te=(0,Z.jsx)(Hv,{docName:v,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:S}),t[190]=v,t[191]=i,t[192]=S,t[193]=e,t[194]=a,t[195]=te):te=t[195];let K;t[196]!==N||t[197]!==ue||t[198]!==oe||t[199]!==B||t[200]!==H||t[201]!==G||t[202]!==te?(K=(0,Z.jsx)(zC,{id:`doc-panel`,panelRef:oe,disabled:N,defaultSize:B,minSize:H,maxSize:BM,collapsible:!0,collapsedSize:0,onResize:U,inert:ue,className:G,children:te}),t[196]=N,t[197]=ue,t[198]=oe,t[199]=B,t[200]=H,t[201]=G,t[202]=te,t[203]=K):K=t[203];let ne;t[204]!==L||t[205]!==K?(ne=(0,Z.jsxs)(Z.Fragment,{children:[L,K]}),t[204]=L,t[205]=K,t[206]=ne):ne=t[206],Gt=ne}let Kt;t[207]!==d||t[208]!==c||t[209]!==o||t[210]!==ye||t[211]!==f||t[212]!==Wt?(Kt=o==null?Wt:(0,Z.jsx)(IM,{visible:f,onVisibleChange:c??GM,dockPosition:ye,onBottomContainer:he,onEditorRegion:_e,onReveal:d,children:Wt}),t[207]=d,t[208]=c,t[209]=o,t[210]=ye,t[211]=f,t[212]=Wt,t[213]=Kt):Kt=t[213];let qt=Kt,Jt;t[214]!==Be||t[215]!==He||t[216]!==c||t[217]!==se||t[218]!==be||t[219]!==_?(Jt=be?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(BC,{withHandle:!0,onPointerDown:()=>{Ue(!0),We.current=!0;let e=()=>{Ue(!1),We.current=!1,window.removeEventListener(`pointerup`,e),se.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(zC,{id:`terminal-column`,panelRef:se,style:{backgroundColor:_},defaultSize:`${Be}px`,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&We.current&&(Ve.current=e.inPixels,qe(e.inPixels))},className:Y(`flex flex-col`,!He&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:pe,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[214]=Be,t[215]=He,t[216]=c,t[217]=se,t[218]=be,t[219]=_,t[220]=Jt):Jt=t[220];let Yt=Jt,Xt=Gt!=null&&!le||be,Zt;t[221]===Symbol.for(`react.memo_cache_sentinel`)?(Zt=e=>{Ze(e),Qe.current=e},t[221]=Zt):Zt=t[221];let Qt=je||He||void 0,$t=be?`5%`:`30%`,en;t[222]===Xt?en=t[223]:(en=Xt?{}:{defaultSize:`100%`},t[222]=Xt,t[223]=en);let nn=!(je||He)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,rn;t[224]===nn?rn=t[225]:(rn=Y(nn),t[224]=nn,t[225]=rn);let an;t[226]!==qt||t[227]!==$t||t[228]!==en||t[229]!==rn?(an=(0,Z.jsx)(zC,{minSize:$t,...en,className:rn,children:qt}),t[226]=qt,t[227]=$t,t[228]=en,t[229]=rn,t[230]=an):an=t[230];let on;t[231]!==$e||t[232]!==Gt||t[233]!==Qt||t[234]!==an||t[235]!==Yt?(on=(0,Z.jsxs)(RC,{orientation:`horizontal`,groupRef:$e,"data-dragging":Qt,children:[an,Gt,Yt]}),t[231]=$e,t[232]=Gt,t[233]=Qt,t[234]=an,t[235]=Yt,t[236]=on):on=t[236];let sn;t[237]!==d||t[238]!==Ce?(sn=Ce?(0,Z.jsx)(PM,{dockPosition:`right`,onReveal:d,className:`top-2.5 right-0`}):null,t[237]=d,t[238]=Ce,t[239]=sn):sn=t[239];let cn;return t[240]!==on||t[241]!==sn?(cn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:Zt,children:[on,sn]}),t[240]=on,t[241]=sn,t[242]=cn):cn=t[242],cn}function GM(){}function KM(e){return!VM.has(e)}function qM(){return Fw()}function JM(){return gw()}function YM(){return Dr()}function XM(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 ZM(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 QM=1e3,$M=!1;function eN(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function tN(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:gs(i)?a=i:(a=void 0,$M||($M=!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`&&(eN({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=ZM(i),{current:c,crossDoc:l}=a?fs(a,n,Date.now()):{current:[],crossDoc:[]},u=nN,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>XM(e.current,p)&&XM(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,QM);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 nN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var rN=!1,iN=new Set,aN=!1;function oN(){for(let e of iN)e()}function sN(e){rN!==e&&(rN=e,oN())}function cN(){return rN}function lN(e){return iN.add(e),()=>{iN.delete(e)}}function uN(e){let t=[e.onUpdateRelaunching(()=>sN(!0)),e.onUpdateRelaunchFailed(()=>sN(!1))];return()=>{for(let e of t)e()}}function dN(){if(aN||typeof window>`u`)return;let e=window.okDesktop;e&&(aN=!0,uN(e))}function fN(){return(0,Q.useSyncExternalStore)(lN,cN,pN)}function pN(){return!1}var mN=`sync-status`;async function hN(e){try{let t=await jg(e);t.ok||_s.error(t.message,{id:mN,duration:1/0})}catch{}}function gN(e,t){let n=(0,$.c)(6),{_:r}=tn(),i=fN(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){_s.dismiss(mN);return}o.current=!0;let e=window.okDesktop;_s.warning(r({id:`HGNCsl`}),{id:mN,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{hN(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,_s.success(r({id:`GhjUB_`}),{id:mN,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var _N=4,vN=3,yN={Bird:gd,Cat:Cd,Dog:jd,Fish:Ld,Mouse:hf,Rabbit:mf,Shrimp:xf,Snail:Sf,Squirrel:Ef,Turtle:If};Object.freeze(Object.keys(yN));function bN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(yN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var xN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function SN(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=tn(),o=bN(n),s=o.kind===`animal`?yN[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Gr(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=Tr(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(Os,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(As,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function CN(e){let t=xN[e.icon];return e.displayName||t||Kc._({id:`iEQQyu`})}function wN(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 TN(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=tn(),{activeDocName:s}=gt(),{presence:c,agentId:l}=n,u=CN(c),d=wN(c.mode),f=!r&&d,p=c.currentDoc&&c.currentDoc!==`(connected)`?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(ms,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(ms,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(Ds,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(Os,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(As,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function EN(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?Kc._({id:`9euN0m`,values:{count:n}}):Kc._({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)(Pe,{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)(SN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(TN,{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)(Nt,{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)(ke,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function DN(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(SN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(TN,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function ON(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=gt(),{current:s,crossDoc:c}=tN(t,r,n);if(gN(Iw(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,_N),n;e[6]===s?n=e[7]:(n=s.slice(_N),e[6]=s,e[7]=n);let r=n,u=c.slice(0,vN),d;e[8]===c?d=e[9]:(d=c.slice(vN),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=>DN(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)(EN,{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=>DN(e,p,!0,m)),f.length>0?(0,Z.jsx)(EN,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function kN(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(AN),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function AN(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function jN(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=tn(),{channel:i}=kN();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`cSCbv3`}),t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==a?(s=(0,Z.jsx)(Ee,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=s):s=t[5],s}function MN(e,t){return t.trim()}function NN(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function PN(e,t){let n=MN(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function FN(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(sl(e)){let t=s.get(Uu(e.docName,e.docExt));if(t){let n=$c(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Qn(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Qc(e))return{...e,path:HN(e.path,n)};if(tl(e)){let t=s.get(e.path);return t&&qc(t)?{kind:`document`,docName:ku(t),docExt:Yc(t),size:e.size,modified:e.modified}:{...e,path:t??HN(e.path,n)}}return e})}function IN(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=>sl(e)?!i.has(e.docName)&&!KN(e.docName,n):Qc(e)?!KN(e.path,n):tl(e)?!a.has(e.path)&&!KN(e.path,n):!0)}function LN(e,t){if(e.kind!==`asset`||t.some(t=>tl(t)&&t.path===e.path))return e;let n=Ku(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function RN(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>UN(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>sl(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=>Qc(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(sl(i)){let e=GN(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Qc(i)){let e=WN(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function zN(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function BN(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function VN(e,t){let n=e.kind===`file`?Uu(e.path,e.docExt):e.path;return na(t.contentDir,n,t.pathSeparator)}function HN(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 UN(e,t){return sl(e)&&sl(t)?e.docName===t.docName:Qc(e)&&Qc(t)||tl(e)&&tl(t)?e.path===t.path:!1}function WN(e,t,n){return e===t?n:GN(e,t,n)}function GN(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function KN(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function qN(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)(Tp,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function JN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ep,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YN(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)(kp,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function XN(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)(Fp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function ZN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 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)(Dp,{children:(0,Z.jsx)(Op,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QN(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Y(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(jp,{"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 $N(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=Y(`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)(Ji,{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)(Ip,{"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 eP(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-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)(Lp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tP(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=Y(`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)(Np,{children:(0,Z.jsx)(Gi,{})})}),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)(Mp,{"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 nP(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=Y(`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)(Ap,{"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 rP(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`-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)(Pp,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var iP=`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`,aP=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,oP={start:[Jo.Space],cancel:[Jo.Esc],end:[Jo.Space,Jo.Enter]};function sP(e){return Y(iP,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function cP(e){return e?void 0:-1}function lP({className:e,isDragging:t}){return Y(e,t&&aP)}function uP(e){return e.code===Jo.Enter&&e.target===e.currentTarget}function dP({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&uP(e)?`activate-tab`:`delegate-sortable`}function fP({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:$o.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 pP(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 mP(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 hP=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 Ho(e)},gP=[`.md`,`.mdx`],_P=`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`,vP=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,yP=Y(vP,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),bP=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function xP(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function SP(e){let t=El(e);window.location.hash!==t&&(window.location.hash=t)}function CP(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function wP(e,t){let n=[t,...gP].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 TP(e){return e.metaKey||e.ctrlKey}var EP=1e3;function DP(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function OP(e,t){return DP(e,t)}function kP(e,t){let n=DP(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function AP(e,t){if(!TP(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function jP(e){let t=(0,$.c)(3),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Y(sP(!0),`font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0`),t[0]=r):r=t[0];let i=`⌘${n}`,a;return t[1]===i?a=t[2]:(a=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:r,children:(0,Z.jsx)(F,{className:`text-[10px]`,children:i})}),t[1]=i,t[2]=a),a}function MP(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:_}=Zo(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=fP({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=dP({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=lP({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 NP(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=Zt(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=Zt(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(JN,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(J,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(QN,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(J,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(QN,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(J,{id:`U2Kx6T`}):(0,Z.jsx)(J,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(QN,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(rP,{}),(0,Z.jsx)(QN,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(J,{id:`SYfHmN`}):(0,Z.jsx)(J,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(ZN,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(qN,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function PP(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=tn();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(jP,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(pf,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=sP(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=cP(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(vs,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function FP(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(cs,{"aria-hidden":`true`,"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 IP(e){let t=(0,$.c)(27),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,enterRenameMode:o,extension:s,hideDocExtension:c,tabId:l}=e,{_:u}=tn(),d=uw(a)===`conflict`,f;t[0]!==u||t[1]!==n||t[2]!==d?(f=d?u({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=u,t[1]=n,t[2]=d,t[3]=f):f=t[3];let p=f,m;t[4]!==r||t[5]!==l?(m=()=>{r(l)},t[4]=r,t[5]=l,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==o||t[9]!==l?(h=e=>{e.preventDefault(),e.stopPropagation(),o(l,a)},t[7]=a,t[8]=o,t[9]=l,t[10]=h):h=t[10];let g;t[11]===d?g=t[12]:(g=(0,Z.jsx)(FP,{hasConflict:d}),t[11]=d,t[12]=g);let _;t[13]===i?_=t[14]:(_=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[13]=i,t[14]=_);let v;t[15]!==s||t[16]!==c?(v=!c&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:s}),t[15]=s,t[16]=c,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":p,title:p,className:bP,onClick:m,onDoubleClick:h,tabIndex:-1,children:[g,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=y,t[26]=b):b=t[26],b}function LP(){let e=(0,$.c)(94),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:c,closeTab:l,closeTabs:u,getPoolActiveDocName:d,poolHas:f,isNewTabActive:p,newTabIds:m,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,reopenClosedTab:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=gt(),{_:T}=tn(),{pageMeta:E}=Zi(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G=(0,Q.useRef)(null),te=(0,Q.useRef)(!1),K=(0,Q.useRef)(!1),ne;e[0]!==n||e[1]!==t||e[2]!==i?(ne=n??(i?h(i):t?Wt(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=ne):ne=e[3];let re=ne,ie;e[4]!==r||e[5]!==re||e[6]!==p||e[7]!==m||e[8]!==_?(ie=p?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${m.join(`\0`)}`:re?`${re}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=re,e[6]=p,e[7]=m,e[8]=_,e[9]=ie):ie=e[9];let ae=ie,oe,se;e[10]===t?(oe=e[11],se=e[12]):(oe=()=>{W.current=t},se=[t],e[10]=t,e[11]=oe,e[12]=se),(0,Q.useEffect)(oe,se);let ce,le;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>()=>{G.current!==null&&(window.clearTimeout(G.current),G.current=null)},le=[],e[13]=ce,e[14]=le):(ce=e[13],le=e[14]),(0,Q.useEffect)(ce,le);let ue,q;e[15]===ae?(ue=e[16],q=e[17]):(ue=()=>{ae&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[ae],e[15]=ae,e[16]=ue,e[17]=q),(0,Q.useEffect)(ue,q);let de,fe;e[18]===A?(de=e[19],fe=e[20]):(de=()=>{A&&(B.current?.focus(),B.current?.select())},fe=[A],e[18]=A,e[19]=de,e[20]=fe),(0,Q.useEffect)(de,fe);let pe,he;e[21]!==_||e[22]!==A?(pe=()=>{!A||_.includes(A.tabId)||(H.current=!0,U.current=null,j(null),N(``),F(null),L(!1))},he=[_,A],e[21]=_,e[22]=A,e[23]=pe,e[24]=he):(pe=e[23],he=e[24]),(0,Q.useEffect)(pe,he);let ge;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,j({docName:t,tabId:e}),N(n[n.length-1]),F(null)},e[25]=ge):ge=e[25];let _e=ge,ve=function(){H.current=!0,U.current=null,j(null),N(``),F(null),L(!1)},ye=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=A?.docName;if(!e){ve();return}let t=MN(`file`,wP(M,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ve();return}if(t===U.current){B.current?.focus();return}if(!NN(t)){F(T({id:`P8yDjG`})),B.current?.focus();return}let i=PN({kind:`file`,path:e,name:r},t);V.current=!0,L(!0),F(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){L(!1),V.current=!1;return}let r=await At(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),V.current=!1,U.current=t,B.current?.focus();return}let a=tt(Lr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,c=zN(o,a);ee(a);let l=!0;try{let e=BN(a,d(),f);await Promise.all(e.map(e=>s(e))),x(a),ul([`files`,`backlinks`,`graph`])}catch(n){let r=n;l=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),_s.error(T({id:`MUBR8r`}))}H.current=!0,j(null),N(``),F(null),L(!1),V.current=!1,U.current=null,l&&c&&c!==o&&SP(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(T({id:`HIb0vl`})),L(!1),V.current=!1,U.current=t,B.current?.focus()}},be=typeof window<`u`&&window.okDesktop!=null,xe;e[26]===m?xe=e[27]:(xe=new Set(m),e[26]=m,e[27]=xe);let Se=xe,Ce;e[28]===O?Ce=e[29]:(Ce=mP(O),e[28]=O,e[29]=Ce);let we;e[30]===Ce?we=e[31]:(we=[Ce],e[30]=Ce,e[31]=we);let Te=we,Ee;e[32]!==c||e[33]!==u||e[34]!==Se?(Ee=function(e){let t=[],n=[];for(let r of e)Se.has(r)?n.push(r):t.push(r);t.length>0&&u(t);for(let e of n)c(e)},e[32]=c,e[33]=u,e[34]=Se,e[35]=Ee):Ee=e[35];let De=Ee,Oe,ke;e[36]!==o||e[37]!==a||e[38]!==r||e[39]!==re||e[40]!==p||e[41]!==m||e[42]!==g||e[43]!==b||e[44]!==w?(Oe=()=>{let e=new Set(m),t=function(){G.current!==null&&(window.clearTimeout(G.current),G.current=null)},n=function(e){te.current!==e&&(te.current=e)},i=function(e){K.current!==e&&(K.current=e,z(e))},s=function(){n(!0),!(K.current||G.current!==null)&&(G.current=window.setTimeout(()=>{G.current=null,te.current&&i(!0)},EP))},c=function(){t(),n(!1),i(!1)},l=function(t){e.has(t)?o(t):a(t)},u=function(e){if(w.length===0)return;let t=p?r:re,n=t?w.indexOf(t):-1;l(w[((n>=0?n:0)+e+w.length)%w.length])},d=function(e){if(TP(e)&&s(),jl(e,`tab-new`)){e.preventDefault(),g();return}if(jl(e,`tab-reopen-closed`)){e.preventDefault(),b();return}if(jl(e,`tab-next`)){e.preventDefault(),u(1);return}if(jl(e,`tab-previous`)){e.preventDefault(),u(-1);return}let t=AP(e,w.length);t!==null&&(e.preventDefault(),l(w[t]))},f=function(e){!e.metaKey&&!e.ctrlKey&&c()};return window.addEventListener(`keydown`,d,{capture:!0}),window.addEventListener(`keyup`,f,{capture:!0}),window.addEventListener(`blur`,c),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),window.removeEventListener(`keyup`,f,{capture:!0}),window.removeEventListener(`blur`,c),document.removeEventListener(`visibilitychange`,c)}},ke=[r,re,o,a,p,m,g,b,w],e[36]=o,e[37]=a,e[38]=r,e[39]=re,e[40]=p,e[41]=m,e[42]=g,e[43]=b,e[44]=w,e[45]=Oe,e[46]=ke):(Oe=e[45],ke=e[46]),(0,Q.useEffect)(Oe,ke);let Ae;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={activationConstraint:{distance:8}},e[47]=Ae):Ae=e[47];let je;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(je={coordinateGetter:Go,keyboardCodes:oP},e[48]=je):je=e[48];let Me=Qo(zo(Uo,Ae),zo(Ko,je)),Ne=R,Pe;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=function(){k(pP(D.current))},e[49]=Pe):Pe=e[49];let Fe=Pe,Ie;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=function(){k(null)},e[50]=Ie):Ie=e[50];let Le=Ie,Re;e[51]!==Le||e[52]!==S||e[53]!==w?(Re=function(e){Le();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(Yo([...w],r,i),t)},e[51]=Le,e[52]=S,e[53]=w,e[54]=Re):Re=e[54];let ze=Re,Be=be?``:void 0,Ve;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=Y(`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]`,be&&`[-webkit-app-region:drag]`),e[55]=Ve):Ve=e[55];let He=CP,Ue;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=Y(`flex items-end gap-1`,be&&`[-webkit-app-region:no-drag]`),e[56]=Ue):Ue=e[56];let We=Vo,Ge=hP,Ke;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ke={container:typeof document<`u`?document.body:void 0},e[57]=Ke):Ke=e[57];let qe=qo,Je;e[58]===w?Je=e[59]:(Je=[...w],e[58]=w,e[59]=Je);let Ye=Bo,Xe=w.map((e,t)=>{let n=R?OP(t,w.length):null,i=kP(t,w.length);if(Se.has(e)){let t=e===r;return(0,Z.jsx)(NP,{tabId:e,canPin:!1,openTabs:w,closeTab:c,closeTabs:De,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(MP,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":t?`true`:void 0,className:Y(_P,t?vP:yP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),c(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:bP,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(J,{id:`3YvS-c`})})}),n?(0,Z.jsx)(jP,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:sP(Ne||t),tabIndex:cP(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(vs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let s=Jt(e),u=e===re,d=y.includes(e);if(s.kind===`folder`){let{baseName:t,label:r,prefix:o}=Kt(s.folderPath,`/`),c=`${o}${r}`;return(0,Z.jsx)(NP,{tabId:e,openTabs:w,closeTab:l,closeTabs:De,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(MP,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(_P,u?vP:yP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:bP,onClick:()=>{a(e)},tabIndex:-1,children:[o&&(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate`,u&&`text-muted-foreground`),children:o}),(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center`,o?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(PP,{accessibleLabel:c,closeTab:l,forceCloseVisible:Ne,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})},e)}if(s.kind===`asset`||s.kind===`skill-file`){let{baseName:t,label:r,prefix:o}=Kt(s.kind===`asset`?s.assetPath:s.path,``),c=`${o}${r}`;return(0,Z.jsx)(NP,{tabId:e,openTabs:w,closeTab:l,closeTabs:De,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(MP,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(_P,u?vP:yP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:bP,onClick:()=>{a(e)},tabIndex:-1,children:[o?(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:o}):null,(0,Z.jsx)(`span`,{className:Y(`min-w-0 truncate`,o?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(PP,{accessibleLabel:c,closeTab:l,forceCloseVisible:Ne,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})},e)}let f=s.docName,p=E.get(f)?.docExt??`.md`,{baseName:m,extension:h,label:g,prefix:_}=Kt(f,p),b=`${_}${g}`,x=p===`.md`||p===`.mdx`,S=A?.tabId===e,D=`editor-tab-rename-error-${xP(f)}`;return(0,Z.jsx)(NP,{disabled:S,tabId:e,openTabs:w,closeTab:l,closeTabs:De,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsx)(MP,{tabId:e,activateFromKeyboard:()=>a(e),disabled:S,"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(_P,u?vP:yP,S&&P&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(VC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(KC,{ref:B,value:M,disabled:I,"aria-label":T({id:`Dw1T_W`,values:{label:g}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":P?!0:void 0,"aria-describedby":P?D:void 0,"aria-busy":I||void 0,title:P??f,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=>{N(wP(e.target.value,p)),F(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ye()):e.key===`Escape`&&(e.preventDefault(),ve())},onBlur:ye}),(0,Z.jsx)(UC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(GC,{className:`text-muted-foreground/60 text-xs`,children:p})})]}),P?(0,Z.jsx)(`span`,{id:D,role:`alert`,className:`sr-only`,children:P}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(IP,{accessibleLabel:b,activateTab:a,baseName:m,docName:f,enterRenameMode:_e,extension:h,hideDocExtension:x,tabId:e}),(0,Z.jsx)(PP,{accessibleLabel:b,closeTab:l,forceCloseVisible:Ne,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})})},e)}),Ze;e[60]!==qe||e[61]!==Je||e[62]!==Ye||e[63]!==Xe?(Ze=(0,Z.jsx)(qe,{items:Je,strategy:Ye,children:Xe}),e[60]=qe,e[61]=Je,e[62]=Ye,e[63]=Xe,e[64]=Ze):Ze=e[64];let Qe;e[65]!==We||e[66]!==Le||e[67]!==ze||e[68]!==Fe||e[69]!==Me||e[70]!==!1||e[71]!==Ge||e[72]!==Ke||e[73]!==Ze||e[74]!==Te?(Qe=(0,Z.jsx)(We,{sensors:Me,autoScroll:!1,collisionDetection:Ge,modifiers:Te,onDragStart:Fe,onDragEnd:ze,onDragCancel:Le,accessibility:Ke,children:Ze}),e[65]=We,e[66]=Le,e[67]=ze,e[68]=Fe,e[69]=Me,e[70]=!1,e[71]=Ge,e[72]=Ke,e[73]=Ze,e[74]=Te,e[75]=Qe):Qe=e[75];let $e;e[76]===T?$e=e[77]:($e=T({id:`3YvS-c`}),e[76]=T,e[77]=$e);let et;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(me,{"aria-hidden":`true`}),e[78]=et):et=e[78];let nt;e[79]!==g||e[80]!==$e?(nt=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":$e,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:et})}),e[79]=g,e[80]=$e,e[81]=nt):nt=e[81];let rt;e[82]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(Os,{children:(0,Z.jsx)(J,{id:`3YvS-c`})}),e[82]=rt):rt=e[82];let it;e[83]===nt?it=e[84]:(it=(0,Z.jsxs)(As,{children:[nt,rt]}),e[83]=nt,e[84]=it);let at;e[85]!==Ue||e[86]!==Qe||e[87]!==it?(at=(0,Z.jsxs)(`div`,{className:Ue,children:[Qe,it]}),e[85]=Ue,e[86]=Qe,e[87]=it,e[88]=at):at=e[88];let ot;return e[89]!==Be||e[90]!==Ve||e[91]!==He||e[92]!==at?(ot=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":Be,className:Ve,onWheel:He,children:at}),e[89]=Be,e[90]=Ve,e[91]=He,e[92]=at,e[93]=ot):ot=e[93],ot}var RP=(e,t,n)=>{if(e&&`reportValidity`in e){let r=La(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},zP=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?RP(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>RP(t,n,e))}},BP=(e,t)=>{t.shouldUseNativeValidation&&zP(e,t);let n={};for(let r in e){let i=La(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(VP(t.names||Object.keys(e),r)){let e=Object.assign({},La(n,r));ro(e,`root`,a),ro(n,r,e)}else ro(n,r,a)}return n},VP=(e,t)=>{let n=HP(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>HP(e).match(`^${n}\\.\\d+`))};function HP(e){return e.replace(/[\[\]]/g,``)}function UP(){return UP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},UP.apply(null,arguments)}function WP(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function GP(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ka(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function KP(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(UP({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ka(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function qP(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(WP(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&zP({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:BP(GP(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(WP(function(){return Promise.resolve((n.mode===`sync`?hr:vr)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&zP({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof qn}(e))return{values:{},errors:BP(KP(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var JP=`https://openknowledge.ai/api/subscribe`;async function YP(e,t){try{let n=await fetch(JP,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function XP(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=tn(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=gr({email:gi({message:u({id:`Wq6Wcm`})})});_=Da,g=qP(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await YP(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=Y(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Gi,{className:`size-4 text-primary`}),(0,Z.jsx)(J,{id:`PIMM5l`})]}):r??(0,Z.jsx)(J,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(J,{id:`pBROkv`}):i??(0,Z.jsx)(J,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(vs,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Va,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(VC,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(UC,{className:`pl-2.5`,children:(0,Z.jsx)(ef,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(KC,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(X,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:Y(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ts,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`EDl9kS`})})]}):(0,Z.jsx)(J,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var ZP=`https://github.com/inkeep/open-knowledge`,QP=`https://discord.com/invite/YujKpFN49`,$P=`https://x.com/OpenKnowledge`,eF=`ok-subscribe-card-v1`,tF={subscribed:!1,dismissed:!1,shownVersions:[]};function nF(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function rF(e){return e===!0}function iF(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function aF(e){if(typeof e!=`object`||!e)return tF;let t=e;return{subscribed:rF(t.subscribed),dismissed:rF(t.dismissed),shownVersions:iF(t.shownVersions)}}function oF(e){try{let t=(e??localStorage).getItem(eF);return t==null?tF:aF(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),tF}}function sF(e,t){try{(t??localStorage).setItem(eF,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function cF(e){let t=oF(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,sF(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=oF(e),i())}}}var lF=cF();function uF(){lF.install()}function dF(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 fF(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),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 pF(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 mF=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:dt},{label:{id:`PCNIuJ`},href:`${ZP}/issues/new`,icon:Td},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Xi}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:QP,icon:dF},{label:`X (Twitter)`,href:$P,icon:pF},{label:`GitHub`,href:ZP,icon:fF}]}],hF=`${ZP}/releases`,gF=`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`;function _F(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var vF=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=tn(),i,a,o,s;t[0]!==r||t[1]!==n?(i=_F(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Df,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},yF=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=tn(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>fu(e,o),l=e=>fu(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:gF,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},bF=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},xF=()=>{let e=(0,$.c)(28),{_:t}=tn(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c,l;e[0]!==n||e[1]!==o?(c=()=>{if(!n||o!==null)return;let e=new AbortController;return fi({signal:e.signal}).then(e=>{e!==null&&s(e)}),()=>e.abort()},l=[n,o],e[0]=n,e[1]=o,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{r(e),e||a(!1)},e[4]=u):u=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(St,{className:`size-4`}),e[5]=d):d=e[5];let f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(Pe,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[d,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`s-MGs7`})})]})})}),e[6]=f):f=e[6];let p;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(As,{children:[f,(0,Z.jsx)(Os,{children:(0,Z.jsx)(J,{id:`s-MGs7`})})]}),e[7]=p):p=e[7];let m;e[8]!==t||e[9]!==o?(m=mF.map((e,n)=>(0,Z.jsxs)(`div`,{className:Y(n>0&&`mt-3`),children:[(0,Z.jsx)(bF,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:e.links.map(e=>(0,Z.jsx)(yF,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&o!==null?(0,Z.jsx)(vF,{count:o}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=o,e[10]=m):m=e[10];let h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(bF,{children:(0,Z.jsx)(J,{id:`arUUsK`})}),e[11]=h):h=e[11];let g;e[12]===t?g=e[13]:(g=t({id:`arUUsK`}),e[12]=t,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(yF,{link:{label:{id:`3ePd3I`},href:hF,icon:tf}}),e[14]=_):_=e[14];let v;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Pe,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:Y(gF,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(ef,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(J,{id:`EDl9kS`})]})}),e[15]=v):v=e[15];let y;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Nt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(XP,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:SF})}),e[16]=y):y=e[16];let b;e[17]===i?b=e[18]:(b=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[_,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(ke,{open:i,onOpenChange:a,children:[v,y]})})]}),e[17]=i,e[18]=b);let x;e[19]!==b||e[20]!==g?(x=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[h,(0,Z.jsx)(`nav`,{"aria-label":g,children:b})]}),e[19]=b,e[20]=g,e[21]=x):x=e[21];let S;e[22]!==x||e[23]!==m?(S=(0,Z.jsxs)(Nt,{align:`end`,className:`w-56 p-3`,children:[m,x]}),e[22]=x,e[23]=m,e[24]=S):S=e[24];let C;return e[25]!==n||e[26]!==S?(C=(0,Z.jsxs)(ke,{open:n,onOpenChange:u,children:[p,S]}),e[25]=n,e[26]=S,e[27]=C):C=e[27],C};function SF(){return lF.markSubscribed()}var CF=50,wF=()=>{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,EC.preload()},CF))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Ga)},l=(0,Z.jsx)(yf,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(As,{children:[u,(0,Z.jsx)(Os,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},TF=`https://openknowledge.ai/docs/features/share`;function EF(e){let t=(0,$.c)(50),{input:n,onClickWhenNoRemote:r}=e,{_:i}=tn(),{status:a}=ji(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h=Di(c?.freshness,a),g;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(g=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Na({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:va,toastSuccess:PF,toastError:NF,logEvent:MF});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{_s.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=g):g=t[9];let _=g,v=c!==null,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{e||l(null)},t[10]=y):y=t[10];let b;t[11]!==i||t[12]!==n?.kind?(b=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=b):b=t[13];let x=o||m,S,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(bf,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(J,{id:`Z8lGw6`}),t[14]=S,t[15]=C):(S=t[14],C=t[15]);let w;t[16]!==_||t[17]!==b||t[18]!==x?(w=(0,Z.jsx)(xt,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":b,onClick:_,disabled:x,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})}),t[16]=_,t[17]=b,t[18]=x,t[19]=w):w=t[19];let T=h?`w-96`:`w-80`,E;t[20]===T?E=t[21]:(E=Y(`flex flex-col gap-2`,T),t[20]=T,t[21]=E);let D;t[22]===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)(J,{id:`Z8lGw6`})}),t[22]=D):D=t[22];let O;t[23]===c?.autoCopyFailed?O=t[24]:(O=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ndeI89`})}):null,t[23]=c?.autoCopyFailed,t[24]=O);let k=c?.url??``,A;t[25]===i?A=t[26]:(A=i({id:`5-FeN2`}),t[25]=i,t[26]=A);let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsx)(Wc,{ref:u,readOnly:!0,value:k,onFocus:jF,onClick:AF,onContextMenu:kF,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":A}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M=c?.url??``,N=c?.autoCopyFailed===!1,P;t[30]!==M||t[31]!==N?(P=(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)(W,{copyContent:M,clipboardWrite:va,initialCopied:N})})}),t[30]=M,t[31]=N,t[32]=P):P=t[32];let F;t[33]!==j||t[34]!==P?(F=(0,Z.jsxs)(`div`,{className:`relative`,children:[j,P]}),t[33]=j,t[34]=P,t[35]=F):F=t[35];let I=c?.freshness,L=n?.kind??`doc`,R;t[36]!==a||t[37]!==I||t[38]!==L?(R=(0,Z.jsx)(Ti,{freshness:I,status:a,kind:L}),t[36]=a,t[37]=I,t[38]=L,t[39]=R):R=t[39];let z;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsxs)(`a`,{href:TF,target:`_blank`,rel:`noopener noreferrer`,onClick:OF,onAuxClick:DF,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)(St,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`aByJ8j`})]}),t[40]=z):z=t[40];let B;t[41]!==E||t[42]!==O||t[43]!==F||t[44]!==R?(B=(0,Z.jsxs)(Nt,{align:`end`,className:E,"data-testid":`share-button-popover`,children:[D,O,F,R,z]}),t[41]=E,t[42]=O,t[43]=F,t[44]=R,t[45]=B):B=t[45];let V;return t[46]!==w||t[47]!==B||t[48]!==v?(V=(0,Z.jsxs)(ke,{open:v,onOpenChange:y,children:[w,B]}),t[46]=w,t[47]=B,t[48]=v,t[49]=V):V=t[49],V}function DF(e){return fu(e,TF)}function OF(e){return fu(e,TF)}function kF(e){return e.currentTarget.select()}function AF(e){return e.currentTarget.select()}function jF(e){return e.currentTarget.select()}function MF(e){return console.log(e)}function NF(e){e!==`Link ready but could not copy to clipboard.`&&_s.error(e)}function PF(e){return _s.success(e)}function FF(e){let t=(0,$.c)(35),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=tn(),{activeDocName:o,activeTarget:s}=gt(),c=o?ei(o):null,{state:l,isDraggingRail:u}=Dj(),d=lg(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=Al(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=Al(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=Aa(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=Ra(o),t[3]=o,t[4]=e),_=e;break bb0}if(!s&&!o){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Aa(``),t[5]=e):e=t[5],_=e;break bb0}_=null}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=l===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,C=y&&!u&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,w;t[6]!==S||t[7]!==C?(w=Y(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,C),t[6]=S,t[7]=C,t[8]=w):w=t[8];let T=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(Mj,{className:Y(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Os,{children:l===`expanded`?(0,Z.jsx)(J,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(J,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Y(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)($t,{"aria-hidden":`true`})})}),(0,Z.jsx)(Os,{children:(0,Z.jsx)(J,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(Xa,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(LP,{})]}),E;t[9]===T?E=t[10]:(E=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:T}),t[9]=T,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=Y(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[11]=D):D=t[11];let O;t[12]!==h||t[13]!==g||t[14]!==v||t[15]!==d?(O=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(EF,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(bo,{open:h,onOpenChange:g})]}),t[12]=h,t[13]=g,t[14]=v,t[15]=d,t[16]=O):O=t[16];let k;t[17]!==r||t[18]!==n?(k=(0,Z.jsx)(Za,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=k):k=t[19];let A,j,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(ON,{}),j=(0,Z.jsx)(Xa,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(jN,{}),t[20]=A,t[21]=j,t[22]=M):(A=t[20],j=t[21],M=t[22]);let N;t[23]===d?N=t[24]:(N=!d&&(0,Z.jsx)(wF,{}),t[23]=d,t[24]=N);let P;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(xF,{}),t[25]=P):P=t[25];let F;t[26]!==O||t[27]!==k||t[28]!==N?(F=(0,Z.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N,P]}),t[26]=O,t[27]=k,t[28]=N,t[29]=F):F=t[29];let I;return t[30]!==F||t[31]!==x||t[32]!==w||t[33]!==E?(I=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[E,F]}),t[30]=F,t[31]=x,t[32]=w,t[33]=E,t[34]=I):I=t[34],I}var IF=`open-knowledge:terminal-launch`;function LF(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(IF,{detail:{prompt:e,cli:t}}))}function RF(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(IF,n),()=>t.removeEventListener(IF,n)}function zF(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=Y(`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)($p,{"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 BF=yi(`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 VF(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=Y(BF({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)(em,{"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 HF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`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)(tm,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}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=Y(`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)(nm,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var WF=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-CFHapL_S.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([91,1,10,3,11,6,7,13,56,16,37,92,65,32,33,93]),import.meta.url));function GF(e){let t=(0,$.c)(14),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o,onPtyId:s}=e,c=a===void 0?null:a,l=o===void 0?null:o,{enabled:u,synced:d}=yo(),f=xo(),{_:p}=tn(),m=d&&u===!1,h;t[0]!==p||t[1]!==f?(h=function(){if(f===null){_s.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||_s.error(p({id:`jKd3AP`,values:{0:e.error}}))},t[0]=p,t[1]=f,t[2]=h):h=t[2];let _=h;if(d&&!m){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let a;return t[4]!==l||t[5]!==n||t[6]!==c||t[7]!==r||t[8]!==s||t[9]!==i?(a=(0,Z.jsx)(g,{fallbackRender:qF,onError:KF,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(WF,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:c,adoptPtyId:l,onPtyId:s})})}),t[4]=l,t[5]=n,t[6]=c,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a}let v;return t[11]!==_||t[12]!==m?(v=m?(0,Z.jsx)(XF,{onEnable:_}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[11]=_,t[12]=m,t[13]=v):v=t[13],v}function KF(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function qF(e){return(0,Z.jsx)(JF,{...e})}function JF(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=tn(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===r?o=t[4]:(o=r({id:`6MnZEC`}),t[3]=r,t[4]=o);let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[5]=a,t[6]=s);let c;t[7]===r?c=t[8]:(c=r({id:`HpK_8d`}),t[7]=r,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,Z.jsx)(X,{onClick:YF,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==o||t[12]!==s||t[13]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":o,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[s,l]}),t[11]=o,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function YF(){return window.location.reload()}function XF(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=tn(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`oYepHb`}),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=r({id:`v2ZW0K`}),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==s?(c=(0,Z.jsx)(X,{onClick:n,children:s}),t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;t[11]===r?l=t[12]:(l=r({id:`ICoNYz`}),t[11]=r,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;return t[15]!==i||t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[o,c,u]}),t[15]=i,t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function ZF(e){let t=(0,$.c)(48),{selected:n,onLaunchSelected:r,onPickCli:i,onPickTerminal:a,className:o}=e,{_:s}=tn(),c=n===`terminal`,l;t[0]!==s||t[1]!==c||t[2]!==n?(l=s(c?{id:`AB4qw9`}:{id:`nP-KFo`,values:{0:ui[n].displayName}}),t[0]=s,t[1]=c,t[2]=n,t[3]=l):l=t[3];let u=l,d;t[4]===o?d=t[5]:(d=Y(`flex shrink-0 items-center`,o),t[4]=o,t[5]=d);let f;t[6]!==c||t[7]!==n?(f=c?(0,Z.jsx)(Tf,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(la,{id:ca(n),className:`size-3.5`,"aria-hidden":`true`}),t[6]=c,t[7]=n,t[8]=f):f=t[8];let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(me,{"aria-hidden":`true`,className:`size-3`}),t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==u||t[12]!==f?(m=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":u,"data-testid":`terminal-new-chat`,className:`cursor-pointer gap-0.5 rounded-r-none px-1.5 text-muted-foreground hover:text-foreground`,onClick:r,children:[f,p]})}),t[10]=r,t[11]=u,t[12]=f,t[13]=m):m=t[13];let h;t[14]===u?h=t[15]:(h=(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:u}),t[14]=u,t[15]=h);let g;t[16]!==m||t[17]!==h?(g=(0,Z.jsxs)(As,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18];let _;t[19]===s?_=t[20]:(_=s({id:`QJaG-9`}),t[19]=s,t[20]=_);let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Ki,{"aria-hidden":`true`,className:`size-3`}),t[21]=v):v=t[21];let y;t[22]===_?y=t[23]:(y=(0,Z.jsx)(_c,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:v})}),t[22]=_,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ac,{children:(0,Z.jsx)(J,{id:`hIQkLb`})}),t[24]=b):b=t[24];let x;t[25]!==s||t[26]!==i||t[27]!==n?(x=ba.map(e=>{let{displayName:t}=ui[e];return(0,Z.jsxs)(yc,{onSelect:()=>i(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":s({id:`9mEZeD`,values:{name:t}}),"aria-current":n===e?`true`:void 0,children:[(0,Z.jsx)(la,{id:ca(e),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),n===e?(0,Z.jsx)(Gi,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)}),t[25]=s,t[26]=i,t[27]=n,t[28]=x):x=t[28];let S;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Mc,{}),t[29]=S):S=t[29];let C=c?`true`:void 0,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Tf,{"aria-hidden":`true`,className:`size-4`}),t[30]=w):w=t[30];let T;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`ALhMYW`})}),t[31]=T):T=t[31];let E;t[32]===c?E=t[33]:(E=c?(0,Z.jsx)(Gi,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null,t[32]=c,t[33]=E);let D;t[34]!==a||t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(yc,{onSelect:a,"data-testid":`terminal-new-chat-terminal`,"aria-current":C,children:[w,T,E]}),t[34]=a,t[35]=C,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==x||t[39]!==D?(O=(0,Z.jsxs)(xc,{align:`start`,className:`min-w-[180px]`,children:[b,x,S,D]}),t[38]=x,t[39]=D,t[40]=O):O=t[40];let k;t[41]!==y||t[42]!==O?(k=(0,Z.jsxs)(Dc,{children:[y,O]}),t[41]=y,t[42]=O,t[43]=k):k=t[43];let A;return t[44]!==d||t[45]!==k||t[46]!==g?(A=(0,Z.jsxs)(`div`,{className:d,children:[g,k]}),t[44]=d,t[45]=k,t[46]=g,t[47]=A):A=t[47],A}function QF(e){let t=(0,$.c)(52),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,newChatSelected:o,onNewChatLaunch:s,onNewChatPickCli:c,onNewChatPickTerminal:l,onClose:u,dockPosition:d,onToggleDock:f,onCollapse:p,children:m,className:h,draggable:g}=e,{_}=tn(),v=d===`right`,y;t[0]===h?y=t[1]:(y=Y(`flex min-h-0 min-w-0 flex-1 flex-col`,h),t[0]=h,t[1]=y);let b=g?``:void 0,x=g&&`h-[62px] [-webkit-app-region:drag] pr-[22px] pl-[calc(var(--ok-titlebar-reserve-left,1rem)+0.75rem)]`,S;t[2]===x?S=t[3]:(S=Y(`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,x),t[2]=x,t[3]=S);let C;t[4]===_?C=t[5]:(C=_({id:`1MGRQl`}),t[4]=_,t[5]=C);let w;if(t[6]!==_||t[7]!==r||t[8]!==g||t[9]!==u||t[10]!==a||t[11]!==n){let e;t[13]!==_||t[14]!==r||t[15]!==g||t[16]!==u||t[17]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:Y(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(HF,{value:e.id,onClick:()=>a?.(e.id),className:Y(`h-7 flex-none rounded-md px-2 text-xs`,g&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})})}),(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:e.label})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:Y(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`,g&&`[-webkit-app-region:no-drag]`),onClick:t=>{t.stopPropagation(),u(e.id)},children:(0,Z.jsx)(vs,{"aria-hidden":`true`})})]},e.id)},t[13]=_,t[14]=r,t[15]=g,t[16]=u,t[17]=a,t[18]=e):e=t[18],w=n.map(e),t[6]=_,t[7]=r,t[8]=g,t[9]=u,t[10]=a,t[11]=n,t[12]=w}else w=t[12];let T;t[19]!==C||t[20]!==w?(T=(0,Z.jsx)(VF,{variant:`line`,"aria-label":C,className:`flex h-auto min-w-0 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:w}),t[19]=C,t[20]=w,t[21]=T):T=t[21];let E=g&&`[-webkit-app-region:no-drag]`,D;t[22]===E?D=t[23]:(D=Y(`shrink-0`,E),t[22]=E,t[23]=D);let O;t[24]!==o||t[25]!==s||t[26]!==c||t[27]!==l||t[28]!==D?(O=(0,Z.jsx)(ZF,{selected:o,onLaunchSelected:s,onPickCli:c,onPickTerminal:l,className:D}),t[24]=o,t[25]=s,t[26]=c,t[27]=l,t[28]=D,t[29]=O):O=t[29];let k;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`div`,{className:`flex-1`}),t[30]=k):k=t[30];let A;t[31]!==_||t[32]!==f||t[33]!==v?(A=f==null?null:(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_(v?{id:`rf6x3F`}:{id:`QNxpRm`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:f,children:v?(0,Z.jsx)(of,{"aria-hidden":`true`}):(0,Z.jsx)(uf,{"aria-hidden":`true`})})}),(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:v?(0,Z.jsx)(J,{id:`rf6x3F`}):(0,Z.jsx)(J,{id:`QNxpRm`})})]}),t[31]=_,t[32]=f,t[33]=v,t[34]=A):A=t[34];let j;t[35]!==_||t[36]!==p||t[37]!==v?(j=p==null?null:(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_({id:`VZGGPK`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:p,children:v?(0,Z.jsx)(Ji,{"aria-hidden":`true`}):(0,Z.jsx)(Ki,{"aria-hidden":`true`})})}),(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`VZGGPK`})})]}),t[35]=_,t[36]=p,t[37]=v,t[38]=j):j=t[38];let M;t[39]!==O||t[40]!==A||t[41]!==j||t[42]!==b||t[43]!==S||t[44]!==T?(M=(0,Z.jsxs)(`div`,{"data-electron-drag":b,className:S,children:[T,O,k,A,j]}),t[39]=O,t[40]=A,t[41]=j,t[42]=b,t[43]=S,t[44]=T,t[45]=M):M=t[45];let N;return t[46]!==r||t[47]!==m||t[48]!==i||t[49]!==y||t[50]!==M?(N=(0,Z.jsxs)(zF,{value:r,onValueChange:i,className:y,children:[M,m]}),t[46]=r,t[47]=m,t[48]=i,t[49]=y,t[50]=M,t[51]=N):N=t[51],N}function $F(e){return`terminal-session-${e}`}function eI(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function tI(e){let t=(0,$.c)(79),{bridge:n,variant:r,visible:i,onVisibleChange:a,launch:o,installedClis:s,container:c,isShowing:l,onRequestEditorFocus:u,dockPosition:d,onToggleDock:f,onHasSessionsChange:p}=e,m=r===void 0?`dock`:r,h=o===void 0?null:o,{_:g}=tn(),[_]=(0,Q.useState)(sI),v,y;t[0]!==c||t[1]!==_?(v=()=>{_==null||c==null||_.parentElement!==c&&c.appendChild(_)},y=[_,c],t[0]=c,t[1]=_,t[2]=v,t[3]=y):(v=t[2],y=t[3]),(0,Q.useLayoutEffect)(v,y);let b=typeof n.terminal?.list==`function`,x;t[4]!==b||t[5]!==h||t[6]!==i?(x=()=>!b&&i?[{id:$F(1),launch:h,title:null,adoptPtyId:null}]:[],t[4]=b,t[5]=h,t[6]=i,t[7]=x):x=t[7];let[S,C]=(0,Q.useState)(x),w;t[8]!==b||t[9]!==i?(w=()=>!b&&i?$F(1):``,t[8]=b,t[9]=i,t[10]=w):w=t[10];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(!b),k=(0,Q.useRef)(!1),A=(0,Q.useRef)(T),j=(0,Q.useRef)(S),M=(0,Q.useRef)(!b&&i?1:0),N=(0,Q.useRef)(i&&h?h.nonce:null),P=(0,Q.useRef)(m===`window`?!1:i),F=(0,Q.useRef)(new Map),I=function(e,t){t===null?F.current.delete(e):F.current.set(e,t)},L=(0,Q.useRef)(0),R;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){M.current+=1;let t=$F(M.current);C(n=>[...n,{id:t,launch:e,title:null,adoptPtyId:null}]),E(t)},t[11]=R):R=t[11];let z=R,[B,V]=(0,Q.useState)(oI),[H,U]=(0,Q.useState)(aI),W;t[12]===s?W=t[13]:(W=s??{},t[12]=s,t[13]=W);let G;t[14]!==B||t[15]!==W?(G=d_(B,W),t[14]=B,t[15]=W,t[16]=G):G=t[16];let ee=G,te=H?`terminal`:ee,K;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){L.current+=1,z({prompt:null,cli:e,nonce:L.current})},t[17]=K):K=t[17];let ne=K,re;t[18]!==ee||t[19]!==H?(re=function(){H?z(null):ne(ee)},t[18]=ee,t[19]=H,t[20]=re):re=t[20];let ie=re,ae;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e){U(!1),b_(!1);let t=a_(e);V(t),l_(t),ne(e)},t[21]=ae):ae=t[21];let oe=ae,se;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(se=function(){U(!0),b_(!0),z(null)},t[22]=se):se=t[22];let ce=se,le;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(le=function(e,t){let n=t.trim()===``?null:t.trim();C(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[23]=le):le=t[23];let ue=le,q=(0,Q.useRef)(z),de;t[24]!==T||t[25]!==u||t[26]!==a?(de=function(e){let t=j.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===T){let e=(t[n-1]??t[n+1])?.id??``;E(e),e!==``&&queueMicrotask(()=>eI(e))}C(r),r.length===0&&(a(!1),u())},t[24]=T,t[25]=u,t[26]=a,t[27]=de):de=t[27];let fe=de,pe=(0,Q.useRef)(iI),me;t[28]!==T||t[29]!==fe||t[30]!==S?(me=()=>{q.current=z,A.current=T,j.current=S,pe.current=()=>{T!==``&&fe(T)}},t[28]=T,t[29]=fe,t[30]=S,t[31]=me):me=t[31],(0,Q.useEffect)(me);let he,ge;t[32]!==h||t[33]!==D||t[34]!==S.length||t[35]!==i?(he=()=>{if(!D)return;let e=P.current;if(P.current=i,h!=null&&h.nonce!==N.current){N.current=h.nonce,q.current(h);return}i&&!e&&S.length===0&&q.current(null)},ge=[i,h,S.length,D],t[32]=h,t[33]=D,t[34]=S.length,t[35]=i,t[36]=he,t[37]=ge):(he=t[36],ge=t[37]),(0,Q.useEffect)(he,ge);let _e;t[38]===n.terminal?_e=t[39]:(_e=()=>{if(typeof n.terminal?.list!=`function`||k.current)return;k.current=!0;let e=!1;return(async()=>{let t;try{t=await n.terminal.list()??[]}catch(e){console.error(`[terminal] reload session list() failed; cold-starting:`,e),t=[]}if(!e){if(t.length>0){let e=t.map(rI);M.current=e.length,C(e),E(e[0]?.id??``)}O(!0)}})(),()=>{e=!0,k.current=!1}},t[38]=n.terminal,t[39]=_e);let ve;t[40]===n?ve=t[41]:(ve=[n],t[40]=n,t[41]=ve),(0,Q.useEffect)(_e,ve);let ye;t[42]===n?ye=t[43]:(ye=[n],t[42]=n,t[43]=ye),(0,Q.useEffect)(()=>UE(e=>{let t=A.current,r=t===``?void 0:F.current.get(t);r==null?uu():(n.terminal.input(r,e),queueMicrotask(()=>eI(t)))}),ye);let be,xe;t[44]!==n||t[45]!==m?(be=()=>n.onMenuAction(e=>{e===`new-terminal`?q.current(null):(e===`kill-terminal`||e===`close-active-tab-or-window`&&m===`window`)&&pe.current()}),xe=[n,m],t[44]=n,t[45]=m,t[46]=be,t[47]=xe):(be=t[46],xe=t[47]),(0,Q.useEffect)(be,xe);let Se,Ce;t[48]!==_||t[49]!==m?(Se=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||m!==`window`&&(_==null||!_.contains(document.activeElement)))return;let t=j.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),E(t.id),queueMicrotask(()=>eI(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},Ce=[_,m],t[48]=_,t[49]=m,t[50]=Se,t[51]=Ce):(Se=t[50],Ce=t[51]),(0,Q.useEffect)(Se,Ce);let we;t[52]!==n.editor||t[53]!==S.length?(we=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:S.length>0})},t[52]=n.editor,t[53]=S.length,t[54]=we):we=t[54];let Te;t[55]!==n||t[56]!==S.length?(Te=[n,S.length],t[55]=n,t[56]=S.length,t[57]=Te):Te=t[57],(0,Q.useEffect)(we,Te);let Ee,De;t[58]!==p||t[59]!==S.length?(Ee=()=>{p?.(S.length>0)},De=[p,S.length],t[58]=p,t[59]=S.length,t[60]=Ee,t[61]=De):(Ee=t[60],De=t[61]),(0,Q.useEffect)(Ee,De);let Oe,ke;t[62]!==_||t[63]!==l||t[64]!==u||t[65]!==i?(Oe=()=>{l||i||_==null||!_.contains(document.activeElement)||u()},ke=[l,i,_,u],t[62]=_,t[63]=l,t[64]=u,t[65]=i,t[66]=Oe,t[67]=ke):(Oe=t[66],ke=t[67]),(0,Q.useLayoutEffect)(Oe,ke);let Ae,je;t[68]===l?(Ae=t[69],je=t[70]):(Ae=()=>{l&&eI(A.current)},je=[l],t[68]=l,t[69]=Ae,t[70]=je),(0,Q.useEffect)(Ae,je);let Me;if(t[71]!==g||t[72]!==S){let e;t[74]===g?e=t[75]:(e=(e,t)=>({id:e.id,label:e.title??g({id:`OVjNeX`,values:{0:t+1}})}),t[74]=g,t[75]=e),Me=S.map(e),t[71]=g,t[72]=S,t[73]=Me}else Me=t[73];let Ne=Me,Pe=S.length>0?(0,Z.jsx)(QF,{sessions:Ne,activeSessionId:T,onSelect:E,onTabActivate:nI,newChatSelected:te,onNewChatLaunch:ie,onNewChatPickCli:oe,onNewChatPickTerminal:ce,onClose:fe,dockPosition:d,onToggleDock:f,onCollapse:m===`window`?void 0:()=>a(!1),draggable:m===`window`,className:`h-full`,children:S.map(e=>(0,Z.jsx)(UF,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:Y(`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,m===`window`&&`px-[22px] pb-[22px]`),children:(0,Z.jsx)(GF,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>I(e.id,t),onTitleChange:t=>ue(e.id,t),onClose:()=>fe(e.id)})},e.id))}):null,Fe;return t[76]!==_||t[77]!==Pe?(Fe=_==null?null:(0,yd.createPortal)(Pe,_),t[76]=_,t[77]=Pe,t[78]=Fe):Fe=t[78],Fe}function nI(e){return queueMicrotask(()=>eI(e))}function rI(e,t){return{id:$F(t+1),launch:null,title:null,adoptPtyId:e.ptyId}}function iI(){}function aI(){return x_()}function oI(){return c_()}function sI(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function cI(e){let t=(0,$.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=Xg(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Lv[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null,[v,y]=(0,Q.useState)(!1),b=Zg(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(__),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),g_(e),y(!0)},t[2]=A):A=t[2];let j=A,M;t[3]===O?M=t[4]:(M=function(){j(O===`right`?`bottom`:`right`)},t[3]=O,t[4]=M);let N=M,P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=P):P=t[5];let[F,I]=(0,Q.useState)(P),L=(0,Q.useRef)(0),R;t[6]===b?R=t[7]:(R=function(e){let t=e??d_(c_(),b);y(!0),L.current+=1,D({prompt:null,cli:t,nonce:L.current})},t[6]=b,t[7]=R);let z=R,B;t[8]!==x||t[9]!==z?(B=function(){y(!0),!x&&!y_()&&z()},t[8]=x,t[9]=z,t[10]=B):B=t[10];let V=B,H=Ai(),{projectConfig:U,projectLocalConfig:W,projectLocalSynced:G,projectSynced:ee}=Io(),{activeDocName:te}=gt(),K=H?.hasRemote,ne=H?.pushPermission?.checkStatus,re;t[11]!==m||t[12]!==U||t[13]!==W||t[14]!==G||t[15]!==ee||t[16]!==K||t[17]!==ne?(re=w_({autoSyncOnboardingDismissed:m,hasRemote:K,projectLocalSynced:G,projectSynced:ee,projectLocalConfig:W,projectConfig:U,pushPermissionCheckStatus:ne}),t[11]=m,t[12]=U,t[13]=W,t[14]=G,t[15]=ee,t[16]=K,t[17]=ne,t[18]=re):re=t[18];let ie=re,ae,oe;t[19]===te?(ae=t[20],oe=t[21]):(ae=()=>{let e=function(e){let t=e.detail;t&&te&&nu(te,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Hg,e),()=>window.removeEventListener(Hg,e)},oe=[te],t[19]=te,t[20]=ae,t[21]=oe),(0,Q.useEffect)(ae,oe);let se,ce;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?y(dI):e===`new-terminal`&&y(!0)})},ce=[],t[22]=se,t[23]=ce):(se=t[22],ce=t[23]),(0,Q.useEffect)(se,ce);let le,ue;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>{if(window.okDesktop!=null)return;let e=function(e){jl(e,`toggle-terminal-panel`)&&(e.preventDefault(),y(uI))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ue=[],t[24]=le,t[25]=ue):(le=t[24],ue=t[25]),(0,Q.useEffect)(le,ue);let q,de;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>RF((e,t)=>{y(!0),L.current+=1,D({prompt:e,cli:t,nonce:L.current})}),de=[],t[26]=q,t[27]=de):(q=t[26],de=t[27]),(0,Q.useEffect)(q,de);let fe,pe;t[28]===v?(fe=t[29],pe=t[30]):(fe=()=>{v||D(null)},pe=[v],t[28]=v,t[29]=fe,t[30]=pe),(0,Q.useEffect)(fe,pe);let me,he;t[31]!==C||t[32]!==v?(me=()=>{window.okDesktop!=null&&C&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v})},he=[v,C],t[31]=C,t[32]=v,t[33]=me,t[34]=he):(me=t[33],he=t[34]),(0,Q.useEffect)(me,he);let ge,_e;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(lI).finally(()=>{t||w(!0)}),()=>{t=!0}},_e=[],t[35]=ge,t[36]=_e):(ge=t[35],_e=t[36]),(0,Q.useEffect)(ge,_e);let ve,ye;t[37]===v?(ve=t[38],ye=t[39]):(ve=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&Ka()}},ye=[v],t[37]=v,t[38]=ve,t[39]=ye),(0,Q.useEffect)(ve,ye),$g(H?.pausedReason),e_();let be;t[40]===a?be=t[41]:(be=function(e){s(e),a(e)},t[40]=a,t[41]=be);let xe=be,Se,Ce;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Se=()=>{d(`auth`),l(!0)},Ce=()=>{d(`identity`),l(!0)},t[42]=Se,t[43]=Ce):(Se=t[42],Ce=t[43]);let we;t[44]===r?we=t[45]:(we=(0,Z.jsx)(FF,{onSignIn:Se,onSetIdentity:Ce,onOpenSearch:r}),t[44]=r,t[45]=we);let Te=_?V:void 0,Ee;t[46]!==f||t[47]!==o||t[48]!==xe||t[49]!==Te||t[50]!==O||t[51]!==v?(Ee=(0,Z.jsx)(HM,{editorMode:o,onModeChange:xe,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:I,onRevealTerminal:Te}),t[46]=f,t[47]=o,t[48]=xe,t[49]=Te,t[50]=O,t[51]=v,t[52]=Ee):Ee=t[52];let De;t[53]!==b||t[54]!==O||t[55]!==E||t[56]!==F||t[57]!==v||t[58]!==N?(De=_&&g!=null?(0,Z.jsx)(tI,{bridge:g,visible:v,onVisibleChange:y,launch:E,installedClis:b,container:F.container,isShowing:F.isShowing,onRequestEditorFocus:()=>F.editorRegion?.focus(),dockPosition:O,onToggleDock:N,onHasSessionsChange:S}):null,t[53]=b,t[54]=O,t[55]=E,t[56]=F,t[57]=v,t[58]=N,t[59]=De):De=t[59];let Oe=u===`identity`,ke;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>{l(!1)},t[60]=ke):ke=t[60];let Ae;t[61]!==c||t[62]!==Oe?(Ae=(0,Z.jsx)(Wa,{open:c,onOpenChange:l,identityPrompt:Oe,onSuccess:ke}),t[61]=c,t[62]=Oe,t[63]=Ae):Ae=t[63];let je;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(je=()=>h(!0),t[64]=je):je=t[64];let Me;t[65]===ie?Me=t[66]:(Me=(0,Z.jsx)(S_,{open:ie,onResolved:je}),t[65]=ie,t[66]=Me);let Ne;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(zg,{}),t[67]=Ne):Ne=t[67];let Pe;return t[68]!==we||t[69]!==Ee||t[70]!==De||t[71]!==Ae||t[72]!==Me?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[we,Ee,De,Ae,Me,Ne]}),t[68]=we,t[69]=Ee,t[70]=De,t[71]=Ae,t[72]=Me,t[73]=Pe):Pe=t[73],Pe}function lI(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function uI(e){return!e}function dI(e){return!e}function fI(e){let t=El(_l(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function pI(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Ba();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)(cs,{"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)(cs,{"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(mI),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 mI(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>fI(e.file),children:[(0,Z.jsx)(cs,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var hI=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
29
|
+
`,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Rl(t,{style:t=>Ql(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return lA.set(t.changes,i),i}function fA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(vk).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(cA);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Fl.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:sA.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function pA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(vk).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(cA).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 mA(e){let t=new Vl;for(let n of e.field(vk)){let r=e.facet(hk).overrideChunk&&_A(e,n);t.add(n.fromB,n.fromB,dA(e,n,!!r))}return t.finish()}var hA=Ll.define({create:e=>mA(e),update(e,t){return t.state.field(vk,!1)==t.startState.field(vk,!1)?e:mA(t.state)},provide:e=>Kl.decorations.from(e)}),gA=new WeakMap;function _A(e,t){let n=gA.get(t);if(n!==void 0)return n;n=null;let r=e.field(cA),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(Bl.widget({widget:new vA(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Pk.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return gA.set(t,n),n}var vA=class extends Nl{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}},yA=new class extends ql{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},bA=Bl.line({class:`cm-inlineChangedLine`});function xA(e,t,n,r){let i=_A(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,yA),n.add(o.from,o.from,bA);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 SA=q({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),CA=D({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),wA=Kl.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 TA({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 EA(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=tn(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=Pn(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C=PO(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?SA:CA,u=[Kl.editable.of(!1),Il.readOnly.of(!0)],g=[du,$l(),...u,l,Kl.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Kl({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=TA({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Kl({doc:d,extensions:[du,$l(),Kl.editable.of(!1),l,wA,Kl.lineWrapping,oA({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Kl.updateListener.of(e=>{let t=yk(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=yk(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new nA({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Kl({doc:d,extensions:[...g,oA({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Kl)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Kl)||Ce(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):Kc._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,yd.createPortal)((0,Z.jsx)(X,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(J,{id:`XyOUTJ`})}),(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(X,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(J,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function DA(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 OA(e,t){return DA(e,`content`,t)}async function kA(e){return DA(e,`mine`)}async function AA(e){return DA(e,`theirs`)}async function jA(e){return DA(e,`delete`)}async function MA(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 NA(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=tn(),{conflicts:i,loading:a}=Ba(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>_l(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=PO(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),MA(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await OA(c,e);t.ok||_s.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),_s.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(EA,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(jA),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(AA),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(EA,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(kA),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(X,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(jA),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(EA,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function PA(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Rt(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 FA=`__back-nav__`;function IA(e){return e instanceof Ne||e instanceof bt||e instanceof Oe||e instanceof et||e instanceof Mt||e instanceof C?e.docName:null}function LA(e){return e instanceof Ne||e instanceof bt}function RA(e){if(e instanceof Ne){let t=e.docName;return{title:Kc._({id:`Jejur6`}),summary:Kc._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof bt){let t=e.docName;return{title:Kc._({id:`V7QxyT`}),summary:Kc._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Oe){let t=e.docName;return{title:Kc._({id:`1di5fu`}),summary:Kc._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:Kc._({id:`wvbc1r`}),summary:Kc._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Mt)return{title:Kc._({id:`Gfr4fu`}),summary:Kc._({id:`UW2Fg3`})};if(e instanceof C){let t=e.docName;return{title:Kc._({id:`vv7kpg`}),summary:Kc._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Kc._({id:`W5A0Ly`});return{title:Kc._({id:`29VNqC`}),summary:t}}function zA(e){let t=(0,$.c)(31),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=RA(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f=typeof window<`u`?window.okDesktop:void 0,p=f&&LA(n)?f:null,m,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{d.current?.focus()},h=[],t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(_S,{size:80,variant:`sleeping`}),t[4]=g):g=t[4];let _;t[5]===c?_=t[6]:(_=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=_);let v;t[7]===l?v=t[8]:(v=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=v);let y;t[9]!==_||t[10]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(J,{id:`KDw4GX`}),t[12]=b):b=t[12];let x;t[13]===r?x=t[14]:(x=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:b}),t[13]=r,t[14]=x);let S;t[15]===p?S=t[16]:(S=p?(0,Z.jsx)(X,{variant:`secondary`,onClick:()=>{jg(p).then(VA).catch(BA)},children:(0,Z.jsx)(J,{id:`uaUc6t`})}):null,t[15]=p,t[16]=S);let C;t[17]!==i||t[18]!==u||t[19]!==n||t[20]!==o||t[21]!==a||t[22]!==r?(C=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(IA(n)??i),o(a),r(FA))},children:(0,Z.jsx)(J,{id:`CKyk7Q`})}):null,t[17]=i,t[18]=u,t[19]=n,t[20]=o,t[21]=a,t[22]=r,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C||t[26]!==x?(w=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[x,S,C]}),t[24]=S,t[25]=C,t[26]=x,t[27]=w):w=t[27];let T;return t[28]!==w||t[29]!==y?(T=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[g,y,w]}),t[28]=w,t[29]=y,t[30]=T):T=t[30],T}function BA(){}function VA(e){e.ok||_s.error(e.message,{id:`server-restart-error`,duration:1/0})}function HA(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)(zA,{...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]===FA){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}: ${RA(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)(g,{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 UA(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=zr(t);return{map:n,keys:Jr(t),parseError:r}}function WA(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>UA(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=tr(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=Ze(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=pt(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)(GA,{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)(KA,{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 GA(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 KA(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var qA=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-DCf7FSvm.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([84,1,41,2,42,43,11,44,45,46,47,48,49,50,51,20,15,13,7,16,10,3,52,53,37,12,6,4,54,17,55,56,19,57,58,59,60,31,32,33,34,35,61,62,63,64,36,65,66,67,73,75,18,85,74,86,87,39,82]),import.meta.url)).ManagedArtifactProperties})),JA=gl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function YA(e){let t=e.threshold??JA;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function XA(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var ZA=gl(`ACTIVITY_MOUNT_LIMIT`,3);function QA(){return n(()=>import(`./SourceEditor-Dqc-ofa3.js`),__vite__mapDeps([88,1,41,2,42,43,11,44,45,46,47,48,49,50,51,20,15,13,7,16,10,3,52,53,37,12,6,4,54,17,55,56,19,57,58,59,60,31,32,33,34,35,61,62,63,64,36,65,66,67,89,21,87,83]),import.meta.url)}var $A=(0,Q.lazy)(async()=>({default:(await QA()).SourceEditor}));function ej(e,t,n){if(n<=0)return[];let r=e.filter(e=>!We(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 tj(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Kc._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Kc._({id:`Sc1bKE`,values:{docName:e}}):Kc._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Kc._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Kc._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Kc._({id:`bmC18N`,values:{docName:e}}):Kc._({id:`pAgkuZ`,values:{docName:e}})}:null}function nj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(hl,{name:`activity-pool`,children:(0,Z.jsx)(rj,{...e})}),t[0]=e,t[1]=n),n}function rj(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=gt(),{pages:u,loading:d}=Zi(),f=ej(c,n,ZA),m=(0,Q.useRef)(``),h=f.map(ij).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(m.current===h)return;let e=m.current?m.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)p(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;k(e,t&&t.length>0?t:crypto.randomUUID())}ml(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),m.current=h,K(t)},[h,n]);let y;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(y=e=>(0,Z.jsx)(uj,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!Jn(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let b=f.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function ij(e){return e.docName}function aj(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&&ml(`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&&(ml(`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&&ml(`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 oj(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)(ex,{}),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)($A,{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 sj(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)(rs,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ts,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(X,{type:`button`,onClick:cj,children:[(0,Z.jsx)(rs,{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 cj(){return window.location.reload()}function lj(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 uj(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=tj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=uw(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,S;t[5]!==i||t[6]!==_||t[7]!==y?(x=()=>{i&&!_?v(!0):!i&&!y&&b(!0)},S=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=x,t[9]=S):(x=t[8],S=t[9]),(0,Q.useEffect)(x,S);let C=YA({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),w=(0,Q.useRef)(``),T=`${C.isLarge}-${C.renderSource}-${C.renderVisual}`,E,D;t[10]!==n.docName||t[11]!==C.isLarge||t[12]!==C.renderSource||t[13]!==C.renderVisual||t[14]!==T||t[15]!==i||t[16]!==g?(E=()=>{w.current!==T&&(w.current=T,C.isLarge&&ml(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:C.renderSource,renderVisual:C.renderVisual}))},D=[T,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=C.isLarge,t[12]=C.renderSource,t[13]=C.renderVisual,t[14]=T,t[15]=i,t[16]=g,t[17]=E,t[18]=D):(E=t[17],D=t[18]),(0,Q.useEffect)(E,D);let O;t[19]===n.docName?O=t[20]:(O=()=>U(n.docName),t[19]=n.docName,t[20]=O);let[k]=(0,Q.useState)(O),A=k?.html??null,[j,M]=(0,Q.useState)(!1),N,P;t[21]!==n.docName||t[22]!==C.isLarge||t[23]!==C.renderSource||t[24]!==C.renderVisual||t[25]!==j||t[26]!==i||t[27]!==g?(N=()=>{XA({isLarge:C.isLarge,renderSource:C.renderSource,renderVisual:C.renderVisual,hasEmittedFirstToggle:j})&&(ml(`ok/cold/first-toggle`,{docName:n.docName,mountId:he(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),M(!0))},P=[j,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=C.isLarge,t[23]=C.renderSource,t[24]=C.renderVisual,t[25]=j,t[26]=i,t[27]=g,t[28]=N,t[29]=P):(N=t[28],P=t[29]),(0,Q.useEffect)(N,P);let F=r?`visible`:`hidden`,I=`editor:${n.docName}`,L=k?.scrollTop,R;t[30]!==a||t[31]!==n||t[32]!==C.renderSource||t[33]!==C.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]!==A?(R=f?(0,Z.jsx)(sj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(HA,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:A?(0,Z.jsx)(lj,{html:A}):(0,Z.jsx)(ex,{}),children:(0,Z.jsx)(PA,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(NA,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(Jn(n.docName)||ue(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(qA,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(WA,{provider:n.provider}),(0,Z.jsx)(Ui,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[C.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(oj,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,C.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(kO,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=C.renderSource,t[33]=C.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]=A,t[44]=R):R=t[44];let z;t[45]!==r||t[46]!==L||t[47]!==R?(z=(0,Z.jsx)(aj,{isActive:r,initialScrollTop:L,children:R}),t[45]=r,t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;return t[49]!==F||t[50]!==I||t[51]!==z?(B=(0,Z.jsx)(Q.Activity,{mode:F,name:I,children:z}),t[49]=F,t[50]=I,t[51]=z,t[52]=B):B=t[52],B}function dj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function fj(e){let{value:t,unit:n}=dj(e);return n===`rem`?t*16:t}function pj(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var mj=3600*24*7;function hj(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?gj:m,O=g===void 0?mj: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,ee;t[3]===y?(G=t[4],ee=t[5]):(G=()=>{H.current=y},ee=[y],t[3]=y,t[4]=G,t[5]=ee),(0,Q.useEffect)(G,ee);let te=fj(b),K;t[6]===x?K=t[7]:(K=fj(x),t[6]=x,t[7]=K);let ne=K,re;t[8]!==E||t[9]!==k?(re=function(e){E&&(P.current=!0,j.current=H.current?0:fj(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]=re):re=t[10];let ie=re,ae,oe;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ne||t[18]!==te||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ae=()=>{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}=dj(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<=te*w;else if(e<=te){let n=te*(w-1);t=te-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>te*T){a();let t=n(r,M.current,j.current,s),c=Math.max(te,Math.min(ne,t)),u=pj(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(te,Math.min(ne,u)),f=pj(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)}},oe=[i,a,D,te,ne,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]=ne,t[18]=te,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ae,t[25]=oe):(ae=t[24],oe=t[25]),(0,Q.useEffect)(ae,oe);let se;return t[26]===ie?se=t[27]:(se={dragRef:A,isDragging:N,handleMouseDown:ie},t[26]=ie,t[27]=se),se}function gj(){}var _j=3600*24*7,vj=`18rem`,yj=`3rem`,bj=`app-file-sidebar`,xj=`14.625rem`,Sj=`32rem`,Cj=`sidebar_width`,wj=/^\d+(?:\.\d+)?(?:rem|px)$/,Tj=Q.createContext(null);function Ej(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${Cj}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return wj.test(n)?n:e}function Dj(){let e=Q.use(Tj);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Oj(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?vj:c,[u]=Q.useState(Aj),d;t[8]===u?d=t[9]:(d=()=>bw(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>Ej(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=Dw();return kw(`left`,bw(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),Aw(`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(kj)},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: ${_w}px)`),t=()=>{let e=bw(u,window.innerWidth,`left`);p(e),C(kw(`left`,e,Dw())===`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(bj)?.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=>{jl(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":yj,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let ee;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(ee=(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]=ee):ee=t[54];let te;return t[55]!==H||t[56]!==ee?(te=(0,Z.jsx)(Tj.Provider,{value:H,children:ee}),t[55]=H,t[56]=ee,t[57]=te):te=t[57],te}function kj(e){return!e}function Aj(){return Dr()}function jj(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=tn(),{state:f,isDraggingRail:p}=Dj();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Y(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=Y(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=Y(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:bj,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function Mj(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=tn(),{toggleSidebar:o,state:s}=Dj(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Ml(`toggle-files-sidebar`);c=X,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=bj,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=Y(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(O,{}):(0,Z.jsx)(sf,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function Nj(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=tn(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=Dj(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:xj,maxResizeWidth:Sj,setIsDraggingRail:m,widthCookieName:Cj,widthCookieMaxAge:_j},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=hj(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=Y(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function Pj(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}=Dj(),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=Y(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,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 Fj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ij(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zj(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?vi:`div`,o;t[4]===n?o=t[5]:(o=Y(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Bj(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?vi:`button`,o;t[4]===n?o=t[5]:(o=Y(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Vj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Hj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Uj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Wj=yi(`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 Gj(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?vi:`button`,{state:m}=Dj(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Y(Wj({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)(Ds,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Os,{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)(As,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function Kj(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?vi:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=Y(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function qj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Jj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yj(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?vi:`a`,d;t[6]===n?d=t[7]:(d=Y(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function Xj(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 Zj(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=kr.safeParse(t);return n.success?n.data.currentBranch??null:null}var Qj=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:Xj({fetchBranch:Zj,subscribeToEvent:cl}),$j=Qj.subscribe,eM=Qj.getSnapshot;function tM(){return(0,Q.useSyncExternalStore)($j,eM,eM)}function nM(){let e=(0,$.c)(6),t=tM(),n=ta(),{state:r}=Dj(),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&&Ia(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 rM(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=tn(),u=nM();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=Y(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(X,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(is,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(Fe,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(iM,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(J,{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)(J,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function 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)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Os,{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)(Ro,{"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 aM(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=tn(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=Y(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function oM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`flex flex-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 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=Y(`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 cM(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=Y(`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 lM(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=Y(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Ji,{}),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 uM=1,dM=2,fM=4;function pM(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ei(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:Kt(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>fM?[...u.slice(0,uM).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(uM,-dM)},...u.slice(-dM).map((e,t)=>d(e,u.length-dM+t))]:u.map((e,t)=>d(e,t));a=aM,t[8]===r?c=t[9]:(c=Y(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=oM,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(mM)}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 mM(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(lM,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(sM,{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)(Md,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(sM,{className:`min-w-0`,children:(0,Z.jsx)(cM,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var hM={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`},gM=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`,...hM,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},_M=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)(gM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},vM=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)(gM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function yM(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=tn(),s=n?`source`:`wysiwyg`,c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l;t[2]===o?l=t[3]:(l=o({id:`n7aopT`}),t[2]=o,t[3]=l);let u;t[4]===o?u=t[5]:(u=o({id:`ur2XSb`}),t[4]=o,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ds,{children:(0,Z.jsx)(vM,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(Lc,{value:`wysiwyg`,"aria-label":u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:d}),t[7]=u,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Os,{side:`bottom`,children:(0,Z.jsx)(J,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(As,{children:[f,p]}),t[10]=f,t[11]=m);let h;t[12]===o?h=t[13]:(h=o({id:`xbdtfY`}),t[12]=o,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(_M,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Lc,{value:`source`,"aria-label":h,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:g})})}),t[15]=a,t[16]=h,t[17]=_):_=t[17];let v;t[18]===a?v=t[19]:(v=(0,Z.jsx)(Os,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`G-JBA1`}):(0,Z.jsx)(J,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(As,{children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==c||t[26]!==l||t[27]!==m?(b=(0,Z.jsxs)(zc,{type:`single`,value:s,onValueChange:c,"aria-label":l,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[m,y]}),t[23]=y,t[24]=s,t[25]=c,t[26]=l,t[27]=m,t[28]=b):b=t[28],b}var bM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-Cwen9r7n.js`);return{SkillEditorActions:e}},__vite__mapDeps([90,1,10,3,11,6,7,13,75,20,15,16,12,17,55,56,18,58,60,34,59,80,76,61,53,64,81,69,37,66]),import.meta.url)).SkillEditorActions}));function xM(e){let t=(0,$.c)(82),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=tn(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Al(`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,k;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=Ml(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?ei(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?ue(n):null,t[28]=n,t[29]=m);let A=m,j;t[30]!==p||t[31]!==A?(j=p?.kind===`skill`?{scope:p.scope,name:p.name}:A?{scope:`project`,name:A}:null,t[30]=p,t[31]=A,t[32]=j):j=t[32];let M=j;b=`editor-toolbar`,x=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[33]!==n||t[34]!==M?(N=M?null:(0,Z.jsx)(pM,{docName:n}),t[33]=n,t[34]=M,t[35]=N):N=t[35];let P;t[36]===N?P=t[37]:(P=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:N}),t[36]=N,t[37]=P);let F;t[38]!==r||t[39]!==a||t[40]!==i?(F=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(yM,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[38]=r,t[39]=a,t[40]=i,t[41]=F):F=t[41],t[42]!==P||t[43]!==F?(S=(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:[P,F]})}),t[42]=P,t[43]=F,t[44]=S):S=t[44];let I=d&&`pr-9`;t[45]===I?_=t[46]:(_=Y(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,I),t[45]=I,t[46]=_),t[47]===M?v=t[48]:(v=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(bM,{scope:M.scope,name:M.name})}):null,t[47]=M,t[48]=v),t[49]!==f||t[50]!==s||t[51]!==o?(y=o&&(0,Z.jsxs)(As,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Ds,{children:(0,Z.jsx)(Zd,{})})}),(0,Z.jsx)(Os,{side:`bottom`,children:(0,Z.jsx)(J,{id:`81H_23`})})]}),t[49]=f,t[50]=s,t[51]=o,t[52]=y):y=t[52],g=As,h=X,C=``,w=`ghost`,T=`icon`,E=l,D=!c,O=`doc-panel`,k=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k}else 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=t[24],k=t[25];let A;t[53]===c?A=t[54]:(A=(0,Z.jsx)(Ds,{children:c?(0,Z.jsx)(lf,{}):(0,Z.jsx)(cf,{})}),t[53]=c,t[54]=A);let j;t[55]!==h||t[56]!==A||t[57]!==C||t[58]!==w||t[59]!==T||t[60]!==E||t[61]!==D||t[62]!==O||t[63]!==k?(j=(0,Z.jsx)(h,{"data-doc-panel-toggle":C,variant:w,size:T,onClick:E,"aria-expanded":D,"aria-controls":O,"aria-label":k,asChild:!0,children:A}),t[55]=h,t[56]=A,t[57]=C,t[58]=w,t[59]=T,t[60]=E,t[61]=D,t[62]=O,t[63]=k,t[64]=j):j=t[64];let M;t[65]===c?M=t[66]:(M=(0,Z.jsx)(Os,{side:`bottom`,children:c?(0,Z.jsx)(J,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(J,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[65]=c,t[66]=M);let N;t[67]!==g||t[68]!==j||t[69]!==M?(N=(0,Z.jsxs)(g,{children:[j,M]}),t[67]=g,t[68]=j,t[69]=M,t[70]=N):N=t[70];let P;t[71]!==_||t[72]!==v||t[73]!==y||t[74]!==N?(P=(0,Z.jsxs)(`div`,{className:_,children:[v,y,N]}),t[71]=_,t[72]=v,t[73]=y,t[74]=N,t[75]=P):P=t[75];let F;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[76]=F):F=t[76];let I;return t[77]!==b||t[78]!==x||t[79]!==S||t[80]!==P?(I=(0,Z.jsxs)(`div`,{"data-testid":b,className:x,children:[S,P,F]}),t[77]=b,t[78]=x,t[79]=S,t[80]=P,t[81]=I):I=t[81],I}function SM(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function CM(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var wM=`ok-terminal-height-v1`,TM=1/3,EM=.5;function DM(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*EM))}function OM(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*TM)}function kM(e,t){let n=DM(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(OM(t),n)}function AM(){return typeof window>`u`?0:window.innerHeight}function jM(e,t){try{let n=e??localStorage,r=t??AM(),i=n.getItem(wM);if(i==null)return kM(OM(r),r);let a=Number.parseInt(i,10);return kM(Number.isFinite(a)?a:OM(r),r)}catch{return 240}}function MM(e,t,n){try{let r=t??localStorage,i=n??AM();r.setItem(wM,String(kM(e,i)))}catch{}}function NM(){try{return typeof localStorage>`u`?240:jM()}catch{return 240}}function PM(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=tn(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`0SBTff`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=Y(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(qi,{"aria-hidden":`true`}):(0,Z.jsx)(Fe,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(Os,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(As,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var FM=`terminal-dock-panel`;function IM(e){let t=(0,$.c)(44),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c}=e,l=a===void 0?`bottom`:a,{resolvedTheme:u}=Pn(),d=Lb(),[f,p]=(0,Q.useState)(!r),m;t[0]===u?m=t[1]:(m=Cu(u),t[0]=u,t[1]=m);let h=m.background,g=r&&l===`bottom`,_=!r&&l===`bottom`&&c!=null,[v]=(0,Q.useState)(LM),y=(0,Q.useRef)(v),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(e){C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{MM(e),C.current=null},100)},t[2]=w):w=t[2];let T=w,E=(0,Q.useRef)(null),D,O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{C.current!=null&&clearTimeout(C.current),E.current!=null&&(window.removeEventListener(`pointerup`,E.current),E.current=null)},O=[],t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A;t[5]!==g||t[6]!==d?(k=()=>{let e=d.current;e!=null&&(g?e.resize(`${y.current}px`):e.collapse())},A=[g,d],t[5]=g,t[6]=d,t[7]=k,t[8]=A):(k=t[7],A=t[8]),(0,Q.useEffect)(k,A);let j=b||void 0,M;t[9]!==c||t[10]!==_?(M=_&&c?(0,Z.jsx)(PM,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[9]=c,t[10]=_,t[11]=M):M=t[11];let N;t[12]!==n||t[13]!==s||t[14]!==M?(N=(0,Z.jsx)(zC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,M]})}),t[12]=n,t[13]=s,t[14]=M,t[15]=N):N=t[15];let P=!g,F;t[16]===g?F=t[17]:(F=()=>{if(!g)return;x(!0),S.current=!0;let e=()=>{x(!1),S.current=!1,window.removeEventListener(`pointerup`,e),E.current=null};E.current=e,window.addEventListener(`pointerup`,e)},t[16]=g,t[17]=F);let I;t[18]!==g||t[19]!==P||t[20]!==F?(I=(0,Z.jsx)(BC,{withHandle:g,disabled:P,onPointerDown:F}),t[18]=g,t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]===h?L=t[23]:(L={backgroundColor:h},t[22]=h,t[23]=L);let R=g?`${v}px`:0,z;t[24]!==i||t[25]!==r?(z=e=>{let t=e.asPercentage===0;p(t),S.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(y.current=e.inPixels,T(e.inPixels)))},t[24]=i,t[25]=r,t[26]=z):z=t[26];let B=!b&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,V;t[27]===B?V=t[28]:(V=Y(`flex flex-col`,B),t[27]=B,t[28]=V);let H;t[29]===o?H=t[30]:(H=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[29]=o,t[30]=H);let U;t[31]!==f||t[32]!==d||t[33]!==L||t[34]!==R||t[35]!==z||t[36]!==V||t[37]!==H?(U=(0,Z.jsx)(zC,{id:FM,style:L,panelRef:d,defaultSize:R,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:z,inert:f,className:V,children:H}),t[31]=f,t[32]=d,t[33]=L,t[34]=R,t[35]=z,t[36]=V,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==N||t[40]!==I||t[41]!==U||t[42]!==j?(W=(0,Z.jsxs)(RC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":j,children:[N,I,U]}),t[39]=N,t[40]=I,t[41]=U,t[42]=j,t[43]=W):W=t[43],W}function LM(){return NM()}var RM=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-Bu-aPWfE.js`),__vite__mapDeps([40,1,2,41,42,43,11,44,45,46,47,48,49,50,51,20,15,13,7,16,10,3,52,53,37,12,6,4,54,17,55,56,19,57,58,59,60,31,32,33,34,35,61,62,63,64,36,65,66,67,68,69]),import.meta.url)).ActivityModeContent})),zM=`300px`,BM=`600px`,VM=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function HM(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(WM,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(UM,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(hl,{name:`editor-area`,children:(0,Z.jsxs)(Ri,{children:[n,r]})}),t[3]=n,t[4]=i),i}function UM(){let e=(0,$.c)(5),t=za(),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)(NC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function WM(e){let t=(0,$.c)(248),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u,onRevealTerminal:d}=e,f=s===void 0?!1:s,p=l===void 0?`right`:l,{_:m}=tn(),{resolvedTheme:h}=Pn(),g;t[0]===h?g=t[1]:(g=Cu(h),t[0]=h,t[1]=g);let _=g.background,{activeDocName:v,activeProvider:y,activeTarget:b,recycleDocument:x,docPanelMode:S,docPanelAgentId:C,docPanelExpandSignal:w}=gt(),{openDocumentTransition:T}=kt(),{requestAddProperty:E}=Fi(),D=cw(y,v),O=dw(v,n===`source`?`source`:`wysiwyg`),k=Iw(y),A=k===`connected`||k===`synced`,j=uw(v)===`conflict`,[M,N]=(0,Q.useState)(!1),P,F;t[2]!==y||t[3]!==M?(P=()=>{y!=null&&!M&&N(!0)},F=[y,M],t[2]=y,t[3]=M,t[4]=P,t[5]=F):(P=t[4],F=t[5]),(0,Q.useEffect)(P,F);let I=(0,Q.useDeferredValue)(v),L=b?.kind===`missing`,R=!!v&&b?.kind!==`folder`,B;t[6]!==m||t[7]!==L?(B=L?m({id:`K-a33w`}):void 0,t[6]=m,t[7]=L,t[8]=B):B=t[8];let V=B,H=(0,Q.useSyncExternalStore)(wi.subscribe,wi.getSnapshot,wi.getSnapshot),U;t[9]!==b||t[10]!==H?(U=Oi(b,H),t[9]=b,t[10]=H,t[11]=U):U=t[11];let W=U,[G]=(0,Q.useState)(YM),ee=G!==null,te;t[12]===G?te=t[13]:(te=()=>bw(G,window.innerWidth,`right`),t[12]=G,t[13]=te);let[K,ne]=(0,Q.useState)(te),re=(0,Q.useRef)(K),ie,ae;t[14]===K?(ie=t[15],ae=t[16]):(ae=()=>{re.current=K},ie=[K],t[14]=K,t[15]=ie,t[16]=ae),(0,Q.useEffect)(ae,ie);let oe=Lb(),se=Lb(),ce;t[17]===K?ce=t[18]:(ce=()=>kw(`right`,K,Dw())===`collapsed`,t[17]=K,t[18]=ce);let[le]=(0,Q.useState)(ce),[ue,q]=(0,Q.useState)(le),de=(0,Q.useRef)(ue),[fe,pe]=(0,Q.useState)(null),[me,he]=(0,Q.useState)(null),[ge,_e]=(0,Q.useState)(null),ve=p===`right`,ye=ve?`right`:`bottom`,be=o!=null&&ve&&f,xe=o!=null&&!f&&d!=null,Se=xe&&!ve,Ce=xe&&ve,we=ve&&f&&fe!=null,Te=we?fe:me,Ee=(ve?we:f)&&Te!=null,De,Oe;t[19]!==Te||t[20]!==u||t[21]!==ye||t[22]!==ge||t[23]!==Ee?(De=()=>{u?.({container:Te,isShowing:Ee,dockPosition:ye,editorRegion:ge})},Oe=[u,Te,Ee,ye,ge],t[19]=Te,t[20]=u,t[21]=ye,t[22]=ge,t[23]=Ee,t[24]=De,t[25]=Oe):(De=t[24],Oe=t[25]),(0,Q.useEffect)(De,Oe);let ke,Ae;t[26]===ue?(ke=t[27],Ae=t[28]):(ke=()=>{de.current=ue},Ae=[ue],t[26]=ue,t[27]=ke,t[28]=Ae),(0,Q.useEffect)(ke,Ae);let[je,Me]=(0,Q.useState)(!1),Ne=(0,Q.useRef)(!1),[Pe]=(0,Q.useState)(JM),Fe=(0,Q.useRef)(Pe),Ie=(0,Q.useRef)(null),Re;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(e){Ie.current!=null&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>{hw(e),Ie.current=null},100)},t[29]=Re):Re=t[29];let ze=Re,[Be]=(0,Q.useState)(qM),Ve=(0,Q.useRef)(Be),[He,Ue]=(0,Q.useState)(!1),We=(0,Q.useRef)(!1),Ge=(0,Q.useRef)(null),Ke;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=function(e){Ge.current!=null&&clearTimeout(Ge.current),Ge.current=setTimeout(()=>{Pw(e),Ge.current=null},100)},t[30]=Ke):Ke=t[30];let qe=Ke,Je,Ye;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Je=()=>()=>{Ie.current!=null&&clearTimeout(Ie.current),Ge.current!=null&&clearTimeout(Ge.current)},Ye=[],t[31]=Je,t[32]=Ye):(Je=t[31],Ye=t[32]),(0,Q.useEffect)(Je,Ye);let[Xe,Ze]=(0,Q.useState)(null),Qe=(0,Q.useRef)(null),$e=Mb(),et=(0,Q.useRef)(be),tt,nt;t[33]===be?(tt=t[34],nt=t[35]):(tt=()=>{et.current=be},nt=[be],t[33]=be,t[34]=tt,t[35]=nt),(0,Q.useEffect)(tt,nt);let rt;t[36]!==oe||t[37]!==se?(rt=function(){for(let e of[oe,se]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=Qe.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[36]=oe,t[37]=se,t[38]=rt):rt=t[38];let it=rt,at;t[39]!==$e||t[40]!==it?(at=function(e){if(Ne.current||We.current)return;let t=$e.current;if(t!=null)try{let n=it();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(KM);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:Fe.current),`terminal-column`in r&&(o[`terminal-column`]=Ve.current),Object.keys(o).length===0)return;let s=CM({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[39]=$e,t[40]=it,t[41]=at):at=t[41];let ot=at,st=(0,Q.useRef)(ot),ct;t[42]===ot?ct=t[43]:(ct=()=>{st.current=ot},t[42]=ot,t[43]=ct),(0,Q.useEffect)(ct);let lt;t[44]!==ot||t[45]!==oe?(lt=function(){et.current?ot(!1):oe.current?.expand()},t[44]=ot,t[45]=oe,t[46]=lt):lt=t[46];let ut=lt,dt;t[47]!==ot||t[48]!==ue||t[49]!==oe?(dt=function(){if(oe.current==null)return;let e=re.current;ue?(Aw(`right`,e,`open`),et.current?ot(!1):oe.current?.expand()):(Aw(`right`,e,`collapsed`),et.current?ot(!0):oe.current?.collapse())},t[47]=ot,t[48]=ue,t[49]=oe,t[50]=dt):dt=t[50];let ft=dt,pt,mt;t[51]!==ot||t[52]!==G||t[53]!==oe?(pt=()=>{let e=window.matchMedia(`(min-width: ${vw}px)`),t=()=>{let e=bw(G,window.innerWidth,`right`);ne(e);let t=kw(`right`,e,Dw())===`collapsed`;q(t),et.current?ot(t):t?oe.current?.collapse():oe.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},mt=[G,oe,ot],t[51]=ot,t[52]=G,t[53]=oe,t[54]=pt,t[55]=mt):(pt=t[54],mt=t[55]),(0,Q.useEffect)(pt,mt);let ht,_t;t[56]!==Xe||t[57]!==ee?(ht=()=>{if(Xe==null||ee)return;let e=new ResizeObserver(()=>{st.current(de.current)});return e.observe(Xe),()=>e.disconnect()},_t=[Xe,ee],t[56]=Xe,t[57]=ee,t[58]=ht,t[59]=_t):(ht=t[58],_t=t[59]),(0,Q.useEffect)(ht,_t);let vt,yt;t[60]!==ut||t[61]!==a?(vt=()=>{let e=e=>{a(e),ut()},t=th();return t&&e(t),rh(t=>{th(),e(t)})},yt=[a,ut],t[60]=ut,t[61]=a,t[62]=vt,t[63]=yt):(vt=t[62],yt=t[63]),(0,Q.useEffect)(vt,yt);let bt,xt;t[64]!==w||t[65]!==ut?(bt=()=>{w!==0&&ut()},xt=[w,ut],t[64]=w,t[65]=ut,t[66]=bt,t[67]=xt):(bt=t[66],xt=t[67]),(0,Q.useEffect)(bt,xt);let St=(0,Q.useRef)(be),Ct,wt;t[68]!==ue||t[69]!==be?(Ct=()=>{if(St.current===be)return;St.current=be;let e=ue;queueMicrotask(()=>{st.current(e)})},wt=[be,ue],t[68]=ue,t[69]=be,t[70]=Ct,t[71]=wt):(Ct=t[70],wt=t[71]),(0,Q.useLayoutEffect)(Ct,wt);let Tt,Et;t[72]===ue?(Tt=t[73],Et=t[74]):(Tt=()=>{if(!ue||!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()},Et=[ue],t[72]=ue,t[73]=Tt,t[74]=Et),(0,Q.useLayoutEffect)(Tt,Et);let Dt,Ot;t[75]===ue?(Dt=t[76],Ot=t[77]):(Dt=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ue})},Ot=[ue],t[75]=ue,t[76]=Dt,t[77]=Ot),(0,Q.useEffect)(Dt,Ot);let At,jt;t[78]===ft?(At=t[79],jt=t[80]):(At=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&ft()})},jt=[ft],t[78]=ft,t[79]=At,t[80]=jt),(0,Q.useEffect)(At,jt);let Mt,Nt;t[81]===ft?(Mt=t[82],Nt=t[83]):(Mt=()=>{if(window.okDesktop!=null)return;let e=e=>{jl(e,`toggle-document-panel`)&&(e.preventDefault(),ft())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Nt=[ft],t[81]=ft,t[82]=Mt,t[83]=Nt),(0,Q.useEffect)(Mt,Nt);let Pt=(0,Q.useRef)(null),[Ft,It]=(0,Q.useState)(null),[Lt,Rt]=(0,Q.useState)(!1),zt=b?.kind===`large-file`?b.docName:v,Bt,Vt;t[84]===zt?(Bt=t[85],Vt=t[86]):(Bt=()=>{if(zt&&zt!==Pt.current){let e=Pt.current;Pt.current=zt,It(e)}},Vt=[zt],t[84]=zt,t[85]=Bt,t[86]=Vt),(0,Q.useEffect)(Bt,Vt);let Ht;t[87]===T?Ht=t[88]:(Ht=function(e){let t=El(e);window.location.hash===t?T(e):window.location.hash=t},t[87]=T,t[88]=Ht);let Ut=Ht,Wt,Gt=null;if(b?.kind===`large-file`){let e;t[89]!==Ut||t[90]!==Ft?(e=Ft?{previousDocName:Ft,onNavigateBack:Ut}:void 0,t[89]=Ut,t[90]=Ft,t[91]=e):e=t[91];let n;t[92]!==b.docName||t[93]!==b.limit||t[94]!==b.size||t[95]!==e?(n=(0,Z.jsx)(hC,{docName:b.docName,size:b.size,limit:b.limit,backNav:e}),t[92]=b.docName,t[93]=b.limit,t[94]=b.size,t[95]=e,t[96]=n):n=t[96],Wt=n}else if(b?.kind===`folder`){let e;t[97]!==ee||t[98]!==f?(e=TT({terminalVisible:f,isEmbedded:ee}),t[97]=ee,t[98]=f,t[99]=e):e=t[99];let n=e,r;t[100]===b.folderPath?r=t[101]:(r=(0,Z.jsx)(dC,{folderPath:b.folderPath}),t[100]=b.folderPath,t[101]=r);let i;t[102]===n?i=t[103]:(i=n?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-2 bg-linear-to-t from-background to-transparent`}):null,t[102]=n,t[103]=i);let a;t[104]!==r||t[105]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[104]=r,t[105]=i,t[106]=a):a=t[106];let o;t[107]!==b.folderPath||t[108]!==n?(o=n?(0,Z.jsx)(fT,{folderPath:b.folderPath}):null,t[107]=b.folderPath,t[108]=n,t[109]=o):o=t[109];let s;if(t[110]!==a||t[111]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),t[110]=a,t[111]=o,t[112]=s):s=t[112],Wt=s,S===`agent`&&C!==null){let e;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(BC,{withHandle:!0}),t[113]=e):e=t[113];let n;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(zC,{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)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(RM,{showBackButton:!1})})})]}),t[114]=n):n=t[114],Gt=n}}else if(b?.kind===`asset`){let e;t[115]!==b.assetPath||t[116]!==b.mediaKind?(e=(0,Z.jsx)($b,{assetPath:b.assetPath,mediaKind:b.mediaKind},b.assetPath),t[115]=b.assetPath,t[116]=b.mediaKind,t[117]=e):e=t[117],Wt=e}else if(b?.kind===`skill-file`){let e=`${b.scope}/${b.name}/${b.path}`,n;t[118]!==b.name||t[119]!==b.path||t[120]!==b.scope||t[121]!==e?(n=(0,Z.jsx)(wC,{scope:b.scope,name:b.name,path:b.path},e),t[118]=b.name,t[119]=b.path,t[120]=b.scope,t[121]=e,t[122]=n):n=t[122],Wt=n}else if(W){let e;t[123]===W?e=t[124]:(e=(0,Z.jsx)(vC,{nav:W},W.path),t[123]=W,t[124]=e),Wt=e}else if(!y||!v)if((typeof window<`u`?Tl(window.location.hash):null)!==null)if(o!=null&&M){let e;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ex,{}),t[125]=e):e=t[125],Wt=e;let n;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(BC,{withHandle:!0,disabled:!0}),t[126]=n):n=t[126];let r=le?0:`${Pe}px`,i;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[127]=i):i=t[127];let a;t[128]===r?a=t[129]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(zC,{id:`doc-panel`,defaultSize:r,minSize:zM,maxSize:BM,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[128]=r,t[129]=a),Gt=a}else{let e;return t[130]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ex,{}),t[130]=e):e=t[130],e}else{let e=f?ye:null,n;t[131]===e?n=t[132]:(n=(0,Z.jsx)(MS,{terminalDock:e}),t[131]=e,t[132]=n),Wt=n}else{let e=n===`source`,o=!A,s=ue,c;t[133]!==v||t[134]!==E?(c=function(){v&&E(v)},t[133]=v,t[134]=E,t[135]=c):c=t[135];let l=c,u;t[136]!==v||t[137]!==ee||t[138]!==f?(u=wT({terminalVisible:f,isEmbedded:ee,activeDocName:v}),t[136]=v,t[137]=ee,t[138]=f,t[139]=u):u=t[139];let d=u,p=I??v,m=Ft??void 0,h;t[140]!==V||t[141]!==e||t[142]!==Ut||t[143]!==x||t[144]!==p||t[145]!==m?(h=(0,Z.jsx)(nj,{activeDocName:p,isSourceMode:e,editorPlaceholder:V,previousDocName:m,onNavigateBack:Ut,onRecycle:x}),t[140]=V,t[141]=e,t[142]=Ut,t[143]=x,t[144]=p,t[145]=m,t[146]=h):h=t[146];let g;t[147]!==v||t[148]!==e?(g=(0,Z.jsx)(iw,{activeDocName:v,isSourceMode:e}),t[147]=v,t[148]=e,t[149]=g):g=t[149];let _;t[150]!==v||t[151]!==I?(_=SM({activeDocName:v,deferredActiveDocName:I,mountResolved:v!==null&&z(v),syncResolved:v!==null&&Le(v)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(ex,{}),v===null?null:(0,Z.jsx)(gC,{docName:v})]}):null,t[150]=v,t[151]=I,t[152]=_):_=t[152];let y;t[153]!==h||t[154]!==g||t[155]!==_?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_]}),t[153]=h,t[154]=g,t[155]=_,t[156]=y):y=t[156];let b;t[157]!==v||t[158]!==j||t[159]!==s||t[160]!==e||t[161]!==r||t[162]!==l||t[163]!==Ce||t[164]!==o||t[165]!==ft?(b=!j&&(0,Z.jsx)(xM,{activeDocName:v,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:ft,reserveRightGutter:Ce&&s}),t[157]=v,t[158]=j,t[159]=s,t[160]=e,t[161]=r,t[162]=l,t[163]=Ce,t[164]=o,t[165]=ft,t[166]=b):b=t[166];let C;t[167]!==v||t[168]!==Lt||t[169]!==e||t[170]!==d?(C=d?(0,Z.jsx)(fT,{docName:v,surface:e?`source`:`wysiwyg`,dismissed:Lt,onDismiss:()=>Rt(!0),onReopen:()=>Rt(!1)}):null,t[167]=v,t[168]=Lt,t[169]=e,t[170]=d,t[171]=C):C=t[171];let w;t[172]!==y||t[173]!==b||t[174]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,b,C]}),t[172]=y,t[173]=b,t[174]=C,t[175]=w):w=t[175];let T;t[176]!==Lt||t[177]!==d?(T=d&&Lt?{onReopen:()=>Rt(!1)}:null,t[176]=Lt,t[177]=d,t[178]=T):T=t[178];let k;t[179]!==Se||t[180]!==O||t[181]!==R||t[182]!==D||t[183]!==T?(k=(0,Z.jsx)(rM,{stats:D,selectionStats:O,showStats:R,composerBadge:T,reserveRightGutter:Se}),t[179]=Se,t[180]=O,t[181]=R,t[182]=D,t[183]=T,t[184]=k):k=t[184];let M;t[185]!==w||t[186]!==k?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,k]}),t[185]=w,t[186]=k,t[187]=M):M=t[187],Wt=M;let N=be&&ue,P=!ue,F;t[188]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{Me(!0),Ne.current=!0;let e=()=>{Me(!1),Ne.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[188]=F):F=t[188];let L;t[189]!==ue||t[190]!==P?(L=(0,Z.jsx)(BC,{withHandle:P,disabled:ue,onPointerDown:F}),t[189]=ue,t[190]=P,t[191]=L):L=t[191];let B=le?0:`${Pe}px`,H=N?`0px`:zM,U;t[192]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{q(e.asPercentage===0),e.inPixels>0&&Ne.current&&(Fe.current=e.inPixels,ze(e.inPixels))},t[192]=U):U=t[192];let W=!je&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[193]===W?G=t[194]:(G=Y(`flex flex-col bg-muted/20`,W),t[193]=W,t[194]=G);let te;t[195]!==v||t[196]!==i||t[197]!==S||t[198]!==e||t[199]!==a?(te=(0,Z.jsx)(Hv,{docName:v,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:S}),t[195]=v,t[196]=i,t[197]=S,t[198]=e,t[199]=a,t[200]=te):te=t[200];let K;t[201]!==N||t[202]!==ue||t[203]!==oe||t[204]!==B||t[205]!==H||t[206]!==G||t[207]!==te?(K=(0,Z.jsx)(zC,{id:`doc-panel`,panelRef:oe,disabled:N,defaultSize:B,minSize:H,maxSize:BM,collapsible:!0,collapsedSize:0,onResize:U,inert:ue,className:G,children:te}),t[201]=N,t[202]=ue,t[203]=oe,t[204]=B,t[205]=H,t[206]=G,t[207]=te,t[208]=K):K=t[208];let ne;t[209]!==L||t[210]!==K?(ne=(0,Z.jsxs)(Z.Fragment,{children:[L,K]}),t[209]=L,t[210]=K,t[211]=ne):ne=t[211],Gt=ne}let Kt;t[212]!==d||t[213]!==c||t[214]!==o||t[215]!==ye||t[216]!==f||t[217]!==Wt?(Kt=o==null?Wt:(0,Z.jsx)(IM,{visible:f,onVisibleChange:c??GM,dockPosition:ye,onBottomContainer:he,onEditorRegion:_e,onReveal:d,children:Wt}),t[212]=d,t[213]=c,t[214]=o,t[215]=ye,t[216]=f,t[217]=Wt,t[218]=Kt):Kt=t[218];let qt=Kt,Jt;t[219]!==Be||t[220]!==He||t[221]!==c||t[222]!==se||t[223]!==be||t[224]!==_?(Jt=be?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(BC,{withHandle:!0,onPointerDown:()=>{Ue(!0),We.current=!0;let e=()=>{Ue(!1),We.current=!1,window.removeEventListener(`pointerup`,e),se.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(zC,{id:`terminal-column`,panelRef:se,style:{backgroundColor:_},defaultSize:`${Be}px`,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&We.current&&(Ve.current=e.inPixels,qe(e.inPixels))},className:Y(`flex flex-col`,!He&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:pe,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[219]=Be,t[220]=He,t[221]=c,t[222]=se,t[223]=be,t[224]=_,t[225]=Jt):Jt=t[225];let Yt=Jt,Xt=Gt!=null&&!le||be,Zt;t[226]===Symbol.for(`react.memo_cache_sentinel`)?(Zt=e=>{Ze(e),Qe.current=e},t[226]=Zt):Zt=t[226];let Qt=je||He||void 0,$t=be?`5%`:`30%`,en;t[227]===Xt?en=t[228]:(en=Xt?{}:{defaultSize:`100%`},t[227]=Xt,t[228]=en);let nn=!(je||He)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,rn;t[229]===nn?rn=t[230]:(rn=Y(nn),t[229]=nn,t[230]=rn);let an;t[231]!==qt||t[232]!==$t||t[233]!==en||t[234]!==rn?(an=(0,Z.jsx)(zC,{minSize:$t,...en,className:rn,children:qt}),t[231]=qt,t[232]=$t,t[233]=en,t[234]=rn,t[235]=an):an=t[235];let on;t[236]!==$e||t[237]!==Gt||t[238]!==Qt||t[239]!==an||t[240]!==Yt?(on=(0,Z.jsxs)(RC,{orientation:`horizontal`,groupRef:$e,"data-dragging":Qt,children:[an,Gt,Yt]}),t[236]=$e,t[237]=Gt,t[238]=Qt,t[239]=an,t[240]=Yt,t[241]=on):on=t[241];let sn;t[242]!==d||t[243]!==Ce?(sn=Ce?(0,Z.jsx)(PM,{dockPosition:`right`,onReveal:d,className:`top-2.5 right-0`}):null,t[242]=d,t[243]=Ce,t[244]=sn):sn=t[244];let cn;return t[245]!==on||t[246]!==sn?(cn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:Zt,children:[on,sn]}),t[245]=on,t[246]=sn,t[247]=cn):cn=t[247],cn}function GM(){}function KM(e){return!VM.has(e)}function qM(){return Fw()}function JM(){return gw()}function YM(){return Dr()}function XM(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 ZM(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 QM=1e3,$M=!1;function eN(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function tN(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:gs(i)?a=i:(a=void 0,$M||($M=!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`&&(eN({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=ZM(i),{current:c,crossDoc:l}=a?fs(a,n,Date.now()):{current:[],crossDoc:[]},u=nN,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>XM(e.current,p)&&XM(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,QM);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 nN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var rN=!1,iN=new Set,aN=!1;function oN(){for(let e of iN)e()}function sN(e){rN!==e&&(rN=e,oN())}function cN(){return rN}function lN(e){return iN.add(e),()=>{iN.delete(e)}}function uN(e){let t=[e.onUpdateRelaunching(()=>sN(!0)),e.onUpdateRelaunchFailed(()=>sN(!1))];return()=>{for(let e of t)e()}}function dN(){if(aN||typeof window>`u`)return;let e=window.okDesktop;e&&(aN=!0,uN(e))}function fN(){return(0,Q.useSyncExternalStore)(lN,cN,pN)}function pN(){return!1}var mN=`sync-status`;async function hN(e){try{let t=await jg(e);t.ok||_s.error(t.message,{id:mN,duration:1/0})}catch{}}function gN(e,t){let n=(0,$.c)(6),{_:r}=tn(),i=fN(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){_s.dismiss(mN);return}o.current=!0;let e=window.okDesktop;_s.warning(r({id:`HGNCsl`}),{id:mN,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{hN(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,_s.success(r({id:`GhjUB_`}),{id:mN,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var _N=4,vN=3,yN={Bird:gd,Cat:Cd,Dog:jd,Fish:Ld,Mouse:hf,Rabbit:mf,Shrimp:xf,Snail:Sf,Squirrel:Ef,Turtle:If};Object.freeze(Object.keys(yN));function bN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(yN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var xN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function SN(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=tn(),o=bN(n),s=o.kind===`animal`?yN[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Gr(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=Tr(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(Os,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(As,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function CN(e){let t=xN[e.icon];return e.displayName||t||Kc._({id:`iEQQyu`})}function wN(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 TN(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=tn(),{activeDocName:s}=gt(),{presence:c,agentId:l}=n,u=CN(c),d=wN(c.mode),f=!r&&d,p=c.currentDoc&&c.currentDoc!==`(connected)`?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(ms,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(ms,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(Ds,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(Os,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(As,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function EN(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?Kc._({id:`9euN0m`,values:{count:n}}):Kc._({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)(Pe,{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)(SN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(TN,{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)(Nt,{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)(ke,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function DN(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(SN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(TN,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function ON(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=gt(),{current:s,crossDoc:c}=tN(t,r,n);if(gN(Iw(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,_N),n;e[6]===s?n=e[7]:(n=s.slice(_N),e[6]=s,e[7]=n);let r=n,u=c.slice(0,vN),d;e[8]===c?d=e[9]:(d=c.slice(vN),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=>DN(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)(EN,{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=>DN(e,p,!0,m)),f.length>0?(0,Z.jsx)(EN,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function kN(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(AN),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function AN(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function jN(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=tn(),{channel:i}=kN();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`cSCbv3`}),t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==a?(s=(0,Z.jsx)(Ee,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=s):s=t[5],s}function MN(e,t){return t.trim()}function NN(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function PN(e,t){let n=MN(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function FN(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(sl(e)){let t=s.get(Uu(e.docName,e.docExt));if(t){let n=$c(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Qn(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Qc(e))return{...e,path:HN(e.path,n)};if(tl(e)){let t=s.get(e.path);return t&&qc(t)?{kind:`document`,docName:ku(t),docExt:Yc(t),size:e.size,modified:e.modified}:{...e,path:t??HN(e.path,n)}}return e})}function IN(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=>sl(e)?!i.has(e.docName)&&!KN(e.docName,n):Qc(e)?!KN(e.path,n):tl(e)?!a.has(e.path)&&!KN(e.path,n):!0)}function LN(e,t){if(e.kind!==`asset`||t.some(t=>tl(t)&&t.path===e.path))return e;let n=Ku(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function RN(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>UN(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>sl(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=>Qc(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(sl(i)){let e=GN(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Qc(i)){let e=WN(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function zN(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function BN(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function VN(e,t){let n=e.kind===`file`?Uu(e.path,e.docExt):e.path;return na(t.contentDir,n,t.pathSeparator)}function HN(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 UN(e,t){return sl(e)&&sl(t)?e.docName===t.docName:Qc(e)&&Qc(t)||tl(e)&&tl(t)?e.path===t.path:!1}function WN(e,t,n){return e===t?n:GN(e,t,n)}function GN(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function KN(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function qN(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)(Tp,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function JN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ep,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YN(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)(kp,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function XN(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)(Fp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function ZN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 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)(Dp,{children:(0,Z.jsx)(Op,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QN(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Y(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(jp,{"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 $N(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=Y(`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)(Ji,{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)(Ip,{"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 eP(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-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)(Lp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tP(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=Y(`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)(Np,{children:(0,Z.jsx)(Gi,{})})}),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)(Mp,{"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 nP(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=Y(`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)(Ap,{"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 rP(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`-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)(Pp,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var iP=`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`,aP=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,oP={start:[Jo.Space],cancel:[Jo.Esc],end:[Jo.Space,Jo.Enter]};function sP(e){return Y(iP,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function cP(e){return e?void 0:-1}function lP({className:e,isDragging:t}){return Y(e,t&&aP)}function uP(e){return e.code===Jo.Enter&&e.target===e.currentTarget}function dP({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&uP(e)?`activate-tab`:`delegate-sortable`}function fP({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:$o.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 pP(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 mP(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 hP=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 Ho(e)},gP=[`.md`,`.mdx`],_P=`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`,vP=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,yP=Y(vP,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),bP=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function xP(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function SP(e){let t=El(e);window.location.hash!==t&&(window.location.hash=t)}function CP(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function wP(e,t){let n=[t,...gP].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 TP(e){return e.metaKey||e.ctrlKey}var EP=1e3;function DP(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function OP(e,t){return DP(e,t)}function kP(e,t){let n=DP(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function AP(e,t){if(!TP(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function jP(e){let t=(0,$.c)(3),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Y(sP(!0),`font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0`),t[0]=r):r=t[0];let i=`⌘${n}`,a;return t[1]===i?a=t[2]:(a=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:r,children:(0,Z.jsx)(F,{className:`text-[10px]`,children:i})}),t[1]=i,t[2]=a),a}function MP(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:_}=Zo(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=fP({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=dP({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=lP({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 NP(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=Zt(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=Zt(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(JN,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(J,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(QN,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(J,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(QN,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(J,{id:`U2Kx6T`}):(0,Z.jsx)(J,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(QN,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(rP,{}),(0,Z.jsx)(QN,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(J,{id:`SYfHmN`}):(0,Z.jsx)(J,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(ZN,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(qN,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function PP(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=tn();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(jP,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(pf,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=sP(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=cP(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(vs,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function FP(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(cs,{"aria-hidden":`true`,"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 IP(e){let t=(0,$.c)(27),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,enterRenameMode:o,extension:s,hideDocExtension:c,tabId:l}=e,{_:u}=tn(),d=uw(a)===`conflict`,f;t[0]!==u||t[1]!==n||t[2]!==d?(f=d?u({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=u,t[1]=n,t[2]=d,t[3]=f):f=t[3];let p=f,m;t[4]!==r||t[5]!==l?(m=()=>{r(l)},t[4]=r,t[5]=l,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==o||t[9]!==l?(h=e=>{e.preventDefault(),e.stopPropagation(),o(l,a)},t[7]=a,t[8]=o,t[9]=l,t[10]=h):h=t[10];let g;t[11]===d?g=t[12]:(g=(0,Z.jsx)(FP,{hasConflict:d}),t[11]=d,t[12]=g);let _;t[13]===i?_=t[14]:(_=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[13]=i,t[14]=_);let v;t[15]!==s||t[16]!==c?(v=!c&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:s}),t[15]=s,t[16]=c,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":p,title:p,className:bP,onClick:m,onDoubleClick:h,tabIndex:-1,children:[g,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=y,t[26]=b):b=t[26],b}function LP(){let e=(0,$.c)(94),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:c,closeTab:l,closeTabs:u,getPoolActiveDocName:d,poolHas:f,isNewTabActive:p,newTabIds:m,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,reopenClosedTab:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=gt(),{_:T}=tn(),{pageMeta:E}=Zi(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G=(0,Q.useRef)(null),te=(0,Q.useRef)(!1),K=(0,Q.useRef)(!1),ne;e[0]!==n||e[1]!==t||e[2]!==i?(ne=n??(i?h(i):t?Wt(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=ne):ne=e[3];let re=ne,ie;e[4]!==r||e[5]!==re||e[6]!==p||e[7]!==m||e[8]!==_?(ie=p?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${m.join(`\0`)}`:re?`${re}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=re,e[6]=p,e[7]=m,e[8]=_,e[9]=ie):ie=e[9];let ae=ie,oe,se;e[10]===t?(oe=e[11],se=e[12]):(oe=()=>{W.current=t},se=[t],e[10]=t,e[11]=oe,e[12]=se),(0,Q.useEffect)(oe,se);let ce,le;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>()=>{G.current!==null&&(window.clearTimeout(G.current),G.current=null)},le=[],e[13]=ce,e[14]=le):(ce=e[13],le=e[14]),(0,Q.useEffect)(ce,le);let ue,q;e[15]===ae?(ue=e[16],q=e[17]):(ue=()=>{ae&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[ae],e[15]=ae,e[16]=ue,e[17]=q),(0,Q.useEffect)(ue,q);let de,fe;e[18]===A?(de=e[19],fe=e[20]):(de=()=>{A&&(B.current?.focus(),B.current?.select())},fe=[A],e[18]=A,e[19]=de,e[20]=fe),(0,Q.useEffect)(de,fe);let pe,he;e[21]!==_||e[22]!==A?(pe=()=>{!A||_.includes(A.tabId)||(H.current=!0,U.current=null,j(null),N(``),F(null),L(!1))},he=[_,A],e[21]=_,e[22]=A,e[23]=pe,e[24]=he):(pe=e[23],he=e[24]),(0,Q.useEffect)(pe,he);let ge;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,j({docName:t,tabId:e}),N(n[n.length-1]),F(null)},e[25]=ge):ge=e[25];let _e=ge,ve=function(){H.current=!0,U.current=null,j(null),N(``),F(null),L(!1)},ye=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=A?.docName;if(!e){ve();return}let t=MN(`file`,wP(M,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ve();return}if(t===U.current){B.current?.focus();return}if(!NN(t)){F(T({id:`P8yDjG`})),B.current?.focus();return}let i=PN({kind:`file`,path:e,name:r},t);V.current=!0,L(!0),F(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){L(!1),V.current=!1;return}let r=await At(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),V.current=!1,U.current=t,B.current?.focus();return}let a=tt(Lr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,c=zN(o,a);ee(a);let l=!0;try{let e=BN(a,d(),f);await Promise.all(e.map(e=>s(e))),x(a),ul([`files`,`backlinks`,`graph`])}catch(n){let r=n;l=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),_s.error(T({id:`MUBR8r`}))}H.current=!0,j(null),N(``),F(null),L(!1),V.current=!1,U.current=null,l&&c&&c!==o&&SP(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(T({id:`HIb0vl`})),L(!1),V.current=!1,U.current=t,B.current?.focus()}},be=typeof window<`u`&&window.okDesktop!=null,xe;e[26]===m?xe=e[27]:(xe=new Set(m),e[26]=m,e[27]=xe);let Se=xe,Ce;e[28]===O?Ce=e[29]:(Ce=mP(O),e[28]=O,e[29]=Ce);let we;e[30]===Ce?we=e[31]:(we=[Ce],e[30]=Ce,e[31]=we);let Te=we,Ee;e[32]!==c||e[33]!==u||e[34]!==Se?(Ee=function(e){let t=[],n=[];for(let r of e)Se.has(r)?n.push(r):t.push(r);t.length>0&&u(t);for(let e of n)c(e)},e[32]=c,e[33]=u,e[34]=Se,e[35]=Ee):Ee=e[35];let De=Ee,Oe,ke;e[36]!==o||e[37]!==a||e[38]!==r||e[39]!==re||e[40]!==p||e[41]!==m||e[42]!==g||e[43]!==b||e[44]!==w?(Oe=()=>{let e=new Set(m),t=function(){G.current!==null&&(window.clearTimeout(G.current),G.current=null)},n=function(e){te.current!==e&&(te.current=e)},i=function(e){K.current!==e&&(K.current=e,z(e))},s=function(){n(!0),!(K.current||G.current!==null)&&(G.current=window.setTimeout(()=>{G.current=null,te.current&&i(!0)},EP))},c=function(){t(),n(!1),i(!1)},l=function(t){e.has(t)?o(t):a(t)},u=function(e){if(w.length===0)return;let t=p?r:re,n=t?w.indexOf(t):-1;l(w[((n>=0?n:0)+e+w.length)%w.length])},d=function(e){if(TP(e)&&s(),jl(e,`tab-new`)){e.preventDefault(),g();return}if(jl(e,`tab-reopen-closed`)){e.preventDefault(),b();return}if(jl(e,`tab-next`)){e.preventDefault(),u(1);return}if(jl(e,`tab-previous`)){e.preventDefault(),u(-1);return}let t=AP(e,w.length);t!==null&&(e.preventDefault(),l(w[t]))},f=function(e){!e.metaKey&&!e.ctrlKey&&c()};return window.addEventListener(`keydown`,d,{capture:!0}),window.addEventListener(`keyup`,f,{capture:!0}),window.addEventListener(`blur`,c),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),window.removeEventListener(`keyup`,f,{capture:!0}),window.removeEventListener(`blur`,c),document.removeEventListener(`visibilitychange`,c)}},ke=[r,re,o,a,p,m,g,b,w],e[36]=o,e[37]=a,e[38]=r,e[39]=re,e[40]=p,e[41]=m,e[42]=g,e[43]=b,e[44]=w,e[45]=Oe,e[46]=ke):(Oe=e[45],ke=e[46]),(0,Q.useEffect)(Oe,ke);let Ae;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={activationConstraint:{distance:8}},e[47]=Ae):Ae=e[47];let je;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(je={coordinateGetter:Go,keyboardCodes:oP},e[48]=je):je=e[48];let Me=Qo(zo(Uo,Ae),zo(Ko,je)),Ne=R,Pe;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=function(){k(pP(D.current))},e[49]=Pe):Pe=e[49];let Fe=Pe,Ie;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=function(){k(null)},e[50]=Ie):Ie=e[50];let Le=Ie,Re;e[51]!==Le||e[52]!==S||e[53]!==w?(Re=function(e){Le();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(Yo([...w],r,i),t)},e[51]=Le,e[52]=S,e[53]=w,e[54]=Re):Re=e[54];let ze=Re,Be=be?``:void 0,Ve;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=Y(`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]`,be&&`[-webkit-app-region:drag]`),e[55]=Ve):Ve=e[55];let He=CP,Ue;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=Y(`flex items-end gap-1`,be&&`[-webkit-app-region:no-drag]`),e[56]=Ue):Ue=e[56];let We=Vo,Ge=hP,Ke;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ke={container:typeof document<`u`?document.body:void 0},e[57]=Ke):Ke=e[57];let qe=qo,Je;e[58]===w?Je=e[59]:(Je=[...w],e[58]=w,e[59]=Je);let Ye=Bo,Xe=w.map((e,t)=>{let n=R?OP(t,w.length):null,i=kP(t,w.length);if(Se.has(e)){let t=e===r;return(0,Z.jsx)(NP,{tabId:e,canPin:!1,openTabs:w,closeTab:c,closeTabs:De,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(MP,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":t?`true`:void 0,className:Y(_P,t?vP:yP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),c(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:bP,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(J,{id:`3YvS-c`})})}),n?(0,Z.jsx)(jP,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:sP(Ne||t),tabIndex:cP(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(vs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let s=Jt(e),u=e===re,d=y.includes(e);if(s.kind===`folder`){let{baseName:t,label:r,prefix:o}=Kt(s.folderPath,`/`),c=`${o}${r}`;return(0,Z.jsx)(NP,{tabId:e,openTabs:w,closeTab:l,closeTabs:De,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(MP,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(_P,u?vP:yP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:bP,onClick:()=>{a(e)},tabIndex:-1,children:[o&&(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate`,u&&`text-muted-foreground`),children:o}),(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center`,o?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(PP,{accessibleLabel:c,closeTab:l,forceCloseVisible:Ne,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})},e)}if(s.kind===`asset`||s.kind===`skill-file`){let{baseName:t,label:r,prefix:o}=Kt(s.kind===`asset`?s.assetPath:s.path,``),c=`${o}${r}`;return(0,Z.jsx)(NP,{tabId:e,openTabs:w,closeTab:l,closeTabs:De,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(MP,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(_P,u?vP:yP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:bP,onClick:()=>{a(e)},tabIndex:-1,children:[o?(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:o}):null,(0,Z.jsx)(`span`,{className:Y(`min-w-0 truncate`,o?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(PP,{accessibleLabel:c,closeTab:l,forceCloseVisible:Ne,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})},e)}let f=s.docName,p=E.get(f)?.docExt??`.md`,{baseName:m,extension:h,label:g,prefix:_}=Kt(f,p),b=`${_}${g}`,x=p===`.md`||p===`.mdx`,S=A?.tabId===e,D=`editor-tab-rename-error-${xP(f)}`;return(0,Z.jsx)(NP,{disabled:S,tabId:e,openTabs:w,closeTab:l,closeTabs:De,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsx)(MP,{tabId:e,activateFromKeyboard:()=>a(e),disabled:S,"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:Y(_P,u?vP:yP,S&&P&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(VC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(KC,{ref:B,value:M,disabled:I,"aria-label":T({id:`Dw1T_W`,values:{label:g}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":P?!0:void 0,"aria-describedby":P?D:void 0,"aria-busy":I||void 0,title:P??f,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=>{N(wP(e.target.value,p)),F(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ye()):e.key===`Escape`&&(e.preventDefault(),ve())},onBlur:ye}),(0,Z.jsx)(UC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(GC,{className:`text-muted-foreground/60 text-xs`,children:p})})]}),P?(0,Z.jsx)(`span`,{id:D,role:`alert`,className:`sr-only`,children:P}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(IP,{accessibleLabel:b,activateTab:a,baseName:m,docName:f,enterRenameMode:_e,extension:h,hideDocExtension:x,tabId:e}),(0,Z.jsx)(PP,{accessibleLabel:b,closeTab:l,forceCloseVisible:Ne,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})})},e)}),Ze;e[60]!==qe||e[61]!==Je||e[62]!==Ye||e[63]!==Xe?(Ze=(0,Z.jsx)(qe,{items:Je,strategy:Ye,children:Xe}),e[60]=qe,e[61]=Je,e[62]=Ye,e[63]=Xe,e[64]=Ze):Ze=e[64];let Qe;e[65]!==We||e[66]!==Le||e[67]!==ze||e[68]!==Fe||e[69]!==Me||e[70]!==!1||e[71]!==Ge||e[72]!==Ke||e[73]!==Ze||e[74]!==Te?(Qe=(0,Z.jsx)(We,{sensors:Me,autoScroll:!1,collisionDetection:Ge,modifiers:Te,onDragStart:Fe,onDragEnd:ze,onDragCancel:Le,accessibility:Ke,children:Ze}),e[65]=We,e[66]=Le,e[67]=ze,e[68]=Fe,e[69]=Me,e[70]=!1,e[71]=Ge,e[72]=Ke,e[73]=Ze,e[74]=Te,e[75]=Qe):Qe=e[75];let $e;e[76]===T?$e=e[77]:($e=T({id:`3YvS-c`}),e[76]=T,e[77]=$e);let et;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(me,{"aria-hidden":`true`}),e[78]=et):et=e[78];let nt;e[79]!==g||e[80]!==$e?(nt=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":$e,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:et})}),e[79]=g,e[80]=$e,e[81]=nt):nt=e[81];let rt;e[82]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(Os,{children:(0,Z.jsx)(J,{id:`3YvS-c`})}),e[82]=rt):rt=e[82];let it;e[83]===nt?it=e[84]:(it=(0,Z.jsxs)(As,{children:[nt,rt]}),e[83]=nt,e[84]=it);let at;e[85]!==Ue||e[86]!==Qe||e[87]!==it?(at=(0,Z.jsxs)(`div`,{className:Ue,children:[Qe,it]}),e[85]=Ue,e[86]=Qe,e[87]=it,e[88]=at):at=e[88];let ot;return e[89]!==Be||e[90]!==Ve||e[91]!==He||e[92]!==at?(ot=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":Be,className:Ve,onWheel:He,children:at}),e[89]=Be,e[90]=Ve,e[91]=He,e[92]=at,e[93]=ot):ot=e[93],ot}var RP=(e,t,n)=>{if(e&&`reportValidity`in e){let r=La(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},zP=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?RP(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>RP(t,n,e))}},BP=(e,t)=>{t.shouldUseNativeValidation&&zP(e,t);let n={};for(let r in e){let i=La(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(VP(t.names||Object.keys(e),r)){let e=Object.assign({},La(n,r));ro(e,`root`,a),ro(n,r,e)}else ro(n,r,a)}return n},VP=(e,t)=>{let n=HP(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>HP(e).match(`^${n}\\.\\d+`))};function HP(e){return e.replace(/[\[\]]/g,``)}function UP(){return UP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},UP.apply(null,arguments)}function WP(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function GP(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ka(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function KP(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(UP({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=ka(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function qP(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(WP(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&zP({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:BP(GP(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(WP(function(){return Promise.resolve((n.mode===`sync`?hr:vr)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&zP({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof qn}(e))return{values:{},errors:BP(KP(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var JP=`https://openknowledge.ai/api/subscribe`;async function YP(e,t){try{let n=await fetch(JP,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function XP(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=tn(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=gr({email:gi({message:u({id:`Wq6Wcm`})})});_=Da,g=qP(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await YP(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=Y(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Gi,{className:`size-4 text-primary`}),(0,Z.jsx)(J,{id:`PIMM5l`})]}):r??(0,Z.jsx)(J,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(J,{id:`pBROkv`}):i??(0,Z.jsx)(J,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(vs,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Va,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(VC,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(UC,{className:`pl-2.5`,children:(0,Z.jsx)(ef,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(KC,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(X,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:Y(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ts,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ze,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`EDl9kS`})})]}):(0,Z.jsx)(J,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var ZP=`https://github.com/inkeep/open-knowledge`,QP=`https://discord.com/invite/YujKpFN49`,$P=`https://x.com/OpenKnowledge`,eF=`ok-subscribe-card-v1`,tF={subscribed:!1,dismissed:!1,shownVersions:[]};function nF(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function rF(e){return e===!0}function iF(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function aF(e){if(typeof e!=`object`||!e)return tF;let t=e;return{subscribed:rF(t.subscribed),dismissed:rF(t.dismissed),shownVersions:iF(t.shownVersions)}}function oF(e){try{let t=(e??localStorage).getItem(eF);return t==null?tF:aF(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),tF}}function sF(e,t){try{(t??localStorage).setItem(eF,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function cF(e){let t=oF(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,sF(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=oF(e),i())}}}var lF=cF();function uF(){lF.install()}function dF(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 fF(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),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 pF(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 mF=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:dt},{label:{id:`PCNIuJ`},href:`${ZP}/issues/new`,icon:Td},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Xi}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:QP,icon:dF},{label:`X (Twitter)`,href:$P,icon:pF},{label:`GitHub`,href:ZP,icon:fF}]}],hF=`${ZP}/releases`,gF=`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`;function _F(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var vF=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=tn(),i,a,o,s;t[0]!==r||t[1]!==n?(i=_F(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Df,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},yF=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=tn(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>fu(e,o),l=e=>fu(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:gF,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},bF=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},xF=()=>{let e=(0,$.c)(28),{_:t}=tn(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c,l;e[0]!==n||e[1]!==o?(c=()=>{if(!n||o!==null)return;let e=new AbortController;return fi({signal:e.signal}).then(e=>{e!==null&&s(e)}),()=>e.abort()},l=[n,o],e[0]=n,e[1]=o,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{r(e),e||a(!1)},e[4]=u):u=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(St,{className:`size-4`}),e[5]=d):d=e[5];let f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(Pe,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[d,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`s-MGs7`})})]})})}),e[6]=f):f=e[6];let p;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(As,{children:[f,(0,Z.jsx)(Os,{children:(0,Z.jsx)(J,{id:`s-MGs7`})})]}),e[7]=p):p=e[7];let m;e[8]!==t||e[9]!==o?(m=mF.map((e,n)=>(0,Z.jsxs)(`div`,{className:Y(n>0&&`mt-3`),children:[(0,Z.jsx)(bF,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:e.links.map(e=>(0,Z.jsx)(yF,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&o!==null?(0,Z.jsx)(vF,{count:o}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=o,e[10]=m):m=e[10];let h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(bF,{children:(0,Z.jsx)(J,{id:`arUUsK`})}),e[11]=h):h=e[11];let g;e[12]===t?g=e[13]:(g=t({id:`arUUsK`}),e[12]=t,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(yF,{link:{label:{id:`3ePd3I`},href:hF,icon:tf}}),e[14]=_):_=e[14];let v;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Pe,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:Y(gF,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(ef,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(J,{id:`EDl9kS`})]})}),e[15]=v):v=e[15];let y;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Nt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(XP,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:SF})}),e[16]=y):y=e[16];let b;e[17]===i?b=e[18]:(b=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[_,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(ke,{open:i,onOpenChange:a,children:[v,y]})})]}),e[17]=i,e[18]=b);let x;e[19]!==b||e[20]!==g?(x=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[h,(0,Z.jsx)(`nav`,{"aria-label":g,children:b})]}),e[19]=b,e[20]=g,e[21]=x):x=e[21];let S;e[22]!==x||e[23]!==m?(S=(0,Z.jsxs)(Nt,{align:`end`,className:`w-56 p-3`,children:[m,x]}),e[22]=x,e[23]=m,e[24]=S):S=e[24];let C;return e[25]!==n||e[26]!==S?(C=(0,Z.jsxs)(ke,{open:n,onOpenChange:u,children:[p,S]}),e[25]=n,e[26]=S,e[27]=C):C=e[27],C};function SF(){return lF.markSubscribed()}var CF=50,wF=()=>{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,EC.preload()},CF))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Ga)},l=(0,Z.jsx)(yf,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(As,{children:[u,(0,Z.jsx)(Os,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},TF=`https://openknowledge.ai/docs/features/share`;function EF(e){let t=(0,$.c)(50),{input:n,onClickWhenNoRemote:r}=e,{_:i}=tn(),{status:a}=ji(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h=Di(c?.freshness,a),g;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(g=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Na({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:va,toastSuccess:PF,toastError:NF,logEvent:MF});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{_s.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=g):g=t[9];let _=g,v=c!==null,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{e||l(null)},t[10]=y):y=t[10];let b;t[11]!==i||t[12]!==n?.kind?(b=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=b):b=t[13];let x=o||m,S,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(bf,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(J,{id:`Z8lGw6`}),t[14]=S,t[15]=C):(S=t[14],C=t[15]);let w;t[16]!==_||t[17]!==b||t[18]!==x?(w=(0,Z.jsx)(xt,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":b,onClick:_,disabled:x,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})}),t[16]=_,t[17]=b,t[18]=x,t[19]=w):w=t[19];let T=h?`w-96`:`w-80`,E;t[20]===T?E=t[21]:(E=Y(`flex flex-col gap-2`,T),t[20]=T,t[21]=E);let D;t[22]===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)(J,{id:`Z8lGw6`})}),t[22]=D):D=t[22];let O;t[23]===c?.autoCopyFailed?O=t[24]:(O=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ndeI89`})}):null,t[23]=c?.autoCopyFailed,t[24]=O);let k=c?.url??``,A;t[25]===i?A=t[26]:(A=i({id:`5-FeN2`}),t[25]=i,t[26]=A);let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsx)(Wc,{ref:u,readOnly:!0,value:k,onFocus:jF,onClick:AF,onContextMenu:kF,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":A}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M=c?.url??``,N=c?.autoCopyFailed===!1,P;t[30]!==M||t[31]!==N?(P=(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)(W,{copyContent:M,clipboardWrite:va,initialCopied:N})})}),t[30]=M,t[31]=N,t[32]=P):P=t[32];let F;t[33]!==j||t[34]!==P?(F=(0,Z.jsxs)(`div`,{className:`relative`,children:[j,P]}),t[33]=j,t[34]=P,t[35]=F):F=t[35];let I=c?.freshness,L=n?.kind??`doc`,R;t[36]!==a||t[37]!==I||t[38]!==L?(R=(0,Z.jsx)(Ti,{freshness:I,status:a,kind:L}),t[36]=a,t[37]=I,t[38]=L,t[39]=R):R=t[39];let z;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsxs)(`a`,{href:TF,target:`_blank`,rel:`noopener noreferrer`,onClick:OF,onAuxClick:DF,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)(St,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`aByJ8j`})]}),t[40]=z):z=t[40];let B;t[41]!==E||t[42]!==O||t[43]!==F||t[44]!==R?(B=(0,Z.jsxs)(Nt,{align:`end`,className:E,"data-testid":`share-button-popover`,children:[D,O,F,R,z]}),t[41]=E,t[42]=O,t[43]=F,t[44]=R,t[45]=B):B=t[45];let V;return t[46]!==w||t[47]!==B||t[48]!==v?(V=(0,Z.jsxs)(ke,{open:v,onOpenChange:y,children:[w,B]}),t[46]=w,t[47]=B,t[48]=v,t[49]=V):V=t[49],V}function DF(e){return fu(e,TF)}function OF(e){return fu(e,TF)}function kF(e){return e.currentTarget.select()}function AF(e){return e.currentTarget.select()}function jF(e){return e.currentTarget.select()}function MF(e){return console.log(e)}function NF(e){e!==`Link ready but could not copy to clipboard.`&&_s.error(e)}function PF(e){return _s.success(e)}function FF(e){let t=(0,$.c)(35),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=tn(),{activeDocName:o,activeTarget:s}=gt(),c=o?ei(o):null,{state:l,isDraggingRail:u}=Dj(),d=lg(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=Al(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=Al(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=Aa(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=Ra(o),t[3]=o,t[4]=e),_=e;break bb0}if(!s&&!o){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Aa(``),t[5]=e):e=t[5],_=e;break bb0}_=null}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=l===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,C=y&&!u&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,w;t[6]!==S||t[7]!==C?(w=Y(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,C),t[6]=S,t[7]=C,t[8]=w):w=t[8];let T=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(Mj,{className:Y(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Os,{children:l===`expanded`?(0,Z.jsx)(J,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(J,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Y(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)($t,{"aria-hidden":`true`})})}),(0,Z.jsx)(Os,{children:(0,Z.jsx)(J,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(Xa,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(LP,{})]}),E;t[9]===T?E=t[10]:(E=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:T}),t[9]=T,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=Y(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[11]=D):D=t[11];let O;t[12]!==h||t[13]!==g||t[14]!==v||t[15]!==d?(O=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(EF,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(bo,{open:h,onOpenChange:g})]}),t[12]=h,t[13]=g,t[14]=v,t[15]=d,t[16]=O):O=t[16];let k;t[17]!==r||t[18]!==n?(k=(0,Z.jsx)(Za,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=k):k=t[19];let A,j,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(ON,{}),j=(0,Z.jsx)(Xa,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(jN,{}),t[20]=A,t[21]=j,t[22]=M):(A=t[20],j=t[21],M=t[22]);let N;t[23]===d?N=t[24]:(N=!d&&(0,Z.jsx)(wF,{}),t[23]=d,t[24]=N);let P;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(xF,{}),t[25]=P):P=t[25];let F;t[26]!==O||t[27]!==k||t[28]!==N?(F=(0,Z.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N,P]}),t[26]=O,t[27]=k,t[28]=N,t[29]=F):F=t[29];let I;return t[30]!==F||t[31]!==x||t[32]!==w||t[33]!==E?(I=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[E,F]}),t[30]=F,t[31]=x,t[32]=w,t[33]=E,t[34]=I):I=t[34],I}var IF=`open-knowledge:terminal-launch`;function LF(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(IF,{detail:{prompt:e,cli:t}}))}function RF(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(IF,n),()=>t.removeEventListener(IF,n)}function zF(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=Y(`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)($p,{"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 BF=yi(`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 VF(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=Y(BF({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)(em,{"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 HF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`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)(tm,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}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=Y(`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)(nm,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var WF=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-CFHapL_S.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([91,1,10,3,11,6,7,13,56,16,37,92,65,32,33,93]),import.meta.url));function GF(e){let t=(0,$.c)(14),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o,onPtyId:s}=e,c=a===void 0?null:a,l=o===void 0?null:o,{enabled:u,synced:d}=yo(),f=xo(),{_:p}=tn(),m=d&&u===!1,h;t[0]!==p||t[1]!==f?(h=function(){if(f===null){_s.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||_s.error(p({id:`jKd3AP`,values:{0:e.error}}))},t[0]=p,t[1]=f,t[2]=h):h=t[2];let _=h;if(d&&!m){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let a;return t[4]!==l||t[5]!==n||t[6]!==c||t[7]!==r||t[8]!==s||t[9]!==i?(a=(0,Z.jsx)(g,{fallbackRender:qF,onError:KF,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(WF,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:c,adoptPtyId:l,onPtyId:s})})}),t[4]=l,t[5]=n,t[6]=c,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a}let v;return t[11]!==_||t[12]!==m?(v=m?(0,Z.jsx)(XF,{onEnable:_}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[11]=_,t[12]=m,t[13]=v):v=t[13],v}function KF(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function qF(e){return(0,Z.jsx)(JF,{...e})}function JF(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=tn(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===r?o=t[4]:(o=r({id:`6MnZEC`}),t[3]=r,t[4]=o);let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[5]=a,t[6]=s);let c;t[7]===r?c=t[8]:(c=r({id:`HpK_8d`}),t[7]=r,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,Z.jsx)(X,{onClick:YF,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==o||t[12]!==s||t[13]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":o,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[s,l]}),t[11]=o,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function YF(){return window.location.reload()}function XF(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=tn(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`oYepHb`}),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=r({id:`v2ZW0K`}),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==s?(c=(0,Z.jsx)(X,{onClick:n,children:s}),t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;t[11]===r?l=t[12]:(l=r({id:`ICoNYz`}),t[11]=r,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;return t[15]!==i||t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[o,c,u]}),t[15]=i,t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function ZF(e){let t=(0,$.c)(48),{selected:n,onLaunchSelected:r,onPickCli:i,onPickTerminal:a,className:o}=e,{_:s}=tn(),c=n===`terminal`,l;t[0]!==s||t[1]!==c||t[2]!==n?(l=s(c?{id:`AB4qw9`}:{id:`nP-KFo`,values:{0:ui[n].displayName}}),t[0]=s,t[1]=c,t[2]=n,t[3]=l):l=t[3];let u=l,d;t[4]===o?d=t[5]:(d=Y(`flex shrink-0 items-center`,o),t[4]=o,t[5]=d);let f;t[6]!==c||t[7]!==n?(f=c?(0,Z.jsx)(Tf,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(la,{id:ca(n),className:`size-3.5`,"aria-hidden":`true`}),t[6]=c,t[7]=n,t[8]=f):f=t[8];let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(me,{"aria-hidden":`true`,className:`size-3`}),t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==u||t[12]!==f?(m=(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":u,"data-testid":`terminal-new-chat`,className:`cursor-pointer gap-0.5 rounded-r-none px-1.5 text-muted-foreground hover:text-foreground`,onClick:r,children:[f,p]})}),t[10]=r,t[11]=u,t[12]=f,t[13]=m):m=t[13];let h;t[14]===u?h=t[15]:(h=(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:u}),t[14]=u,t[15]=h);let g;t[16]!==m||t[17]!==h?(g=(0,Z.jsxs)(As,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18];let _;t[19]===s?_=t[20]:(_=s({id:`QJaG-9`}),t[19]=s,t[20]=_);let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Ki,{"aria-hidden":`true`,className:`size-3`}),t[21]=v):v=t[21];let y;t[22]===_?y=t[23]:(y=(0,Z.jsx)(_c,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:v})}),t[22]=_,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ac,{children:(0,Z.jsx)(J,{id:`hIQkLb`})}),t[24]=b):b=t[24];let x;t[25]!==s||t[26]!==i||t[27]!==n?(x=ba.map(e=>{let{displayName:t}=ui[e];return(0,Z.jsxs)(yc,{onSelect:()=>i(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":s({id:`9mEZeD`,values:{name:t}}),"aria-current":n===e?`true`:void 0,children:[(0,Z.jsx)(la,{id:ca(e),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),n===e?(0,Z.jsx)(Gi,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)}),t[25]=s,t[26]=i,t[27]=n,t[28]=x):x=t[28];let S;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Mc,{}),t[29]=S):S=t[29];let C=c?`true`:void 0,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Tf,{"aria-hidden":`true`,className:`size-4`}),t[30]=w):w=t[30];let T;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`ALhMYW`})}),t[31]=T):T=t[31];let E;t[32]===c?E=t[33]:(E=c?(0,Z.jsx)(Gi,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null,t[32]=c,t[33]=E);let D;t[34]!==a||t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(yc,{onSelect:a,"data-testid":`terminal-new-chat-terminal`,"aria-current":C,children:[w,T,E]}),t[34]=a,t[35]=C,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==x||t[39]!==D?(O=(0,Z.jsxs)(xc,{align:`start`,className:`min-w-[180px]`,children:[b,x,S,D]}),t[38]=x,t[39]=D,t[40]=O):O=t[40];let k;t[41]!==y||t[42]!==O?(k=(0,Z.jsxs)(Dc,{children:[y,O]}),t[41]=y,t[42]=O,t[43]=k):k=t[43];let A;return t[44]!==d||t[45]!==k||t[46]!==g?(A=(0,Z.jsxs)(`div`,{className:d,children:[g,k]}),t[44]=d,t[45]=k,t[46]=g,t[47]=A):A=t[47],A}function QF(e){let t=(0,$.c)(52),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,newChatSelected:o,onNewChatLaunch:s,onNewChatPickCli:c,onNewChatPickTerminal:l,onClose:u,dockPosition:d,onToggleDock:f,onCollapse:p,children:m,className:h,draggable:g}=e,{_}=tn(),v=d===`right`,y;t[0]===h?y=t[1]:(y=Y(`flex min-h-0 min-w-0 flex-1 flex-col`,h),t[0]=h,t[1]=y);let b=g?``:void 0,x=g&&`h-[62px] [-webkit-app-region:drag] pr-[22px] pl-[calc(var(--ok-titlebar-reserve-left,1rem)+0.75rem)]`,S;t[2]===x?S=t[3]:(S=Y(`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,x),t[2]=x,t[3]=S);let C;t[4]===_?C=t[5]:(C=_({id:`1MGRQl`}),t[4]=_,t[5]=C);let w;if(t[6]!==_||t[7]!==r||t[8]!==g||t[9]!==u||t[10]!==a||t[11]!==n){let e;t[13]!==_||t[14]!==r||t[15]!==g||t[16]!==u||t[17]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:Y(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(HF,{value:e.id,onClick:()=>a?.(e.id),className:Y(`h-7 flex-none rounded-md px-2 text-xs`,g&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})})}),(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:e.label})]}),(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:Y(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`,g&&`[-webkit-app-region:no-drag]`),onClick:t=>{t.stopPropagation(),u(e.id)},children:(0,Z.jsx)(vs,{"aria-hidden":`true`})})]},e.id)},t[13]=_,t[14]=r,t[15]=g,t[16]=u,t[17]=a,t[18]=e):e=t[18],w=n.map(e),t[6]=_,t[7]=r,t[8]=g,t[9]=u,t[10]=a,t[11]=n,t[12]=w}else w=t[12];let T;t[19]!==C||t[20]!==w?(T=(0,Z.jsx)(VF,{variant:`line`,"aria-label":C,className:`flex h-auto min-w-0 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:w}),t[19]=C,t[20]=w,t[21]=T):T=t[21];let E=g&&`[-webkit-app-region:no-drag]`,D;t[22]===E?D=t[23]:(D=Y(`shrink-0`,E),t[22]=E,t[23]=D);let O;t[24]!==o||t[25]!==s||t[26]!==c||t[27]!==l||t[28]!==D?(O=(0,Z.jsx)(ZF,{selected:o,onLaunchSelected:s,onPickCli:c,onPickTerminal:l,className:D}),t[24]=o,t[25]=s,t[26]=c,t[27]=l,t[28]=D,t[29]=O):O=t[29];let k;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`div`,{className:`flex-1`}),t[30]=k):k=t[30];let A;t[31]!==_||t[32]!==f||t[33]!==v?(A=f==null?null:(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_(v?{id:`rf6x3F`}:{id:`QNxpRm`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:f,children:v?(0,Z.jsx)(of,{"aria-hidden":`true`}):(0,Z.jsx)(uf,{"aria-hidden":`true`})})}),(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:v?(0,Z.jsx)(J,{id:`rf6x3F`}):(0,Z.jsx)(J,{id:`QNxpRm`})})]}),t[31]=_,t[32]=f,t[33]=v,t[34]=A):A=t[34];let j;t[35]!==_||t[36]!==p||t[37]!==v?(j=p==null?null:(0,Z.jsxs)(As,{children:[(0,Z.jsx)(Ds,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_({id:`VZGGPK`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:p,children:v?(0,Z.jsx)(Ji,{"aria-hidden":`true`}):(0,Z.jsx)(Ki,{"aria-hidden":`true`})})}),(0,Z.jsx)(Os,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`VZGGPK`})})]}),t[35]=_,t[36]=p,t[37]=v,t[38]=j):j=t[38];let M;t[39]!==O||t[40]!==A||t[41]!==j||t[42]!==b||t[43]!==S||t[44]!==T?(M=(0,Z.jsxs)(`div`,{"data-electron-drag":b,className:S,children:[T,O,k,A,j]}),t[39]=O,t[40]=A,t[41]=j,t[42]=b,t[43]=S,t[44]=T,t[45]=M):M=t[45];let N;return t[46]!==r||t[47]!==m||t[48]!==i||t[49]!==y||t[50]!==M?(N=(0,Z.jsxs)(zF,{value:r,onValueChange:i,className:y,children:[M,m]}),t[46]=r,t[47]=m,t[48]=i,t[49]=y,t[50]=M,t[51]=N):N=t[51],N}function $F(e){return`terminal-session-${e}`}function eI(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function tI(e){let t=(0,$.c)(79),{bridge:n,variant:r,visible:i,onVisibleChange:a,launch:o,installedClis:s,container:c,isShowing:l,onRequestEditorFocus:u,dockPosition:d,onToggleDock:f,onHasSessionsChange:p}=e,m=r===void 0?`dock`:r,h=o===void 0?null:o,{_:g}=tn(),[_]=(0,Q.useState)(sI),v,y;t[0]!==c||t[1]!==_?(v=()=>{_==null||c==null||_.parentElement!==c&&c.appendChild(_)},y=[_,c],t[0]=c,t[1]=_,t[2]=v,t[3]=y):(v=t[2],y=t[3]),(0,Q.useLayoutEffect)(v,y);let b=typeof n.terminal?.list==`function`,x;t[4]!==b||t[5]!==h||t[6]!==i?(x=()=>!b&&i?[{id:$F(1),launch:h,title:null,adoptPtyId:null}]:[],t[4]=b,t[5]=h,t[6]=i,t[7]=x):x=t[7];let[S,C]=(0,Q.useState)(x),w;t[8]!==b||t[9]!==i?(w=()=>!b&&i?$F(1):``,t[8]=b,t[9]=i,t[10]=w):w=t[10];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(!b),k=(0,Q.useRef)(!1),A=(0,Q.useRef)(T),j=(0,Q.useRef)(S),M=(0,Q.useRef)(!b&&i?1:0),N=(0,Q.useRef)(i&&h?h.nonce:null),P=(0,Q.useRef)(m===`window`?!1:i),F=(0,Q.useRef)(new Map),I=function(e,t){t===null?F.current.delete(e):F.current.set(e,t)},L=(0,Q.useRef)(0),R;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){M.current+=1;let t=$F(M.current);C(n=>[...n,{id:t,launch:e,title:null,adoptPtyId:null}]),E(t)},t[11]=R):R=t[11];let z=R,[B,V]=(0,Q.useState)(oI),[H,U]=(0,Q.useState)(aI),W;t[12]===s?W=t[13]:(W=s??{},t[12]=s,t[13]=W);let G;t[14]!==B||t[15]!==W?(G=d_(B,W),t[14]=B,t[15]=W,t[16]=G):G=t[16];let ee=G,te=H?`terminal`:ee,K;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(K=function(e){L.current+=1,z({prompt:null,cli:e,nonce:L.current})},t[17]=K):K=t[17];let ne=K,re;t[18]!==ee||t[19]!==H?(re=function(){H?z(null):ne(ee)},t[18]=ee,t[19]=H,t[20]=re):re=t[20];let ie=re,ae;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e){U(!1),b_(!1);let t=a_(e);V(t),l_(t),ne(e)},t[21]=ae):ae=t[21];let oe=ae,se;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(se=function(){U(!0),b_(!0),z(null)},t[22]=se):se=t[22];let ce=se,le;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(le=function(e,t){let n=t.trim()===``?null:t.trim();C(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[23]=le):le=t[23];let ue=le,q=(0,Q.useRef)(z),de;t[24]!==T||t[25]!==u||t[26]!==a?(de=function(e){let t=j.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===T){let e=(t[n-1]??t[n+1])?.id??``;E(e),e!==``&&queueMicrotask(()=>eI(e))}C(r),r.length===0&&(a(!1),u())},t[24]=T,t[25]=u,t[26]=a,t[27]=de):de=t[27];let fe=de,pe=(0,Q.useRef)(iI),me;t[28]!==T||t[29]!==fe||t[30]!==S?(me=()=>{q.current=z,A.current=T,j.current=S,pe.current=()=>{T!==``&&fe(T)}},t[28]=T,t[29]=fe,t[30]=S,t[31]=me):me=t[31],(0,Q.useEffect)(me);let he,ge;t[32]!==h||t[33]!==D||t[34]!==S.length||t[35]!==i?(he=()=>{if(!D)return;let e=P.current;if(P.current=i,h!=null&&h.nonce!==N.current){N.current=h.nonce,q.current(h);return}i&&!e&&S.length===0&&q.current(null)},ge=[i,h,S.length,D],t[32]=h,t[33]=D,t[34]=S.length,t[35]=i,t[36]=he,t[37]=ge):(he=t[36],ge=t[37]),(0,Q.useEffect)(he,ge);let _e;t[38]===n.terminal?_e=t[39]:(_e=()=>{if(typeof n.terminal?.list!=`function`||k.current)return;k.current=!0;let e=!1;return(async()=>{let t;try{t=await n.terminal.list()??[]}catch(e){console.error(`[terminal] reload session list() failed; cold-starting:`,e),t=[]}if(!e){if(t.length>0){let e=t.map(rI);M.current=e.length,C(e),E(e[0]?.id??``)}O(!0)}})(),()=>{e=!0,k.current=!1}},t[38]=n.terminal,t[39]=_e);let ve;t[40]===n?ve=t[41]:(ve=[n],t[40]=n,t[41]=ve),(0,Q.useEffect)(_e,ve);let ye;t[42]===n?ye=t[43]:(ye=[n],t[42]=n,t[43]=ye),(0,Q.useEffect)(()=>UE(e=>{let t=A.current,r=t===``?void 0:F.current.get(t);r==null?uu():(n.terminal.input(r,e),queueMicrotask(()=>eI(t)))}),ye);let be,xe;t[44]!==n||t[45]!==m?(be=()=>n.onMenuAction(e=>{e===`new-terminal`?q.current(null):(e===`kill-terminal`||e===`close-active-tab-or-window`&&m===`window`)&&pe.current()}),xe=[n,m],t[44]=n,t[45]=m,t[46]=be,t[47]=xe):(be=t[46],xe=t[47]),(0,Q.useEffect)(be,xe);let Se,Ce;t[48]!==_||t[49]!==m?(Se=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||m!==`window`&&(_==null||!_.contains(document.activeElement)))return;let t=j.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),E(t.id),queueMicrotask(()=>eI(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},Ce=[_,m],t[48]=_,t[49]=m,t[50]=Se,t[51]=Ce):(Se=t[50],Ce=t[51]),(0,Q.useEffect)(Se,Ce);let we;t[52]!==n.editor||t[53]!==S.length?(we=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:S.length>0})},t[52]=n.editor,t[53]=S.length,t[54]=we):we=t[54];let Te;t[55]!==n||t[56]!==S.length?(Te=[n,S.length],t[55]=n,t[56]=S.length,t[57]=Te):Te=t[57],(0,Q.useEffect)(we,Te);let Ee,De;t[58]!==p||t[59]!==S.length?(Ee=()=>{p?.(S.length>0)},De=[p,S.length],t[58]=p,t[59]=S.length,t[60]=Ee,t[61]=De):(Ee=t[60],De=t[61]),(0,Q.useEffect)(Ee,De);let Oe,ke;t[62]!==_||t[63]!==l||t[64]!==u||t[65]!==i?(Oe=()=>{l||i||_==null||!_.contains(document.activeElement)||u()},ke=[l,i,_,u],t[62]=_,t[63]=l,t[64]=u,t[65]=i,t[66]=Oe,t[67]=ke):(Oe=t[66],ke=t[67]),(0,Q.useLayoutEffect)(Oe,ke);let Ae,je;t[68]===l?(Ae=t[69],je=t[70]):(Ae=()=>{l&&eI(A.current)},je=[l],t[68]=l,t[69]=Ae,t[70]=je),(0,Q.useEffect)(Ae,je);let Me;if(t[71]!==g||t[72]!==S){let e;t[74]===g?e=t[75]:(e=(e,t)=>({id:e.id,label:e.title??g({id:`OVjNeX`,values:{0:t+1}})}),t[74]=g,t[75]=e),Me=S.map(e),t[71]=g,t[72]=S,t[73]=Me}else Me=t[73];let Ne=Me,Pe=S.length>0?(0,Z.jsx)(QF,{sessions:Ne,activeSessionId:T,onSelect:E,onTabActivate:nI,newChatSelected:te,onNewChatLaunch:ie,onNewChatPickCli:oe,onNewChatPickTerminal:ce,onClose:fe,dockPosition:d,onToggleDock:f,onCollapse:m===`window`?void 0:()=>a(!1),draggable:m===`window`,className:`h-full`,children:S.map(e=>(0,Z.jsx)(UF,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:Y(`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,m===`window`&&`px-[22px] pb-[22px]`),children:(0,Z.jsx)(GF,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>I(e.id,t),onTitleChange:t=>ue(e.id,t),onClose:()=>fe(e.id)})},e.id))}):null,Fe;return t[76]!==_||t[77]!==Pe?(Fe=_==null?null:(0,yd.createPortal)(Pe,_),t[76]=_,t[77]=Pe,t[78]=Fe):Fe=t[78],Fe}function nI(e){return queueMicrotask(()=>eI(e))}function rI(e,t){return{id:$F(t+1),launch:null,title:null,adoptPtyId:e.ptyId}}function iI(){}function aI(){return x_()}function oI(){return c_()}function sI(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function cI(e){let t=(0,$.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=Xg(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Lv[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null,[v,y]=(0,Q.useState)(!1),b=Zg(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(__),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),g_(e),y(!0)},t[2]=A):A=t[2];let j=A,M;t[3]===O?M=t[4]:(M=function(){j(O===`right`?`bottom`:`right`)},t[3]=O,t[4]=M);let N=M,P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=P):P=t[5];let[F,I]=(0,Q.useState)(P),L=(0,Q.useRef)(0),R;t[6]===b?R=t[7]:(R=function(e){let t=e??d_(c_(),b);y(!0),L.current+=1,D({prompt:null,cli:t,nonce:L.current})},t[6]=b,t[7]=R);let z=R,B;t[8]!==x||t[9]!==z?(B=function(){y(!0),!x&&!y_()&&z()},t[8]=x,t[9]=z,t[10]=B):B=t[10];let V=B,H=Ai(),{projectConfig:U,projectLocalConfig:W,projectLocalSynced:G,projectSynced:ee}=Io(),{activeDocName:te}=gt(),K=H?.hasRemote,ne=H?.pushPermission?.checkStatus,re;t[11]!==m||t[12]!==U||t[13]!==W||t[14]!==G||t[15]!==ee||t[16]!==K||t[17]!==ne?(re=w_({autoSyncOnboardingDismissed:m,hasRemote:K,projectLocalSynced:G,projectSynced:ee,projectLocalConfig:W,projectConfig:U,pushPermissionCheckStatus:ne}),t[11]=m,t[12]=U,t[13]=W,t[14]=G,t[15]=ee,t[16]=K,t[17]=ne,t[18]=re):re=t[18];let ie=re,ae,oe;t[19]===te?(ae=t[20],oe=t[21]):(ae=()=>{let e=function(e){let t=e.detail;t&&te&&nu(te,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Hg,e),()=>window.removeEventListener(Hg,e)},oe=[te],t[19]=te,t[20]=ae,t[21]=oe),(0,Q.useEffect)(ae,oe);let se,ce;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?y(dI):e===`new-terminal`&&y(!0)})},ce=[],t[22]=se,t[23]=ce):(se=t[22],ce=t[23]),(0,Q.useEffect)(se,ce);let le,ue;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>{if(window.okDesktop!=null)return;let e=function(e){jl(e,`toggle-terminal-panel`)&&(e.preventDefault(),y(uI))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ue=[],t[24]=le,t[25]=ue):(le=t[24],ue=t[25]),(0,Q.useEffect)(le,ue);let q,de;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>RF((e,t)=>{y(!0),L.current+=1,D({prompt:e,cli:t,nonce:L.current})}),de=[],t[26]=q,t[27]=de):(q=t[26],de=t[27]),(0,Q.useEffect)(q,de);let fe,pe;t[28]===v?(fe=t[29],pe=t[30]):(fe=()=>{v||D(null)},pe=[v],t[28]=v,t[29]=fe,t[30]=pe),(0,Q.useEffect)(fe,pe);let me,he;t[31]!==C||t[32]!==v?(me=()=>{window.okDesktop!=null&&C&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v})},he=[v,C],t[31]=C,t[32]=v,t[33]=me,t[34]=he):(me=t[33],he=t[34]),(0,Q.useEffect)(me,he);let ge,_e;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(lI).finally(()=>{t||w(!0)}),()=>{t=!0}},_e=[],t[35]=ge,t[36]=_e):(ge=t[35],_e=t[36]),(0,Q.useEffect)(ge,_e);let ve,ye;t[37]===v?(ve=t[38],ye=t[39]):(ve=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&Ka()}},ye=[v],t[37]=v,t[38]=ve,t[39]=ye),(0,Q.useEffect)(ve,ye),$g(H?.pausedReason),e_();let be;t[40]===a?be=t[41]:(be=function(e){s(e),a(e)},t[40]=a,t[41]=be);let xe=be,Se,Ce;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Se=()=>{d(`auth`),l(!0)},Ce=()=>{d(`identity`),l(!0)},t[42]=Se,t[43]=Ce):(Se=t[42],Ce=t[43]);let we;t[44]===r?we=t[45]:(we=(0,Z.jsx)(FF,{onSignIn:Se,onSetIdentity:Ce,onOpenSearch:r}),t[44]=r,t[45]=we);let Te=_?V:void 0,Ee;t[46]!==f||t[47]!==o||t[48]!==xe||t[49]!==Te||t[50]!==O||t[51]!==v?(Ee=(0,Z.jsx)(HM,{editorMode:o,onModeChange:xe,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:I,onRevealTerminal:Te}),t[46]=f,t[47]=o,t[48]=xe,t[49]=Te,t[50]=O,t[51]=v,t[52]=Ee):Ee=t[52];let De;t[53]!==b||t[54]!==O||t[55]!==E||t[56]!==F||t[57]!==v||t[58]!==N?(De=_&&g!=null?(0,Z.jsx)(tI,{bridge:g,visible:v,onVisibleChange:y,launch:E,installedClis:b,container:F.container,isShowing:F.isShowing,onRequestEditorFocus:()=>F.editorRegion?.focus(),dockPosition:O,onToggleDock:N,onHasSessionsChange:S}):null,t[53]=b,t[54]=O,t[55]=E,t[56]=F,t[57]=v,t[58]=N,t[59]=De):De=t[59];let Oe=u===`identity`,ke;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>{l(!1)},t[60]=ke):ke=t[60];let Ae;t[61]!==c||t[62]!==Oe?(Ae=(0,Z.jsx)(Wa,{open:c,onOpenChange:l,identityPrompt:Oe,onSuccess:ke}),t[61]=c,t[62]=Oe,t[63]=Ae):Ae=t[63];let je;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(je=()=>h(!0),t[64]=je):je=t[64];let Me;t[65]===ie?Me=t[66]:(Me=(0,Z.jsx)(S_,{open:ie,onResolved:je}),t[65]=ie,t[66]=Me);let Ne;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(zg,{}),t[67]=Ne):Ne=t[67];let Pe;return t[68]!==we||t[69]!==Ee||t[70]!==De||t[71]!==Ae||t[72]!==Me?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[we,Ee,De,Ae,Me,Ne]}),t[68]=we,t[69]=Ee,t[70]=De,t[71]=Ae,t[72]=Me,t[73]=Pe):Pe=t[73],Pe}function lI(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function uI(e){return!e}function dI(e){return!e}function fI(e){let t=El(_l(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function pI(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Ba();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)(cs,{"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)(cs,{"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(mI),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 mI(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>fI(e.file),children:[(0,Z.jsx)(cs,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var hI=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
30
30
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
31
31
|
<path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
|
|
32
32
|
</symbol>
|