@inkeep/open-knowledge 0.20.0-beta.2 → 0.20.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.
Files changed (41) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +2 -2
  2. package/dist/assets/skills/project/SKILL.md +67 -455
  3. package/dist/assets/skills/project/references/anti-patterns.md +33 -0
  4. package/dist/assets/skills/project/references/cadence-and-logs.md +17 -0
  5. package/dist/assets/skills/project/references/components-and-visuals.md +53 -0
  6. package/dist/assets/skills/project/references/conflict-resolution.md +28 -0
  7. package/dist/assets/skills/project/references/corpus-qa.md +14 -0
  8. package/dist/assets/skills/project/references/doc-editing.md +11 -0
  9. package/dist/assets/skills/project/references/folder-model.md +42 -0
  10. package/dist/assets/skills/project/references/ingest-and-sources.md +24 -0
  11. package/dist/assets/skills/project/references/linking.md +14 -0
  12. package/dist/assets/skills/project/references/media-and-assets.md +14 -0
  13. package/dist/assets/skills/project/references/preview.md +51 -0
  14. package/dist/assets/skills/project/references/setup.md +2 -2
  15. package/dist/assets/skills/project/references/template-authoring.md +65 -0
  16. package/dist/assets/skills/project/references/workflow-guides.md +30 -0
  17. package/dist/assets/skills/project/references/writing.md +9 -0
  18. package/dist/assets/skills/write-skill/SKILL.md +16 -5
  19. package/dist/cli.mjs +6 -6
  20. package/dist/constants-8TbZTxy2.mjs +2 -0
  21. package/dist/index.mjs +1 -1
  22. package/dist/init-B8ThmEDv.mjs +1 -0
  23. package/dist/{init-B7uIAmKy.mjs → init-CXgKbGqU.mjs} +3 -3
  24. package/dist/loader-B4XVtshT.mjs +1 -0
  25. package/dist/{loader-C1HBTcQa.mjs → loader-P-wIqwQJ.mjs} +2 -2
  26. package/dist/{preview-lXnqdb3D.mjs → preview-C6u_HSrM.mjs} +2 -2
  27. package/dist/preview-CiozYdtg.mjs +1 -0
  28. package/dist/public/assets/{TerminalPanel-DiJi11zw.js → TerminalPanel-DRbEwLNU.js} +1 -1
  29. package/dist/public/assets/{index-BRRMUSFc.js → index-PKtmMZD3.js} +2 -2
  30. package/dist/public/index.html +1 -1
  31. package/dist/{repair-launch-json-CHs1S_6W.mjs → repair-launch-json-DhC6fFqf.mjs} +2 -2
  32. package/dist/{repair-mcp-configs-BNXjgbYB.mjs → repair-mcp-configs-Mu9q2KP8.mjs} +2 -2
  33. package/dist/{src-Cj9YcMw2.mjs → src-DPSnkoZ_.mjs} +2 -2
  34. package/dist/start-BrzdwifC.mjs +1 -0
  35. package/dist/{start-Cxl8h9Mt.mjs → start-Bz1Xy2ov.mjs} +2 -2
  36. package/package.json +1 -1
  37. package/dist/constants-DOCLO9Wy.mjs +0 -2
  38. package/dist/init-_bjIxAij.mjs +0 -1
  39. package/dist/loader-DAdEi1_2.mjs +0 -1
  40. package/dist/preview-B4Oewkq2.mjs +0 -1
  41. package/dist/start-CSaaayz9.mjs +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-Cbuwv6dZ.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-D2bW5RZv.js","./propagation-api-Dhdns5D6.js","./ConsentDialogBody-BD48TGm2.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./checkbox-DBdFRrZg.js","./dist-CPXhSDT0.js","./button-DGf25ccp.js","./react-dom-C-oc-P2K.js","./dialog-Bt8vN5IM.js","./dist-BLu8fLv5.js","./dist-KER3mSN7.js","./collapsible-B9pRLq8V.js","./chevron-right-jyIhGBkw.js","./project-paths-CK_36JyE.js","./label-Bg6tgeFh.js","./radio-group-_aqBV1Ev.js","./dist-DEyMVsLW.js","./dist-Dpgw_p7D.js","./tooltip-D-omjYEX.js","./input-CFm7DcvJ.js","./textarea-C-Hijn80.js","./McpConsentDialogBody-XGOmuRSp.js","./mcp-consent-store-DZJQdxaS.js","./ActivityPanelDiffView-BXoGtJMu.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-EZGWljSP.js","./dist-C0uDGnS5.js","./w3c-keyname-CO1Sq6Ug.js","./documents-events-BTsmrZJT.js","./toggle-group-Bwdb9pNj.js","./panel-BbrtnF__.js","./min-CBRRdG4A.js","./src-BqsPAyWV.js","./colors-Di0NygFo.js","./ordinal-DkoIOw9o.js","./init-CRMkf9sL.js","./isObjectLike-CXTdSPmv.js","./now-CEjbn_S3.js","./isSymbol-BedorAQF.js","./prop-types-D6SQBoDq.js","./target-navigation-intent-BrunJmhI.js","./external-link-CJXR-UFu.js","./ActivityModeContent-BwvIOsCl.js","./DocumentContext-BA3nlskN.js","./dist-C_ATH0cs.js","./dist-BXTYSiRS.js","./dist-Dkd2NyD9.js","./dist-wA9FGceo.js","./dist-BKvCaeVU.js","./dist-Diq9mvyh.js","./dist-Bzfgenqd2.js","./dist-hRhcPaZU.js","./dist-DisLVkiU.js","./stex-h1E98Bzt.js","./chevron-down-BaPMAfbX.js","./config-context-DhhN0rlf.js","./DocumentContext-B0sQn39F.css","./agent-presence-CPRnxEOl.js","./cursor-CpjEfgnv.js","./dist-HRxi3YvV2.js","./dist-ChteXkW7.js","./SettingsDialogBody-DsXaaN0Q.js","./open-managed-artifact-tab-VuHt1k6e.js","./skills-api-F2HCxVlt.js","./config-validation-events-Bk36aHUQ.js","./skill-actions-SUqrJBew.js","./keyboard-shortcuts-BzwnpNd_.js","./ManagedArtifactProperties-CZG_MU4S.js","./PropertyPanel-uw27ydPe.js","./format-iztu8fVR.js","./selection-context-CJxohv6V.js","./SourceEditor-UA7qm9BP.js","./typing-burst-detector-Dk2TZ23x.js","./SkillEditorActions-CnqozQbp.js","./TerminalPanel-DiJi11zw.js","./terminal-theme-BxhEvVX2.js","./TerminalPanel-BrP-ENHg.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-Cbuwv6dZ.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-D2bW5RZv.js","./propagation-api-Dhdns5D6.js","./ConsentDialogBody-BD48TGm2.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./checkbox-DBdFRrZg.js","./dist-CPXhSDT0.js","./button-DGf25ccp.js","./react-dom-C-oc-P2K.js","./dialog-Bt8vN5IM.js","./dist-BLu8fLv5.js","./dist-KER3mSN7.js","./collapsible-B9pRLq8V.js","./chevron-right-jyIhGBkw.js","./project-paths-CK_36JyE.js","./label-Bg6tgeFh.js","./radio-group-_aqBV1Ev.js","./dist-DEyMVsLW.js","./dist-Dpgw_p7D.js","./tooltip-D-omjYEX.js","./input-CFm7DcvJ.js","./textarea-C-Hijn80.js","./McpConsentDialogBody-XGOmuRSp.js","./mcp-consent-store-DZJQdxaS.js","./ActivityPanelDiffView-BXoGtJMu.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-EZGWljSP.js","./dist-C0uDGnS5.js","./w3c-keyname-CO1Sq6Ug.js","./documents-events-BTsmrZJT.js","./toggle-group-Bwdb9pNj.js","./panel-BbrtnF__.js","./min-CBRRdG4A.js","./src-BqsPAyWV.js","./colors-Di0NygFo.js","./ordinal-DkoIOw9o.js","./init-CRMkf9sL.js","./isObjectLike-CXTdSPmv.js","./now-CEjbn_S3.js","./isSymbol-BedorAQF.js","./prop-types-D6SQBoDq.js","./target-navigation-intent-BrunJmhI.js","./external-link-CJXR-UFu.js","./ActivityModeContent-BwvIOsCl.js","./DocumentContext-BA3nlskN.js","./dist-C_ATH0cs.js","./dist-BXTYSiRS.js","./dist-Dkd2NyD9.js","./dist-wA9FGceo.js","./dist-BKvCaeVU.js","./dist-Diq9mvyh.js","./dist-Bzfgenqd2.js","./dist-hRhcPaZU.js","./dist-DisLVkiU.js","./stex-h1E98Bzt.js","./chevron-down-BaPMAfbX.js","./config-context-DhhN0rlf.js","./DocumentContext-B0sQn39F.css","./agent-presence-CPRnxEOl.js","./cursor-CpjEfgnv.js","./dist-HRxi3YvV2.js","./dist-ChteXkW7.js","./SettingsDialogBody-DsXaaN0Q.js","./open-managed-artifact-tab-VuHt1k6e.js","./skills-api-F2HCxVlt.js","./config-validation-events-Bk36aHUQ.js","./skill-actions-SUqrJBew.js","./keyboard-shortcuts-BzwnpNd_.js","./ManagedArtifactProperties-CZG_MU4S.js","./PropertyPanel-uw27ydPe.js","./format-iztu8fVR.js","./selection-context-CJxohv6V.js","./SourceEditor-UA7qm9BP.js","./typing-burst-detector-Dk2TZ23x.js","./SkillEditorActions-CnqozQbp.js","./TerminalPanel-DRbEwLNU.js","./terminal-theme-BxhEvVX2.js","./TerminalPanel-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
2
  import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-CVnuRdak.js";import{$n as o,$t as s,A as c,Ar as l,B as u,Bn as d,Bt as f,Cn as p,Ct as m,D as h,Dn as g,Dt as _,Er as v,Et as y,F as b,Ft as x,G as S,Gn as C,Gt as w,H as T,Hn as E,Ht as D,I as O,It as k,Jn as A,Jt as j,K as M,Kn as N,Kt as P,L as F,Lt as I,Mr as L,Mt as R,Nt as z,O as B,Or as V,Ot as H,Pt as U,Q as W,Qn as G,Qt as K,R as q,Rt as J,Sn as Y,Sr as ee,St as te,Tn as ne,Tt as re,U as ie,Un as ae,Ut as oe,V as se,Vn as ce,Vt as le,W as ue,Wn as de,Wt as fe,Xn as pe,Xt as me,Yn as he,Yt as ge,Zn as _e,Zt as ve,_n as ye,_r as be,_t as xe,a as Se,an as Ce,ar as we,at as Te,bn as Ee,br as De,bt as Oe,c as ke,cn as Ae,cr as je,ct as Me,d as Ne,dn as Pe,dr as Fe,dt as Ie,en as Le,er as Re,et as ze,f as Be,fn as Ve,fr as He,ft as Ue,g as We,gn as Ge,gr as Ke,gt as qe,h as Je,hn as Ye,hr as Xe,ht as Ze,i as Qe,in as $e,ir as et,it as tt,j as nt,jr as rt,k as it,kr as at,kt as ot,l as st,ln as ct,lr as lt,lt as ut,m as dt,mn as ft,mr as pt,mt,n as ht,nn as gt,nr as _t,o as vt,on as yt,or as bt,ot as xt,p as St,pn as Ct,pr as wt,pt as Tt,q as Et,qn as Dt,qt as Ot,r as kt,rn as At,rr as jt,rt as Mt,s as Nt,sn as Pt,sr as Ft,st as It,t as Lt,tn as Rt,tt as zt,u as Bt,un as Vt,ur as Ht,ut as Ut,v as Wt,vn as Gt,vr as Kt,vt as qt,wn as Jt,wr as Yt,wt as Xt,xn as Zt,xt as Qt,y as $t,yn as en,yr as tn,yt as nn,z as rn,zn as an,zt as on}from"./DocumentContext-BA3nlskN.js";import{n as X,r as sn,t as cn}from"./dist-CQw2y-s3.js";import{A as ln,C as un,D as dn,E as fn,O as pn,S as mn,T as hn,_ as gn,a as _n,b as vn,c as yn,d as bn,f as xn,g as Sn,h as Cn,i as wn,k as Tn,l as En,m as Dn,n as On,o as kn,p as An,r as jn,s as Mn,t as Nn,u as Pn,v as Fn,w as In,x as Ln,y as Rn}from"./panel-BbrtnF__.js";import{A as zn,An as Bn,Ar as Vn,At as Hn,B as Un,Br as Wn,C as Gn,Dn as Kn,Dr as qn,En as Jn,Er as Yn,F as Xn,Hr as Zn,Ir as Qn,Jr as $n,Kn as er,Li as tr,M as nr,Mn as rr,Mr as ir,N as ar,Nt as or,O as sr,Or as cr,Pn as lr,Pt as ur,Q as dr,Qn as fr,Qt as pr,Ri as mr,Rr as hr,Sr as gr,Tn as _r,Tr as vr,Un as yr,Ut as br,Vr as xr,Xr as Sr,Xt as Cr,Yn as wr,_n as Tr,_r as Er,an as Dr,b as Or,bi as kr,bn as Ar,br as jr,bt as Mr,c as Nr,ci as Pr,cr as Fr,gi as Ir,hr as Lr,i as Rr,ii as zr,in as Br,j as Vr,ji as Hr,kr as Ur,kt as Wr,li as Gr,lt as Kr,mn as qr,mt as Jr,n as Yr,pi as Xr,qn as Zr,qr as Qr,ri as $r,rn as ei,si as ti,t as ni,ui as ri,ur as ii,vi as ai,vn as oi,w as si,xn as ci,xr as li,yi as ui,yn as di,yt as fi,z as pi,zr as mi,zt as hi}from"./dist-C0uDGnS5.js";import{t as gi}from"./react-dom-C-oc-P2K.js";import{c as _i,l as vi,r as yi,t as bi,u as xi}from"./button-DGf25ccp.js";import{a as Si,c as Ci,i as wi,l as Ti,n as Ei,o as Di,r as Oi,s as ki,t as Ai}from"./agent-presence-CPRnxEOl.js";import{$ as ji,A as Mi,B as Ni,C as Pi,D as Fi,E as Ii,G as Li,H as Ri,I as zi,J as Bi,K as Vi,L as Hi,M as Ui,N as Wi,O as Gi,Q as Ki,R as qi,T as Ji,U as Yi,V as Xi,W as Zi,X as Qi,Y as $i,Z as ea,at as ta,c as na,ct as ra,dt as ia,et as aa,f as oa,g as sa,h as ca,it as la,j as ua,k as da,lt as fa,nt as pa,o as ma,ot as ha,q as ga,r as _a,rt as va,s as ya,st as ba,t as xa,tt as Sa,ut as Ca,w as wa,x as Ta,z as Ea}from"./config-validation-events-Bk36aHUQ.js";import{i as Da,n as Oa,r as ka,t as Aa}from"./toggle-group-Bwdb9pNj.js";import{a as ja,c as Ma,d as Na,i as Pa,l as Fa,o as Ia,r as La,s as Ra,t as za,u as Ba}from"./PropertyPanel-uw27ydPe.js";import{_ as Va,a as Ha,c as Ua,i as Wa,n as Ga,o as Ka,s as qa,t as Ja}from"./dialog-Bt8vN5IM.js";import{t as Ya}from"./chevron-down-BaPMAfbX.js";import{t as Xa}from"./chevron-right-jyIhGBkw.js";import{A as Za,C as Qa,D as $a,E as eo,F as to,I as no,M as ro,N as io,O as ao,P as oo,S as so,T as co,_ as lo,a as uo,b as fo,c as po,g as mo,h as ho,i as go,j as _o,k as vo,l as yo,n as bo,o as xo,s as So,v as Co,w as wo,x as To,y as Eo}from"./prop-types-D6SQBoDq.js";import{A as Do,C as Oo,D as ko,E as Ao,O as jo,S as Mo,T as No,_ as Po,a as Fo,c as Io,d as Lo,g as Ro,h as zo,i as Bo,k as Vo,l as Ho,m as Uo,n as Wo,o as Go,p as Ko,r as qo,s as Jo,u as Yo,v as Xo,w as Zo,x as Qo,y as $o}from"./skill-actions-SUqrJBew.js";import{a as es,c as ts,d as ns,f as rs,i as is,l as as,m as os,n as ss,o as cs,p as ls,r as us,u as ds}from"./config-context-DhhN0rlf.js";import{_ as fs,c as ps,f as ms,g as hs,h as gs,i as _s,l as vs,m as ys,o as bs,p as xs,s as Ss,t as Cs,u as ws,v as Ts,y as Es}from"./open-managed-artifact-tab-VuHt1k6e.js";import{i as Ds,n as Os,r as ks,t as As}from"./collapsible-B9pRLq8V.js";import{a as js,i as Ms,r as Ns,t as Ps}from"./cursor-CpjEfgnv.js";import{n as Fs,r as Is,t as Ls}from"./dist-BLu8fLv5.js";import{a as Rs,c as zs,l as Bs,n as Vs,o as Hs,r as Us,s as Ws,u as Gs}from"./documents-events-BTsmrZJT.js";import{t as Ks}from"./external-link-CJXR-UFu.js";import{a as qs,d as Js,f as Ys,i as Xs,l as Zs,o as Qs,s as $s}from"./dist-CPXhSDT0.js";import{i as ec,n as tc,r as nc,t as rc}from"./tooltip-D-omjYEX.js";import{c as ic,d as ac,f as oc,g as sc,h as cc,l as lc,m as uc,o as dc,p as fc,s as pc,u as mc}from"./dist-DEyMVsLW.js";import{t as hc}from"./checkbox-DBdFRrZg.js";import{n as gc,r as _c,t as vc}from"./dist-Dpgw_p7D.js";import{A as yc,B as bc,C as xc,D as Sc,E as Cc,F as wc,H as Tc,I as Ec,L as Dc,M as Oc,N as kc,O as Ac,P as jc,R as Mc,S as Nc,T as Pc,V as Fc,_ as Ic,g as Lc,h as Rc,i as zc,j as Bc,k as Vc,m as Hc,o as Uc,p as Wc,r as Gc,u as Kc,v as qc,w as Jc,x as Yc,z as Xc}from"./skills-api-F2HCxVlt.js";import{t as Zc}from"./label-Bg6tgeFh.js";import{n as Qc,t as $c}from"./radio-group-_aqBV1Ev.js";import{t as el}from"./input-CFm7DcvJ.js";import{a as tl,i as nl,n as rl,r as il}from"./project-paths-CK_36JyE.js";import{n as al,t as ol}from"./mcp-consent-store-DZJQdxaS.js";import{c as sl,i as cl,l as ll,o as ul}from"./keyboard-shortcuts-BzwnpNd_.js";import{$ as dl,At as fl,Ct as pl,Dt as ml,Ft as hl,I as gl,It as _l,J as vl,Mt as yl,Ot as bl,Pt as xl,Q as Sl,Tt as Cl,X as wl,Z as Tl,at as El,bt as Dl,jt as Ol,k as kl,w as Al}from"./dist-BXTYSiRS.js";import{n as jl}from"./dist-hRhcPaZU.js";import{c as Ml,f as Nl,g as Pl,i as Fl,l as Il,n as Ll,o as Rl,p as zl,r as Bl,s as Vl,t as Hl,u as Ul}from"./typing-burst-detector-Dk2TZ23x.js";import{t as Wl}from"./target-navigation-intent-BrunJmhI.js";import"./textarea-C-Hijn80.js";import{c as Gl,i as Kl,n as ql,r as Jl,s as Yl}from"./selection-context-CJxohv6V.js";import{t as Xl}from"./terminal-theme-BxhEvVX2.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function Zl(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.19.2`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-Cbuwv6dZ.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Ql(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Sn(e,()=>t.signal,()=>n=!0)},u=Rn(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Fn:gn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?eu:$l,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:$l(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function $l(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function eu(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var tu=class extends xn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||nu(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=An({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),Cn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function nu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ru=class extends ln{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new tu({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=iu(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=iu(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=iu(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=iu(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Cn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>un(t,e))}findAll(e={}){return this.getAll().filter(t=>un(e,t))}notify(e){Cn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Cn.batch(()=>Promise.all(e.map(e=>e.continue().catch(hn))))}};function iu(e){return e.options.scope?.id}var au=class extends ln{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??mn(r,t),a=this.get(i);return a||(a=new bn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Cn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>In(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>In(e,t)):t}notify(e){Cn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Cn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Cn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ou=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new au,this.#t=e.mutationCache||new ru,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Tn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Dn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(dn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=vn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Cn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Cn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Cn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Cn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(hn).catch(hn)}invalidateQueries(e,t={}){return Cn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Cn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(hn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(hn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(dn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(hn).catch(hn)}fetchInfiniteQuery(e){return e.behavior=Ql(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(hn).catch(hn)}ensureInfiniteQueryData(e){return e.behavior=Ql(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Dn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Ln(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{fn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Ln(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{fn(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=mn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===pn&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},su=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),cu=t(((e,t)=>{t.exports=su()})),lu=t((e=>{var t=cu(),n=r(),i=gi();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function J(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function Y(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ee,te;function ne(e){if(ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ee=t&&t[1]||``,te=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ee+e+te}var re=!1;function ie(e,t){if(!e||re)return``;re=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -28,7 +28,7 @@ Error generating stack: `+e.message+`
28
28
  `).trim();return i.length===0||i.length>Zw||i.includes(`
29
29
  `)?null:i}function nT(e){let t=Ze(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function rT(e,t){return e.current===t.current&&e.total===t.total}function iT(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(Xw)}function aT(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=ue(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 oT(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=$w(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)(Xw),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(cT))},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(sT)},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(Xw);return}if(!u.open||r){i.commands.clearFindMatches(),p(Xw);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=nT(i);p(t=>rT(t,e)?t:e)},Qw);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=Ze(i.state),t=nT(i);p(e=>rT(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},D=[i,u.open,r],t[25]=i,t[26]=u.open,t[27]=r,t[28]=E,t[29]=D):(E=t[28],D=t[29]),(0,Q.useEffect)(E,D);let O,k;t[30]!==n||t[31]!==i||t[32]!==u.open||t[33]!==r?(O=()=>{let e=function(e){let t=tT(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(ll(t,`find`)){t.preventDefault(),u.open?iT(i,d,p):e(!1);return}if(ll(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=ll(t,`find-next`),n=ll(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&aT(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),iT(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=Ze(i.state),t=nT(i);p(e=>rT(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=M);let N=M,P;t[43]===i?P=t[44]:(P=function(){iT(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()&&aT(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()&&aT(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)&&aT(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)&&aT(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,q,J;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),q=e=>d(t=>({...t,caseSensitive:e})),J=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=J):(W=t[63],G=t[64],K=t[65],q=t[66],J=t[67]);let Y;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?(Y=(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)(Yw,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:q,onWholeWordChange:J,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=Y):Y=t[80],Y}function sT(e){return{...e,open:!1,activeIndex:0}}function cT(e){return{...e,activeIndex:0}}var lT=300;function uT(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Ml),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Ml);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Il(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,lT)};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 dT(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function fT(e){let t=(0,$.c)(8),{poolEntries:n}=ht(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>dT(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(dT(i));let t=()=>s(dT(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 pT(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Bl(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Vl,r)}var mT=`ok-doc-panel-width-v1`;function hT(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function gT(e){try{let t=(e??localStorage).getItem(mT);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?hT(n):320}catch{return 320}}function _T(e,t){try{(t??localStorage).setItem(mT,String(hT(e)))}catch{}}function vT(){try{return typeof localStorage>`u`?320:gT()}catch{return 320}}var yT=1024,bT=1280,xT={left:yT,right:bT};function ST(e,t,n){return e==null?t>=xT[n]?`above`:`below`:`embedded`}function CT(e){return e===`above`?`open`:`collapsed`}var wT=`ok-sidebar-pins-v2`;function TT(e){return e===`open`||e===`collapsed`}function ET(e){return e===`above`||e===`below`||e===`embedded`}function DT(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!ET(e)||!TT(t[e]))return!1;return!0}function OT(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return DT(n.left)&&(r.left=n.left),DT(n.right)&&(r.right=n.right),r}function kT(e){try{let t=(e??localStorage).getItem(wT);return t==null?{}:OT(t)}catch{return{}}}function AT(e,t){try{t.setItem(wT,JSON.stringify(e))}catch{}}function jT(e,t,n){return n[e]?.[t]??CT(t)}function MT(e,t,n,r){let i=r??localStorage,a=kT(i);return a[e]={...a[e],[t]:n},AT(a,i),a}function NT(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`?PT: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 PT(e){return e===`synced`?`synced`:`connected`}function FT(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function IT(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=sn(),a,o;t[0]!==i||t[1]!==n?(a=FT(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)(Ae,{path:n,className:`size-3`})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Is,{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)(bi,{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 LT(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=vi(`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)(IT,{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 RT(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,{_}=sn(),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)(bi,{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)(Ya,{"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)(Pc,{asChild:!0,children:(0,Z.jsx)(bi,{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:[v?(0,Z.jsxs)(Lc,{"aria-label":_({id:`BBqGS9`}),children:[(0,Z.jsx)(qc,{children:(0,Z.jsx)(X,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(Ic,{onSelect:()=>s(e),"data-testid":m.option(e.id),children:[(0,Z.jsx)(Lo,{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)(Va,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,b?(0,Z.jsxs)(Z.Fragment,{children:[v?(0,Z.jsx)(Yc,{}):null,(0,Z.jsxs)(Lc,{"aria-label":_({id:`ALhMYW`}),children:[(0,Z.jsx)(qc,{children:(0,Z.jsx)(X,{id:`ALhMYW`})}),y?y.map(e=>(0,Z.jsxs)(Ic,{onSelect:e.onSelect,"data-testid":C(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(Lo,{id:Io(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Va,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):c?(0,Z.jsxs)(Ic,{onSelect:c.onSelect,"data-testid":C(`claude`),"aria-label":_({id:`AcK_r0`}),children:[(0,Z.jsx)(Lo,{id:Io(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(X,{id:`fcgvCA`})}),c.selected?(0,Z.jsx)(Va,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]})]}):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)(Rc,{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)(Wc,{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)(lS,{children:[w,k]}),t[32]=w,t[33]=k,t[34]=A):A=t[34],A}var zT=5200,BT=500;function VT(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function HT(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(UT),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 UT(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function WT(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),zT);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(GT),o(!0)},BT);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 GT(e){return e+1}function KT(e){let t=(0,$.c)(149),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=sn(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=HT(),m=ko(),{states:h}=Uo(),{dispatch:g}=Zo(),_=Yo(),[v]=(0,Q.useState)(nE),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!0),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),[D]=(0,Q.useState)(tE),O,k;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(O=()=>{if(u||n==null)return;let e=document.documentElement,t=$T,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=oe(n),t=E.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=E.current;if(c||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+24}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},k=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=O,t[5]=k):(O=t[4],k=t[5]),(0,Q.useEffect)(O,k);let A=(0,Q.useRef)(c),j=(0,Q.useRef)(s),M;t[6]!==c||t[7]!==s?(M=()=>{A.current=c,j.current=s},t[6]=c,t[7]=s,t[8]=M):M=t[8],(0,Q.useEffect)(M);let N,P;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>Ll(()=>{A.current?j.current?.():T.current?.focus()}),P=[],t[9]=N,t[10]=P):(N=t[9],P=t[10]),(0,Q.useEffect)(N,P);let F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=[],t[11]=F):F=t[11],(0,Q.useEffect)(ZT,F);let I=(0,Q.useRef)(!1),L,R;t[12]===c?(L=t[13],R=t[14]):(L=()=>{if(!I.current){I.current=!0;return}c||T.current?.focus()},R=[c],t[12]=c,t[13]=L,t[14]=R),(0,Q.useEffect)(L,R);let z;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[15]=z):z=t[15];let[B,V]=(0,Q.useState)(z),[H,U]=(0,Q.useState)(XT),W;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(W=[],t[16]=W):W=t[16];let[G,K]=(0,Q.useState)(W),q;t[17]!==n||t[18]!==u?(q=u||n==null?``:No(n),t[17]=n,t[18]=u,t[19]=q):q=t[19];let J=q,Y,ee;t[20]!==J||t[21]!==H||t[22]!==u||t[23]!==x?(Y=()=>{u||x||V(e=>e.includes(J)||H.has(J)?e:[...e,J])},ee=[u,x,J,H],t[20]=J,t[21]=H,t[22]=u,t[23]=x,t[24]=Y,t[25]=ee):(Y=t[24],ee=t[25]),(0,Q.useEffect)(Y,ee);let te;t[26]!==H||t[27]!==u||t[28]!==i||t[29]!==G||t[30]!==B?(te=u?i&&!H.has(i)&&!G.includes(i)?[i]:[]:B.filter(e=>!H.has(e)&&!G.includes(e)),t[26]=H,t[27]=u,t[28]=i,t[29]=G,t[30]=B,t[31]=te):te=t[31];let ne=te,re=La(d,f),ie=La(d,`frontmatter`),[ae,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(!1),ue,de;t[32]===re?(ue=t[33],de=t[34]):(ue=()=>{re&&se(re)},de=[re],t[32]=re,t[33]=ue,t[34]=de),(0,Q.useEffect)(ue,de);let fe,pe;t[35]===ie?(fe=t[36],pe=t[37]):(fe=()=>{ie&&se(ie)},pe=[ie],t[35]=ie,t[36]=fe,t[37]=pe),(0,Q.useEffect)(fe,pe);let me=y??v,he;t[38]!==me||t[39]!==_?(he=_===null?null:FS(me),t[38]=me,t[39]=_,t[40]=he):he=t[40];let ge=he,_e=ge!==null,ve;t[41]!==me||t[42]!==_e||t[43]!==h?(ve=_e?null:zS(h,me),t[41]=me,t[42]=_e,t[43]=h,t[44]=ve):ve=t[44];let ye=ve,be=!C&&(!x||ae!==null)&&(_e||ye!==null),xe;t[45]===h?xe=t[46]:(xe=jo.filter(e=>h[e.id]?.installed===!0),t[45]=h,t[46]=xe);let Se=xe,Ce;t[47]===h?Ce=t[48]:(Ce=jo.some(e=>h[e.id]?.installed==null),t[47]=h,t[48]=Ce);let we=Ce,Te=_===null?void 0:Hn.map(e=>{let{displayName:t}=Wr[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:ge===e,onSelect:()=>Pe(e)}}),Ee;t[49]===l?Ee=t[50]:(Ee=l({id:`KYSocE`}),t[49]=l,t[50]=Ee);let De;t[51]===l?De=t[52]:(De=l({id:`7Ongq0`}),t[51]=l,t[52]=De);let Oe;t[53]===l?Oe=t[54]:(Oe=l({id:`HPTPGr`}),t[53]=l,t[54]=Oe);let ke;t[55]===l?ke=t[56]:(ke=l({id:`qiRoLb`}),t[55]=l,t[56]=ke);let Ae;t[57]!==Ee||t[58]!==De||t[59]!==Oe||t[60]!==ke?(Ae=[Ee,De,Oe,ke],t[57]=Ee,t[58]=De,t[59]=Oe,t[60]=ke,t[61]=Ae):Ae=t[61];let je=WT(Ae,!p&&x&&!c),Me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Me=e=>{b(e.id),RS(e.id)},t[62]=Me):Me=t[62];let Ne=Me,Pe=e=>{let t=PS(e);b(t),RS(t)},Fe;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=()=>{T.current?.clear(),se(null),le(!1),V([]),U(new Set),sS()},t[63]=Fe):Fe=t[63];let Ie=Fe,Le;t[64]!==l||t[65]!==g||t[66]!==ye||t[67]!==ge||t[68]!==_?(Le=e=>{if(e===null){Fs.error(l({id:`y8B54M`}));return}if(ge!==null&&_!==null){try{_.launchInTerminal(e,ge)}catch{Fs.error(l({id:`jBVUXo`}));return}Ie();return}ye!==null&&(w(!0),g(ye.id,e).finally(()=>{w(!1),Ie()}))},t[64]=l,t[65]=g,t[66]=ye,t[67]=ge,t[68]=_,t[69]=Le):Le=t[69];let Re=Le,ze;t[70]!==J||t[71]!==be||t[72]!==Re||t[73]!==n||t[74]!==ne||t[75]!==u||t[76]!==i||t[77]!==ae||t[78]!==m?(ze=()=>{if(!be)return;let{instruction:e,mentions:t}=T.current?.getContent()??{instruction:``,mentions:[]};if(u){Re(zo({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...ne,...t])].filter(e=>e!==i)}));return}let r=ae?Gl(ae):void 0,a=ae?.docName??null,o=ae?a:ne.includes(J)?n??null:null,s=o===null?null:No(o);Re(zo({docName:o,workspace:m,instruction:e,mentions:[...new Set([...ne,...t])].filter(e=>e!==s),selection:r}))},t[70]=J,t[71]=be,t[72]=Re,t[73]=n,t[74]=ne,t[75]=u,t[76]=i,t[77]=ae,t[78]=m,t[79]=ze):ze=t[79];let Be=ze;if(c)return null;let Ve=``,He=``;if(ae){let e;t[80]===ae?e=t[81]:(e=Kl(ae,No(ae.docName).split(`/`).pop()??``),t[80]=ae,t[81]=e),Ve=e;let n;t[82]===ae.markdown?n=t[83]:(n=ql(ae.markdown),t[82]=ae.markdown,t[83]=n),He=n}let Ue;t[84]!==l||t[85]!==u||t[86]!==o?(Ue=u?null:(0,Z.jsx)(bi,{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)(Ya,{className:`size-3.5`,"aria-hidden":!0})}),t[84]=l,t[85]=u,t[86]=o,t[87]=Ue):Ue=t[87];let We;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(We=e=>U(t=>{let n=new Set(t);return n.add(e),n}),t[88]=We):We=t[88];let Ge;t[89]!==l||t[90]!==Ve||t[91]!==He||t[92]!==ae||t[93]!==ce?(Ge=ae?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:Ve,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)(bi,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{se(null),le(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Ed,{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)(Is,{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)(bi,{type:`button`,variant:`ghost`,"aria-expanded":ce,"aria-label":l(ce?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>le(YT),"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:Ve})})]}),ce&&He!==``?(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:He}):null]}):null,t[89]=l,t[90]=Ve,t[91]=He,t[92]=ae,t[93]=ce,t[94]=Ge):Ge=t[94];let Ke;t[95]!==ne||t[96]!==Ge?(Ke=(0,Z.jsx)(LT,{files:ne,onRemoveFile:We,children:Ge}),t[95]=ne,t[96]=Ge,t[97]=Ke):Ke=t[97];let qe;t[98]===l?qe=t[99]:(qe=l({id:`xWEvuo`}),t[98]=l,t[99]=qe);let Je;t[100]!==D||t[101]!==Be||t[102]!==qe?(Je=(0,Z.jsx)(OS,{ref:T,ariaLabel:qe,onEmptyChange:S,onContentChange:oS,onMentionsChange:K,onSubmit:Be,initialDoc:D,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),t[100]=D,t[101]=Be,t[102]=qe,t[103]=Je):Je=t[103];let Ye;t[104]!==x||t[105]!==p||t[106]!==je?(Ye=x?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:vi(`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`,je.visible?`opacity-100`:`opacity-0`),children:je.text}):null,t[104]=x,t[105]=p,t[106]=je,t[107]=Ye):Ye=t[107];let Xe;t[108]!==Je||t[109]!==Ye?(Xe=(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[Je,Ye]}),t[108]=Je,t[109]=Ye,t[110]=Xe):Xe=t[110];let Ze;t[111]!==ye||t[112]!==ge?(Ze=ge===null?ye?(0,Z.jsx)(Lo,{id:ye.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(Lo,{id:Io(ge),className:`size-4`,"aria-hidden":!0}),t[111]=ye,t[112]=ge,t[113]=Ze):Ze=t[113];let Qe;t[114]!==ye||t[115]!==ge?(Qe=(0,Z.jsx)(`span`,{children:ge===null?ye?(0,Z.jsx)(X,{id:`nUNZL4`,values:{0:ye.displayName}}):(0,Z.jsx)(X,{id:`F-vBv0`}):(0,Z.jsx)(X,{id:`ti6aF_`,values:{0:Wr[ge].displayName}})}),t[114]=ye,t[115]=ge,t[116]=Qe):Qe=t[116];let $e;t[117]===C?$e=t[118]:($e=C?(0,Z.jsx)(ns,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[117]=C,t[118]=$e);let et;t[119]!==Ze||t[120]!==Qe||t[121]!==$e?(et=(0,Z.jsxs)(Z.Fragment,{children:[Ze,Qe,$e]}),t[119]=Ze,t[120]=Qe,t[121]=$e,t[122]=et):et=t[122];let tt=!be,nt=_e?null:ye?.id??null,rt;t[123]===we?rt=t[124]:(rt=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:we?(0,Z.jsx)(X,{id:`EcR0fl`}):(0,Z.jsx)(X,{id:`l6OXqI`})}),t[123]=we,t[124]=rt);let it;t[125]===l?it=t[126]:(it=l({id:`nskygk`}),t[125]=l,t[126]=it);let at;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(at={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:JT,terminal:qT},t[127]=at):at=t[127];let ot;t[128]!==Te||t[129]!==Ne||t[130]!==Se||t[131]!==Be||t[132]!==et||t[133]!==tt||t[134]!==nt||t[135]!==rt||t[136]!==it?(ot=(0,Z.jsx)(RT,{primary:et,onPrimary:Be,primaryDisabled:tt,installedTargets:Se,selectedTargetId:nt,onSelectTarget:Ne,terminals:Te,menuEmptyState:rt,triggerAriaLabel:it,testIds:at}),t[128]=Te,t[129]=Ne,t[130]=Se,t[131]=Be,t[132]=et,t[133]=tt,t[134]=nt,t[135]=rt,t[136]=it,t[137]=ot):ot=t[137];let st;t[138]!==Xe||t[139]!==ot?(st=(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[Xe,ot]}),t[138]=Xe,t[139]=ot,t[140]=st):st=t[140];let ct;t[141]!==Ue||t[142]!==Ke||t[143]!==st?(ct=(0,Z.jsxs)(`div`,{ref:E,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:[Ue,Ke,st]}),t[141]=Ue,t[142]=Ke,t[143]=st,t[144]=ct):ct=t[144];let lt=ct;if(u){let e;return t[145]===lt?e=t[146]:(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:lt})}),t[145]=lt,t[146]=e),e}let ut;return t[147]===lt?ut=t[148]:(ut=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-20 editor-content-aligned bg-gradient-to-t from-background from-65% via-background to-transparent pt-10 pb-2`,"data-testid":`bottom-composer`,children:lt}),t[147]=lt,t[148]=ut),ut}function qT(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function JT(e){return`ask-ai-agent-option-${e}`}function YT(e){return!e}function XT(){return new Set}function ZT(){let e=QT;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function QT(e){ll(e,`open-ask-ai`)&&(VT(e.target)||(e.preventDefault(),Hl()))}function $T(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(eE);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 eE(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function tE(){return aS().doc??void 0}function nE(){return LS()}function rE(e){return!e.terminalVisible&&!e.isEmbedded&&e.isDesktop&&e.activeDocName!==null}function iE(e){return!e.terminalVisible&&!e.isEmbedded&&e.isDesktop}function aE(e,t={}){let n=Te(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var oE=200,sE=`Outside any block`;function cE(e){let t=(0,$.c)(5),{editor:n}=e,r=$t(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?lE(n,r):o.current?sE:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},oE),()=>{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 lE(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=aE(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=aE(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}function uE(){let[e]=(0,Q.useState)(Bn);return e}function dE({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Kn(e.display_name),color:Dr(e.id,Un),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Dr(e.id,Un),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function fE(e,t){return e>t}function pE(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 mE=3,hE=6e4;function gE(e,t){let n=0;for(let r of e)t-r<hE&&(n+=1);return n<mE}var _E=new Map;function vE(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 yE(e){let t=ne.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function bE(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=ne.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){N.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=>{fE(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!fE(i,a)||l!==null&&yE(l.state))return;o=!0;let e=Date.now();for(let[t,n]of _E)n.every(t=>e-t>=hE)&&_E.delete(t);let t=(_E.get(n)??[]).filter(t=>e-t<hE);if(!gE(t,e)){_E.set(n,t),N.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),_E.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,N.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==ne&&vE(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new ui({state:{init:()=>null,apply:e=>(pE(e.getMeta(ne))&&(a=i,o&&N.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!fE(i,a)||yE(t)?!0:e.getMeta(ne)!==void 0,view:e=>{let r=t.doc;return r==null?(N.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 xE(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 SE=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&&Pr(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(mc(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(uc(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(fc(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(dc(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(cc(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(pc(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(ac(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(oc(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=ri(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof ai){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 Zn){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():xE(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&lc(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()}},CE=e=>new ui({key:typeof e.pluginKey==`string`?new kr(e.pluginKey):e.pluginKey,view:t=>new SE({view:t,...e})});$n.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[CE({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 wE=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 $r(e,{textSerializers:zr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(mc(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(uc(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(fc(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(dc(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(cc(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(pc(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(ac(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(oc(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=ri(this.view,e.from,e.to);lc({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()}},TE=e=>new ui({key:typeof e.pluginKey==`string`?new kr(e.pluginKey):e.pluginKey,view:t=>new wE({view:t,...e})});$n.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?[TE({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 EE(e,t){return e??new kr(t)}var DE=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,OE=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),kE=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(`.`)),AE=new Set([`children`,`className`,`style`]),jE=new Set([`tabIndex`]),ME=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),NE={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function PE(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function FE(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function IE(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||ME.has(e)}function LE(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function RE(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:NE[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function zE(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 BE(e){return jE.has(e)}function VE(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function HE(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 UE(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||kE.has(e)?String(t):`${t}px`}function WE(e,t){OE.has(t)||e.style.removeProperty(LE(t))}function GE(e,t,n){OE.has(t)||e.style.setProperty(LE(t),UE(t,n))}function KE(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(AE.has(r)||!IE(r)||PE(r,t[r])||PE(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=FE(r);if(a==null||a===!1){BE(r)&&HE(e,r),e.removeAttribute(o);return}if(a===!0){BE(r)&&VE(e,r,!0),e.setAttribute(o,``);return}if(BE(r)){VE(e,r,a);return}e.setAttribute(o,String(a))})}function qE(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function JE(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){WE(e,t);return}GE(e,t,a)}})}function YE(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(!PE(t,n))return;let{eventName:i,options:a}=RE(t),o=t=>{n(zE(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function XE(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);DE(()=>{let i=n.current;return qE(e,i.className,t.className),JE(e,i.style,t.style),KE(e,i,t),r.current=YE(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 ZE=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)(EE(e,`bubbleMenu`)).current;XE(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=E(),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=CE({...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,_u.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)(EE(e,`floatingMenu`)).current;XE(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=E(),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=TE({...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,_u.createPortal)(s,u.current)});var QE=[{name:`paragraph`,label:`Text`,icon:ad,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Xe,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:pt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:wt,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Ft,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:lt,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:je,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:et,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:gd,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function $E(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:eD},t[0]=n,t[1]=r);let{current:i,activeStates:a}=de(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)(Ya,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Pc,{asChild:!0,children:(0,Z.jsxs)(bi,{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=QE.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Ic,{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)(Rc,{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)(Wc,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function eD(e){let t=Object.fromEntries(QE.map(t=>[t.name,t.isActive(e.editor)]));return{current:QE.find(e=>t[e.name])??QE[0],activeStates:t}}function tD(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function nD(e){let t=(0,$.c)(2),{shortcutEnabled:n}=e,r=n===void 0?!1:n,i=ti(),a=Vo();if(!i||a)return null;let o;return t[0]===r?o=t[1]:(o=(0,Z.jsx)(rD,{shortcutEnabled:r}),t[0]=r,t[1]=o),o}function rD(e){let t=(0,$.c)(5),{shortcutEnabled:n}=e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{let e=e=>{n&&ll(e,`edit-with-ai`)&&(tD(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),Hl()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ea,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[3]=a):a=t[3];let o;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(Z.Fragment,{children:[a,(0,Z.jsxs)(bi,{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:iD,children:[(0,Z.jsx)(js,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`xWEvuo`})})]})]}),t[4]=o):o=t[4],o}function iD(){return Hl()}function aD(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 oD(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:ut(typeof n.src==`string`?n.src:``)}function sD(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 cD(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=sn(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:lD},t[0]=n,t[1]=i),de(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=aD(n);t&&sD(t,oD(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Ca,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{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)(tc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(X,{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)(rc,{children:[c,l]})}),t[11]=c,t[12]=u),u}function lD(e){return aD(e.editor)}function uD(e){return aD(e)!==null}function dD(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function fD(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 pD(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function mD(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=sn(),i;t[0]===n?i=t[1]:(i={editor:n,selector:hD},t[0]=n,t[1]=i);let a=de(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!dD(n)||n.state.selection.empty||pD(n)||fD(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=ii(Br(n.state.doc)),o=_r(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)(_t,{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)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{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)(tc,{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)(rc,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function hD(e){let t=e.editor;return!!(!dD(t)||t.state.selection.empty||pD(t)||fD(t))}var gD=`img, .ok-embed, .ok-video`,_D=220,vD=`cubic-bezier(0.23, 1, 0.32, 1)`,yD=`ok-image-align-flip`,bD=.5;function xD(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function SD(){return typeof requestAnimationFrame==`function`}function CD(e){return e?e.querySelector(gD):null}function wD(e,t){if(xD()||!SD()){t();return}let n=CD(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=CD(e);if(!t)return;for(let e of t.getAnimations())e.id===yD&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<bD)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:_D,easing:vD,fill:`none`});i.id=yD})}var TD=[{value:`left`,label:`Align left`,icon:Td},{value:`center`,label:`Align center`,icon:Cd},{value:`right`,label:`Align right`,icon:wd}];function ED(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Wt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function DD(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:OD},t[0]=n,t[1]=r);let i=de(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=TD.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(rc,{children:[(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{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(!Wt.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(ai.create(u.doc,s)),wD(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:r})]},t)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function OD(e){return ED(e.editor)}function kD(e){return ED(e)!==null}var AD=[{name:`bold`,icon:hu,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:Wu,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Od,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:bd,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:Yt,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Hu,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function jD(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:MD},t[0]=n,t[1]=r);let i=de(r),a;t[2]!==i||t[3]!==n?(a=AD.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(rc,{children:[(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(tc,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Et,{"aria-label":ul(e.shortcutId),children:cl(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 MD(e){return Object.fromEntries(AD.map(t=>[t.name,t.isActive(e.editor)]))}function ND(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=sn(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=(0,Q.useRef)(null),{folderPaths:l,loading:u,pages:d}=go(),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(q(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)(it,{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)(Du,{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)(bi,{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)(rc,{children:[(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),rn(h)},children:(0,Z.jsx)(Da,{className:`size-3.5`})})}),(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(X,{id:`2vIPtm`})})]}),(0,Z.jsxs)(rc,{children:[(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),T()},children:(0,Z.jsx)(as,{className:`size-3.5`})})}),(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(X,{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)(Ku,{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)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{variant:`ghost`,size:`icon-xs`,"aria-label":A,className:j,onMouseDown:M,children:N})}),t[58]=A,t[59]=j,t[60]=M,t[61]=P):P=t[61];let F;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(X,{id:`yzF66j`}),t[62]=F):F=t[62];let I;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsxs)(tc,{side:`bottom`,sideOffset:8,children:[F,(0,Z.jsx)(Et,{children:cl(`command-palette`)})]}),t[63]=I):I=t[63];let L;return t[64]===P?L=t[65]:(L=(0,Z.jsxs)(rc,{children:[P,I]}),t[64]=P,t[65]=L),L}function PD({editor:e}){if(Ze(e.state).query||e.isActive(`codeBlock`))return!1;if(kD(e)||uD(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 FD(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:BD},t[0]=n,t[1]=l);let u=de(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:zD},t[2]=n,t[3]=d);let f=de(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return ri(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=ic(e,t,()=>{lc(e,t,{placement:`top`,strategy:`fixed`,middleware:[fc(8),mc(),uc({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(RD)}))},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(LD)},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)(DD,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(cD,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($E,{editor:n}),(0,Z.jsx)(ea,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(jD,{editor:n},o),(0,Z.jsx)(ea,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(ND,{editor:n},`${o}-link`),(0,Z.jsx)(mD,{editor:n},`${o}-footnote`),(0,Z.jsx)(nD,{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)(ZE,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:ID,shouldShow:PD,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 ID(){return document.body}function LD(e){return e+1}function RD(){}function zD(e){return uD(e.editor)}function BD(e){return kD(e.editor)}var VD=56,HD=`0 2px 4px rgba(0, 0, 0, 0.08)`,UD=150,WD=globalThis.ScrollTimeline;function GD(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+VD);return{startOffset:o,endOffset:o+a,maxShift:a}}var KD=new WeakMap;function qD(e){let t=KD.get(e);if(t){for(let e of t.animations)e.cancel();KD.delete(e)}}function JD(e){for(let t of Array.from(e.cells))qD(t)}var YD=e=>e.cellIndex===0?`3`:`2`;function XD(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 QD(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 $D(e,t,n){return QD(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:HD})}function eO(e,t){return QD(e,t,{opacity:`0`},{opacity:`1`})}function tO(e,t,n,r){let i=YD(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=KD.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(XD(n,r),s),l=e.animate($D(n,r,i),s),u=e.animate(eO(n,r),{...s,pseudoElement:`::before`});KD.set(e,{key:a,animations:[c,l,u]})}function nO(e,t){let n=YD(e),r=`in|${t}|${n}`,i=KD.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:HD}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});KD.set(e,{key:r,animations:[a,o]})}function rO(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=GD(a,i,c.top,c.height,l.height);if(!u){JD(s);continue}if(n){if(o<=0){JD(s);continue}for(let e of Array.from(s.cells))tO(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+VD){JD(s);continue}for(let e of Array.from(s.cells))nO(e,d)}}var iO=$n.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new ui({key:new kr(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||rO(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()},UD);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&WD)try{n=new WD({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`))JD(t)}}}})]}}),aO=`application/x-open-knowledge-sidebar-item+json`,oO={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function sO(e){return JSON.stringify(e)}function cO(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:vo(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:$a(e.assetPath)}:{target:So(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:ao(e.docName)}}function lO(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(aO);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!uO(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!dO(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function uO(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function dO(e){return typeof e==`string`&&Object.hasOwn(oO,e)}function fO(e,t){return(n,r)=>{let i=r,a=lO(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function pO(e,t){let n=cO(e);t(n.target,{tabBehavior:`append`}),ro(n.hash)}function mO(e){return[...e?[{label:`Toggle header column`,icon:Tu,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:Ti,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:ia,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:as,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:zu,run:e=>e.chain().focus().deleteTable().run()}]}function hO(e){return[...e?[{label:`Toggle header row`,icon:xd,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:rt,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:L,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:as,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:zu,run:e=>e.chain().focus().deleteTable().run()}]}function gO(e){if(!e.isEditable||Ze(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 _O(e){let t=(0,$.c)(22),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==i?(s=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return ic(r,e,()=>{lc(r,e,{strategy:`absolute`,placement:t,middleware:[fc(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(vO)})},c=[r,i],t[0]=r,t[1]=i,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l=i===`column`?ku:fa,u=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`,d=i===`column`?`Column options`:`Row options`,f;t[4]===l?f=t[5]:(f=(0,Z.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[4]=l,t[5]=f);let p;t[6]!==u||t[7]!==d||t[8]!==f?(p=(0,Z.jsx)(Pc,{asChild:!0,children:(0,Z.jsx)(bi,{variant:`secondary`,className:u,"aria-label":d,children:f})}),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m=i===`column`?`center`:`start`,h=i===`column`?`bottom`:`right`,g;if(t[10]!==n||t[11]!==a){let e;t[13]===n?e=t[14]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(Yc,{}),(0,Z.jsxs)(Ic,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[13]=n,t[14]=e),g=a.map(e),t[10]=n,t[11]=a,t[12]=g}else g=t[12];let _;t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Z.jsx)(Rc,{align:m,side:h,className:`w-auto min-w-44 whitespace-nowrap`,children:g}),t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==_||t[20]!==p?(v=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(Wc,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function vO(){}function yO(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=gO(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=mO(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)(_O,{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=hO(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)(_O,{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 bO(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=ne.getState(e.state)?.binding;if(!t){N.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){N.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}N.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return $n.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new ui({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var xO=new WeakMap;function SO(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=di(e.color),n.textContent=e.name,t.append(n),t}var CO={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},wO=100,TO=100,EO=3,DO=250;function OO(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function kO(e,t){let n=ue(e);if(!n||t.contains(n.dom))return!1;if(!OO(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 AO(){let e=new dr({extensions:qn});return{mdManager:e,text:zt({mdManager:e}),html:ze({mdManager:e}),paste:tt({mdManager:e}),drop:Mt({mdManager:e})}}function jO(e,t){return t?{collaboration:nt.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[bO({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:nt.configure({document:e.document}),guard:[]}}function MO(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=jO(t,r);return[...St.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),uS.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,$n.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[Ue]}}),$n.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[Jt(e,{cursorBuilder:SO})]}}),$n.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[bE({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,iO]}function NO(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{xO.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=xO.get(e);if(xO.delete(e),r==null)return;let i=performance.now();N(`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:fO(n.drop,e.onSidebarDrop)},extensions:fh(MO(e))}}function PO(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=NO({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}=p(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var FO=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(CO),c=uE(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=ht(),p=n.configuration.name??``,[m]=(0,Q.useState)(AO),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new Qr(PO({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;N(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{pO(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=le(p)??crypto.randomUUID();_=Q.use,v=J({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{R(y)},S=[y],t[12]=y,t[13]=x,t[14]=S),(0,Q.useEffect)(x,S);let C;return t[15]!==u||t[16]!==p||t[17]!==b||t[18]!==c||t[19]!==i||t[20]!==a||t[21]!==l||t[22]!==n?(C=(0,Z.jsx)(IO,{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},IO=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(0),h,g;t[0]===d?(h=t[1],g=t[2]):(h=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},g=[d],t[0]=d,t[1]=h,t[2]=g),(0,Q.useLayoutEffect)(h,g);let _,v;t[3]!==c||t[4]!==d?(_=()=>{kO(c,d)&&m(LO)},v=[c,d],t[3]=c,t[4]=d,t[5]=_,t[6]=v):(_=t[5],v=t[6]),(0,Q.useEffect)(_,v);let y;t[7]!==c||t[8]!==n.configuration.name?(y=()=>(mt(c,n.configuration.name??null),()=>{mt(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=y):y=t[9];let b;t[10]!==c||t[11]!==n?(b=[c,n],t[10]=c,t[11]=n,t[12]=b):b=t[12],(0,Q.useEffect)(y,b);let x;t[13]!==c||t[14]!==n.configuration.name?(x=()=>{let e=n.configuration.name;if(e)return fe(e,c),()=>P(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=x):x=t[15];let S;t[16]!==c||t[17]!==n?(S=[c,n],t[16]=c,t[17]=n,t[18]=S):S=t[18],(0,Q.useEffect)(x,S);let C;t[19]!==c||t[20]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,Fl(e,`wysiwyg`,Rl(c)),Jl(e,`wysiwyg`,Yl(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),Fl(e,`wysiwyg`,null),Jl(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=C):C=t[21];let w;t[22]!==c||t[23]!==n?(w=[c,n],t[22]=c,t[23]=n,t[24]=w):w=t[24],(0,Q.useEffect)(C,w);let T;t[25]!==c||t[26]!==n.configuration.name?(T=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=T):T=t[27];let E;t[28]!==c||t[29]!==n?(E=[c,n],t[28]=c,t[29]=n,t[30]=E):E=t[30],(0,Q.useEffect)(T,E);let D,O;t[31]===c?(D=t[32],O=t[33]):(D=()=>{let e=RO,t=null,n=()=>{if(t||c.isDestroyed)return;let n=ue(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 ue(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},O=[c],t[31]=c,t[32]=D,t[33]=O),(0,Q.useEffect)(D,O);let k,A;t[34]!==i||t[35]!==c?(k=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!ue(c))return;e=!0;let t=z(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})),N(`ok/editor/selection-restore-failed`,{docName:i,message:n})}ot(i)};if(ue(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},A=[c,i],t[34]=i,t[35]=c,t[36]=k,t[37]=A):(k=t[36],A=t[37]),(0,Q.useEffect)(k,A);let j,M;t[38]!==u||t[39]!==n.document||t[40]!==l?(j=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},Xn)};c(CO);let f=()=>{if(ci(e),!rr(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?rr(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},M=[n.document,u,l],t[38]=u,t[39]=n.document,t[40]=l,t[41]=j,t[42]=M):(j=t[41],M=t[42]),(0,Q.useEffect)(j,M);let F,I;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(F=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<wO){e+=1,t=window.setTimeout(p,TO);return}r=null,o=null,e=0},u=function(e){let t=ue(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=EO,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,DO)))};t=window.setTimeout(o,DO)};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=so(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},I=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=F,t[48]=I):(F=t[47],I=t[48]),(0,Q.useEffect)(F,I);let L,R;t[49]===c?(L=t[50],R=t[51]):(L=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=ue(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(Nl,e),()=>window.removeEventListener(Nl,e)},R=[c],t[49]=c,t[50]=L,t[51]=R),(0,Q.useEffect)(L,R);let B;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(B=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:dE({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]=B):B=t[58];let V;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(V=[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]=V):V=t[65],(0,Q.useEffect)(B,V);let H,U;t[66]!==c||t[67]!==r?(H=()=>(Ee(c,r),()=>{Ee(c,!1)}),U=[c,r],t[66]=c,t[67]=r,t[68]=H,t[69]=U):(H=t[68],U=t[69]),(0,Q.useEffect)(H,U);let W;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(W=!r&&(0,Z.jsx)(FD,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=W):W=t[74];let G;t[75]!==c||t[76]!==r?(G=!r&&(0,Z.jsx)(yO,{editor:c}),t[75]=c,t[76]=r,t[77]=G):G=t[77];let K;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[78]=K):K=t[78];let q;t[79]!==c||t[80]!==p?(q=(0,Z.jsx)(an,{editor:c,className:`tiptap-editor-portal-content h-full`},p),t[79]=c,t[80]=p,t[81]=q):q=t[81];let J;t[82]!==d||t[83]!==q?(J=(0,_u.createPortal)(q,d),t[82]=d,t[83]=q,t[84]=J):J=t[84];let Y;t[85]===c?Y=t[86]:(Y=(0,Z.jsx)(cE,{editor:c}),t[85]=c,t[86]=Y);let ee;t[87]===c?ee=t[88]:(ee=Ut(c),t[87]=c,t[88]=ee);let te;t[89]===ee.store?te=t[90]:(te=(0,Z.jsx)(Ie,{store:ee.store}),t[89]=ee.store,t[90]=te);let ne;return t[91]!==W||t[92]!==G||t[93]!==J||t[94]!==Y||t[95]!==te||t[96]!==l?(ne=(0,Z.jsxs)(`div`,{ref:l,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[W,G,K,J,Y,te]}),t[91]=W,t[92]=G,t[93]=J,t[94]=Y,t[95]=te,t[96]=l,t[97]=ne):ne=t[97],ne};function LO(e){return e+1}function RO(){return S()}var zO=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 BO(e,t,n,r,i,a){if(e==r)return[];let o=XO(e,t,n,r,i,a),s=ZO(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 zO(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new zO(t,t+o,i,i),new zO(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 zO(t,t,i,i+o),new zO(n,n,i+o+c,a)]}if(c==1||l==1)return[new zO(t,n,i,a)];let u=$O(e,t,n,r,i,a);if(u){let[o,s,c]=u;return BO(e,t,o,r,i,s).concat(BO(e,o+c,n,r,s+c,a))}return WO(e,t,n,r,i,a)}var VO=1e9,HO=0,UO=!1;function WO(e,t,n,r,i,a){let o=n-t,s=a-i;if(VO<1e9&&Math.min(o,s)>VO*16||HO>0&&Date.now()>HO)return Math.min(o,s)>VO*64?[new zO(t,n,i,a)]:ek(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);KO.reset(c),qO.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:qO,f=d?null:KO;for(let p=0;p<c;p++){if(p>VO||HO>0&&!(p&63)&&Date.now()>HO)return ek(e,t,n,r,i,a);let m=KO.advance(p,o,s,c,d,!1,l)||qO.advance(p,o,s,c,f,!0,u);if(m)return JO(e,t,n,t+m[0],r,i,a,i+m[1])}return[new zO(t,n,i,a)]}var GO=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}},KO=new GO,qO=new GO;function JO(e,t,n,r,i,a,o,s){let c=!1;return!hk(e,r)&&++r==n&&(c=!0),!hk(i,s)&&++s==o&&(c=!0),c?[new zO(t,n,a,o)]:BO(e,t,r,i,a,s).concat(BO(e,r,n,i,s,o))}function YO(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function XO(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=YO(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-+!hk(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function ZO(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=YO(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-+!hk(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function QO(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;;){hk(e,s)||s++;let u=s+o;if(hk(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=XO(e,u,n,r,i+f+d.length,a),c=ZO(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 $O(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=$O(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:QO(e,t,n,r,i,a,Math.floor(o/4),-1)}function ek(e,t,n,r,i,a){UO=!0;let o=n-t,s=a-i,c;if(o<s){let s=QO(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=QO(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new zO(t,n,i,a)];let[l,u,d]=c;return BO(e,t,l,r,i,u).concat(BO(e,l+d,n,r,u+d,a))}function tk(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 zO(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function nk(e,t,n){for(;;){tk(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=XO(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new zO(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=ZO(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new zO(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 zO(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 zO(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function rk(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=uk(t,a.fromA,l),f=lk(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 zO(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=lk(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new zO(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=uk(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new zO(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=fk(n,a.fromB,a.toB),r,o=t<0?-1:dk(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=fk(t,a.fromA,a.toA),r,o=n<0?-1:dk(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 tk(e,3),e}var ik;try{ik=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function ak(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function ok(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!ak(n):ik?!pk(n)||t==e.length-1?+!!ik.test(String.fromCharCode(n)):ik.test(e.slice(t,t+2))?2:0:0}function sk(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!ak(n):ik?!mk(n)||t==1?+!!ik.test(String.fromCharCode(n)):ik.test(e.slice(t-2,t))?2:0:0}var ck=8;function lk(e,t,n){if(t==e.length||!sk(e,t))return t;for(let r=t,i=t+n,a=0;a<ck;a++){let t=ok(e,r);if(!t||r+t>i)return r;r+=t}return t}function uk(e,t,n){if(!t||!ok(e,t))return t;for(let r=t,i=t-n,a=0;a<ck;a++){let t=sk(e,r);if(!t||r-t<i)return r;r-=t}return t}function dk(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function fk(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var pk=e=>e>=55296&&e<=56319,mk=e=>e>=56320&&e<=57343;function hk(e,t){return!t||t==e.length||!pk(e.charCodeAt(t-1))||!mk(e.charCodeAt(t))}function gk(e,t,n){let r=n?.override;return r?r(e,t):(VO=(n?.scanLimit??1e9)>>1,HO=n?.timeout?Date.now()+n.timeout:0,UO=!1,nk(e,t,BO(e,0,e.length,t,0,t.length)))}function _k(){return!UO}function vk(e,t,n){return rk(gk(e,t,n),e,t)}var yk=bl.define({combine:e=>e[0]}),bk=xl.define(),xk=bl.define(),Sk=hl.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(bk)&&(e=n.value);for(let n of t.state.facet(xk))e=n(e,t);return e}});function Ck(e){let t=e.field(Sk,!1);if(!t)return null;let n=e.facet(yk);return{chunks:t,side:n?n.side:null}}var wk=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 Dk(vk(e.toString(),t.toString(),n),e,t,0,0,_k())}static updateA(e,t,n,r,i){return jk(Ak(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return jk(Ak(e,r,!1,t.length),e,t,n,i)}};function Tk(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 Ek(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 Dk(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Tk(c.fromA+r,c.fromB+i,t,n),[d,f]=Ek(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]=Tk(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]=Ek(a.toA+r,a.toB+i,t,n),s++}o.push(new wk(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Ok=1e3;function kk(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 Ak(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>Ok&&([l,d]=kk(e,a-Ok,n,!0)),o<t.length-Ok&&([u,f]=kk(e,o+Ok,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 jk(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=vk(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Dk(h,n,r,d,f,_k()))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 Mk={scanLimit:500},Nk=Sl.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Uk(e))}update(e){(e.docChanged||e.viewportChanged||Fk(e.startState,e.state)||Ik(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Uk(e.view))}},{decorations:e=>e.deco}),Pk=fl.low(El({class:`cm-changeGutter`,markers:e=>e.plugin(Nk)?.gutter||Ol.empty}));function Fk(e,t){return e.field(Sk,!1)!=t.field(Sk,!1)}function Ik(e,t){return e.facet(yk)!=t.facet(yk)}var Lk=vl.line({class:`cm-changedLine`}),Rk=vl.mark({class:`cm-changedText`}),zk=vl.mark({tagName:`ins`,class:`cm-insertedLine`}),Bk=vl.mark({tagName:`del`,class:`cm-deletedLine`}),Vk=new class extends Tl{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Hk(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,Lk),i.add(o,s,n?Bk:zk),a&&a.add(o,o,Vk);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,Lk),a&&a.add(u,u,Vk);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,Rk),s<t)c++;else break}u=t}}}function Uk(e){let t=e.state.field(Sk),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(yk),o=n==`a`,s=new yl,c=i?new yl: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))&&Hk(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var Wk=class extends dl{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}},Gk=xl.define({map:(e,t)=>e.map(t)}),Kk=hl.define({create:()=>vl.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Gk))return e.value;return e.map(t.changes)},provide:e=>wl.decorations.from(e)}),qk=.01;function Jk(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 Yk(e,t,n){let r=new yl,i=new yl,a=e.state.field(Kk).iter(),o=t.state.field(Kk).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<-qk?(l-=n,r.add(s,s,vl.widget({widget:new Wk(-n),block:!0,side:-1}))):n>qk&&(u+=n,i.add(c,c,vl.widget({widget:new Wk(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<qk?r.add(e.state.doc.length,e.state.doc.length,vl.widget({widget:new Wk(-p),block:!0,side:1})):p>qk&&i.add(t.state.doc.length,t.state.doc.length,vl.widget({widget:new Wk(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Jk(m,e.state.field(Kk))||e.dispatch({effects:Gk.of(m)}),Jk(h,t.state.field(Kk))||t.dispatch({effects:Gk.of(h)})}var Xk=xl.define({map:(e,t)=>t.mapPos(e)}),Zk=class extends dl{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:Xk.of(n)});let{side:r,sibling:i}=e.state.facet(yk);i&&i().dispatch({effects:Xk.of(Qk(n,e.state.field(Sk),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Qk(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 $k=hl.define({create(e){return vl.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Xk)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>wl.decorations.from(e)});function eA({margin:e=3,minSize:t=4}){return $k.init(n=>tA(n,e,t))}function tA(e,t,n){let r=new yl,i=e.facet(yk).side==`a`,a=e.field(Sk),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,vl.replace({widget:new Zk(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var nA=wl.styleModule.of(new Dl({".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`}})),rA=wl.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`}}),iA=new Cl,aA=new Cl,oA=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Mk;let t=[fl.low(Nk),rA,nA,Kk,wl.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Gk)))&&this.measure()})],n=[yk.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Pk);let r=ml.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],wl.editorAttributes.of({class:`cm-merge-a`}),aA.of(n),t]}),i=[yk.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Pk);let a=ml.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],wl.editorAttributes.of({class:`cm-merge-b`}),aA.of(i),t]});this.chunks=wk.build(r.doc,a.doc,this.diffConf);let o=[Sk.init(()=>this.chunks),iA.of(e.collapseUnchanged?eA(e.collapseUnchanged):[])];r=r.update({effects:xl.appendConfig.of(o)}).state,a=a.update({effects:xl.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 wl({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new wl({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),pl.empty(e[0].startState.doc.length));this.chunks=t==this.a?wk.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):wk.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:bk.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:bk.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(yk),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(aA.reconfigure([yk.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Pk:[]])),a.push(aA.reconfigure([yk.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Pk:[]]))}if(r){let t=iA.reconfigure(e.collapseUnchanged?eA(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(){Yk(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=sA(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=sA(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 sA(e){let t=e.nextSibling;return e.remove(),t}var cA=new class extends Tl{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},lA=fl.low(El({class:`cm-changeGutter`,markers:e=>e.plugin(Nk)?.gutter||Ol.empty,widgetMarker:(e,t)=>t instanceof mA?cA:null}));function uA(e){let t=typeof e.original==`string`?_l.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Mk;return[fl.low(Nk),yA,rA,wl.editorAttributes.of({class:`cm-merge-b`}),xk.of((e,t)=>{let r=t.effects.find(e=>e.is(dA));return r&&(e=wk.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=wk.updateB(e,t.state.field(fA),t.newDoc,t.changes,n)),e}),yk.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?TA:void 0,side:`b`}),fA.init(()=>t),e.gutter===!1?[]:lA,e.collapseUnchanged?eA(e.collapseUnchanged):[],Sk.init(e=>wk.build(t,e.doc,n))]}var dA=xl.define(),fA=hl.define({create:()=>_l.empty,update(e,t){for(let n of t.effects)n.is(dA)&&(e=n.value.doc);return e}}),pA=new WeakMap,mA=class extends dl{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 hA(e,t,n){let r=pA.get(t.changes);if(r)return r;let i=vl.widget({block:!0,side:-1,widget:new mA(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(yk),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(),gA(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),_A(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(fA).sliceString(t.fromA,t.endA),u=a&&e.facet(kl),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
30
30
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
31
- `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;gl(t,{style:t=>Al(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 pA.set(t.changes,i),i}function gA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Sk).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(fA);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=pl.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:dA.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function _A(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Sk).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(fA).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 vA(e){let t=new yl;for(let n of e.field(Sk)){let r=e.facet(yk).overrideChunk&&xA(e,n);t.add(n.fromB,n.fromB,hA(e,n,!!r))}return t.finish()}var yA=hl.define({create:e=>vA(e),update(e,t){return t.state.field(Sk,!1)==t.startState.field(Sk,!1)?e:vA(t.state)},provide:e=>wl.decorations.from(e)}),bA=new WeakMap;function xA(e,t){let n=bA.get(t);if(n!==void 0)return n;n=null;let r=e.field(fA),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(vl.widget({widget:new SA(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Rk.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return bA.set(t,n),n}var SA=class extends dl{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}},CA=new class extends Tl{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},wA=vl.line({class:`cm-inlineChangedLine`});function TA(e,t,n,r){let i=xA(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,CA),n.add(o.from,o.from,wA);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 EA=ie({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),DA=T({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),OA=wl.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 kA({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 AA(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=sn(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=mr(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C;t[1]!==l||t[2]!==c?(C=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=C):C=t[3],(0,Q.useEffect)(C);let w,T;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(w=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?EA:DA,u=[wl.editable.of(!1),ml.readOnly.of(!0)],g=[Ul,jl(),...u,l,wl.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new wl({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=kA({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 wl({doc:d,extensions:[Ul,jl(),wl.editable.of(!1),l,OA,wl.lineWrapping,uA({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),wl.updateListener.of(e=>{let t=Ck(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=Ck(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new oA({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new wl({doc:d,extensions:[...g,uA({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},T=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=w,t[11]=T):(w=t[10],T=t[11]),(0,Q.useEffect)(w,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=p.current;!e||!(e instanceof wl)||g.current?.(e.state.doc.toString())},t[12]=E):E=t[12];let D=E,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=p.current;!e||!(e instanceof wl)||W(e)},t[13]=O):O=t[13];let k=O,A=v===0,j;t[14]!==u||t[15]!==v?(j=v===null?``:v===0?u({id:`lPzyrU`}):Gs._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=j):j=t[16];let M=j,N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=N):N=t[17];let P;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,_u.createPortal)((0,Z.jsx)(bi,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),P=x.map(e),t[18]=u,t[19]=x,t[20]=P}else P=t[20];let F;t[23]!==A||t[24]!==a||t[25]!==M||t[26]!==l||t[27]!==c?(F=a&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${A?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:M}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(bi,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(X,{id:`XyOUTJ`})}),(0,Z.jsx)(bi,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:k,children:`Undo`}),c&&(0,Z.jsx)(bi,{variant:`default`,size:`sm`,disabled:!A,onClick:D,children:(0,Z.jsx)(X,{id:`Lcehxn`})})]})]}),t[23]=A,t[24]=a,t[25]=M,t[26]=l,t[27]=c,t[28]=F):F=t[28];let I;return t[29]!==F||t[30]!==P?(I=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[N,P,F]}),t[29]=F,t[30]=P,t[31]=I):I=t[31],I}async function jA(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 MA(e,t){return jA(e,`content`,t)}async function NA(e){return jA(e,`mine`)}async function PA(e){return jA(e,`theirs`)}async function FA(e){return jA(e,`delete`)}async function IA(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 LA(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=sn(),{conflicts:i,loading:a}=da(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>eo(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h,g;t[5]===n?(h=t[6],g=t[7]):(h=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),g=[n],t[5]=n,t[6]=h,t[7]=g),(0,Q.useEffect)(h,g);let _=a||s===void 0,v,y;t[8]!==_||t[9]!==c?(v=()=>{if(_)return;let e=!1;return u(null),f(!1),IA(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},y=[c,_],t[8]=_,t[9]=c,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,Q.useEffect)(v,y);let b;t[12]!==r||t[13]!==c?(b=async function(e){let t=await MA(c,e);t.ok||Fs.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=b):b=t[14];let x=b,S;t[15]!==r||t[16]!==c?(S=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),Fs.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=S):S=t[17];let C=S;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{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)(X,{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)(AA,{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)(X,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===C?a=t[30]:(a=()=>void C(FA),t[29]=C,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(X,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(bi,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===C?u=t[36]:(u=()=>void C(PA),t[35]=C,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(X,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(bi,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let h;t[44]!==i||t[45]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=h):h=t[46];let g;return t[47]!==h||t[48]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[47]=h,t[48]=e,t[49]=g):g=t[49],g}if(l.kind===`modify-delete`){let e;t[50]===l.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(AA,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[50]=l.ours,t[51]=e);let n;t[52]===c?n=t[53]:(n={filePath:c},t[52]=c,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===C?a=t[58]:(a=()=>void C(NA),t[57]=C,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(X,{id:`0NA4b3`}),t[59]=o):o=t[59];let s;t[60]!==p||t[61]!==a?(s=(0,Z.jsx)(bi,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[60]=p,t[61]=a,t[62]=s):s=t[62];let u;t[63]===C?u=t[64]:(u=()=>void C(FA),t[63]=C,t[64]=u);let d;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(X,{id:`qSxaOz`}),t[65]=d):d=t[65];let f;t[66]!==p||t[67]!==u?(f=(0,Z.jsx)(bi,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[66]=p,t[67]=u,t[68]=f):f=t[68];let m;t[69]!==s||t[70]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[69]=s,t[70]=f,t[71]=m):m=t[71];let h;t[72]!==i||t[73]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=h):h=t[74];let g;return t[75]!==h||t[76]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[75]=h,t[76]=e,t[77]=g):g=t[77],g}let w;t[78]===x?w=t[79]:(w=e=>void x(e),t[78]=x,t[79]=w);let T;return t[80]!==l.ours||t[81]!==l.theirs||t[82]!==w?(T=(0,Z.jsx)(AA,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:w}),t[80]=l.ours,t[81]=l.theirs,t[82]=w,t[83]=T):T=t[83],T}function RA(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Bt(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 zA=`__back-nav__`;function BA(e){return e instanceof ke||e instanceof vt||e instanceof Se||e instanceof Qe||e instanceof Nt||e instanceof x?e.docName:null}function VA(e){if(e instanceof ke){let t=e.docName;return{title:Gs._({id:`Jejur6`}),summary:Gs._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof vt){let t=e.docName;return{title:Gs._({id:`V7QxyT`}),summary:Gs._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Se){let t=e.docName;return{title:Gs._({id:`1di5fu`}),summary:Gs._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Qe){let t=e.docName;return{title:Gs._({id:`wvbc1r`}),summary:Gs._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Nt)return{title:Gs._({id:`Gfr4fu`}),summary:Gs._({id:`UW2Fg3`})};if(e instanceof x){let t=e.docName;return{title:Gs._({id:`vv7kpg`}),summary:Gs._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Gs._({id:`W5A0Ly`});return{title:Gs._({id:`29VNqC`}),summary:t}}function HA(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=VA(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(vC,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(X,{id:`KDw4GX`}),t[12]=v):v=t[12];let y;t[13]===r?y=t[14]:(y=(0,Z.jsx)(bi,{ref:d,variant:`default`,onClick:r,children:v}),t[13]=r,t[14]=y);let b;t[15]!==i||t[16]!==u||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(b=u?(0,Z.jsx)(bi,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(st(BA(n)??i),o(a),r(zA))},children:(0,Z.jsx)(X,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=u,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==b||t[23]!==y?(x=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[y,b]}),t[22]=b,t[23]=y,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==_?(S=(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:[m,_,x]}),t[25]=x,t[26]=_,t[27]=S):S=t[27],S}function UA(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)(HA,{...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]===zA){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}: ${VA(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(h,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function WA(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=gr(t);return{map:n,keys:li(t),parseError:r}}function GA(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>WA(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=br(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=Je(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=dt(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)(KA,{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)(qA,{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 KA(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 qA(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 JA=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CZG_MU4S.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([71,1,47,2,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,66,67,21,72,8,73,74,45,24]),import.meta.url)).ManagedArtifactProperties})),YA=Dt(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function XA(e){let t=e.threshold??YA;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function ZA(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var QA=Dt(`ACTIVITY_MOUNT_LIMIT`,3);function $A(){return n(()=>import(`./SourceEditor-UA7qm9BP.js`),__vite__mapDeps([75,1,47,2,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,76,34,74,70]),import.meta.url)}var ej=(0,Q.lazy)(async()=>({default:(await $A()).SourceEditor}));function tj(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Be(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 nj(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Gs._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Gs._({id:`Sc1bKE`,values:{docName:e}}):Gs._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Gs._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Gs._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Gs._({id:`bmC18N`,values:{docName:e}}):Gs._({id:`pAgkuZ`,values:{docName:e}})}:null}function rj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(C,{name:`activity-pool`,children:(0,Z.jsx)(ij,{...e})}),t[0]=e,t[1]=n),n}function ij(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ht(),{pages:u,loading:d}=go(),p=tj(c,n,QA),m=(0,Q.useRef)(``),h=p.map(aj).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)f(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;D(e,t&&t.length>0?t:crypto.randomUUID())}N(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),m.current=h,U(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)(dj,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!fr(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=p.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 aj(e){return e.docName}function oj(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&&N(`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&&(N(`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&&N(`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 sj(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)(Gx,{}),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)(ej,{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 cj(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)(Do,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ns,{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)(bi,{type:`button`,onClick:lj,children:[(0,Z.jsx)(Do,{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 lj(){return window.location.reload()}function uj(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 dj(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=nj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=fT(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=XA({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&&N(`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=()=>z(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),P,F;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?(P=()=>{ZA({isLarge:C.isLarge,renderSource:C.renderSource,renderVisual:C.renderVisual,hasEmittedFirstToggle:j})&&(N(`ok/cold/first-toggle`,{docName:n.docName,mountId:le(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),M(!0))},F=[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]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=k?.scrollTop,B;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?(B=f?(0,Z.jsx)(cj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(UA,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:A?(0,Z.jsx)(uj,{html:A}):(0,Z.jsx)(Gx,{}),children:(0,Z.jsx)(RA,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(LA,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(fr(n.docName)||re(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(JA,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(GA,{provider:n.provider}),(0,Z.jsx)(za,{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)(sj,{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)(FO,{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]=B):B=t[44];let V;t[45]!==r||t[46]!==R||t[47]!==B?(V=(0,Z.jsx)(oj,{isActive:r,initialScrollTop:R,children:B}),t[45]=r,t[46]=R,t[47]=B,t[48]=V):V=t[48];let H;return t[49]!==I||t[50]!==L||t[51]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:V}),t[49]=I,t[50]=L,t[51]=V,t[52]=H):H=t[52],H}function fj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function pj(e){let{value:t,unit:n}=fj(e);return n===`rem`?t*16:t}function mj(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var hj=3600*24*7;function gj(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?_j:m,O=g===void 0?hj:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=pj(b),J;t[6]===x?J=t[7]:(J=pj(x),t[6]=x,t[7]=J);let Y=J,ee;t[8]!==E||t[9]!==k?(ee=function(e){E&&(P.current=!0,j.current=H.current?0:pj(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]=ee):ee=t[10];let te=ee,ne,re;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==Y||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ne=()=>{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}=fj(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(Y,t)),u=mj(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(Y,u)),f=mj(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)}},re=[i,a,D,q,Y,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]=Y,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=re):(ne=t[24],re=t[25]),(0,Q.useEffect)(ne,re);let ie;return t[26]===te?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=ie),ie}function _j(){}var vj=3600*24*7,yj=`18rem`,bj=`3rem`,xj=`app-file-sidebar`,Sj=`14.625rem`,Cj=`32rem`,wj=`sidebar_width`,Tj=/^\d+(?:\.\d+)?(?:rem|px)$/,Ej=Q.createContext(null);function Dj(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${wj}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return Tj.test(n)?n:e}function Oj(){let e=Q.use(Ej);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function kj(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?yj:c,[u]=Q.useState(jj),d;t[8]===u?d=t[9]:(d=()=>ST(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>Dj(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=kT();return jT(`left`,ST(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),MT(`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(Aj)},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: ${yT}px)`),t=()=>{let e=ST(u,window.innerWidth,`left`);p(e),C(jT(`left`,e,kT())===`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(xj)?.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=>{ll(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":bj,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=vi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(Ej.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function Aj(e){return!e}function jj(){return Ar()}function Mj(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}=sn(),{state:f,isDraggingRail:p}=Oj();if(u===`none`){let e;t[7]===r?e=t[8]:(e=vi(`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=vi(`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=vi(`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:xj,"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 Nj(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}=sn(),{toggleSidebar:o,state:s}=Oj(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=ul(`toggle-files-sidebar`);c=bi,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=xj,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=vi(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)(bt,{}):(0,Z.jsx)(td,{}),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 Pj(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}=sn(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=Oj(),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:Sj,maxResizeWidth:Cj,setIsDraggingRail:m,widthCookieName:wj,widthCookieMaxAge:vj},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}=gj(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=vi(`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 Fj(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}=Oj(),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=vi(`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 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=vi(`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 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=vi(`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 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=vi(`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 zj(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=vi(`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 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?yi:`div`,o;t[4]===n?o=t[5]:(o=vi(`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 Vj(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?yi:`button`,o;t[4]===n?o=t[5]:(o=vi(`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 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=vi(`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 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=vi(`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 Wj(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=vi(`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 Gj=_i(`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 Kj(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?yi:`button`,{state:m}=Oj(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=vi(Gj({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)(ec,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(tc,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(rc,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function qj(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?yi:`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=vi(`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 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=vi(`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 Yj(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=vi(`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 Xj(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?yi:`a`,d;t[6]===n?d=t[7]:(d=vi(`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 Zj(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 Qj(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Mr.safeParse(t);return n.success?n.data.currentBranch??null:null}var $j=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:Zj({fetchBranch:Qj,subscribeToEvent:Rs}),eM=$j.subscribe,tM=$j.getSnapshot;function nM(){return(0,Q.useSyncExternalStore)(eM,tM,tM)}function rM(){let e=(0,$.c)(6),t=nM(),n=ko(),{state:r}=Oj(),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&&Gi(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 iM(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:i,composerBadge:a}=e,o=i===void 0?!0:i,{_:s}=sn(),c=rM();if(!o&&c===null&&a==null)return null;let l=r??n,u=r!=null,{words:d,chars:f,tokens:p}=l,m;t[0]!==s||t[1]!==u||t[2]!==o?(m=s(o?u?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=s,t[1]=u,t[2]=o,t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=h):h=t[4];let g;t[5]!==s||t[6]!==a?(g=a?(0,Z.jsxs)(bi,{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)(js,{className:`size-3`,"aria-hidden":!0}),s({id:`xWEvuo`}),(0,Z.jsx)(V,{className:`size-3`,"aria-hidden":!0})]}):null,t[5]=s,t[6]=a,t[7]=g):g=t[7];let _;t[8]===c?_=t[9]:(_=c===null?null:(0,Z.jsx)(aM,{identity:c}),t[8]=c,t[9]=_);let v;t[10]===_?v=t[11]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[10]=_,t[11]=v);let y;t[12]!==s||t[13]!==l.chars||t[14]!==l.tokens||t[15]!==l.words||t[16]!==f||t[17]!==u||t[18]!==o||t[19]!==p||t[20]!==d?(y=o?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[u?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:s({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.words.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`gljvbT`,values:{words:d}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.chars.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`d5rK4X`,values:{chars:f}})]}),(0,Z.jsxs)(`span`,{children:[l.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.tokens.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`uynXup`,values:{tokens:p}})]})]}):null,t[12]=s,t[13]=l.chars,t[14]=l.tokens,t[15]=l.words,t[16]=f,t[17]=u,t[18]=o,t[19]=p,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==m||t[23]!==g||t[24]!==v||t[25]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":m,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[h,g,v,y]}),t[22]=m,t[23]=g,t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function aM(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)(rc,{children:[(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(tc,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(be,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function oM(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}=sn(),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=vi(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 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=vi(`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 cM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=vi(`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 lM(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=vi(`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 uM(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=vi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Xa,{}),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 dM=1,fM=2,pM=4;function mM(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=Lr(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:Xt(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>pM?[...u.slice(0,dM).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(dM,-fM)},...u.slice(-fM).map((e,t)=>d(e,u.length-fM+t))]:u.map((e,t)=>d(e,t));a=oM,t[8]===r?c=t[9]:(c=vi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=sM,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(hM)}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 hM(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(uM,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(cM,{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)(ku,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(cM,{className:`min-w-0`,children:(0,Z.jsx)(lM,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var gM={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`},_M=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`,...gM,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},vM=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)(_M,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},yM=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)(_M,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function bM(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=sn(),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)(ec,{children:(0,Z.jsx)(yM,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(Oa,{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)(tc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(rc,{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)(vM,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Oa,{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)(tc,{side:`bottom`,children:a?(0,Z.jsx)(X,{id:`G-JBA1`}):(0,Z.jsx)(X,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(rc,{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)(Aa,{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 xM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-CnqozQbp.js`);return{SkillEditorActions:e}},__vite__mapDeps([77,1,30,3,7,31,6,10,67,20,9,11,32,12,13,21,16,58,69,18,59,62,23]),import.meta.url)).SkillEditorActions}));function SM(e){let t=(0,$.c)(79),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l}=e,{_:u}=sn(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=cl(`toggle-document-panel`),t[0]=d):d=t[0];let f=d,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;if(t[1]!==u||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==o||t[9]!==i){let e=ul(`toggle-document-panel`),d;t[25]===n?d=t[26]:(d=n?Lr(n):null,t[25]=n,t[26]=d);let f=d,O;t[27]===n?O=t[28]:(O=n?re(n):null,t[27]=n,t[28]=O);let k=O,A;t[29]!==f||t[30]!==k?(A=f?.kind===`skill`?{scope:f.scope,name:f.name}:k?{scope:`project`,name:k}:null,t[29]=f,t[30]=k,t[31]=A):A=t[31];let j=A;_=`editor-toolbar`,v=`pointer-events-none absolute inset-x-0 top-0 z-10`;let M;t[32]!==n||t[33]!==j?(M=j?null:(0,Z.jsx)(mM,{docName:n}),t[32]=n,t[33]=j,t[34]=M):M=t[34];let N;t[35]===M?N=t[36]:(N=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:M}),t[35]=M,t[36]=N);let P;t[37]!==r||t[38]!==a||t[39]!==i?(P=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(bM,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[37]=r,t[38]=a,t[39]=i,t[40]=P):P=t[40],t[41]!==N||t[42]!==P?(y=(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:[N,P]})}),t[41]=N,t[42]=P,t[43]=y):y=t[43],D=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[44]===j?h=t[45]:(h=j?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(xM,{scope:j.scope,name:j.name})}):null,t[44]=j,t[45]=h),t[46]!==u||t[47]!==s||t[48]!==o?(g=o&&(0,Z.jsxs)(rc,{children:[(0,Z.jsx)(bi,{variant:`ghost`,size:`icon`,"aria-label":u({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(ec,{children:(0,Z.jsx)(Ju,{})})}),(0,Z.jsx)(tc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`81H_23`})})]}),t[46]=u,t[47]=s,t[48]=o,t[49]=g):g=t[49],m=rc,p=bi,b=``,x=`ghost`,S=`icon`,C=l,w=!c,T=`doc-panel`,E=u(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=u,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=o,t[9]=i,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S,t[20]=C,t[21]=w,t[22]=T,t[23]=E,t[24]=D}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19],C=t[20],w=t[21],T=t[22],E=t[23],D=t[24];let O;t[50]===c?O=t[51]:(O=(0,Z.jsx)(ec,{children:c?(0,Z.jsx)(rd,{}):(0,Z.jsx)(nd,{})}),t[50]=c,t[51]=O);let k;t[52]!==p||t[53]!==O||t[54]!==b||t[55]!==x||t[56]!==S||t[57]!==C||t[58]!==w||t[59]!==T||t[60]!==E?(k=(0,Z.jsx)(p,{"data-doc-panel-toggle":b,variant:x,size:S,onClick:C,"aria-expanded":w,"aria-controls":T,"aria-label":E,asChild:!0,children:O}),t[52]=p,t[53]=O,t[54]=b,t[55]=x,t[56]=S,t[57]=C,t[58]=w,t[59]=T,t[60]=E,t[61]=k):k=t[61];let A;t[62]===c?A=t[63]:(A=(0,Z.jsx)(tc,{side:`bottom`,children:c?(0,Z.jsx)(X,{id:`KFdXwz`,values:{panelShortcut:f}}):(0,Z.jsx)(X,{id:`MsuXaI`,values:{panelShortcut:f}})}),t[62]=c,t[63]=A);let j;t[64]!==m||t[65]!==k||t[66]!==A?(j=(0,Z.jsxs)(m,{children:[k,A]}),t[64]=m,t[65]=k,t[66]=A,t[67]=j):j=t[67];let M;t[68]!==h||t[69]!==g||t[70]!==j||t[71]!==D?(M=(0,Z.jsxs)(`div`,{className:D,children:[h,g,j]}),t[68]=h,t[69]=g,t[70]=j,t[71]=D,t[72]=M):M=t[72];let N;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[73]=N):N=t[73];let P;return t[74]!==_||t[75]!==v||t[76]!==y||t[77]!==M?(P=(0,Z.jsxs)(`div`,{"data-testid":_,className:v,children:[y,M,N]}),t[74]=_,t[75]=v,t[76]=y,t[77]=M,t[78]=P):P=t[78],P}function CM(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function wM(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=vi(`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)(rp,{"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 TM=_i(`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 EM(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=vi(TM({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)(ip,{"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 DM(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=vi(`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)(ap,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}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=vi(`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)(op,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var kM=`ok-terminal-height-v1`,AM=1/3,jM=.5;function MM(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*jM))}function NM(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*AM)}function PM(e,t){let n=MM(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(NM(t),n)}function FM(){return typeof window>`u`?0:window.innerHeight}function IM(e,t){try{let n=e??localStorage,r=t??FM(),i=n.getItem(kM);if(i==null)return PM(NM(r),r);let a=Number.parseInt(i,10);return PM(Number.isFinite(a)?a:NM(r),r)}catch{return 240}}function LM(e,t,n){try{let r=t??localStorage,i=n??FM();r.setItem(kM,String(PM(e,i)))}catch{}}function RM(){try{return typeof localStorage>`u`?240:IM()}catch{return 240}}var zM=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-DiJi11zw.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([78,1,30,3,7,31,6,10,13,11,79,80]),import.meta.url));function BM(e){let t=(0,$.c)(12),{bridge:n,onClose:r,onTitleChange:i,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=Ii(),l=Fi(),{_:u}=sn(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){Fs.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||Fs.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let a;return t[4]!==n||t[5]!==o||t[6]!==r||t[7]!==i?(a=(0,Z.jsx)(h,{fallbackRender:HM,onError:VM,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(zM,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i,t[8]=a):a=t[8],a}let m;return t[9]!==p||t[10]!==d?(m=d?(0,Z.jsx)(GM,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[9]=p,t[10]=d,t[11]=m):m=t[11],m}function VM(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function HM(e){return(0,Z.jsx)(UM,{...e})}function UM(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=sn(),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)(bi,{onClick:WM,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 WM(){return window.location.reload()}function GM(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=sn(),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)(bi,{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 KM(e){let t=(0,$.c)(36),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,onNew:o,onClose:s,children:c,className:l}=e,{_:u}=sn(),d;t[0]===l?d=t[1]:(d=vi(`flex min-h-0 min-w-0 flex-1 flex-col`,l),t[0]=l,t[1]=d);let f;t[2]===u?f=t[3]:(f=u({id:`1MGRQl`}),t[2]=u,t[3]=f);let p;if(t[4]!==u||t[5]!==r||t[6]!==s||t[7]!==a||t[8]!==n){let e;t[10]!==u||t[11]!==r||t[12]!==s||t[13]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:vi(`group flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(DM,{value:e.id,onClick:()=>a?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(bi,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:vi(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),s(e.id)},children:(0,Z.jsx)(Is,{"aria-hidden":`true`})})]},e.id)},t[10]=u,t[11]=r,t[12]=s,t[13]=a,t[14]=e):e=t[14],p=n.map(e),t[4]=u,t[5]=r,t[6]=s,t[7]=a,t[8]=n,t[9]=p}else p=t[9];let m;t[15]!==f||t[16]!==p?(m=(0,Z.jsx)(EM,{variant:`line`,"aria-label":f,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:p}),t[15]=f,t[16]=p,t[17]=m):m=t[17];let h;t[18]===u?h=t[19]:(h=u({id:`AB4qw9`}),t[18]=u,t[19]=h);let g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(we,{"aria-hidden":`true`}),t[20]=g):g=t[20];let _;t[21]!==o||t[22]!==h?(_=(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":h,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:o,children:g})}),t[21]=o,t[22]=h,t[23]=_):_=t[23];let v;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(X,{id:`AB4qw9`})}),t[24]=v):v=t[24];let y;t[25]===_?y=t[26]:(y=(0,Z.jsxs)(rc,{children:[_,v]}),t[25]=_,t[26]=y);let b;t[27]!==m||t[28]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[m,y]}),t[27]=m,t[28]=y,t[29]=b):b=t[29];let x;return t[30]!==r||t[31]!==c||t[32]!==i||t[33]!==d||t[34]!==b?(x=(0,Z.jsxs)(wM,{value:r,onValueChange:i,className:d,children:[b,c]}),t[30]=r,t[31]=c,t[32]=i,t[33]=d,t[34]=b,t[35]=x):x=t[35],x}var qM=`terminal-dock-panel`;function JM(e){return`terminal-session-${e}`}function YM(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function XM(e){let t=(0,$.c)(78),{bridge:n,children:r,visible:i,onVisibleChange:a,launch:o}=e,s=o===void 0?null:o,{_:c}=sn(),{resolvedTheme:l}=mr(),u=kx(),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!i),m;t[0]!==s||t[1]!==i?(m=()=>i?[{id:JM(1),launch:s,title:null}]:[],t[0]=s,t[1]=i,t[2]=m):m=t[2];let[h,g]=(0,Q.useState)(m),_;t[3]===i?_=t[4]:(_=()=>i?JM(1):``,t[3]=i,t[4]=_);let[v,y]=(0,Q.useState)(_),b=(0,Q.useRef)(v),x=(0,Q.useRef)(h),S=(0,Q.useRef)(+!!i),C=(0,Q.useRef)(i&&s?s.nonce:null),w=(0,Q.useRef)(i),T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){S.current+=1;let t=JM(S.current);g(n=>[...n,{id:t,launch:e,title:null}]),y(t)},t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e,t){let n=t.trim()===``?null:t.trim();g(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[6]=D):D=t[6];let O=D,k=(0,Q.useRef)(E),A;t[7]!==v||t[8]!==a?(A=function(e){let t=x.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===v){let e=(t[n-1]??t[n+1])?.id??``;y(e),e!==``&&queueMicrotask(()=>YM(e))}g(r),r.length===0&&(a(!1),d.current?.focus())},t[7]=v,t[8]=a,t[9]=A):A=t[9];let j=A,M=(0,Q.useRef)($M),N;t[10]!==v||t[11]!==j||t[12]!==h?(N=()=>{k.current=E,b.current=v,x.current=h,M.current=()=>{v!==``&&j(v)}},t[10]=v,t[11]=j,t[12]=h,t[13]=N):N=t[13],(0,Q.useEffect)(N);let[P]=(0,Q.useState)(QM),F=(0,Q.useRef)(P),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(null),B;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){z.current!=null&&clearTimeout(z.current),z.current=setTimeout(()=>{LM(e),z.current=null},100)},t[14]=B):B=t[14];let V=B,H=(0,Q.useRef)(null),U,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>()=>{z.current!=null&&clearTimeout(z.current),H.current!=null&&(window.removeEventListener(`pointerup`,H.current),H.current=null)},U=[],t[15]=U,t[16]=W):(U=t[15],W=t[16]),(0,Q.useEffect)(W,U);let G,K;t[17]!==s||t[18]!==h.length||t[19]!==i?(G=()=>{let e=w.current;if(w.current=i,s!=null&&s.nonce!==C.current){C.current=s.nonce,k.current(s);return}i&&!e&&h.length===0&&k.current(null)},K=[i,s,h.length],t[17]=s,t[18]=h.length,t[19]=i,t[20]=G,t[21]=K):(G=t[20],K=t[21]),(0,Q.useEffect)(G,K);let q,J;t[22]===n?(q=t[23],J=t[24]):(q=()=>n.onMenuAction(e=>{e===`new-terminal`?k.current(null):e===`kill-terminal`&&M.current()}),J=[n],t[22]=n,t[23]=q,t[24]=J),(0,Q.useEffect)(q,J);let Y,ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Y=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(qM)?.contains(document.activeElement))return;let t=x.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),y(t.id),queueMicrotask(()=>YM(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[25]=Y,t[26]=ee):(Y=t[25],ee=t[26]),(0,Q.useEffect)(Y,ee);let te;t[27]!==n.editor||t[28]!==h.length?(te=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:h.length>0})},t[27]=n.editor,t[28]=h.length,t[29]=te):te=t[29];let ne;t[30]!==n||t[31]!==h.length?(ne=[n,h.length],t[30]=n,t[31]=h.length,t[32]=ne):ne=t[32],(0,Q.useEffect)(te,ne);let re,ie;t[33]!==u||t[34]!==i?(re=()=>{let e=u.current;e!=null&&(i?e.resize(`${F.current}px`):e.collapse())},ie=[i,u],t[33]=u,t[34]=i,t[35]=re,t[36]=ie):(re=t[35],ie=t[36]),(0,Q.useEffect)(re,ie);let ae,oe;t[37]===f?(ae=t[38],oe=t[39]):(ae=()=>{f&&document.getElementById(qM)?.contains(document.activeElement)&&d.current?.focus()},oe=[f],t[37]=f,t[38]=ae,t[39]=oe),(0,Q.useLayoutEffect)(ae,oe);let se,ce;t[40]===f?(se=t[41],ce=t[42]):(se=()=>{f||YM(b.current)},ce=[f],t[40]=f,t[41]=se,t[42]=ce),(0,Q.useEffect)(se,ce);let le;if(t[43]!==c||t[44]!==h){let e;t[46]===c?e=t[47]:(e=(e,t)=>({id:e.id,label:e.title??c({id:`OVjNeX`,values:{0:t+1}})}),t[46]=c,t[47]=e),le=h.map(e),t[43]=c,t[44]=h,t[45]=le}else le=t[45];let ue=le,de=I||void 0,fe;t[48]===r?fe=t[49]:(fe=(0,Z.jsx)(Vw,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:d,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[48]=r,t[49]=fe);let pe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(Hw,{withHandle:!0,onPointerDown:()=>{L(!0),R.current=!0;let e=()=>{L(!1),R.current=!1,window.removeEventListener(`pointerup`,e),H.current=null};H.current=e,window.addEventListener(`pointerup`,e)}}),t[50]=pe):pe=t[50];let me;t[51]===l?me=t[52]:(me=Xl(l),t[51]=l,t[52]=me);let he;t[53]===me.background?he=t[54]:(he={backgroundColor:me.background},t[53]=me.background,t[54]=he);let ge=i?`${P}px`:0,_e;t[55]!==a||t[56]!==i?(_e=e=>{let t=e.asPercentage===0;p(t),R.current&&(t&&i?a(!1):!t&&!i&&a(!0),e.inPixels>0&&(F.current=e.inPixels,V(e.inPixels)))},t[55]=a,t[56]=i,t[57]=_e):_e=t[57];let ve=!I&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ye;t[58]===ve?ye=t[59]:(ye=vi(`flex flex-col`,ve),t[58]=ve,t[59]=ye);let be;t[60]!==v||t[61]!==n||t[62]!==j||t[63]!==h||t[64]!==ue?(be=h.length>0?(0,Z.jsx)(KM,{sessions:ue,activeSessionId:v,onSelect:y,onTabActivate:ZM,onNew:()=>E(null),onClose:j,className:`h-full`,children:h.map(e=>(0,Z.jsx)(OM,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(BM,{bridge:n,launch:e.launch,onTitleChange:t=>O(e.id,t),onClose:()=>j(e.id)})},e.id))}):null,t[60]=v,t[61]=n,t[62]=j,t[63]=h,t[64]=ue,t[65]=be):be=t[65];let xe;t[66]!==f||t[67]!==u||t[68]!==he||t[69]!==ge||t[70]!==_e||t[71]!==ye||t[72]!==be?(xe=(0,Z.jsx)(Vw,{id:qM,style:he,panelRef:u,defaultSize:ge,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:_e,inert:f,className:ye,children:be}),t[66]=f,t[67]=u,t[68]=he,t[69]=ge,t[70]=_e,t[71]=ye,t[72]=be,t[73]=xe):xe=t[73];let Se;return t[74]!==de||t[75]!==fe||t[76]!==xe?(Se=(0,Z.jsxs)(Bw,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":de,children:[fe,pe,xe]}),t[74]=de,t[75]=fe,t[76]=xe,t[77]=Se):Se=t[77],Se}function ZM(e){return queueMicrotask(()=>YM(e))}function QM(){return RM()}function $M(){}var eN=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BwvIOsCl.js`),__vite__mapDeps([46,1,2,47,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,61,62]),import.meta.url)).ActivityModeContent})),tN=`300px`,nN=`600px`;function rN(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(aN,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(iN,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(C,{name:`editor-area`,children:(0,Z.jsxs)(Pa,{children:[n,r]})}),t[3]=n,t[4]=i),i}function iN(){let e=(0,$.c)(5),t=Zi(),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)(Fw,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function aN(e){let t=(0,$.c)(187),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalLaunch:l}=e,u=s===void 0?!1:s,d=l===void 0?null:l,{_:f}=sn(),{activeDocName:p,activeProvider:m,activeTarget:h,recycleDocument:g,docPanelMode:_,docPanelAgentId:v,docPanelExpandSignal:y}=ht(),{openDocumentTransition:b}=kt(),{requestAddProperty:x}=ja(),S=uT(m,p),C=pT(p,n===`source`?`source`:`wysiwyg`),w=NT(m),T=w===`connected`||w===`synced`,E=fT(p)===`conflict`,[D,O]=(0,Q.useState)(!1),k,A;t[0]!==m||t[1]!==D?(k=()=>{m!=null&&!D&&O(!0)},A=[m,D],t[0]=m,t[1]=D,t[2]=k,t[3]=A):(k=t[2],A=t[3]),(0,Q.useEffect)(k,A);let j=(0,Q.useDeferredValue)(p),M=h?.kind===`missing`,N=!!p&&h?.kind!==`folder`,P;t[4]!==f||t[5]!==M?(P=M?f({id:`K-a33w`}):void 0,t[4]=f,t[5]=M,t[6]=P):P=t[6];let F=P,[L]=(0,Q.useState)(lN),R=L!==null,[z]=(0,Q.useState)(cN),B;t[7]===L?B=t[8]:(B=()=>ST(L,window.innerWidth,`right`),t[7]=L,t[8]=B);let[V,H]=(0,Q.useState)(B),U=(0,Q.useRef)(V),W,G;t[9]===V?(W=t[10],G=t[11]):(W=()=>{U.current=V},G=[V],t[9]=V,t[10]=W,t[11]=G),(0,Q.useEffect)(W,G);let K=kx(),q;t[12]===V?q=t[13]:(q=()=>jT(`right`,V,kT())===`collapsed`,t[12]=V,t[13]=q);let[J]=(0,Q.useState)(q),[Y,ee]=(0,Q.useState)(J),te=(0,Q.useRef)(Y),ne,re;t[14]===Y?(ne=t[15],re=t[16]):(ne=()=>{te.current=Y},re=[Y],t[14]=Y,t[15]=ne,t[16]=re),(0,Q.useEffect)(ne,re);let[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(!1),[se]=(0,Q.useState)(sN),ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){le.current!=null&&clearTimeout(le.current),le.current=setTimeout(()=>{_T(e),le.current=null},100)},t[17]=ue):ue=t[17];let de=ue,fe,pe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>()=>{le.current!=null&&clearTimeout(le.current)},pe=[],t[18]=fe,t[19]=pe):(fe=t[18],pe=t[19]),(0,Q.useEffect)(fe,pe);let[me,he]=(0,Q.useState)(null),ge;t[20]!==Y||t[21]!==K?(ge=function(){if(K.current==null)return;let e=U.current;Y?(MT(`right`,e,`open`),K.current?.expand()):(MT(`right`,e,`collapsed`),K.current?.collapse())},t[20]=Y,t[21]=K,t[22]=ge):ge=t[22];let _e=ge,ve,ye;t[23]!==L||t[24]!==K?(ve=()=>{let e=window.matchMedia(`(min-width: ${bT}px)`),t=()=>{let e=ST(L,window.innerWidth,`right`);H(e);let t=jT(`right`,e,kT())===`collapsed`;ee(t),t?K.current?.collapse():K.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ye=[L,K],t[23]=L,t[24]=K,t[25]=ve,t[26]=ye):(ve=t[25],ye=t[26]),(0,Q.useEffect)(ve,ye);let be,xe;t[27]!==me||t[28]!==R||t[29]!==K?(be=()=>{if(me==null||R)return;let e=new ResizeObserver(()=>{te.current||oe.current||K.current?.resize(`${ce.current}px`)});return e.observe(me),()=>e.disconnect()},xe=[me,R,K],t[27]=me,t[28]=R,t[29]=K,t[30]=be,t[31]=xe):(be=t[30],xe=t[31]),(0,Q.useEffect)(be,xe);let Se,Ce;t[32]!==a||t[33]!==K?(Se=()=>{let e=e=>{a(e),K.current?.expand()},t=Vg();return t&&e(t),Ug(t=>{Vg(),e(t)})},Ce=[a,K],t[32]=a,t[33]=K,t[34]=Se,t[35]=Ce):(Se=t[34],Ce=t[35]),(0,Q.useEffect)(Se,Ce);let we,Te;t[36]!==y||t[37]!==K?(we=()=>{y!==0&&K.current?.expand()},Te=[y,K],t[36]=y,t[37]=K,t[38]=we,t[39]=Te):(we=t[38],Te=t[39]),(0,Q.useEffect)(we,Te);let Ee,De;t[40]===Y?(Ee=t[41],De=t[42]):(Ee=()=>{if(!Y||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},De=[Y],t[40]=Y,t[41]=Ee,t[42]=De),(0,Q.useLayoutEffect)(Ee,De);let Oe,ke;t[43]===Y?(Oe=t[44],ke=t[45]):(Oe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Y})},ke=[Y],t[43]=Y,t[44]=Oe,t[45]=ke),(0,Q.useEffect)(Oe,ke);let Ae,je;t[46]===_e?(Ae=t[47],je=t[48]):(Ae=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&_e()})},je=[_e],t[46]=_e,t[47]=Ae,t[48]=je),(0,Q.useEffect)(Ae,je);let Me,Pe;t[49]===_e?(Me=t[50],Pe=t[51]):(Me=()=>{if(window.okDesktop!=null)return;let e=e=>{ll(e,`toggle-document-panel`)&&(e.preventDefault(),_e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Pe=[_e],t[49]=_e,t[50]=Me,t[51]=Pe),(0,Q.useEffect)(Me,Pe);let Fe=(0,Q.useRef)(null),[Ie,Le]=(0,Q.useState)(null),[Re,ze]=(0,Q.useState)(!1),Be=h?.kind===`large-file`?h.docName:p,Ve,He;t[52]===Be?(Ve=t[53],He=t[54]):(Ve=()=>{if(Be&&Be!==Fe.current){let e=Fe.current;Fe.current=Be,Le(e)}},He=[Be],t[52]=Be,t[53]=Ve,t[54]=He),(0,Q.useEffect)(Ve,He);let Ue;t[55]===b?Ue=t[56]:(Ue=function(e){let t=ao(e);window.location.hash===t?b(e):window.location.hash=t},t[55]=b,t[56]=Ue);let We=Ue,Ge,Ke=null;if(h?.kind===`large-file`){let e;t[57]!==We||t[58]!==Ie?(e=Ie?{previousDocName:Ie,onNavigateBack:We}:void 0,t[57]=We,t[58]=Ie,t[59]=e):e=t[59];let n;t[60]!==h.docName||t[61]!==h.limit||t[62]!==h.size||t[63]!==e?(n=(0,Z.jsx)(vw,{docName:h.docName,size:h.size,limit:h.limit,backNav:e}),t[60]=h.docName,t[61]=h.limit,t[62]=h.size,t[63]=e,t[64]=n):n=t[64],Ge=n}else if(h?.kind===`folder`){let e;t[65]!==z||t[66]!==R||t[67]!==u?(e=iE({terminalVisible:u,isEmbedded:R,isDesktop:z}),t[65]=z,t[66]=R,t[67]=u,t[68]=e):e=t[68];let n=e,r;t[69]===h.folderPath?r=t[70]:(r=(0,Z.jsx)(mw,{folderPath:h.folderPath}),t[69]=h.folderPath,t[70]=r);let i;t[71]!==h.folderPath||t[72]!==n?(i=n?(0,Z.jsx)(KT,{folderPath:h.folderPath}):null,t[71]=h.folderPath,t[72]=n,t[73]=i):i=t[73];let a;if(t[74]!==r||t[75]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[74]=r,t[75]=i,t[76]=a):a=t[76],Ge=a,_===`agent`&&v!==null){let e;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Hw,{withHandle:!0}),t[77]=e):e=t[77];let n;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(Vw,{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)(X,{id:`ONPvOb`})}),children:(0,Z.jsx)(eN,{showBackButton:!1})})})]}),t[78]=n):n=t[78],Ke=n}}else if(h?.kind===`asset`){let e;t[79]!==h.assetPath||t[80]!==h.mediaKind?(e=(0,Z.jsx)(Wx,{assetPath:h.assetPath,mediaKind:h.mediaKind},h.assetPath),t[79]=h.assetPath,t[80]=h.mediaKind,t[81]=e):e=t[81],Ge=e}else if(h?.kind===`skill-file`){let e=`${h.scope}/${h.name}/${h.path}`,n;t[82]!==h.name||t[83]!==h.path||t[84]!==h.scope||t[85]!==e?(n=(0,Z.jsx)(Ew,{scope:h.scope,name:h.name,path:h.path},e),t[82]=h.name,t[83]=h.path,t[84]=h.scope,t[85]=e,t[86]=n):n=t[86],Ge=n}else if(!m||!p)if((typeof window<`u`?wo(window.location.hash):null)!==null)if(o!=null&&D){let e;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Gx,{}),t[87]=e):e=t[87],Ge=e;let n;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Hw,{withHandle:!0,disabled:!0}),t[88]=n):n=t[88];let r=J?0:`${se}px`,i;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[89]=i):i=t[89];let a;t[90]===r?a=t[91]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(Vw,{id:`doc-panel`,defaultSize:r,minSize:tN,maxSize:nN,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[90]=r,t[91]=a),Ke=a}else{let e;return t[92]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Gx,{}),t[92]=e):e=t[92],e}else{let e;t[93]===u?e=t[94]:(e=(0,Z.jsx)(NC,{terminalVisible:u}),t[93]=u,t[94]=e),Ge=e}else{let e=n===`source`,o=!T,s=Y,c;t[95]!==p||t[96]!==x?(c=function(){p&&x(p)},t[95]=p,t[96]=x,t[97]=c):c=t[97];let l=c,d;t[98]!==p||t[99]!==z||t[100]!==R||t[101]!==u?(d=rE({terminalVisible:u,isEmbedded:R,isDesktop:z,activeDocName:p}),t[98]=p,t[99]=z,t[100]=R,t[101]=u,t[102]=d):d=t[102];let f=d,m=j??p,h=Ie??void 0,v;t[103]!==F||t[104]!==e||t[105]!==We||t[106]!==g||t[107]!==m||t[108]!==h?(v=(0,Z.jsx)(rj,{activeDocName:m,isSourceMode:e,editorPlaceholder:F,previousDocName:h,onNavigateBack:We,onRecycle:g}),t[103]=F,t[104]=e,t[105]=We,t[106]=g,t[107]=m,t[108]=h,t[109]=v):v=t[109];let y;t[110]!==p||t[111]!==e?(y=(0,Z.jsx)(oT,{activeDocName:p,isSourceMode:e}),t[110]=p,t[111]=e,t[112]=y):y=t[112];let b;t[113]!==p||t[114]!==j?(b=CM({activeDocName:p,deferredActiveDocName:j,mountResolved:p!==null&&I(p),syncResolved:p!==null&&Ne(p)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Gx,{}),p===null?null:(0,Z.jsx)(yw,{docName:p})]}):null,t[113]=p,t[114]=j,t[115]=b):b=t[115];let w;t[116]!==v||t[117]!==y||t[118]!==b?(w=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[v,y,b]}),t[116]=v,t[117]=y,t[118]=b,t[119]=w):w=t[119];let D;t[120]!==p||t[121]!==E||t[122]!==s||t[123]!==e||t[124]!==r||t[125]!==l||t[126]!==o||t[127]!==_e?(D=!E&&(0,Z.jsx)(SM,{activeDocName:p,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:_e}),t[120]=p,t[121]=E,t[122]=s,t[123]=e,t[124]=r,t[125]=l,t[126]=o,t[127]=_e,t[128]=D):D=t[128];let O;t[129]!==p||t[130]!==Re||t[131]!==e||t[132]!==f?(O=f?(0,Z.jsx)(KT,{docName:p,surface:e?`source`:`wysiwyg`,dismissed:Re,onDismiss:()=>ze(!0),onReopen:()=>ze(!1)}):null,t[129]=p,t[130]=Re,t[131]=e,t[132]=f,t[133]=O):O=t[133];let k;t[134]!==w||t[135]!==D||t[136]!==O?(k=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[w,D,O]}),t[134]=w,t[135]=D,t[136]=O,t[137]=k):k=t[137];let A;t[138]!==Re||t[139]!==f?(A=f&&Re?{onReopen:()=>ze(!1)}:null,t[138]=Re,t[139]=f,t[140]=A):A=t[140];let M;t[141]!==C||t[142]!==N||t[143]!==S||t[144]!==A?(M=(0,Z.jsx)(iM,{stats:S,selectionStats:C,showStats:N,composerBadge:A}),t[141]=C,t[142]=N,t[143]=S,t[144]=A,t[145]=M):M=t[145];let P;t[146]!==k||t[147]!==M?(P=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[k,M]}),t[146]=k,t[147]=M,t[148]=P):P=t[148],Ge=P;let L=R&&Y,B;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{ae(!0),oe.current=!0;let e=()=>{ae(!1),oe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[149]=B):B=t[149];let V;t[150]===L?V=t[151]:(V=(0,Z.jsx)(Hw,{withHandle:!0,disabled:L,onPointerDown:B}),t[150]=L,t[151]=V);let H=J?0:`${se}px`,U;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{ee(e.asPercentage===0),e.inPixels>0&&oe.current&&(ce.current=e.inPixels,de(e.inPixels))},t[152]=U):U=t[152];let W=!ie&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[153]===W?G=t[154]:(G=vi(`flex flex-col bg-muted/20`,W),t[153]=W,t[154]=G);let q;t[155]!==p||t[156]!==i||t[157]!==_||t[158]!==e||t[159]!==a?(q=(0,Z.jsx)(Fy,{docName:p,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:_}),t[155]=p,t[156]=i,t[157]=_,t[158]=e,t[159]=a,t[160]=q):q=t[160];let te;t[161]!==Y||t[162]!==K||t[163]!==H||t[164]!==G||t[165]!==q?(te=(0,Z.jsx)(Vw,{id:`doc-panel`,panelRef:K,defaultSize:H,minSize:tN,maxSize:nN,collapsible:!0,collapsedSize:0,onResize:U,inert:Y,className:G,children:q}),t[161]=Y,t[162]=K,t[163]=H,t[164]=G,t[165]=q,t[166]=te):te=t[166];let ne;t[167]!==V||t[168]!==te?(ne=(0,Z.jsxs)(Z.Fragment,{children:[V,te]}),t[167]=V,t[168]=te,t[169]=ne):ne=t[169],Ke=ne}let qe;t[170]!==c||t[171]!==o||t[172]!==d||t[173]!==u||t[174]!==Ge?(qe=o==null?Ge:(0,Z.jsx)(XM,{bridge:o,visible:u,onVisibleChange:c??oN,launch:d,children:Ge}),t[170]=c,t[171]=o,t[172]=d,t[173]=u,t[174]=Ge,t[175]=qe):qe=t[175];let Je=qe,Ye=ie||void 0,Xe;t[176]!==J||t[177]!==Ke?(Xe=Ke!=null&&!J?{}:{defaultSize:`100%`},t[176]=J,t[177]=Ke,t[178]=Xe):Xe=t[178];let Ze=ie?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Qe;t[179]!==Je||t[180]!==Xe||t[181]!==Ze?(Qe=(0,Z.jsx)(Vw,{minSize:`30%`,...Xe,className:Ze,children:Je}),t[179]=Je,t[180]=Xe,t[181]=Ze,t[182]=Qe):Qe=t[182];let $e;return t[183]!==Ke||t[184]!==Ye||t[185]!==Qe?($e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:he,children:(0,Z.jsxs)(Bw,{orientation:`horizontal`,"data-dragging":Ye,children:[Qe,Ke]})}),t[183]=Ke,t[184]=Ye,t[185]=Qe,t[186]=$e):$e=t[186],$e}function oN(){}function sN(){return vT()}function cN(){return typeof window<`u`&&window.okDesktop!=null}function lN(){return Ar()}function uN(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 dN(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 fN=1e3,pN=!1;function mN(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function hN(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:Ai(i)?a=i:(a=void 0,pN||(pN=!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`&&(mN({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=dN(i),{current:c,crossDoc:l}=a?Ei(a,n,Date.now()):{current:[],crossDoc:[]},u=gN,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>uN(e.current,p)&&uN(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,fN);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function gN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var _N=`sync-status`;function vN(e,t){let n=(0,$.c)(6),{_:r}=sn(),i=Ch(),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){Fs.dismiss(_N);return}o.current=!0,Fs.warning(r({id:`HGNCsl`}),{id:_N,duration:1/0})}else o.current&&e===`synced`&&(o.current=!1,Fs.success(r({id:`GhjUB_`}),{id:_N,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 yN=4,bN=3,xN={Bird:mu,Cat:xu,Dog:Ou,Fish:Pu,Mouse:cd,Rabbit:sd,Shrimp:md,Snail:hd,Squirrel:vd,Turtle:Dd};Object.freeze(Object.keys(xN));function SN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(xN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var CN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function wN(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=sn(),o=SN(n),s=o.kind===`animal`?xN[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=qr(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=di(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)(ec,{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)(tc,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(rc,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function TN(e){let t=CN[e.icon];return e.displayName||t||Gs._({id:`iEQQyu`})}function EN(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 DN(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=sn(),{activeDocName:s}=ht(),{presence:c,agentId:l}=n,u=TN(c),d=EN(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)(Oi,{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)(Oi,{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)(ec,{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)(X,{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)(tc,{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)(rc,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function ON(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?Gs._({id:`9euN0m`,values:{count:n}}):Gs._({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)(G,{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)(wN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(DN,{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)(_e,{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)(he,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function kN(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(wN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(DN,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function AN(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ht(),{current:s,crossDoc:c}=hN(t,r,n);if(vN(NT(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,yN),n;e[6]===s?n=e[7]:(n=s.slice(yN),e[6]=s,e[7]=n);let r=n,u=c.slice(0,bN),d;e[8]===c?d=e[9]:(d=c.slice(bN),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=>kN(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)(ON,{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=>kN(e,p,!0,m)),f.length>0?(0,Z.jsx)(ON,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var jN=`.md`,MN=/\.(md|mdx)$/i;function NN(e,t=jN){return`${e}${t}`}function PN(e){return sP(e).replace(MN,``)}function FN(e){return Eo(e)?RN(e.path):lo(e)?e.path:NN(e.docName,e.docExt)}function IN(e){let t=sP(e).match(MN);return t?`.${t[1].toLowerCase()}`:void 0}function LN(e){return sP(e)}function RN(e){let t=sP(e.trim());return t?`${t}/`:``}function zN(e){return e.endsWith(`/`)?LN(e):PN(e)}function BN(e){return e.map(FN)}function VN(e){return[...e].sort().join(`\0`)}function HN(e){return VN(BN(e))}function UN(e){let t=new Set;for(let n of e){let e=(Eo(n)||lo(n)?n.path:n.docName).split(`/`).filter(Boolean);if(e.includes(`.ok`))continue;if(Eo(n)){let e=RN(n.path);e&&t.add(e)}let r=Eo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function WN(e){if(!e)return[];let t=sP(e.replace(MN,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function GN(e,t,n){let r=IN(e);if(r)return r;let i=n.find(e=>Co(e)&&e.docName===t);return i?i.docExt??jN:oP(e).includes(`.`)?void 0:jN}function KN(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!lo(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function qN(e,t,n){if(IN(e))return null;let r=n.find(e=>lo(e)&&e.path===t);return r?r.path:oP(e).includes(`.`)?t:KN(t,n)}function JN(e,t){let n=e.kind===`directory`,r=n?LN(e.path):PN(e.path);if(n)return{kind:`folder`,name:sP(oP(e.path)).replace(MN,``),path:r,treePath:XN(e.path,!0)};let i=qN(e.path,r,t);if(i)return{kind:`asset`,name:sP(oP(i)),path:i,treePath:i};let a=GN(e.path,r,t);return{kind:`file`,name:sP(oP(e.path)).replace(MN,``),path:r,treePath:XN(e.path,!1),docExt:a}}function YN(e){return e.kind===`directory`?LN(e.path):e.path}function XN(e,t){return t?RN(e):MN.test(e)?e:`${e}${jN}`}function ZN(e,t,n){let r=RN(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${jN}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function QN(e,t){return e===`file`?XN(t,!1):`${LN(t)}/index${jN}`}function $N(e,t){return t.kind===`root`||t.directoryPath==null?oP(e):`${t.directoryPath}${oP(e)}`}function eP(e,t){if(t)return LN(RN(e));let n=PN(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function tP(e,t){let n=LN(RN(e));return n?`${n}/${t}`:t}function nP(e,t){return(t.path??tP(e,t.src)).replace(/^\/+/,``)}function rP(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function iP(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function aP(e,t){let n=Ct(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:PN(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:Fr(i),modified:r,size:t.size}}function oP(e){let t=sP(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function sP(e){return e.endsWith(`/`)?e.slice(0,-1):e}function cP(e,t){return t.trim()}function lP(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function uP(e,t){let n=cP(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function dP(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(Co(e)){let t=s.get(NN(e.docName,e.docExt));if(t){let n=fo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Fr(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(Eo(e))return{...e,path:vP(e.path,n)};if(lo(e)){let t=s.get(e.path);return t&&ft(t)?{kind:`document`,docName:PN(t),docExt:Ct(t),size:e.size,modified:e.modified}:{...e,path:t??vP(e.path,n)}}return e})}function fP(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=>Co(e)?!i.has(e.docName)&&!SP(e.docName,n):Eo(e)?!SP(e.path,n):lo(e)?!a.has(e.path)&&!SP(e.path,n):!0)}function pP(e,t){if(e.kind!==`asset`||t.some(t=>lo(t)&&t.path===e.path))return e;let n=KN(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function mP(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>yP(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Co(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=>Eo(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(Co(i)){let e=xP(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Eo(i)){let e=bP(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function hP(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function gP(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function _P(e,t){let n=e.kind===`file`?NN(e.path,e.docExt):e.path;return Ao(t.contentDir,n,t.pathSeparator)}function vP(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 yP(e,t){return Co(e)&&Co(t)?e.docName===t.docName:Eo(e)&&Eo(t)||lo(e)&&lo(t)?e.path===t.path:!1}function bP(e,t,n){return e===t?n:xP(e,t,n)}function xP(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function SP(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function CP(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)(kf,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function wP(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=vi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Af,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TP(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)(Nf,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function EP(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)(zf,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function DP(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=vi(`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)(jf,{children:(0,Z.jsx)(Mf,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function OP(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=vi(`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)(Ff,{"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 kP(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=vi(`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)(Xa,{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)(Bf,{"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 AP(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=vi(`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)(Vf,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jP(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=vi(`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)(Lf,{children:(0,Z.jsx)(Va,{})})}),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)(If,{"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 MP(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=vi(`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)(Pf,{"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 NP(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=vi(`-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)(Rf,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var PP=`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`,FP=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,IP={start:[xs.Space],cancel:[xs.Esc],end:[xs.Space,xs.Enter]};function LP(e){return vi(PP,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function RP(e){return e?void 0:-1}function zP({className:e,isDragging:t}){return vi(e,t&&FP)}function BP(e){return e.code===xs.Enter&&e.target===e.currentTarget}function VP({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&BP(e)?`activate-tab`:`delegate-sortable`}function HP({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Es.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 UP(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 WP(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 GP=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 hs(e)},KP=[`.md`,`.mdx`],qP=`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`,JP=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,YP=vi(JP,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),XP=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function ZP(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function QP(e){let t=ao(e);window.location.hash!==t&&(window.location.hash=t)}function $P(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function eF(e,t){let n=[t,...KP].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 tF(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:_}=ws(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=HP({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=VP({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=zP({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 nF(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=nn(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?(_=nn(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)(wP,{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)(X,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(OP,{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)(X,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(OP,{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)(X,{id:`U2Kx6T`}):(0,Z.jsx)(X,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(OP,{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)(NP,{}),(0,Z.jsx)(OP,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(X,{id:`SYfHmN`}):(0,Z.jsx)(X,{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)(DP,{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)(CP,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function rF(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:i,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=sn();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(od,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(bi,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]===i?u=t[14]:(u=LP(i),t[13]=i,t[14]=u);let d;t[15]===i?d=t[16]:(d=RP(i),t[15]=i,t[16]=d);let f;t[17]!==r||t[18]!==o?(f=e=>{e.stopPropagation(),r(o)},t[17]=r,t[18]=o,t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Is,{"aria-hidden":`true`}),t[20]=p):p=t[20];let m;return t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f?(m=(0,Z.jsx)(bi,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:u,tabIndex:d,onClick:f,children:p}),t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=m):m=t[25],m}function iF(e){let t=(0,$.c)(1),{docName:n}=e;if(fT(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(oo,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function aF(){let e=(0,$.c)(80),{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:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=ht(),{_:w}=sn(),{pageMeta:T}=go(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(t),U;e[0]!==n||e[1]!==t||e[2]!==i?(U=n??(i?m(i):t?qt(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=U):U=e[3];let W=U,G;e[4]!==r||e[5]!==W||e[6]!==p||e[7]!==h||e[8]!==_?(G=p?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:W?`${W}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=W,e[6]=p,e[7]=h,e[8]=_,e[9]=G):G=e[9];let q=G,J,Y;e[10]===t?(J=e[11],Y=e[12]):(J=()=>{V.current=t},Y=[t],e[10]=t,e[11]=J,e[12]=Y),(0,Q.useEffect)(J,Y);let ee,te;e[13]===q?(ee=e[14],te=e[15]):(ee=()=>{q&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},te=[q],e[13]=q,e[14]=ee,e[15]=te),(0,Q.useEffect)(ee,te);let ne,re;e[16]===k?(ne=e[17],re=e[18]):(ne=()=>{k&&(L.current?.focus(),L.current?.select())},re=[k],e[16]=k,e[17]=ne,e[18]=re),(0,Q.useEffect)(ne,re);let ie,ae;e[19]!==_||e[20]!==k?(ie=()=>{!k||_.includes(k.tabId)||(z.current=!0,B.current=null,A(null),M(``),P(null),I(!1))},ae=[_,k],e[19]=_,e[20]=k,e[21]=ie,e[22]=ae):(ie=e[21],ae=e[22]),(0,Q.useEffect)(ie,ae);let oe=function(e,t){let n=t.split(`/`);z.current=!1,B.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),P(null)},se=function(){z.current=!0,B.current=null,A(null),M(``),P(null),I(!1)},ce=async function(){if(z.current){z.current=!1;return}if(R.current)return;let e=k?.docName;if(!e){se();return}let t=cP(`file`,eF(j,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===B.current){L.current?.focus();return}if(!lP(t)){P(w({id:`P8yDjG`})),L.current?.focus();return}let i=uP({kind:`file`,path:e,name:r},t);R.current=!0,I(!0),P(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(z.current){I(!1),R.current=!1;return}let r=await ve(n,`Server error (HTTP ${n.status})`);if(!r.ok){P(r.title),I(!1),R.current=!1,B.current=t,L.current?.focus();return}let a=K(Jr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=V.current,c=hP(o,a);H(a);let l=!0;try{let e=gP(a,d(),f);await Promise.all(e.map(e=>s(e))),b(a),Vs([`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}),Fs.error(w({id:`MUBR8r`}))}z.current=!0,A(null),M(``),P(null),I(!1),R.current=!1,B.current=null,l&&c&&c!==o&&QP(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),P(w({id:`HIb0vl`})),I(!1),R.current=!1,B.current=t,L.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===h?ue=e[24]:(ue=new Set(h),e[23]=h,e[24]=ue);let de=ue,fe;e[25]===D?fe=e[26]:(fe=WP(D),e[25]=D,e[26]=fe);let pe;e[27]===fe?pe=e[28]:(pe=[fe],e[27]=fe,e[28]=pe);let me=pe,he;e[29]!==c||e[30]!==u||e[31]!==de?(he=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&u(t);for(let e of n)c(e)},e[29]=c,e[30]=u,e[31]=de,e[32]=he):he=e[32];let ge=he,_e;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(_e={activationConstraint:{distance:8}},e[33]=_e):_e=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:vs,keyboardCodes:IP},e[34]=ye):ye=e[34];let be=Ts(fs(gs,_e),fs(ys,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){O(UP(E.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){O(null)},e[36]=Ce):Ce=e[36];let Te=Ce,Ee;e[37]!==Te||e[38]!==x||e[39]!==C?(Ee=function(e){Te();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=C.indexOf(t),i=C.indexOf(n);r<0||i<0||r===i||x(Ss([...C],r,i),t)},e[37]=Te,e[38]=x,e[39]=C,e[40]=Ee):Ee=e[40];let De=Ee,Oe=le?``:void 0,ke;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(ke=vi(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,le&&`[-webkit-app-region:drag]`),e[41]=ke):ke=e[41];let Ae=$P,je;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(je=vi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[42]=je):je=e[42];let Me=ms,Ne=GP,Pe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Pe={container:typeof document<`u`?document.body:void 0},e[43]=Pe):Pe=e[43];let Fe=bs,Ie;e[44]===C?Ie=e[45]:(Ie=[...C],e[44]=C,e[45]=Ie);let Le=ps,Re=C.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(nF,{tabId:e,canPin:!1,openTabs:C,closeTab:c,closeTabs:ge,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(tF,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:vi(qP,t?JP: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":w({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:XP,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(X,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:LP(t),tabIndex:RP(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(Is,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=Qt(e),n=e===W,i=y.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=Xt(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(nF,{tabId:e,openTabs:C,closeTab:l,closeTabs:ge,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(tF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:vi(qP,n?JP:YP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:XP,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:vi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:vi(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(rF,{accessibleLabel:c,closeTab:l,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}if(t.kind===`asset`||t.kind===`skill-file`){let{baseName:r,label:o,prefix:s}=Xt(t.kind===`asset`?t.assetPath:t.path,``),c=`${s}${o}`;return(0,Z.jsx)(nF,{tabId:e,openTabs:C,closeTab:l,closeTabs:ge,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(tF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:vi(qP,n?JP:YP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:XP,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:vi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:vi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(rF,{accessibleLabel:c,closeTab:l,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}let s=t.docName,u=T.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=Xt(s,u),h=`${m}${p}`,g=u===`.md`||u===`.mdx`,_=k?.tabId===e,b=`editor-tab-rename-error-${ZP(s)}`;return(0,Z.jsx)(nF,{disabled:_,tabId:e,openTabs:C,closeTab:l,closeTabs:ge,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsx)(tF,{tabId:e,activateFromKeyboard:()=>a(e),disabled:_,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:vi(qP,n?JP:YP,_&&N&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Uw,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(Jw,{ref:L,value:j,disabled:F,"aria-label":w({id:`Dw1T_W`,values:{label:p}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?b:void 0,"aria-busy":F||void 0,title:N??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{M(eF(e.target.value,u)),P(null),B.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(Gw,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(qw,{className:`text-muted-foreground/60 text-xs`,children:u})})]}),N?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":h,title:h,className:XP,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,s)},tabIndex:-1,children:[(0,Z.jsx)(iF,{docName:s}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(rF,{accessibleLabel:h,closeTab:l,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})})},e)}),ze;e[46]!==Fe||e[47]!==Ie||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Fe,{items:Ie,strategy:Le,children:Re}),e[46]=Fe,e[47]=Ie,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==Me||e[52]!==Te||e[53]!==De||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Ne||e[58]!==Pe||e[59]!==ze||e[60]!==me?(Be=(0,Z.jsx)(Me,{sensors:be,autoScroll:!1,collisionDetection:Ne,modifiers:me,onDragStart:Se,onDragEnd:De,onDragCancel:Te,accessibility:Pe,children:ze}),e[51]=Me,e[52]=Te,e[53]=De,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Ne,e[58]=Pe,e[59]=ze,e[60]=me,e[61]=Be):Be=e[61];let Ve;e[62]===w?Ve=e[63]:(Ve=w({id:`3YvS-c`}),e[62]=w,e[63]=Ve);let He;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(we,{"aria-hidden":`true`}),e[64]=He):He=e[64];let Ue;e[65]!==g||e[66]!==Ve?(Ue=(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:He})}),e[65]=g,e[66]=Ve,e[67]=Ue):Ue=e[67];let We;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(tc,{children:(0,Z.jsx)(X,{id:`3YvS-c`})}),e[68]=We):We=e[68];let Ge;e[69]===Ue?Ge=e[70]:(Ge=(0,Z.jsxs)(rc,{children:[Ue,We]}),e[69]=Ue,e[70]=Ge);let Ke;e[71]!==je||e[72]!==Be||e[73]!==Ge?(Ke=(0,Z.jsxs)(`div`,{className:je,children:[Be,Ge]}),e[71]=je,e[72]=Be,e[73]=Ge,e[74]=Ke):Ke=e[74];let qe;return e[75]!==Oe||e[76]!==ke||e[77]!==Ae||e[78]!==Ke?(qe=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":Oe,className:ke,onWheel:Ae,children:Ke}),e[75]=Oe,e[76]=ke,e[77]=Ae,e[78]=Ke,e[79]=qe):qe=e[79],qe}function oF(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 sF(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 cF=[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:l},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:zp},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:oF},{label:`X`,href:`https://x.com/OpenKnowledgeAI`,icon:sF},{label:`OpenKnowledge`,href:`https://openknowledge.ai/`,icon:Bp,iconClassName:`scale-125 grayscale transition-[filter] group-hover:grayscale-0`}],lF=()=>{let e=(0,$.c)(16),{_:t}=sn(),[n,r]=(0,Q.useState)(!1),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(v,{className:`size-4`}),e[0]=i):i=e[0];let a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(G,{asChild:!0,children:(0,Z.jsxs)(bi,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[i,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`s-MGs7`})})]})})}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(rc,{children:[a,(0,Z.jsx)(tc,{children:(0,Z.jsx)(X,{id:`s-MGs7`})})]}),e[2]=o):o=e[2];let s;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(X,{id:`s-MGs7`})}),e[3]=s):s=e[3];let c;e[4]===t?c=e[5]:(c=t({id:`s-MGs7`}),e[4]=t,e[5]=c);let l;e[6]===t?l=e[7]:(l=cF.map(e=>{let{label:n,href:r,icon:i,iconClassName:a}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Ks(e,r),onAuxClick:e=>Ks(e,r),className:`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:vi(`size-4 shrink-0`,a)}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=l);let u;e[8]===l?u=e[9]:(u=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:l}),e[8]=l,e[9]=u);let d;e[10]!==c||e[11]!==u?(d=(0,Z.jsxs)(_e,{align:`end`,className:`w-48 p-3`,children:[s,(0,Z.jsx)(`nav`,{"aria-label":c,children:u})]}),e[10]=c,e[11]=u,e[12]=d):d=e[12];let f;return e[13]!==n||e[14]!==d?(f=(0,Z.jsxs)(he,{open:n,onOpenChange:r,children:[o,d]}),e[13]=n,e[14]=d,e[15]=f):f=e[15],f},uF=50,dF=()=>{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,Ow.preload()},uF))},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=Ri)},l=(0,Z.jsx)(fd,{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)(ec,{asChild:!0,children:(0,Z.jsxs)(bi,{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)(X,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(rc,{children:[u,(0,Z.jsx)(tc,{children:(0,Z.jsx)(X,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},fF=`https://openknowledge.ai/docs/features/share`;function pF(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:i}=sn(),{status:a}=Xi(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(h=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Ji({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:Ko,toastSuccess:xF,toastError:bF,logEvent:yF});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0})}catch{Fs.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=h):h=t[9];let g=h,_=c!==null,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)(pd,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(X,{id:`Z8lGw6`}),t[14]=S,t[15]=C):(S=t[14],C=t[15]);let w;t[16]!==g||t[17]!==b||t[18]!==x?(w=(0,Z.jsx)(pe,{asChild:!0,children:(0,Z.jsxs)(bi,{variant:`ghost`,size:`sm`,"aria-label":b,onClick:g,disabled:x,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})}),t[16]=g,t[17]=b,t[18]=x,t[19]=w):w=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(X,{id:`Z8lGw6`})}),t[20]=T):T=t[20];let E;t[21]===c?.autoCopyFailed?E=t[22]:(E=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(X,{id:`ndeI89`})}):null,t[21]=c?.autoCopyFailed,t[22]=E);let D=c?.url??``,O;t[23]===i?O=t[24]:(O=i({id:`5-FeN2`}),t[23]=i,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsx)(el,{ref:u,readOnly:!0,value:D,onFocus:vF,onClick:_F,onContextMenu:gF,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":O}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A=c?.url??``,j=c?.autoCopyFailed===!1,M;t[28]!==A||t[29]!==j?(M=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(B,{copyContent:A,clipboardWrite:Ko,initialCopied:j})})}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(`div`,{className:`relative`,children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33];let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(`a`,{href:fF,target:`_blank`,rel:`noopener noreferrer`,onClick:hF,onAuxClick:mF,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)(v,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(X,{id:`aByJ8j`})]}),t[34]=P):P=t[34];let F;t[35]!==E||t[36]!==N?(F=(0,Z.jsxs)(_e,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[T,E,N,P]}),t[35]=E,t[36]=N,t[37]=F):F=t[37];let I;return t[38]!==w||t[39]!==F||t[40]!==_?(I=(0,Z.jsxs)(he,{open:_,onOpenChange:y,children:[w,F]}),t[38]=w,t[39]=F,t[40]=_,t[41]=I):I=t[41],I}function mF(e){return Ks(e,fF)}function hF(e){return Ks(e,fF)}function gF(e){return e.currentTarget.select()}function _F(e){return e.currentTarget.select()}function vF(e){return e.currentTarget.select()}function yF(e){return console.log(e)}function bF(e){e!==`Link ready but could not copy to clipboard.`&&Fs.error(e)}function xF(e){return Fs.success(e)}function SF(e){let t=(0,$.c)(34),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=sn(),{activeDocName:o,activeTarget:s}=ht(),c=o?Lr(o):null,{state:l,isDraggingRail:u}=Oj(),d=N_(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=cl(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=cl(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=wa(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=Pi(o),t[3]=o,t[4]=e),_=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[5]!==S||t[6]!==C?(w=vi(`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[5]=S,t[6]=C,t[7]=w):w=t[7];let T=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(rc,{children:[(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(Nj,{className:vi(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(tc,{children:l===`expanded`?(0,Z.jsx)(X,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(X,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(rc,{children:[(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:vi(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(jt,{"aria-hidden":`true`})})}),(0,Z.jsx)(tc,{children:(0,Z.jsx)(X,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(ea,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(aF,{})]}),E;t[8]===T?E=t[9]:(E=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:T}),t[8]=T,t[9]=E);let D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=vi(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[10]=D):D=t[10];let O;t[11]!==h||t[12]!==g||t[13]!==v||t[14]!==d?(O=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pF,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(Ta,{open:h,onOpenChange:g})]}),t[11]=h,t[12]=g,t[13]=v,t[14]=d,t[15]=O):O=t[15];let k;t[16]!==r||t[17]!==n?(k=(0,Z.jsx)(sa,{onSignIn:n,onSetIdentity:r}),t[16]=r,t[17]=n,t[18]=k):k=t[18];let A,j,M;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(AN,{}),j=(0,Z.jsx)(ea,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(lp,{}),t[19]=A,t[20]=j,t[21]=M):(A=t[19],j=t[20],M=t[21]);let N;t[22]===d?N=t[23]:(N=!d&&(0,Z.jsx)(dF,{}),t[22]=d,t[23]=N);let P;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(lF,{}),t[24]=P):P=t[24];let F;t[25]!==O||t[26]!==k||t[27]!==N?(F=(0,Z.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N,P]}),t[25]=O,t[26]=k,t[27]=N,t[28]=F):F=t[28];let I;return t[29]!==F||t[30]!==x||t[31]!==w||t[32]!==E?(I=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[E,F]}),t[29]=F,t[30]=x,t[31]=w,t[32]=E,t[33]=I):I=t[33],I}var CF=`open-knowledge:terminal-launch`;function wF(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(CF,{detail:{prompt:e,cli:t}}))}function TF(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(CF,n),()=>t.removeEventListener(CF,n)}function EF(e){let t=(0,$.c)(53),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=pv(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Ay[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),x=(0,Q.useRef)(0),S=Ni(),{projectConfig:C,projectLocalConfig:w,projectLocalSynced:T,projectSynced:E}=ss(),{activeDocName:D}=ht(),O=S?.hasRemote,k=S?.pushPermission?.checkStatus,A;t[2]!==m||t[3]!==C||t[4]!==w||t[5]!==T||t[6]!==E||t[7]!==O||t[8]!==k?(A=_v({autoSyncOnboardingDismissed:m,hasRemote:O,projectLocalSynced:T,projectSynced:E,projectLocalConfig:w,projectConfig:C,pushPermissionCheckStatus:k}),t[2]=m,t[3]=C,t[4]=w,t[5]=T,t[6]=E,t[7]=O,t[8]=k,t[9]=A):A=t[9];let j=A,M,N;t[10]===D?(M=t[11],N=t[12]):(M=()=>{let e=function(e){let t=e.detail;t&&D&&Pl(D,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(av,e),()=>window.removeEventListener(av,e)},N=[D],t[10]=D,t[11]=M,t[12]=N),(0,Q.useEffect)(M,N);let P,F;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?v(OF):e===`new-terminal`&&v(!0)})},F=[],t[13]=P,t[14]=F):(P=t[13],F=t[14]),(0,Q.useEffect)(P,F);let I,L;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{if(window.okDesktop!=null)return;let e=function(e){ll(e,`toggle-terminal-panel`)&&(e.preventDefault(),v(DF))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},I=[],t[15]=I,t[16]=L):(I=t[15],L=t[16]),(0,Q.useEffect)(L,I);let R,z;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>TF((e,t)=>{v(!0),x.current+=1,b({prompt:e,cli:t,nonce:x.current})}),z=[],t[17]=R,t[18]=z):(R=t[17],z=t[18]),(0,Q.useEffect)(R,z);let B,V;t[19]===_?(B=t[20],V=t[21]):(B=()=>{_||b(null)},V=[_],t[19]=_,t[20]=B,t[21]=V),(0,Q.useEffect)(B,V);let H,U;t[22]===_?(H=t[23],U=t[24]):(H=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:_})},U=[_],t[22]=_,t[23]=H,t[24]=U),(0,Q.useEffect)(H,U);let W,G;t[25]===_?(W=t[26],G=t[27]):(W=()=>{window.okDesktop!=null&&_&&Ea()},G=[_],t[25]=_,t[26]=W,t[27]=G),(0,Q.useEffect)(W,G),mv(S?.pausedReason);let K;t[28]===a?K=t[29]:(K=function(e){s(e),a(e)},t[28]=a,t[29]=K);let q=K,J,Y;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{d(`auth`),l(!0)},Y=()=>{d(`identity`),l(!0)},t[30]=J,t[31]=Y):(J=t[30],Y=t[31]);let ee;t[32]===r?ee=t[33]:(ee=(0,Z.jsx)(SF,{onSignIn:J,onSetIdentity:Y,onOpenSearch:r}),t[32]=r,t[33]=ee);let te;t[34]!==f||t[35]!==o||t[36]!==q||t[37]!==y||t[38]!==_?(te=(0,Z.jsx)(rN,{editorMode:o,onModeChange:q,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:_,onTerminalVisibleChange:v,terminalLaunch:y}),t[34]=f,t[35]=o,t[36]=q,t[37]=y,t[38]=_,t[39]=te):te=t[39];let ne=u===`identity`,re;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>{l(!1)},t[40]=re):re=t[40];let ie;t[41]!==c||t[42]!==ne?(ie=(0,Z.jsx)(va,{open:c,onOpenChange:l,identityPrompt:ne,onSuccess:re}),t[41]=c,t[42]=ne,t[43]=ie):ie=t[43];let ae;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>h(!0),t[44]=ae):ae=t[44];let oe;t[45]===j?oe=t[46]:(oe=(0,Z.jsx)(hv,{open:j,onResolved:ae}),t[45]=j,t[46]=oe);let se;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(nv,{}),t[47]=se):se=t[47];let ce;return t[48]!==ee||t[49]!==te||t[50]!==ie||t[51]!==oe?(ce=(0,Z.jsxs)(Z.Fragment,{children:[ee,te,ie,oe,se]}),t[48]=ee,t[49]=te,t[50]=ie,t[51]=oe,t[52]=ce):ce=t[52],ce}function DF(e){return!e}function OF(e){return!e}function kF(e){let t=ao(eo(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function AF(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=da();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)(oo,{"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)(oo,{"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(jF),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 jF(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(bi,{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:()=>kF(e.file),children:[(0,Z.jsx)(oo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var MF=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
31
+ `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;gl(t,{style:t=>Al(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 pA.set(t.changes,i),i}function gA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Sk).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(fA);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=pl.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:dA.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function _A(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Sk).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(fA).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 vA(e){let t=new yl;for(let n of e.field(Sk)){let r=e.facet(yk).overrideChunk&&xA(e,n);t.add(n.fromB,n.fromB,hA(e,n,!!r))}return t.finish()}var yA=hl.define({create:e=>vA(e),update(e,t){return t.state.field(Sk,!1)==t.startState.field(Sk,!1)?e:vA(t.state)},provide:e=>wl.decorations.from(e)}),bA=new WeakMap;function xA(e,t){let n=bA.get(t);if(n!==void 0)return n;n=null;let r=e.field(fA),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(vl.widget({widget:new SA(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Rk.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return bA.set(t,n),n}var SA=class extends dl{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}},CA=new class extends Tl{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},wA=vl.line({class:`cm-inlineChangedLine`});function TA(e,t,n,r){let i=xA(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,CA),n.add(o.from,o.from,wA);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 EA=ie({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),DA=T({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),OA=wl.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 kA({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 AA(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=sn(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=mr(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C;t[1]!==l||t[2]!==c?(C=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=C):C=t[3],(0,Q.useEffect)(C);let w,T;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(w=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?EA:DA,u=[wl.editable.of(!1),ml.readOnly.of(!0)],g=[Ul,jl(),...u,l,wl.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new wl({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=kA({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 wl({doc:d,extensions:[Ul,jl(),wl.editable.of(!1),l,OA,wl.lineWrapping,uA({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),wl.updateListener.of(e=>{let t=Ck(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=Ck(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new oA({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new wl({doc:d,extensions:[...g,uA({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},T=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=w,t[11]=T):(w=t[10],T=t[11]),(0,Q.useEffect)(w,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=p.current;!e||!(e instanceof wl)||g.current?.(e.state.doc.toString())},t[12]=E):E=t[12];let D=E,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=p.current;!e||!(e instanceof wl)||W(e)},t[13]=O):O=t[13];let k=O,A=v===0,j;t[14]!==u||t[15]!==v?(j=v===null?``:v===0?u({id:`lPzyrU`}):Gs._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=j):j=t[16];let M=j,N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=N):N=t[17];let P;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,_u.createPortal)((0,Z.jsx)(bi,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),P=x.map(e),t[18]=u,t[19]=x,t[20]=P}else P=t[20];let F;t[23]!==A||t[24]!==a||t[25]!==M||t[26]!==l||t[27]!==c?(F=a&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${A?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:M}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(bi,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(X,{id:`XyOUTJ`})}),(0,Z.jsx)(bi,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:k,children:`Undo`}),c&&(0,Z.jsx)(bi,{variant:`default`,size:`sm`,disabled:!A,onClick:D,children:(0,Z.jsx)(X,{id:`Lcehxn`})})]})]}),t[23]=A,t[24]=a,t[25]=M,t[26]=l,t[27]=c,t[28]=F):F=t[28];let I;return t[29]!==F||t[30]!==P?(I=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[N,P,F]}),t[29]=F,t[30]=P,t[31]=I):I=t[31],I}async function jA(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 MA(e,t){return jA(e,`content`,t)}async function NA(e){return jA(e,`mine`)}async function PA(e){return jA(e,`theirs`)}async function FA(e){return jA(e,`delete`)}async function IA(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 LA(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=sn(),{conflicts:i,loading:a}=da(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>eo(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h,g;t[5]===n?(h=t[6],g=t[7]):(h=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),g=[n],t[5]=n,t[6]=h,t[7]=g),(0,Q.useEffect)(h,g);let _=a||s===void 0,v,y;t[8]!==_||t[9]!==c?(v=()=>{if(_)return;let e=!1;return u(null),f(!1),IA(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},y=[c,_],t[8]=_,t[9]=c,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,Q.useEffect)(v,y);let b;t[12]!==r||t[13]!==c?(b=async function(e){let t=await MA(c,e);t.ok||Fs.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=b):b=t[14];let x=b,S;t[15]!==r||t[16]!==c?(S=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),Fs.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=S):S=t[17];let C=S;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{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)(X,{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)(AA,{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)(X,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===C?a=t[30]:(a=()=>void C(FA),t[29]=C,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(X,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(bi,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===C?u=t[36]:(u=()=>void C(PA),t[35]=C,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(X,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(bi,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let h;t[44]!==i||t[45]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=h):h=t[46];let g;return t[47]!==h||t[48]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[47]=h,t[48]=e,t[49]=g):g=t[49],g}if(l.kind===`modify-delete`){let e;t[50]===l.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(AA,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[50]=l.ours,t[51]=e);let n;t[52]===c?n=t[53]:(n={filePath:c},t[52]=c,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===C?a=t[58]:(a=()=>void C(NA),t[57]=C,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(X,{id:`0NA4b3`}),t[59]=o):o=t[59];let s;t[60]!==p||t[61]!==a?(s=(0,Z.jsx)(bi,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[60]=p,t[61]=a,t[62]=s):s=t[62];let u;t[63]===C?u=t[64]:(u=()=>void C(FA),t[63]=C,t[64]=u);let d;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(X,{id:`qSxaOz`}),t[65]=d):d=t[65];let f;t[66]!==p||t[67]!==u?(f=(0,Z.jsx)(bi,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[66]=p,t[67]=u,t[68]=f):f=t[68];let m;t[69]!==s||t[70]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[69]=s,t[70]=f,t[71]=m):m=t[71];let h;t[72]!==i||t[73]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=h):h=t[74];let g;return t[75]!==h||t[76]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[75]=h,t[76]=e,t[77]=g):g=t[77],g}let w;t[78]===x?w=t[79]:(w=e=>void x(e),t[78]=x,t[79]=w);let T;return t[80]!==l.ours||t[81]!==l.theirs||t[82]!==w?(T=(0,Z.jsx)(AA,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:w}),t[80]=l.ours,t[81]=l.theirs,t[82]=w,t[83]=T):T=t[83],T}function RA(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Bt(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 zA=`__back-nav__`;function BA(e){return e instanceof ke||e instanceof vt||e instanceof Se||e instanceof Qe||e instanceof Nt||e instanceof x?e.docName:null}function VA(e){if(e instanceof ke){let t=e.docName;return{title:Gs._({id:`Jejur6`}),summary:Gs._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof vt){let t=e.docName;return{title:Gs._({id:`V7QxyT`}),summary:Gs._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Se){let t=e.docName;return{title:Gs._({id:`1di5fu`}),summary:Gs._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Qe){let t=e.docName;return{title:Gs._({id:`wvbc1r`}),summary:Gs._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Nt)return{title:Gs._({id:`Gfr4fu`}),summary:Gs._({id:`UW2Fg3`})};if(e instanceof x){let t=e.docName;return{title:Gs._({id:`vv7kpg`}),summary:Gs._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Gs._({id:`W5A0Ly`});return{title:Gs._({id:`29VNqC`}),summary:t}}function HA(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=VA(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(vC,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(X,{id:`KDw4GX`}),t[12]=v):v=t[12];let y;t[13]===r?y=t[14]:(y=(0,Z.jsx)(bi,{ref:d,variant:`default`,onClick:r,children:v}),t[13]=r,t[14]=y);let b;t[15]!==i||t[16]!==u||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(b=u?(0,Z.jsx)(bi,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(st(BA(n)??i),o(a),r(zA))},children:(0,Z.jsx)(X,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=u,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==b||t[23]!==y?(x=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[y,b]}),t[22]=b,t[23]=y,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==_?(S=(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:[m,_,x]}),t[25]=x,t[26]=_,t[27]=S):S=t[27],S}function UA(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)(HA,{...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]===zA){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}: ${VA(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(h,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function WA(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=gr(t);return{map:n,keys:li(t),parseError:r}}function GA(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>WA(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=br(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=Je(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=dt(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)(KA,{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)(qA,{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 KA(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 qA(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 JA=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CZG_MU4S.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([71,1,47,2,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,66,67,21,72,8,73,74,45,24]),import.meta.url)).ManagedArtifactProperties})),YA=Dt(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function XA(e){let t=e.threshold??YA;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function ZA(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var QA=Dt(`ACTIVITY_MOUNT_LIMIT`,3);function $A(){return n(()=>import(`./SourceEditor-UA7qm9BP.js`),__vite__mapDeps([75,1,47,2,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,76,34,74,70]),import.meta.url)}var ej=(0,Q.lazy)(async()=>({default:(await $A()).SourceEditor}));function tj(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Be(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 nj(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Gs._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Gs._({id:`Sc1bKE`,values:{docName:e}}):Gs._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Gs._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Gs._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Gs._({id:`bmC18N`,values:{docName:e}}):Gs._({id:`pAgkuZ`,values:{docName:e}})}:null}function rj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(C,{name:`activity-pool`,children:(0,Z.jsx)(ij,{...e})}),t[0]=e,t[1]=n),n}function ij(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ht(),{pages:u,loading:d}=go(),p=tj(c,n,QA),m=(0,Q.useRef)(``),h=p.map(aj).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)f(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;D(e,t&&t.length>0?t:crypto.randomUUID())}N(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),m.current=h,U(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)(dj,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!fr(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=p.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 aj(e){return e.docName}function oj(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&&N(`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&&(N(`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&&N(`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 sj(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)(Gx,{}),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)(ej,{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 cj(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)(Do,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ns,{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)(bi,{type:`button`,onClick:lj,children:[(0,Z.jsx)(Do,{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 lj(){return window.location.reload()}function uj(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 dj(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=nj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=fT(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=XA({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&&N(`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=()=>z(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),P,F;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?(P=()=>{ZA({isLarge:C.isLarge,renderSource:C.renderSource,renderVisual:C.renderVisual,hasEmittedFirstToggle:j})&&(N(`ok/cold/first-toggle`,{docName:n.docName,mountId:le(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),M(!0))},F=[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]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=k?.scrollTop,B;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?(B=f?(0,Z.jsx)(cj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(UA,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:A?(0,Z.jsx)(uj,{html:A}):(0,Z.jsx)(Gx,{}),children:(0,Z.jsx)(RA,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(LA,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(fr(n.docName)||re(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(JA,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(GA,{provider:n.provider}),(0,Z.jsx)(za,{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)(sj,{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)(FO,{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]=B):B=t[44];let V;t[45]!==r||t[46]!==R||t[47]!==B?(V=(0,Z.jsx)(oj,{isActive:r,initialScrollTop:R,children:B}),t[45]=r,t[46]=R,t[47]=B,t[48]=V):V=t[48];let H;return t[49]!==I||t[50]!==L||t[51]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:V}),t[49]=I,t[50]=L,t[51]=V,t[52]=H):H=t[52],H}function fj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function pj(e){let{value:t,unit:n}=fj(e);return n===`rem`?t*16:t}function mj(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var hj=3600*24*7;function gj(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?_j:m,O=g===void 0?hj:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=pj(b),J;t[6]===x?J=t[7]:(J=pj(x),t[6]=x,t[7]=J);let Y=J,ee;t[8]!==E||t[9]!==k?(ee=function(e){E&&(P.current=!0,j.current=H.current?0:pj(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]=ee):ee=t[10];let te=ee,ne,re;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==Y||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ne=()=>{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}=fj(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(Y,t)),u=mj(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(Y,u)),f=mj(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)}},re=[i,a,D,q,Y,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]=Y,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=re):(ne=t[24],re=t[25]),(0,Q.useEffect)(ne,re);let ie;return t[26]===te?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=ie),ie}function _j(){}var vj=3600*24*7,yj=`18rem`,bj=`3rem`,xj=`app-file-sidebar`,Sj=`14.625rem`,Cj=`32rem`,wj=`sidebar_width`,Tj=/^\d+(?:\.\d+)?(?:rem|px)$/,Ej=Q.createContext(null);function Dj(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${wj}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return Tj.test(n)?n:e}function Oj(){let e=Q.use(Ej);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function kj(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?yj:c,[u]=Q.useState(jj),d;t[8]===u?d=t[9]:(d=()=>ST(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>Dj(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=kT();return jT(`left`,ST(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),MT(`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(Aj)},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: ${yT}px)`),t=()=>{let e=ST(u,window.innerWidth,`left`);p(e),C(jT(`left`,e,kT())===`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(xj)?.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=>{ll(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":bj,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=vi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(Ej.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function Aj(e){return!e}function jj(){return Ar()}function Mj(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}=sn(),{state:f,isDraggingRail:p}=Oj();if(u===`none`){let e;t[7]===r?e=t[8]:(e=vi(`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=vi(`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=vi(`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:xj,"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 Nj(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}=sn(),{toggleSidebar:o,state:s}=Oj(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=ul(`toggle-files-sidebar`);c=bi,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=xj,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=vi(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)(bt,{}):(0,Z.jsx)(td,{}),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 Pj(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}=sn(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=Oj(),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:Sj,maxResizeWidth:Cj,setIsDraggingRail:m,widthCookieName:wj,widthCookieMaxAge:vj},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}=gj(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=vi(`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 Fj(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}=Oj(),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=vi(`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 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=vi(`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 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=vi(`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 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=vi(`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 zj(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=vi(`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 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?yi:`div`,o;t[4]===n?o=t[5]:(o=vi(`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 Vj(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?yi:`button`,o;t[4]===n?o=t[5]:(o=vi(`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 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=vi(`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 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=vi(`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 Wj(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=vi(`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 Gj=_i(`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 Kj(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?yi:`button`,{state:m}=Oj(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=vi(Gj({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)(ec,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(tc,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(rc,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function qj(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?yi:`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=vi(`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 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=vi(`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 Yj(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=vi(`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 Xj(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?yi:`a`,d;t[6]===n?d=t[7]:(d=vi(`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 Zj(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 Qj(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Mr.safeParse(t);return n.success?n.data.currentBranch??null:null}var $j=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:Zj({fetchBranch:Qj,subscribeToEvent:Rs}),eM=$j.subscribe,tM=$j.getSnapshot;function nM(){return(0,Q.useSyncExternalStore)(eM,tM,tM)}function rM(){let e=(0,$.c)(6),t=nM(),n=ko(),{state:r}=Oj(),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&&Gi(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 iM(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:i,composerBadge:a}=e,o=i===void 0?!0:i,{_:s}=sn(),c=rM();if(!o&&c===null&&a==null)return null;let l=r??n,u=r!=null,{words:d,chars:f,tokens:p}=l,m;t[0]!==s||t[1]!==u||t[2]!==o?(m=s(o?u?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=s,t[1]=u,t[2]=o,t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=h):h=t[4];let g;t[5]!==s||t[6]!==a?(g=a?(0,Z.jsxs)(bi,{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)(js,{className:`size-3`,"aria-hidden":!0}),s({id:`xWEvuo`}),(0,Z.jsx)(V,{className:`size-3`,"aria-hidden":!0})]}):null,t[5]=s,t[6]=a,t[7]=g):g=t[7];let _;t[8]===c?_=t[9]:(_=c===null?null:(0,Z.jsx)(aM,{identity:c}),t[8]=c,t[9]=_);let v;t[10]===_?v=t[11]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[10]=_,t[11]=v);let y;t[12]!==s||t[13]!==l.chars||t[14]!==l.tokens||t[15]!==l.words||t[16]!==f||t[17]!==u||t[18]!==o||t[19]!==p||t[20]!==d?(y=o?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[u?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:s({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.words.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`gljvbT`,values:{words:d}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.chars.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`d5rK4X`,values:{chars:f}})]}),(0,Z.jsxs)(`span`,{children:[l.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.tokens.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`uynXup`,values:{tokens:p}})]})]}):null,t[12]=s,t[13]=l.chars,t[14]=l.tokens,t[15]=l.words,t[16]=f,t[17]=u,t[18]=o,t[19]=p,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==m||t[23]!==g||t[24]!==v||t[25]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":m,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[h,g,v,y]}),t[22]=m,t[23]=g,t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function aM(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)(rc,{children:[(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(tc,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(be,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function oM(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}=sn(),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=vi(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 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=vi(`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 cM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=vi(`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 lM(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=vi(`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 uM(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=vi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Xa,{}),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 dM=1,fM=2,pM=4;function mM(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=Lr(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:Xt(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>pM?[...u.slice(0,dM).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(dM,-fM)},...u.slice(-fM).map((e,t)=>d(e,u.length-fM+t))]:u.map((e,t)=>d(e,t));a=oM,t[8]===r?c=t[9]:(c=vi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=sM,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(hM)}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 hM(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(uM,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(cM,{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)(ku,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(cM,{className:`min-w-0`,children:(0,Z.jsx)(lM,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var gM={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`},_M=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`,...gM,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},vM=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)(_M,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},yM=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)(_M,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function bM(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=sn(),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)(ec,{children:(0,Z.jsx)(yM,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(Oa,{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)(tc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(rc,{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)(vM,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Oa,{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)(tc,{side:`bottom`,children:a?(0,Z.jsx)(X,{id:`G-JBA1`}):(0,Z.jsx)(X,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(rc,{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)(Aa,{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 xM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-CnqozQbp.js`);return{SkillEditorActions:e}},__vite__mapDeps([77,1,30,3,7,31,6,10,67,20,9,11,32,12,13,21,16,58,69,18,59,62,23]),import.meta.url)).SkillEditorActions}));function SM(e){let t=(0,$.c)(79),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l}=e,{_:u}=sn(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=cl(`toggle-document-panel`),t[0]=d):d=t[0];let f=d,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;if(t[1]!==u||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==o||t[9]!==i){let e=ul(`toggle-document-panel`),d;t[25]===n?d=t[26]:(d=n?Lr(n):null,t[25]=n,t[26]=d);let f=d,O;t[27]===n?O=t[28]:(O=n?re(n):null,t[27]=n,t[28]=O);let k=O,A;t[29]!==f||t[30]!==k?(A=f?.kind===`skill`?{scope:f.scope,name:f.name}:k?{scope:`project`,name:k}:null,t[29]=f,t[30]=k,t[31]=A):A=t[31];let j=A;_=`editor-toolbar`,v=`pointer-events-none absolute inset-x-0 top-0 z-10`;let M;t[32]!==n||t[33]!==j?(M=j?null:(0,Z.jsx)(mM,{docName:n}),t[32]=n,t[33]=j,t[34]=M):M=t[34];let N;t[35]===M?N=t[36]:(N=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:M}),t[35]=M,t[36]=N);let P;t[37]!==r||t[38]!==a||t[39]!==i?(P=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(bM,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[37]=r,t[38]=a,t[39]=i,t[40]=P):P=t[40],t[41]!==N||t[42]!==P?(y=(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:[N,P]})}),t[41]=N,t[42]=P,t[43]=y):y=t[43],D=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[44]===j?h=t[45]:(h=j?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(xM,{scope:j.scope,name:j.name})}):null,t[44]=j,t[45]=h),t[46]!==u||t[47]!==s||t[48]!==o?(g=o&&(0,Z.jsxs)(rc,{children:[(0,Z.jsx)(bi,{variant:`ghost`,size:`icon`,"aria-label":u({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(ec,{children:(0,Z.jsx)(Ju,{})})}),(0,Z.jsx)(tc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`81H_23`})})]}),t[46]=u,t[47]=s,t[48]=o,t[49]=g):g=t[49],m=rc,p=bi,b=``,x=`ghost`,S=`icon`,C=l,w=!c,T=`doc-panel`,E=u(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=u,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=o,t[9]=i,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S,t[20]=C,t[21]=w,t[22]=T,t[23]=E,t[24]=D}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19],C=t[20],w=t[21],T=t[22],E=t[23],D=t[24];let O;t[50]===c?O=t[51]:(O=(0,Z.jsx)(ec,{children:c?(0,Z.jsx)(rd,{}):(0,Z.jsx)(nd,{})}),t[50]=c,t[51]=O);let k;t[52]!==p||t[53]!==O||t[54]!==b||t[55]!==x||t[56]!==S||t[57]!==C||t[58]!==w||t[59]!==T||t[60]!==E?(k=(0,Z.jsx)(p,{"data-doc-panel-toggle":b,variant:x,size:S,onClick:C,"aria-expanded":w,"aria-controls":T,"aria-label":E,asChild:!0,children:O}),t[52]=p,t[53]=O,t[54]=b,t[55]=x,t[56]=S,t[57]=C,t[58]=w,t[59]=T,t[60]=E,t[61]=k):k=t[61];let A;t[62]===c?A=t[63]:(A=(0,Z.jsx)(tc,{side:`bottom`,children:c?(0,Z.jsx)(X,{id:`KFdXwz`,values:{panelShortcut:f}}):(0,Z.jsx)(X,{id:`MsuXaI`,values:{panelShortcut:f}})}),t[62]=c,t[63]=A);let j;t[64]!==m||t[65]!==k||t[66]!==A?(j=(0,Z.jsxs)(m,{children:[k,A]}),t[64]=m,t[65]=k,t[66]=A,t[67]=j):j=t[67];let M;t[68]!==h||t[69]!==g||t[70]!==j||t[71]!==D?(M=(0,Z.jsxs)(`div`,{className:D,children:[h,g,j]}),t[68]=h,t[69]=g,t[70]=j,t[71]=D,t[72]=M):M=t[72];let N;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[73]=N):N=t[73];let P;return t[74]!==_||t[75]!==v||t[76]!==y||t[77]!==M?(P=(0,Z.jsxs)(`div`,{"data-testid":_,className:v,children:[y,M,N]}),t[74]=_,t[75]=v,t[76]=y,t[77]=M,t[78]=P):P=t[78],P}function CM(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function wM(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=vi(`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)(rp,{"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 TM=_i(`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 EM(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=vi(TM({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)(ip,{"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 DM(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=vi(`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)(ap,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}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=vi(`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)(op,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var kM=`ok-terminal-height-v1`,AM=1/3,jM=.5;function MM(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*jM))}function NM(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*AM)}function PM(e,t){let n=MM(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(NM(t),n)}function FM(){return typeof window>`u`?0:window.innerHeight}function IM(e,t){try{let n=e??localStorage,r=t??FM(),i=n.getItem(kM);if(i==null)return PM(NM(r),r);let a=Number.parseInt(i,10);return PM(Number.isFinite(a)?a:NM(r),r)}catch{return 240}}function LM(e,t,n){try{let r=t??localStorage,i=n??FM();r.setItem(kM,String(PM(e,i)))}catch{}}function RM(){try{return typeof localStorage>`u`?240:IM()}catch{return 240}}var zM=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-DRbEwLNU.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([78,1,30,3,7,31,6,10,13,11,79,80]),import.meta.url));function BM(e){let t=(0,$.c)(12),{bridge:n,onClose:r,onTitleChange:i,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=Ii(),l=Fi(),{_:u}=sn(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){Fs.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||Fs.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let a;return t[4]!==n||t[5]!==o||t[6]!==r||t[7]!==i?(a=(0,Z.jsx)(h,{fallbackRender:HM,onError:VM,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(zM,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i,t[8]=a):a=t[8],a}let m;return t[9]!==p||t[10]!==d?(m=d?(0,Z.jsx)(GM,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[9]=p,t[10]=d,t[11]=m):m=t[11],m}function VM(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function HM(e){return(0,Z.jsx)(UM,{...e})}function UM(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=sn(),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)(bi,{onClick:WM,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 WM(){return window.location.reload()}function GM(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=sn(),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)(bi,{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 KM(e){let t=(0,$.c)(36),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,onNew:o,onClose:s,children:c,className:l}=e,{_:u}=sn(),d;t[0]===l?d=t[1]:(d=vi(`flex min-h-0 min-w-0 flex-1 flex-col`,l),t[0]=l,t[1]=d);let f;t[2]===u?f=t[3]:(f=u({id:`1MGRQl`}),t[2]=u,t[3]=f);let p;if(t[4]!==u||t[5]!==r||t[6]!==s||t[7]!==a||t[8]!==n){let e;t[10]!==u||t[11]!==r||t[12]!==s||t[13]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:vi(`group flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(DM,{value:e.id,onClick:()=>a?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(bi,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:vi(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),s(e.id)},children:(0,Z.jsx)(Is,{"aria-hidden":`true`})})]},e.id)},t[10]=u,t[11]=r,t[12]=s,t[13]=a,t[14]=e):e=t[14],p=n.map(e),t[4]=u,t[5]=r,t[6]=s,t[7]=a,t[8]=n,t[9]=p}else p=t[9];let m;t[15]!==f||t[16]!==p?(m=(0,Z.jsx)(EM,{variant:`line`,"aria-label":f,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:p}),t[15]=f,t[16]=p,t[17]=m):m=t[17];let h;t[18]===u?h=t[19]:(h=u({id:`AB4qw9`}),t[18]=u,t[19]=h);let g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(we,{"aria-hidden":`true`}),t[20]=g):g=t[20];let _;t[21]!==o||t[22]!==h?(_=(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":h,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:o,children:g})}),t[21]=o,t[22]=h,t[23]=_):_=t[23];let v;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(tc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(X,{id:`AB4qw9`})}),t[24]=v):v=t[24];let y;t[25]===_?y=t[26]:(y=(0,Z.jsxs)(rc,{children:[_,v]}),t[25]=_,t[26]=y);let b;t[27]!==m||t[28]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[m,y]}),t[27]=m,t[28]=y,t[29]=b):b=t[29];let x;return t[30]!==r||t[31]!==c||t[32]!==i||t[33]!==d||t[34]!==b?(x=(0,Z.jsxs)(wM,{value:r,onValueChange:i,className:d,children:[b,c]}),t[30]=r,t[31]=c,t[32]=i,t[33]=d,t[34]=b,t[35]=x):x=t[35],x}var qM=`terminal-dock-panel`;function JM(e){return`terminal-session-${e}`}function YM(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function XM(e){let t=(0,$.c)(78),{bridge:n,children:r,visible:i,onVisibleChange:a,launch:o}=e,s=o===void 0?null:o,{_:c}=sn(),{resolvedTheme:l}=mr(),u=kx(),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!i),m;t[0]!==s||t[1]!==i?(m=()=>i?[{id:JM(1),launch:s,title:null}]:[],t[0]=s,t[1]=i,t[2]=m):m=t[2];let[h,g]=(0,Q.useState)(m),_;t[3]===i?_=t[4]:(_=()=>i?JM(1):``,t[3]=i,t[4]=_);let[v,y]=(0,Q.useState)(_),b=(0,Q.useRef)(v),x=(0,Q.useRef)(h),S=(0,Q.useRef)(+!!i),C=(0,Q.useRef)(i&&s?s.nonce:null),w=(0,Q.useRef)(i),T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){S.current+=1;let t=JM(S.current);g(n=>[...n,{id:t,launch:e,title:null}]),y(t)},t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e,t){let n=t.trim()===``?null:t.trim();g(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[6]=D):D=t[6];let O=D,k=(0,Q.useRef)(E),A;t[7]!==v||t[8]!==a?(A=function(e){let t=x.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===v){let e=(t[n-1]??t[n+1])?.id??``;y(e),e!==``&&queueMicrotask(()=>YM(e))}g(r),r.length===0&&(a(!1),d.current?.focus())},t[7]=v,t[8]=a,t[9]=A):A=t[9];let j=A,M=(0,Q.useRef)($M),N;t[10]!==v||t[11]!==j||t[12]!==h?(N=()=>{k.current=E,b.current=v,x.current=h,M.current=()=>{v!==``&&j(v)}},t[10]=v,t[11]=j,t[12]=h,t[13]=N):N=t[13],(0,Q.useEffect)(N);let[P]=(0,Q.useState)(QM),F=(0,Q.useRef)(P),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(null),B;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){z.current!=null&&clearTimeout(z.current),z.current=setTimeout(()=>{LM(e),z.current=null},100)},t[14]=B):B=t[14];let V=B,H=(0,Q.useRef)(null),U,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>()=>{z.current!=null&&clearTimeout(z.current),H.current!=null&&(window.removeEventListener(`pointerup`,H.current),H.current=null)},U=[],t[15]=U,t[16]=W):(U=t[15],W=t[16]),(0,Q.useEffect)(W,U);let G,K;t[17]!==s||t[18]!==h.length||t[19]!==i?(G=()=>{let e=w.current;if(w.current=i,s!=null&&s.nonce!==C.current){C.current=s.nonce,k.current(s);return}i&&!e&&h.length===0&&k.current(null)},K=[i,s,h.length],t[17]=s,t[18]=h.length,t[19]=i,t[20]=G,t[21]=K):(G=t[20],K=t[21]),(0,Q.useEffect)(G,K);let q,J;t[22]===n?(q=t[23],J=t[24]):(q=()=>n.onMenuAction(e=>{e===`new-terminal`?k.current(null):e===`kill-terminal`&&M.current()}),J=[n],t[22]=n,t[23]=q,t[24]=J),(0,Q.useEffect)(q,J);let Y,ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Y=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(qM)?.contains(document.activeElement))return;let t=x.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),y(t.id),queueMicrotask(()=>YM(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[25]=Y,t[26]=ee):(Y=t[25],ee=t[26]),(0,Q.useEffect)(Y,ee);let te;t[27]!==n.editor||t[28]!==h.length?(te=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:h.length>0})},t[27]=n.editor,t[28]=h.length,t[29]=te):te=t[29];let ne;t[30]!==n||t[31]!==h.length?(ne=[n,h.length],t[30]=n,t[31]=h.length,t[32]=ne):ne=t[32],(0,Q.useEffect)(te,ne);let re,ie;t[33]!==u||t[34]!==i?(re=()=>{let e=u.current;e!=null&&(i?e.resize(`${F.current}px`):e.collapse())},ie=[i,u],t[33]=u,t[34]=i,t[35]=re,t[36]=ie):(re=t[35],ie=t[36]),(0,Q.useEffect)(re,ie);let ae,oe;t[37]===f?(ae=t[38],oe=t[39]):(ae=()=>{f&&document.getElementById(qM)?.contains(document.activeElement)&&d.current?.focus()},oe=[f],t[37]=f,t[38]=ae,t[39]=oe),(0,Q.useLayoutEffect)(ae,oe);let se,ce;t[40]===f?(se=t[41],ce=t[42]):(se=()=>{f||YM(b.current)},ce=[f],t[40]=f,t[41]=se,t[42]=ce),(0,Q.useEffect)(se,ce);let le;if(t[43]!==c||t[44]!==h){let e;t[46]===c?e=t[47]:(e=(e,t)=>({id:e.id,label:e.title??c({id:`OVjNeX`,values:{0:t+1}})}),t[46]=c,t[47]=e),le=h.map(e),t[43]=c,t[44]=h,t[45]=le}else le=t[45];let ue=le,de=I||void 0,fe;t[48]===r?fe=t[49]:(fe=(0,Z.jsx)(Vw,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:d,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[48]=r,t[49]=fe);let pe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(Hw,{withHandle:!0,onPointerDown:()=>{L(!0),R.current=!0;let e=()=>{L(!1),R.current=!1,window.removeEventListener(`pointerup`,e),H.current=null};H.current=e,window.addEventListener(`pointerup`,e)}}),t[50]=pe):pe=t[50];let me;t[51]===l?me=t[52]:(me=Xl(l),t[51]=l,t[52]=me);let he;t[53]===me.background?he=t[54]:(he={backgroundColor:me.background},t[53]=me.background,t[54]=he);let ge=i?`${P}px`:0,_e;t[55]!==a||t[56]!==i?(_e=e=>{let t=e.asPercentage===0;p(t),R.current&&(t&&i?a(!1):!t&&!i&&a(!0),e.inPixels>0&&(F.current=e.inPixels,V(e.inPixels)))},t[55]=a,t[56]=i,t[57]=_e):_e=t[57];let ve=!I&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ye;t[58]===ve?ye=t[59]:(ye=vi(`flex flex-col`,ve),t[58]=ve,t[59]=ye);let be;t[60]!==v||t[61]!==n||t[62]!==j||t[63]!==h||t[64]!==ue?(be=h.length>0?(0,Z.jsx)(KM,{sessions:ue,activeSessionId:v,onSelect:y,onTabActivate:ZM,onNew:()=>E(null),onClose:j,className:`h-full`,children:h.map(e=>(0,Z.jsx)(OM,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(BM,{bridge:n,launch:e.launch,onTitleChange:t=>O(e.id,t),onClose:()=>j(e.id)})},e.id))}):null,t[60]=v,t[61]=n,t[62]=j,t[63]=h,t[64]=ue,t[65]=be):be=t[65];let xe;t[66]!==f||t[67]!==u||t[68]!==he||t[69]!==ge||t[70]!==_e||t[71]!==ye||t[72]!==be?(xe=(0,Z.jsx)(Vw,{id:qM,style:he,panelRef:u,defaultSize:ge,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:_e,inert:f,className:ye,children:be}),t[66]=f,t[67]=u,t[68]=he,t[69]=ge,t[70]=_e,t[71]=ye,t[72]=be,t[73]=xe):xe=t[73];let Se;return t[74]!==de||t[75]!==fe||t[76]!==xe?(Se=(0,Z.jsxs)(Bw,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":de,children:[fe,pe,xe]}),t[74]=de,t[75]=fe,t[76]=xe,t[77]=Se):Se=t[77],Se}function ZM(e){return queueMicrotask(()=>YM(e))}function QM(){return RM()}function $M(){}var eN=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BwvIOsCl.js`),__vite__mapDeps([46,1,2,47,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,61,62]),import.meta.url)).ActivityModeContent})),tN=`300px`,nN=`600px`;function rN(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(aN,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(iN,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(C,{name:`editor-area`,children:(0,Z.jsxs)(Pa,{children:[n,r]})}),t[3]=n,t[4]=i),i}function iN(){let e=(0,$.c)(5),t=Zi(),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)(Fw,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function aN(e){let t=(0,$.c)(187),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalLaunch:l}=e,u=s===void 0?!1:s,d=l===void 0?null:l,{_:f}=sn(),{activeDocName:p,activeProvider:m,activeTarget:h,recycleDocument:g,docPanelMode:_,docPanelAgentId:v,docPanelExpandSignal:y}=ht(),{openDocumentTransition:b}=kt(),{requestAddProperty:x}=ja(),S=uT(m,p),C=pT(p,n===`source`?`source`:`wysiwyg`),w=NT(m),T=w===`connected`||w===`synced`,E=fT(p)===`conflict`,[D,O]=(0,Q.useState)(!1),k,A;t[0]!==m||t[1]!==D?(k=()=>{m!=null&&!D&&O(!0)},A=[m,D],t[0]=m,t[1]=D,t[2]=k,t[3]=A):(k=t[2],A=t[3]),(0,Q.useEffect)(k,A);let j=(0,Q.useDeferredValue)(p),M=h?.kind===`missing`,N=!!p&&h?.kind!==`folder`,P;t[4]!==f||t[5]!==M?(P=M?f({id:`K-a33w`}):void 0,t[4]=f,t[5]=M,t[6]=P):P=t[6];let F=P,[L]=(0,Q.useState)(lN),R=L!==null,[z]=(0,Q.useState)(cN),B;t[7]===L?B=t[8]:(B=()=>ST(L,window.innerWidth,`right`),t[7]=L,t[8]=B);let[V,H]=(0,Q.useState)(B),U=(0,Q.useRef)(V),W,G;t[9]===V?(W=t[10],G=t[11]):(W=()=>{U.current=V},G=[V],t[9]=V,t[10]=W,t[11]=G),(0,Q.useEffect)(W,G);let K=kx(),q;t[12]===V?q=t[13]:(q=()=>jT(`right`,V,kT())===`collapsed`,t[12]=V,t[13]=q);let[J]=(0,Q.useState)(q),[Y,ee]=(0,Q.useState)(J),te=(0,Q.useRef)(Y),ne,re;t[14]===Y?(ne=t[15],re=t[16]):(ne=()=>{te.current=Y},re=[Y],t[14]=Y,t[15]=ne,t[16]=re),(0,Q.useEffect)(ne,re);let[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(!1),[se]=(0,Q.useState)(sN),ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){le.current!=null&&clearTimeout(le.current),le.current=setTimeout(()=>{_T(e),le.current=null},100)},t[17]=ue):ue=t[17];let de=ue,fe,pe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>()=>{le.current!=null&&clearTimeout(le.current)},pe=[],t[18]=fe,t[19]=pe):(fe=t[18],pe=t[19]),(0,Q.useEffect)(fe,pe);let[me,he]=(0,Q.useState)(null),ge;t[20]!==Y||t[21]!==K?(ge=function(){if(K.current==null)return;let e=U.current;Y?(MT(`right`,e,`open`),K.current?.expand()):(MT(`right`,e,`collapsed`),K.current?.collapse())},t[20]=Y,t[21]=K,t[22]=ge):ge=t[22];let _e=ge,ve,ye;t[23]!==L||t[24]!==K?(ve=()=>{let e=window.matchMedia(`(min-width: ${bT}px)`),t=()=>{let e=ST(L,window.innerWidth,`right`);H(e);let t=jT(`right`,e,kT())===`collapsed`;ee(t),t?K.current?.collapse():K.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ye=[L,K],t[23]=L,t[24]=K,t[25]=ve,t[26]=ye):(ve=t[25],ye=t[26]),(0,Q.useEffect)(ve,ye);let be,xe;t[27]!==me||t[28]!==R||t[29]!==K?(be=()=>{if(me==null||R)return;let e=new ResizeObserver(()=>{te.current||oe.current||K.current?.resize(`${ce.current}px`)});return e.observe(me),()=>e.disconnect()},xe=[me,R,K],t[27]=me,t[28]=R,t[29]=K,t[30]=be,t[31]=xe):(be=t[30],xe=t[31]),(0,Q.useEffect)(be,xe);let Se,Ce;t[32]!==a||t[33]!==K?(Se=()=>{let e=e=>{a(e),K.current?.expand()},t=Vg();return t&&e(t),Ug(t=>{Vg(),e(t)})},Ce=[a,K],t[32]=a,t[33]=K,t[34]=Se,t[35]=Ce):(Se=t[34],Ce=t[35]),(0,Q.useEffect)(Se,Ce);let we,Te;t[36]!==y||t[37]!==K?(we=()=>{y!==0&&K.current?.expand()},Te=[y,K],t[36]=y,t[37]=K,t[38]=we,t[39]=Te):(we=t[38],Te=t[39]),(0,Q.useEffect)(we,Te);let Ee,De;t[40]===Y?(Ee=t[41],De=t[42]):(Ee=()=>{if(!Y||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},De=[Y],t[40]=Y,t[41]=Ee,t[42]=De),(0,Q.useLayoutEffect)(Ee,De);let Oe,ke;t[43]===Y?(Oe=t[44],ke=t[45]):(Oe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Y})},ke=[Y],t[43]=Y,t[44]=Oe,t[45]=ke),(0,Q.useEffect)(Oe,ke);let Ae,je;t[46]===_e?(Ae=t[47],je=t[48]):(Ae=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&_e()})},je=[_e],t[46]=_e,t[47]=Ae,t[48]=je),(0,Q.useEffect)(Ae,je);let Me,Pe;t[49]===_e?(Me=t[50],Pe=t[51]):(Me=()=>{if(window.okDesktop!=null)return;let e=e=>{ll(e,`toggle-document-panel`)&&(e.preventDefault(),_e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Pe=[_e],t[49]=_e,t[50]=Me,t[51]=Pe),(0,Q.useEffect)(Me,Pe);let Fe=(0,Q.useRef)(null),[Ie,Le]=(0,Q.useState)(null),[Re,ze]=(0,Q.useState)(!1),Be=h?.kind===`large-file`?h.docName:p,Ve,He;t[52]===Be?(Ve=t[53],He=t[54]):(Ve=()=>{if(Be&&Be!==Fe.current){let e=Fe.current;Fe.current=Be,Le(e)}},He=[Be],t[52]=Be,t[53]=Ve,t[54]=He),(0,Q.useEffect)(Ve,He);let Ue;t[55]===b?Ue=t[56]:(Ue=function(e){let t=ao(e);window.location.hash===t?b(e):window.location.hash=t},t[55]=b,t[56]=Ue);let We=Ue,Ge,Ke=null;if(h?.kind===`large-file`){let e;t[57]!==We||t[58]!==Ie?(e=Ie?{previousDocName:Ie,onNavigateBack:We}:void 0,t[57]=We,t[58]=Ie,t[59]=e):e=t[59];let n;t[60]!==h.docName||t[61]!==h.limit||t[62]!==h.size||t[63]!==e?(n=(0,Z.jsx)(vw,{docName:h.docName,size:h.size,limit:h.limit,backNav:e}),t[60]=h.docName,t[61]=h.limit,t[62]=h.size,t[63]=e,t[64]=n):n=t[64],Ge=n}else if(h?.kind===`folder`){let e;t[65]!==z||t[66]!==R||t[67]!==u?(e=iE({terminalVisible:u,isEmbedded:R,isDesktop:z}),t[65]=z,t[66]=R,t[67]=u,t[68]=e):e=t[68];let n=e,r;t[69]===h.folderPath?r=t[70]:(r=(0,Z.jsx)(mw,{folderPath:h.folderPath}),t[69]=h.folderPath,t[70]=r);let i;t[71]!==h.folderPath||t[72]!==n?(i=n?(0,Z.jsx)(KT,{folderPath:h.folderPath}):null,t[71]=h.folderPath,t[72]=n,t[73]=i):i=t[73];let a;if(t[74]!==r||t[75]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[74]=r,t[75]=i,t[76]=a):a=t[76],Ge=a,_===`agent`&&v!==null){let e;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Hw,{withHandle:!0}),t[77]=e):e=t[77];let n;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(Vw,{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)(X,{id:`ONPvOb`})}),children:(0,Z.jsx)(eN,{showBackButton:!1})})})]}),t[78]=n):n=t[78],Ke=n}}else if(h?.kind===`asset`){let e;t[79]!==h.assetPath||t[80]!==h.mediaKind?(e=(0,Z.jsx)(Wx,{assetPath:h.assetPath,mediaKind:h.mediaKind},h.assetPath),t[79]=h.assetPath,t[80]=h.mediaKind,t[81]=e):e=t[81],Ge=e}else if(h?.kind===`skill-file`){let e=`${h.scope}/${h.name}/${h.path}`,n;t[82]!==h.name||t[83]!==h.path||t[84]!==h.scope||t[85]!==e?(n=(0,Z.jsx)(Ew,{scope:h.scope,name:h.name,path:h.path},e),t[82]=h.name,t[83]=h.path,t[84]=h.scope,t[85]=e,t[86]=n):n=t[86],Ge=n}else if(!m||!p)if((typeof window<`u`?wo(window.location.hash):null)!==null)if(o!=null&&D){let e;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Gx,{}),t[87]=e):e=t[87],Ge=e;let n;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Hw,{withHandle:!0,disabled:!0}),t[88]=n):n=t[88];let r=J?0:`${se}px`,i;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[89]=i):i=t[89];let a;t[90]===r?a=t[91]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(Vw,{id:`doc-panel`,defaultSize:r,minSize:tN,maxSize:nN,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[90]=r,t[91]=a),Ke=a}else{let e;return t[92]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Gx,{}),t[92]=e):e=t[92],e}else{let e;t[93]===u?e=t[94]:(e=(0,Z.jsx)(NC,{terminalVisible:u}),t[93]=u,t[94]=e),Ge=e}else{let e=n===`source`,o=!T,s=Y,c;t[95]!==p||t[96]!==x?(c=function(){p&&x(p)},t[95]=p,t[96]=x,t[97]=c):c=t[97];let l=c,d;t[98]!==p||t[99]!==z||t[100]!==R||t[101]!==u?(d=rE({terminalVisible:u,isEmbedded:R,isDesktop:z,activeDocName:p}),t[98]=p,t[99]=z,t[100]=R,t[101]=u,t[102]=d):d=t[102];let f=d,m=j??p,h=Ie??void 0,v;t[103]!==F||t[104]!==e||t[105]!==We||t[106]!==g||t[107]!==m||t[108]!==h?(v=(0,Z.jsx)(rj,{activeDocName:m,isSourceMode:e,editorPlaceholder:F,previousDocName:h,onNavigateBack:We,onRecycle:g}),t[103]=F,t[104]=e,t[105]=We,t[106]=g,t[107]=m,t[108]=h,t[109]=v):v=t[109];let y;t[110]!==p||t[111]!==e?(y=(0,Z.jsx)(oT,{activeDocName:p,isSourceMode:e}),t[110]=p,t[111]=e,t[112]=y):y=t[112];let b;t[113]!==p||t[114]!==j?(b=CM({activeDocName:p,deferredActiveDocName:j,mountResolved:p!==null&&I(p),syncResolved:p!==null&&Ne(p)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Gx,{}),p===null?null:(0,Z.jsx)(yw,{docName:p})]}):null,t[113]=p,t[114]=j,t[115]=b):b=t[115];let w;t[116]!==v||t[117]!==y||t[118]!==b?(w=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[v,y,b]}),t[116]=v,t[117]=y,t[118]=b,t[119]=w):w=t[119];let D;t[120]!==p||t[121]!==E||t[122]!==s||t[123]!==e||t[124]!==r||t[125]!==l||t[126]!==o||t[127]!==_e?(D=!E&&(0,Z.jsx)(SM,{activeDocName:p,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:_e}),t[120]=p,t[121]=E,t[122]=s,t[123]=e,t[124]=r,t[125]=l,t[126]=o,t[127]=_e,t[128]=D):D=t[128];let O;t[129]!==p||t[130]!==Re||t[131]!==e||t[132]!==f?(O=f?(0,Z.jsx)(KT,{docName:p,surface:e?`source`:`wysiwyg`,dismissed:Re,onDismiss:()=>ze(!0),onReopen:()=>ze(!1)}):null,t[129]=p,t[130]=Re,t[131]=e,t[132]=f,t[133]=O):O=t[133];let k;t[134]!==w||t[135]!==D||t[136]!==O?(k=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[w,D,O]}),t[134]=w,t[135]=D,t[136]=O,t[137]=k):k=t[137];let A;t[138]!==Re||t[139]!==f?(A=f&&Re?{onReopen:()=>ze(!1)}:null,t[138]=Re,t[139]=f,t[140]=A):A=t[140];let M;t[141]!==C||t[142]!==N||t[143]!==S||t[144]!==A?(M=(0,Z.jsx)(iM,{stats:S,selectionStats:C,showStats:N,composerBadge:A}),t[141]=C,t[142]=N,t[143]=S,t[144]=A,t[145]=M):M=t[145];let P;t[146]!==k||t[147]!==M?(P=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[k,M]}),t[146]=k,t[147]=M,t[148]=P):P=t[148],Ge=P;let L=R&&Y,B;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{ae(!0),oe.current=!0;let e=()=>{ae(!1),oe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[149]=B):B=t[149];let V;t[150]===L?V=t[151]:(V=(0,Z.jsx)(Hw,{withHandle:!0,disabled:L,onPointerDown:B}),t[150]=L,t[151]=V);let H=J?0:`${se}px`,U;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{ee(e.asPercentage===0),e.inPixels>0&&oe.current&&(ce.current=e.inPixels,de(e.inPixels))},t[152]=U):U=t[152];let W=!ie&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[153]===W?G=t[154]:(G=vi(`flex flex-col bg-muted/20`,W),t[153]=W,t[154]=G);let q;t[155]!==p||t[156]!==i||t[157]!==_||t[158]!==e||t[159]!==a?(q=(0,Z.jsx)(Fy,{docName:p,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:_}),t[155]=p,t[156]=i,t[157]=_,t[158]=e,t[159]=a,t[160]=q):q=t[160];let te;t[161]!==Y||t[162]!==K||t[163]!==H||t[164]!==G||t[165]!==q?(te=(0,Z.jsx)(Vw,{id:`doc-panel`,panelRef:K,defaultSize:H,minSize:tN,maxSize:nN,collapsible:!0,collapsedSize:0,onResize:U,inert:Y,className:G,children:q}),t[161]=Y,t[162]=K,t[163]=H,t[164]=G,t[165]=q,t[166]=te):te=t[166];let ne;t[167]!==V||t[168]!==te?(ne=(0,Z.jsxs)(Z.Fragment,{children:[V,te]}),t[167]=V,t[168]=te,t[169]=ne):ne=t[169],Ke=ne}let qe;t[170]!==c||t[171]!==o||t[172]!==d||t[173]!==u||t[174]!==Ge?(qe=o==null?Ge:(0,Z.jsx)(XM,{bridge:o,visible:u,onVisibleChange:c??oN,launch:d,children:Ge}),t[170]=c,t[171]=o,t[172]=d,t[173]=u,t[174]=Ge,t[175]=qe):qe=t[175];let Je=qe,Ye=ie||void 0,Xe;t[176]!==J||t[177]!==Ke?(Xe=Ke!=null&&!J?{}:{defaultSize:`100%`},t[176]=J,t[177]=Ke,t[178]=Xe):Xe=t[178];let Ze=ie?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Qe;t[179]!==Je||t[180]!==Xe||t[181]!==Ze?(Qe=(0,Z.jsx)(Vw,{minSize:`30%`,...Xe,className:Ze,children:Je}),t[179]=Je,t[180]=Xe,t[181]=Ze,t[182]=Qe):Qe=t[182];let $e;return t[183]!==Ke||t[184]!==Ye||t[185]!==Qe?($e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:he,children:(0,Z.jsxs)(Bw,{orientation:`horizontal`,"data-dragging":Ye,children:[Qe,Ke]})}),t[183]=Ke,t[184]=Ye,t[185]=Qe,t[186]=$e):$e=t[186],$e}function oN(){}function sN(){return vT()}function cN(){return typeof window<`u`&&window.okDesktop!=null}function lN(){return Ar()}function uN(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 dN(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 fN=1e3,pN=!1;function mN(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function hN(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:Ai(i)?a=i:(a=void 0,pN||(pN=!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`&&(mN({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=dN(i),{current:c,crossDoc:l}=a?Ei(a,n,Date.now()):{current:[],crossDoc:[]},u=gN,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>uN(e.current,p)&&uN(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,fN);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function gN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var _N=`sync-status`;function vN(e,t){let n=(0,$.c)(6),{_:r}=sn(),i=Ch(),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){Fs.dismiss(_N);return}o.current=!0,Fs.warning(r({id:`HGNCsl`}),{id:_N,duration:1/0})}else o.current&&e===`synced`&&(o.current=!1,Fs.success(r({id:`GhjUB_`}),{id:_N,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 yN=4,bN=3,xN={Bird:mu,Cat:xu,Dog:Ou,Fish:Pu,Mouse:cd,Rabbit:sd,Shrimp:md,Snail:hd,Squirrel:vd,Turtle:Dd};Object.freeze(Object.keys(xN));function SN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(xN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var CN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function wN(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=sn(),o=SN(n),s=o.kind===`animal`?xN[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=qr(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=di(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)(ec,{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)(tc,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(rc,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function TN(e){let t=CN[e.icon];return e.displayName||t||Gs._({id:`iEQQyu`})}function EN(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 DN(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=sn(),{activeDocName:s}=ht(),{presence:c,agentId:l}=n,u=TN(c),d=EN(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)(Oi,{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)(Oi,{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)(ec,{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)(X,{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)(tc,{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)(rc,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function ON(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?Gs._({id:`9euN0m`,values:{count:n}}):Gs._({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)(G,{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)(wN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(DN,{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)(_e,{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)(he,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function kN(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(wN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(DN,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function AN(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ht(),{current:s,crossDoc:c}=hN(t,r,n);if(vN(NT(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,yN),n;e[6]===s?n=e[7]:(n=s.slice(yN),e[6]=s,e[7]=n);let r=n,u=c.slice(0,bN),d;e[8]===c?d=e[9]:(d=c.slice(bN),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=>kN(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)(ON,{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=>kN(e,p,!0,m)),f.length>0?(0,Z.jsx)(ON,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var jN=`.md`,MN=/\.(md|mdx)$/i;function NN(e,t=jN){return`${e}${t}`}function PN(e){return sP(e).replace(MN,``)}function FN(e){return Eo(e)?RN(e.path):lo(e)?e.path:NN(e.docName,e.docExt)}function IN(e){let t=sP(e).match(MN);return t?`.${t[1].toLowerCase()}`:void 0}function LN(e){return sP(e)}function RN(e){let t=sP(e.trim());return t?`${t}/`:``}function zN(e){return e.endsWith(`/`)?LN(e):PN(e)}function BN(e){return e.map(FN)}function VN(e){return[...e].sort().join(`\0`)}function HN(e){return VN(BN(e))}function UN(e){let t=new Set;for(let n of e){let e=(Eo(n)||lo(n)?n.path:n.docName).split(`/`).filter(Boolean);if(e.includes(`.ok`))continue;if(Eo(n)){let e=RN(n.path);e&&t.add(e)}let r=Eo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function WN(e){if(!e)return[];let t=sP(e.replace(MN,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function GN(e,t,n){let r=IN(e);if(r)return r;let i=n.find(e=>Co(e)&&e.docName===t);return i?i.docExt??jN:oP(e).includes(`.`)?void 0:jN}function KN(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!lo(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function qN(e,t,n){if(IN(e))return null;let r=n.find(e=>lo(e)&&e.path===t);return r?r.path:oP(e).includes(`.`)?t:KN(t,n)}function JN(e,t){let n=e.kind===`directory`,r=n?LN(e.path):PN(e.path);if(n)return{kind:`folder`,name:sP(oP(e.path)).replace(MN,``),path:r,treePath:XN(e.path,!0)};let i=qN(e.path,r,t);if(i)return{kind:`asset`,name:sP(oP(i)),path:i,treePath:i};let a=GN(e.path,r,t);return{kind:`file`,name:sP(oP(e.path)).replace(MN,``),path:r,treePath:XN(e.path,!1),docExt:a}}function YN(e){return e.kind===`directory`?LN(e.path):e.path}function XN(e,t){return t?RN(e):MN.test(e)?e:`${e}${jN}`}function ZN(e,t,n){let r=RN(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${jN}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function QN(e,t){return e===`file`?XN(t,!1):`${LN(t)}/index${jN}`}function $N(e,t){return t.kind===`root`||t.directoryPath==null?oP(e):`${t.directoryPath}${oP(e)}`}function eP(e,t){if(t)return LN(RN(e));let n=PN(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function tP(e,t){let n=LN(RN(e));return n?`${n}/${t}`:t}function nP(e,t){return(t.path??tP(e,t.src)).replace(/^\/+/,``)}function rP(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function iP(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function aP(e,t){let n=Ct(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:PN(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:Fr(i),modified:r,size:t.size}}function oP(e){let t=sP(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function sP(e){return e.endsWith(`/`)?e.slice(0,-1):e}function cP(e,t){return t.trim()}function lP(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function uP(e,t){let n=cP(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function dP(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(Co(e)){let t=s.get(NN(e.docName,e.docExt));if(t){let n=fo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Fr(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(Eo(e))return{...e,path:vP(e.path,n)};if(lo(e)){let t=s.get(e.path);return t&&ft(t)?{kind:`document`,docName:PN(t),docExt:Ct(t),size:e.size,modified:e.modified}:{...e,path:t??vP(e.path,n)}}return e})}function fP(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=>Co(e)?!i.has(e.docName)&&!SP(e.docName,n):Eo(e)?!SP(e.path,n):lo(e)?!a.has(e.path)&&!SP(e.path,n):!0)}function pP(e,t){if(e.kind!==`asset`||t.some(t=>lo(t)&&t.path===e.path))return e;let n=KN(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function mP(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>yP(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Co(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=>Eo(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(Co(i)){let e=xP(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Eo(i)){let e=bP(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function hP(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function gP(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function _P(e,t){let n=e.kind===`file`?NN(e.path,e.docExt):e.path;return Ao(t.contentDir,n,t.pathSeparator)}function vP(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 yP(e,t){return Co(e)&&Co(t)?e.docName===t.docName:Eo(e)&&Eo(t)||lo(e)&&lo(t)?e.path===t.path:!1}function bP(e,t,n){return e===t?n:xP(e,t,n)}function xP(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function SP(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function CP(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)(kf,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function wP(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=vi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Af,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TP(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)(Nf,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function EP(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)(zf,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function DP(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=vi(`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)(jf,{children:(0,Z.jsx)(Mf,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function OP(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=vi(`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)(Ff,{"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 kP(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=vi(`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)(Xa,{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)(Bf,{"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 AP(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=vi(`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)(Vf,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jP(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=vi(`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)(Lf,{children:(0,Z.jsx)(Va,{})})}),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)(If,{"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 MP(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=vi(`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)(Pf,{"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 NP(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=vi(`-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)(Rf,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var PP=`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`,FP=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,IP={start:[xs.Space],cancel:[xs.Esc],end:[xs.Space,xs.Enter]};function LP(e){return vi(PP,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function RP(e){return e?void 0:-1}function zP({className:e,isDragging:t}){return vi(e,t&&FP)}function BP(e){return e.code===xs.Enter&&e.target===e.currentTarget}function VP({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&BP(e)?`activate-tab`:`delegate-sortable`}function HP({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Es.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 UP(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 WP(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 GP=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 hs(e)},KP=[`.md`,`.mdx`],qP=`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`,JP=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,YP=vi(JP,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),XP=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function ZP(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function QP(e){let t=ao(e);window.location.hash!==t&&(window.location.hash=t)}function $P(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function eF(e,t){let n=[t,...KP].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 tF(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:_}=ws(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=HP({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=VP({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=zP({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 nF(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=nn(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?(_=nn(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)(wP,{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)(X,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(OP,{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)(X,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(OP,{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)(X,{id:`U2Kx6T`}):(0,Z.jsx)(X,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(OP,{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)(NP,{}),(0,Z.jsx)(OP,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(X,{id:`SYfHmN`}):(0,Z.jsx)(X,{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)(DP,{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)(CP,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function rF(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:i,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=sn();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(od,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(bi,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]===i?u=t[14]:(u=LP(i),t[13]=i,t[14]=u);let d;t[15]===i?d=t[16]:(d=RP(i),t[15]=i,t[16]=d);let f;t[17]!==r||t[18]!==o?(f=e=>{e.stopPropagation(),r(o)},t[17]=r,t[18]=o,t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Is,{"aria-hidden":`true`}),t[20]=p):p=t[20];let m;return t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f?(m=(0,Z.jsx)(bi,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:u,tabIndex:d,onClick:f,children:p}),t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=m):m=t[25],m}function iF(e){let t=(0,$.c)(1),{docName:n}=e;if(fT(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(oo,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function aF(){let e=(0,$.c)(80),{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:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=ht(),{_:w}=sn(),{pageMeta:T}=go(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(t),U;e[0]!==n||e[1]!==t||e[2]!==i?(U=n??(i?m(i):t?qt(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=U):U=e[3];let W=U,G;e[4]!==r||e[5]!==W||e[6]!==p||e[7]!==h||e[8]!==_?(G=p?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:W?`${W}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=W,e[6]=p,e[7]=h,e[8]=_,e[9]=G):G=e[9];let q=G,J,Y;e[10]===t?(J=e[11],Y=e[12]):(J=()=>{V.current=t},Y=[t],e[10]=t,e[11]=J,e[12]=Y),(0,Q.useEffect)(J,Y);let ee,te;e[13]===q?(ee=e[14],te=e[15]):(ee=()=>{q&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},te=[q],e[13]=q,e[14]=ee,e[15]=te),(0,Q.useEffect)(ee,te);let ne,re;e[16]===k?(ne=e[17],re=e[18]):(ne=()=>{k&&(L.current?.focus(),L.current?.select())},re=[k],e[16]=k,e[17]=ne,e[18]=re),(0,Q.useEffect)(ne,re);let ie,ae;e[19]!==_||e[20]!==k?(ie=()=>{!k||_.includes(k.tabId)||(z.current=!0,B.current=null,A(null),M(``),P(null),I(!1))},ae=[_,k],e[19]=_,e[20]=k,e[21]=ie,e[22]=ae):(ie=e[21],ae=e[22]),(0,Q.useEffect)(ie,ae);let oe=function(e,t){let n=t.split(`/`);z.current=!1,B.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),P(null)},se=function(){z.current=!0,B.current=null,A(null),M(``),P(null),I(!1)},ce=async function(){if(z.current){z.current=!1;return}if(R.current)return;let e=k?.docName;if(!e){se();return}let t=cP(`file`,eF(j,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===B.current){L.current?.focus();return}if(!lP(t)){P(w({id:`P8yDjG`})),L.current?.focus();return}let i=uP({kind:`file`,path:e,name:r},t);R.current=!0,I(!0),P(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(z.current){I(!1),R.current=!1;return}let r=await ve(n,`Server error (HTTP ${n.status})`);if(!r.ok){P(r.title),I(!1),R.current=!1,B.current=t,L.current?.focus();return}let a=K(Jr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=V.current,c=hP(o,a);H(a);let l=!0;try{let e=gP(a,d(),f);await Promise.all(e.map(e=>s(e))),b(a),Vs([`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}),Fs.error(w({id:`MUBR8r`}))}z.current=!0,A(null),M(``),P(null),I(!1),R.current=!1,B.current=null,l&&c&&c!==o&&QP(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),P(w({id:`HIb0vl`})),I(!1),R.current=!1,B.current=t,L.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===h?ue=e[24]:(ue=new Set(h),e[23]=h,e[24]=ue);let de=ue,fe;e[25]===D?fe=e[26]:(fe=WP(D),e[25]=D,e[26]=fe);let pe;e[27]===fe?pe=e[28]:(pe=[fe],e[27]=fe,e[28]=pe);let me=pe,he;e[29]!==c||e[30]!==u||e[31]!==de?(he=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&u(t);for(let e of n)c(e)},e[29]=c,e[30]=u,e[31]=de,e[32]=he):he=e[32];let ge=he,_e;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(_e={activationConstraint:{distance:8}},e[33]=_e):_e=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:vs,keyboardCodes:IP},e[34]=ye):ye=e[34];let be=Ts(fs(gs,_e),fs(ys,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){O(UP(E.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){O(null)},e[36]=Ce):Ce=e[36];let Te=Ce,Ee;e[37]!==Te||e[38]!==x||e[39]!==C?(Ee=function(e){Te();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=C.indexOf(t),i=C.indexOf(n);r<0||i<0||r===i||x(Ss([...C],r,i),t)},e[37]=Te,e[38]=x,e[39]=C,e[40]=Ee):Ee=e[40];let De=Ee,Oe=le?``:void 0,ke;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(ke=vi(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,le&&`[-webkit-app-region:drag]`),e[41]=ke):ke=e[41];let Ae=$P,je;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(je=vi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[42]=je):je=e[42];let Me=ms,Ne=GP,Pe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Pe={container:typeof document<`u`?document.body:void 0},e[43]=Pe):Pe=e[43];let Fe=bs,Ie;e[44]===C?Ie=e[45]:(Ie=[...C],e[44]=C,e[45]=Ie);let Le=ps,Re=C.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(nF,{tabId:e,canPin:!1,openTabs:C,closeTab:c,closeTabs:ge,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(tF,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:vi(qP,t?JP: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":w({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:XP,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(X,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:LP(t),tabIndex:RP(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(Is,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=Qt(e),n=e===W,i=y.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=Xt(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(nF,{tabId:e,openTabs:C,closeTab:l,closeTabs:ge,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(tF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:vi(qP,n?JP:YP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:XP,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:vi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:vi(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(rF,{accessibleLabel:c,closeTab:l,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}if(t.kind===`asset`||t.kind===`skill-file`){let{baseName:r,label:o,prefix:s}=Xt(t.kind===`asset`?t.assetPath:t.path,``),c=`${s}${o}`;return(0,Z.jsx)(nF,{tabId:e,openTabs:C,closeTab:l,closeTabs:ge,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(tF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:vi(qP,n?JP:YP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:XP,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:vi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:vi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(rF,{accessibleLabel:c,closeTab:l,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}let s=t.docName,u=T.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=Xt(s,u),h=`${m}${p}`,g=u===`.md`||u===`.mdx`,_=k?.tabId===e,b=`editor-tab-rename-error-${ZP(s)}`;return(0,Z.jsx)(nF,{disabled:_,tabId:e,openTabs:C,closeTab:l,closeTabs:ge,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsx)(tF,{tabId:e,activateFromKeyboard:()=>a(e),disabled:_,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:vi(qP,n?JP:YP,_&&N&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Uw,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(Jw,{ref:L,value:j,disabled:F,"aria-label":w({id:`Dw1T_W`,values:{label:p}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?b:void 0,"aria-busy":F||void 0,title:N??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{M(eF(e.target.value,u)),P(null),B.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(Gw,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(qw,{className:`text-muted-foreground/60 text-xs`,children:u})})]}),N?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":h,title:h,className:XP,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,s)},tabIndex:-1,children:[(0,Z.jsx)(iF,{docName:s}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(rF,{accessibleLabel:h,closeTab:l,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})})},e)}),ze;e[46]!==Fe||e[47]!==Ie||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Fe,{items:Ie,strategy:Le,children:Re}),e[46]=Fe,e[47]=Ie,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==Me||e[52]!==Te||e[53]!==De||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Ne||e[58]!==Pe||e[59]!==ze||e[60]!==me?(Be=(0,Z.jsx)(Me,{sensors:be,autoScroll:!1,collisionDetection:Ne,modifiers:me,onDragStart:Se,onDragEnd:De,onDragCancel:Te,accessibility:Pe,children:ze}),e[51]=Me,e[52]=Te,e[53]=De,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Ne,e[58]=Pe,e[59]=ze,e[60]=me,e[61]=Be):Be=e[61];let Ve;e[62]===w?Ve=e[63]:(Ve=w({id:`3YvS-c`}),e[62]=w,e[63]=Ve);let He;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(we,{"aria-hidden":`true`}),e[64]=He):He=e[64];let Ue;e[65]!==g||e[66]!==Ve?(Ue=(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:He})}),e[65]=g,e[66]=Ve,e[67]=Ue):Ue=e[67];let We;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(tc,{children:(0,Z.jsx)(X,{id:`3YvS-c`})}),e[68]=We):We=e[68];let Ge;e[69]===Ue?Ge=e[70]:(Ge=(0,Z.jsxs)(rc,{children:[Ue,We]}),e[69]=Ue,e[70]=Ge);let Ke;e[71]!==je||e[72]!==Be||e[73]!==Ge?(Ke=(0,Z.jsxs)(`div`,{className:je,children:[Be,Ge]}),e[71]=je,e[72]=Be,e[73]=Ge,e[74]=Ke):Ke=e[74];let qe;return e[75]!==Oe||e[76]!==ke||e[77]!==Ae||e[78]!==Ke?(qe=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":Oe,className:ke,onWheel:Ae,children:Ke}),e[75]=Oe,e[76]=ke,e[77]=Ae,e[78]=Ke,e[79]=qe):qe=e[79],qe}function oF(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 sF(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 cF=[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:l},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:zp},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:oF},{label:`X`,href:`https://x.com/OpenKnowledgeAI`,icon:sF},{label:`OpenKnowledge`,href:`https://openknowledge.ai/`,icon:Bp,iconClassName:`scale-125 grayscale transition-[filter] group-hover:grayscale-0`}],lF=()=>{let e=(0,$.c)(16),{_:t}=sn(),[n,r]=(0,Q.useState)(!1),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(v,{className:`size-4`}),e[0]=i):i=e[0];let a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(G,{asChild:!0,children:(0,Z.jsxs)(bi,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[i,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`s-MGs7`})})]})})}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(rc,{children:[a,(0,Z.jsx)(tc,{children:(0,Z.jsx)(X,{id:`s-MGs7`})})]}),e[2]=o):o=e[2];let s;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(X,{id:`s-MGs7`})}),e[3]=s):s=e[3];let c;e[4]===t?c=e[5]:(c=t({id:`s-MGs7`}),e[4]=t,e[5]=c);let l;e[6]===t?l=e[7]:(l=cF.map(e=>{let{label:n,href:r,icon:i,iconClassName:a}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Ks(e,r),onAuxClick:e=>Ks(e,r),className:`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:vi(`size-4 shrink-0`,a)}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=l);let u;e[8]===l?u=e[9]:(u=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:l}),e[8]=l,e[9]=u);let d;e[10]!==c||e[11]!==u?(d=(0,Z.jsxs)(_e,{align:`end`,className:`w-48 p-3`,children:[s,(0,Z.jsx)(`nav`,{"aria-label":c,children:u})]}),e[10]=c,e[11]=u,e[12]=d):d=e[12];let f;return e[13]!==n||e[14]!==d?(f=(0,Z.jsxs)(he,{open:n,onOpenChange:r,children:[o,d]}),e[13]=n,e[14]=d,e[15]=f):f=e[15],f},uF=50,dF=()=>{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,Ow.preload()},uF))},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=Ri)},l=(0,Z.jsx)(fd,{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)(ec,{asChild:!0,children:(0,Z.jsxs)(bi,{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)(X,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(rc,{children:[u,(0,Z.jsx)(tc,{children:(0,Z.jsx)(X,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},fF=`https://openknowledge.ai/docs/features/share`;function pF(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:i}=sn(),{status:a}=Xi(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(h=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Ji({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:Ko,toastSuccess:xF,toastError:bF,logEvent:yF});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0})}catch{Fs.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=h):h=t[9];let g=h,_=c!==null,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)(pd,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(X,{id:`Z8lGw6`}),t[14]=S,t[15]=C):(S=t[14],C=t[15]);let w;t[16]!==g||t[17]!==b||t[18]!==x?(w=(0,Z.jsx)(pe,{asChild:!0,children:(0,Z.jsxs)(bi,{variant:`ghost`,size:`sm`,"aria-label":b,onClick:g,disabled:x,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})}),t[16]=g,t[17]=b,t[18]=x,t[19]=w):w=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(X,{id:`Z8lGw6`})}),t[20]=T):T=t[20];let E;t[21]===c?.autoCopyFailed?E=t[22]:(E=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(X,{id:`ndeI89`})}):null,t[21]=c?.autoCopyFailed,t[22]=E);let D=c?.url??``,O;t[23]===i?O=t[24]:(O=i({id:`5-FeN2`}),t[23]=i,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsx)(el,{ref:u,readOnly:!0,value:D,onFocus:vF,onClick:_F,onContextMenu:gF,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":O}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A=c?.url??``,j=c?.autoCopyFailed===!1,M;t[28]!==A||t[29]!==j?(M=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(B,{copyContent:A,clipboardWrite:Ko,initialCopied:j})})}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(`div`,{className:`relative`,children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33];let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(`a`,{href:fF,target:`_blank`,rel:`noopener noreferrer`,onClick:hF,onAuxClick:mF,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)(v,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(X,{id:`aByJ8j`})]}),t[34]=P):P=t[34];let F;t[35]!==E||t[36]!==N?(F=(0,Z.jsxs)(_e,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[T,E,N,P]}),t[35]=E,t[36]=N,t[37]=F):F=t[37];let I;return t[38]!==w||t[39]!==F||t[40]!==_?(I=(0,Z.jsxs)(he,{open:_,onOpenChange:y,children:[w,F]}),t[38]=w,t[39]=F,t[40]=_,t[41]=I):I=t[41],I}function mF(e){return Ks(e,fF)}function hF(e){return Ks(e,fF)}function gF(e){return e.currentTarget.select()}function _F(e){return e.currentTarget.select()}function vF(e){return e.currentTarget.select()}function yF(e){return console.log(e)}function bF(e){e!==`Link ready but could not copy to clipboard.`&&Fs.error(e)}function xF(e){return Fs.success(e)}function SF(e){let t=(0,$.c)(34),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=sn(),{activeDocName:o,activeTarget:s}=ht(),c=o?Lr(o):null,{state:l,isDraggingRail:u}=Oj(),d=N_(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=cl(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=cl(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=wa(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=Pi(o),t[3]=o,t[4]=e),_=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[5]!==S||t[6]!==C?(w=vi(`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[5]=S,t[6]=C,t[7]=w):w=t[7];let T=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(rc,{children:[(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(Nj,{className:vi(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(tc,{children:l===`expanded`?(0,Z.jsx)(X,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(X,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(rc,{children:[(0,Z.jsx)(ec,{asChild:!0,children:(0,Z.jsx)(bi,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:vi(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(jt,{"aria-hidden":`true`})})}),(0,Z.jsx)(tc,{children:(0,Z.jsx)(X,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(ea,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(aF,{})]}),E;t[8]===T?E=t[9]:(E=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:T}),t[8]=T,t[9]=E);let D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=vi(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[10]=D):D=t[10];let O;t[11]!==h||t[12]!==g||t[13]!==v||t[14]!==d?(O=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pF,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(Ta,{open:h,onOpenChange:g})]}),t[11]=h,t[12]=g,t[13]=v,t[14]=d,t[15]=O):O=t[15];let k;t[16]!==r||t[17]!==n?(k=(0,Z.jsx)(sa,{onSignIn:n,onSetIdentity:r}),t[16]=r,t[17]=n,t[18]=k):k=t[18];let A,j,M;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(AN,{}),j=(0,Z.jsx)(ea,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(lp,{}),t[19]=A,t[20]=j,t[21]=M):(A=t[19],j=t[20],M=t[21]);let N;t[22]===d?N=t[23]:(N=!d&&(0,Z.jsx)(dF,{}),t[22]=d,t[23]=N);let P;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(lF,{}),t[24]=P):P=t[24];let F;t[25]!==O||t[26]!==k||t[27]!==N?(F=(0,Z.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N,P]}),t[25]=O,t[26]=k,t[27]=N,t[28]=F):F=t[28];let I;return t[29]!==F||t[30]!==x||t[31]!==w||t[32]!==E?(I=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[E,F]}),t[29]=F,t[30]=x,t[31]=w,t[32]=E,t[33]=I):I=t[33],I}var CF=`open-knowledge:terminal-launch`;function wF(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(CF,{detail:{prompt:e,cli:t}}))}function TF(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(CF,n),()=>t.removeEventListener(CF,n)}function EF(e){let t=(0,$.c)(53),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=pv(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Ay[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),x=(0,Q.useRef)(0),S=Ni(),{projectConfig:C,projectLocalConfig:w,projectLocalSynced:T,projectSynced:E}=ss(),{activeDocName:D}=ht(),O=S?.hasRemote,k=S?.pushPermission?.checkStatus,A;t[2]!==m||t[3]!==C||t[4]!==w||t[5]!==T||t[6]!==E||t[7]!==O||t[8]!==k?(A=_v({autoSyncOnboardingDismissed:m,hasRemote:O,projectLocalSynced:T,projectSynced:E,projectLocalConfig:w,projectConfig:C,pushPermissionCheckStatus:k}),t[2]=m,t[3]=C,t[4]=w,t[5]=T,t[6]=E,t[7]=O,t[8]=k,t[9]=A):A=t[9];let j=A,M,N;t[10]===D?(M=t[11],N=t[12]):(M=()=>{let e=function(e){let t=e.detail;t&&D&&Pl(D,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(av,e),()=>window.removeEventListener(av,e)},N=[D],t[10]=D,t[11]=M,t[12]=N),(0,Q.useEffect)(M,N);let P,F;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?v(OF):e===`new-terminal`&&v(!0)})},F=[],t[13]=P,t[14]=F):(P=t[13],F=t[14]),(0,Q.useEffect)(P,F);let I,L;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{if(window.okDesktop!=null)return;let e=function(e){ll(e,`toggle-terminal-panel`)&&(e.preventDefault(),v(DF))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},I=[],t[15]=I,t[16]=L):(I=t[15],L=t[16]),(0,Q.useEffect)(L,I);let R,z;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>TF((e,t)=>{v(!0),x.current+=1,b({prompt:e,cli:t,nonce:x.current})}),z=[],t[17]=R,t[18]=z):(R=t[17],z=t[18]),(0,Q.useEffect)(R,z);let B,V;t[19]===_?(B=t[20],V=t[21]):(B=()=>{_||b(null)},V=[_],t[19]=_,t[20]=B,t[21]=V),(0,Q.useEffect)(B,V);let H,U;t[22]===_?(H=t[23],U=t[24]):(H=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:_})},U=[_],t[22]=_,t[23]=H,t[24]=U),(0,Q.useEffect)(H,U);let W,G;t[25]===_?(W=t[26],G=t[27]):(W=()=>{window.okDesktop!=null&&_&&Ea()},G=[_],t[25]=_,t[26]=W,t[27]=G),(0,Q.useEffect)(W,G),mv(S?.pausedReason);let K;t[28]===a?K=t[29]:(K=function(e){s(e),a(e)},t[28]=a,t[29]=K);let q=K,J,Y;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{d(`auth`),l(!0)},Y=()=>{d(`identity`),l(!0)},t[30]=J,t[31]=Y):(J=t[30],Y=t[31]);let ee;t[32]===r?ee=t[33]:(ee=(0,Z.jsx)(SF,{onSignIn:J,onSetIdentity:Y,onOpenSearch:r}),t[32]=r,t[33]=ee);let te;t[34]!==f||t[35]!==o||t[36]!==q||t[37]!==y||t[38]!==_?(te=(0,Z.jsx)(rN,{editorMode:o,onModeChange:q,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:_,onTerminalVisibleChange:v,terminalLaunch:y}),t[34]=f,t[35]=o,t[36]=q,t[37]=y,t[38]=_,t[39]=te):te=t[39];let ne=u===`identity`,re;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>{l(!1)},t[40]=re):re=t[40];let ie;t[41]!==c||t[42]!==ne?(ie=(0,Z.jsx)(va,{open:c,onOpenChange:l,identityPrompt:ne,onSuccess:re}),t[41]=c,t[42]=ne,t[43]=ie):ie=t[43];let ae;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>h(!0),t[44]=ae):ae=t[44];let oe;t[45]===j?oe=t[46]:(oe=(0,Z.jsx)(hv,{open:j,onResolved:ae}),t[45]=j,t[46]=oe);let se;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(nv,{}),t[47]=se):se=t[47];let ce;return t[48]!==ee||t[49]!==te||t[50]!==ie||t[51]!==oe?(ce=(0,Z.jsxs)(Z.Fragment,{children:[ee,te,ie,oe,se]}),t[48]=ee,t[49]=te,t[50]=ie,t[51]=oe,t[52]=ce):ce=t[52],ce}function DF(e){return!e}function OF(e){return!e}function kF(e){let t=ao(eo(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function AF(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=da();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)(oo,{"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)(oo,{"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(jF),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 jF(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(bi,{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:()=>kF(e.file),children:[(0,Z.jsx)(oo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var MF=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
32
32
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
33
33
  <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
34
34
  </symbol>