@inkeep/open-knowledge 0.9.0-beta.26 → 0.9.0-beta.27

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 (46) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +4 -4
  4. package/dist/constants-CvRfM2D5.mjs +2 -0
  5. package/dist/{dist-DlmFeQ-H.mjs → dist-BCZuoJER.mjs} +1 -1
  6. package/dist/{dist-q5PZFM5z.mjs → dist-ByvLyk9y.mjs} +5 -5
  7. package/dist/{gh-detect-BA7tlPzY.mjs → gh-detect-CqUbPTBu.mjs} +2 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/{init-B_sTXRIk.mjs → init-BjGyg3HC.mjs} +4 -4
  10. package/dist/init-CELJF0nK.mjs +1 -0
  11. package/dist/loader-CbSvCxvK.mjs +1 -0
  12. package/dist/{loader-BKlVklj3.mjs → loader-JKNoOZ0R.mjs} +2 -2
  13. package/dist/{preview-CbI4FLL_.mjs → preview-BdVoT9qF.mjs} +2 -2
  14. package/dist/preview-DvKlwczR.mjs +1 -0
  15. package/dist/public/assets/{ActivityModeContent-DBUlDDd_.js → ActivityModeContent-Q1f1O1VR.js} +1 -1
  16. package/dist/public/assets/DocumentContext-CebW2pMB.js +61 -0
  17. package/dist/public/assets/{GraphPanel-DQPd07Df.js → GraphPanel-CvKl6isv.js} +1 -1
  18. package/dist/public/assets/{SettingsDialogBody-Ds0lg6RZ.js → SettingsDialogBody-B582h2g9.js} +1 -1
  19. package/dist/public/assets/{SourceEditor-DypG3lee.js → SourceEditor-SBPJy4qz.js} +1 -1
  20. package/dist/public/assets/{config-validation-events-_VhVoID2.js → config-validation-events-CrZadlJb.js} +1 -1
  21. package/dist/public/assets/{index-Dt0YPYjG.js → index-BntPDegy.js} +7 -7
  22. package/dist/public/assets/index-Ceww6ypF.css +1 -0
  23. package/dist/public/assets/{prop-types-BukjUPXR.js → prop-types-LW3nz6ON.js} +2 -2
  24. package/dist/public/assets/{target-navigation-intent-B9ffyxAO.js → target-navigation-intent-D17qGD9f.js} +1 -1
  25. package/dist/public/assets/{typing-burst-detector-Dd3NE2ME.js → typing-burst-detector-PBiL5ySf.js} +1 -1
  26. package/dist/public/index.html +7 -7
  27. package/dist/{repair-launch-json-3jIkDqw3.mjs → repair-launch-json-C04uFVkx.mjs} +2 -2
  28. package/dist/{repair-mcp-configs-DDnS29FF.mjs → repair-mcp-configs-DePkSoHq.mjs} +2 -2
  29. package/dist/repair-skills-DQQOhELx.mjs +1 -0
  30. package/dist/{repair-skills-BxGSose1.mjs → repair-skills-Dzigqc9G.mjs} +2 -2
  31. package/dist/{server-lock-BpjJj3OD-C5eNAMGL.mjs → server-lock-BpjJj3OD-DxHkfAmg.mjs} +3 -3
  32. package/dist/server-lock-CyhBidkz-CT18eT26.mjs +1 -0
  33. package/dist/{src-BuCQLQDk.mjs → src-C_trk1AK.mjs} +2 -2
  34. package/dist/{start-CrVLGEqx.mjs → start-Cb7isxwM.mjs} +2 -2
  35. package/dist/start-Cl6twyiU.mjs +1 -0
  36. package/dist/{write-project-skill--cARlVJ3.mjs → write-project-skill-CM3q8lZC.mjs} +2 -2
  37. package/package.json +1 -1
  38. package/dist/constants-D5I52lz_.mjs +0 -2
  39. package/dist/init-DMpyz77j.mjs +0 -1
  40. package/dist/loader-DBzd0LoE.mjs +0 -1
  41. package/dist/preview-CrDrdqqT.mjs +0 -1
  42. package/dist/public/assets/DocumentContext-Db4QZJLh.js +0 -61
  43. package/dist/public/assets/index-BClOnUHN.css +0 -1
  44. package/dist/repair-skills-Cn_FcRjU.mjs +0 -1
  45. package/dist/server-lock-CyhBidkz-mFPU94zN.mjs +0 -1
  46. package/dist/start-BwuKO3na.mjs +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-CuUV_174.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-Jk72eOkX.js","./compiler-runtime-Cs91PcD2.js","./button-DenIdY-r.js","./checkbox-Co7Tjlri.js","./dialog-B1es0EvU.js","./collapsible-BhpeB6tu.js","./textarea-luaT-nOK.js","./dist-DicqJavT.js","./dist-P7DYrfOB.js","./project-paths-CsGHlmFh.js","./McpConsentDialogBody-w45-uKw5.js","./label-DwEePOBC.js","./mcp-consent-store-CijO54Jd.js","./ActivityPanelDiffView-BNQupLE1.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-DQPd07Df.js","./prop-types-BukjUPXR.js","./w3c-keyname-B5t0fahT.js","./toggle-group-Cs-1L92l.js","./panel-BNBODYwB.js","./min-VayDM1tY.js","./src-BYmEUJ3I.js","./colors-BbIH8S-B.js","./ordinal-C6wHcby9.js","./init-gbiKrEzm.js","./isObjectLike-BNNgtFA6.js","./now--RAZR_wd.js","./isSymbol-CiN6ou2H.js","./target-navigation-intent-B9ffyxAO.js","./ActivityModeContent-DBUlDDd_.js","./DocumentContext-Db4QZJLh.js","./dist-Cp-iTcML.js","./dist-D2RGH7XO.js","./dist-BiYnsAMa.js","./dist-B3L7cm0M.js","./dist-CATLRngz.js","./stex-J8UMaf7u.js","./DocumentContext-B0sQn39F.css","./agent-presence-DxGcS3q2.js","./SettingsDialogBody-Ds0lg6RZ.js","./config-validation-events-_VhVoID2.js","./SourceEditor-DypG3lee.js","./typing-burst-detector-Dd3NE2ME.js"])))=>i.map(i=>d[i]);
2
- import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{a as r,i,n as a,o,r as s,t as c}from"./compiler-runtime-Cs91PcD2.js";import{$ as l,$n as u,$t as d,A as f,An as p,At as m,B as h,Bn as g,Bt as _,Cn as v,Ct as y,Dn as b,En as x,F as S,Fn as C,Ft as w,Gn as T,Gt as E,H as D,Hn as O,Ht as k,I as A,It as j,J as M,Jn as N,Jt as P,Kn as F,Kt as I,L,Ln as R,Lt as z,Mn as B,Mt as V,Nn as H,Nt as U,O as W,On as G,Ot as ee,Pn as K,Pt as te,Q as ne,Qn as q,Qt as re,R as ie,Rn as ae,Rt as oe,Sn as se,St as ce,Tn as le,Tt as ue,U as de,Un as fe,Ut as pe,V as me,Vn as he,Vt as ge,Wn as _e,Wt as ve,X as ye,Xn as be,Xt as xe,Yn as Se,Yt as Ce,Z as we,Zn as Te,Zt as Ee,_r as De,_t as Oe,a as ke,an as Ae,ar as je,at as Me,b as Ne,br as Pe,bt as Fe,c as Ie,cn as Le,cr as Re,ct as ze,d as Be,dr as Ve,dt as He,en as Ue,er as We,et as Ge,f as Ke,fr as qe,ft as Je,g as Ye,gr as J,gt as Xe,h as Ze,ht as Qe,i as $e,in as et,ir as tt,it as nt,j as rt,jn as it,jt as at,k as ot,kn as st,kt as ct,l as lt,lr as ut,lt as dt,m as ft,mr as pt,mt,n as ht,nn as gt,nr as _t,nt as vt,o as yt,on as bt,or as xt,ot as St,p as Ct,pt as wt,qn as Tt,qt as Et,r as Dt,rn as Ot,rr as kt,rt as At,s as jt,sn as Mt,sr as Nt,st as Pt,t as Ft,tn as It,tr as Lt,tt as Rt,u as zt,un as Bt,ur as Vt,ut as Ht,v as Ut,vr as Wt,vt as Gt,wn as Kt,wt as qt,xr as Jt,xt as Yt,y as Xt,yr as Zt,yt as Qt,z as $t,zn as en,zt as tn}from"./DocumentContext-Db4QZJLh.js";import{A as nn,C as rn,D as an,E as on,O as sn,S as cn,T as ln,_ as un,a as dn,b as fn,c as pn,d as mn,f as hn,g as gn,h as _n,i as vn,k as yn,l as bn,m as xn,n as Sn,o as Cn,p as wn,r as Tn,s as En,t as Dn,u as On,v as kn,w as An,x as jn,y as Mn}from"./panel-BNBODYwB.js";import{A as Nn,B as Pn,Bi as Y,Bn as Fn,Br as In,Ci as Ln,Cn as Rn,Ct as zn,D as Bn,Dr as Vn,Dt as Hn,E as Un,Et as Wn,Fn as Gn,Fr as Kn,G as qn,Gi as Jn,H as Yn,Hi as Xn,Hn as Zn,Hr as Qn,In as $n,Ir as er,J as tr,Jn as nr,Jr as rr,K as ir,Kn as ar,Kr as or,M as sr,Mn as cr,Mt as lr,N as ur,Nn as dr,Nr as fr,Nt as pr,O as mr,P as hr,Pn as gr,Q as _r,Qn as vr,Rr as yr,Sn as br,T as xr,Ti as Sr,Tt as Cr,U as wr,Ui as Tr,Un as Er,V as Dr,Vi as Or,Vn as kr,Vr as Ar,Vt as jr,W as Mr,Wi as Nr,Wr as Pr,Xn as Fr,Xt as Ir,Y as Lr,Yr as Rr,Z as zr,a as Br,bt as Vr,c as Hr,ci as Ur,d as Wr,ei as Gr,en as Kr,er as qr,et as Jr,f as Yr,gi as Xr,gn as Zr,gr as Qr,gt as $r,h as ei,i as ti,it as ni,j as ri,jn as ii,k as ai,kt as oi,l as si,li as ci,m as li,mi as ui,mr as di,n as fi,o as pi,p as mi,pi as hi,pr as gi,q as _i,qn as vi,r as yi,rn as bi,s as xi,ti as Si,tr as Ci,u as wi,ui as Ti,un as Ei,ur as Di,wi as Oi,wn as ki,wt as Ai,x as ji,xi as Mi,xn as Ni,y as Pi,yn as Fi,yt as Ii,zn as Li,zr as Ri}from"./prop-types-BukjUPXR.js";import{C as zi,S as Bi,d as Vi,g as Hi,l as Ui,m as Wi,o as Gi,p as Ki,t as qi,w as Ji,x as Yi}from"./button-DenIdY-r.js";import{a as Xi,c as Zi,d as Qi,f as $i,i as ea,l as ta,m as na,n as ra,o as ia,p as aa,r as oa,s as sa,t as ca,u as la}from"./agent-presence-DxGcS3q2.js";import{$ as ua,$t as da,A as fa,At as pa,B as ma,Bt as ha,C as ga,Ct as _a,D as va,Dt as ya,E as ba,F as xa,Ft as Sa,G as Ca,Gt as wa,H as Ta,Ht as Ea,I as Da,It as Oa,J as ka,Jt as Aa,K as ja,Kt as Ma,L as Na,Lt as Pa,M as Fa,Mt as Ia,N as La,Nt as Ra,O as za,Ot as Ba,P as Va,Pt as Ha,Q as Ua,Qt as Wa,R as Ga,Rt as Ka,S as qa,T as Ja,Tt as Ya,U as Xa,Ut as Za,V as Qa,Vt as $a,W as eo,Wt as to,X as no,Xt as ro,Y as io,Yt as ao,Z as oo,Zt as so,_t as co,an as lo,at as uo,b as fo,ct as po,dt as mo,en as ho,et as go,ft as _o,gt as vo,ht as yo,in as bo,it as xo,j as So,jt as Co,k as wo,kt as To,lt as Eo,m as Do,mt as Oo,nn as ko,nt as Ao,o as jo,on as Mo,ot as No,p as Po,pt as Fo,q as Io,qt as Lo,r as Ro,rt as zo,sn as Bo,t as Vo,tn as Ho,tt as Uo,u as Wo,ut as Go,vt as Ko,w as qo,x as Jo,y as Yo,yt as Xo,z as Zo,zt as Qo}from"./config-validation-events-_VhVoID2.js";import{i as $o,n as es,r as ts,t as ns}from"./toggle-group-Cs-1L92l.js";import{a as rs,b as is,c as as,i as os,n as ss,o as cs,s as ls,t as us,v as ds,x as fs,y as X}from"./dialog-B1es0EvU.js";import{a as ps,i as ms,n as hs,r as gs,t as _s}from"./collapsible-BhpeB6tu.js";import{t as vs}from"./checkbox-Co7Tjlri.js";import{t as ys}from"./label-DwEePOBC.js";import{n as bs,r as xs}from"./textarea-luaT-nOK.js";import{i as Ss,n as Cs,r as ws}from"./project-paths-CsGHlmFh.js";import{n as Ts,t as Es}from"./mcp-consent-store-CijO54Jd.js";import{$ as Ds,At as Os,Ct as ks,Dt as As,Ft as js,I as Ms,It as Ns,J as Ps,Mt as Fs,Ot as Is,Pt as Ls,Q as Rs,Tt as zs,X as Bs,Z as Vs,at as Hs,bt as Us,c as Ws,jt as Gs,k as Ks,w as qs}from"./dist-D2RGH7XO.js";import{n as Js}from"./dist-BiYnsAMa.js";import{n as Ys,o as Xs,r as Zs,t as Qs}from"./typing-burst-detector-Dd3NE2ME.js";import{t as $s}from"./target-navigation-intent-B9ffyxAO.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 ec(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.8.1`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-CuUV_174.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function tc(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=>{gn(e,()=>t.signal,()=>n=!0)},u=Mn(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?kn:un;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?rc:nc,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:nc(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 nc(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 rc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ic=class extends hn{#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||ac(),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=wn({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),_n.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ac(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var oc=class extends nn{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 ic({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=sc(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=sc(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=sc(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=sc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.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=>rn(t,e))}findAll(e={}){return this.getAll().filter(t=>rn(e,t))}notify(e){_n.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return _n.batch(()=>Promise.all(e.map(e=>e.continue().catch(ln))))}};function sc(e){return e.options.scope?.id}var cc=class extends nn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??cn(r,t),a=this.get(i);return a||(a=new mn({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(){_n.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=>An(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>An(e,t)):t}notify(e){_n.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},lc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new cc,this.#t=e.mutationCache||new oc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=xn.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(an(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=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return _n.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;_n.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return _n.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=_n.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ln).catch(ln)}invalidateQueries(e,t={}){return _n.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=_n.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(ln)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ln)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(an(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ln).catch(ln)}fetchInfiniteQuery(e){return e.behavior=tc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ln).catch(ln)}ensureInfiniteQueryData(e){return e.behavior=tc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return xn.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(jn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{on(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(jn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{on(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||=cn(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===sn&&(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()}},uc=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}}}})),dc=t(((e,t)=>{t.exports=uc()})),fc=t((e=>{var t=dc(),n=r(),i=Ji();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 ee(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 K(){B(H),B(U),B(W)}function te(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 ne(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var q,re;function ie(e){if(q===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);q=t&&t[1]||``,re=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-CuUV_174.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-Jk72eOkX.js","./compiler-runtime-Cs91PcD2.js","./button-DenIdY-r.js","./checkbox-Co7Tjlri.js","./dialog-B1es0EvU.js","./collapsible-BhpeB6tu.js","./textarea-luaT-nOK.js","./dist-DicqJavT.js","./dist-P7DYrfOB.js","./project-paths-CsGHlmFh.js","./McpConsentDialogBody-w45-uKw5.js","./label-DwEePOBC.js","./mcp-consent-store-CijO54Jd.js","./ActivityPanelDiffView-BNQupLE1.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-CvKl6isv.js","./prop-types-LW3nz6ON.js","./w3c-keyname-B5t0fahT.js","./toggle-group-Cs-1L92l.js","./panel-BNBODYwB.js","./min-VayDM1tY.js","./src-BYmEUJ3I.js","./colors-BbIH8S-B.js","./ordinal-C6wHcby9.js","./init-gbiKrEzm.js","./isObjectLike-BNNgtFA6.js","./now--RAZR_wd.js","./isSymbol-CiN6ou2H.js","./target-navigation-intent-D17qGD9f.js","./ActivityModeContent-Q1f1O1VR.js","./DocumentContext-CebW2pMB.js","./dist-Cp-iTcML.js","./dist-D2RGH7XO.js","./dist-BiYnsAMa.js","./dist-B3L7cm0M.js","./dist-CATLRngz.js","./stex-J8UMaf7u.js","./DocumentContext-B0sQn39F.css","./agent-presence-DxGcS3q2.js","./SettingsDialogBody-B582h2g9.js","./config-validation-events-CrZadlJb.js","./SourceEditor-SBPJy4qz.js","./typing-burst-detector-PBiL5ySf.js"])))=>i.map(i=>d[i]);
2
+ import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{a as r,i,n as a,o,r as s,t as c}from"./compiler-runtime-Cs91PcD2.js";import{$ as l,$n as u,$t as d,A as f,An as p,At as m,B as h,Bn as g,Bt as _,Cn as v,Ct as y,Dn as b,En as x,F as S,Fn as C,Ft as w,Gn as T,Gt as E,H as D,Hn as O,Ht as k,I as A,It as j,J as M,Jn as N,Jt as P,Kn as F,Kt as I,L,Ln as R,Lt as z,Mn as B,Mt as V,Nn as H,Nt as U,O as W,On as G,Ot as ee,Pn as K,Pt as te,Q as ne,Qn as q,Qt as re,R as ie,Rn as ae,Rt as oe,Sn as se,St as ce,Tn as le,Tt as ue,U as de,Un as fe,Ut as pe,V as me,Vn as he,Vt as ge,Wn as _e,Wt as ve,X as ye,Xn as be,Xt as xe,Yn as Se,Yt as Ce,Z as we,Zn as Te,Zt as Ee,_r as De,_t as Oe,a as ke,an as Ae,ar as je,at as Me,b as Ne,br as Pe,bt as Fe,c as Ie,cn as Le,cr as Re,ct as ze,d as Be,dr as Ve,dt as He,en as Ue,er as We,et as Ge,f as Ke,fr as qe,ft as Je,g as Ye,gr as J,gt as Xe,h as Ze,ht as Qe,i as $e,in as et,ir as tt,it as nt,j as rt,jn as it,jt as at,k as ot,kn as st,kt as ct,l as lt,lr as ut,lt as dt,m as ft,mr as pt,mt,n as ht,nn as gt,nr as _t,nt as vt,o as yt,on as bt,or as xt,ot as St,p as Ct,pt as wt,qn as Tt,qt as Et,r as Dt,rn as Ot,rr as kt,rt as At,s as jt,sn as Mt,sr as Nt,st as Pt,t as Ft,tn as It,tr as Lt,tt as Rt,u as zt,un as Bt,ur as Vt,ut as Ht,v as Ut,vr as Wt,vt as Gt,wn as Kt,wt as qt,xr as Jt,xt as Yt,y as Xt,yr as Zt,yt as Qt,z as $t,zn as en,zt as tn}from"./DocumentContext-CebW2pMB.js";import{A as nn,C as rn,D as an,E as on,O as sn,S as cn,T as ln,_ as un,a as dn,b as fn,c as pn,d as mn,f as hn,g as gn,h as _n,i as vn,k as yn,l as bn,m as xn,n as Sn,o as Cn,p as wn,r as Tn,s as En,t as Dn,u as On,v as kn,w as An,x as jn,y as Mn}from"./panel-BNBODYwB.js";import{A as Nn,B as Pn,Bi as Y,Bn as Fn,Br as In,Ci as Ln,Cn as Rn,Ct as zn,D as Bn,Dr as Vn,Dt as Hn,E as Un,Et as Wn,Fn as Gn,Fr as Kn,G as qn,Gi as Jn,H as Yn,Hi as Xn,Hn as Zn,Hr as Qn,In as $n,Ir as er,J as tr,Jn as nr,Jr as rr,K as ir,Kn as ar,Kr as or,M as sr,Mn as cr,Mt as lr,N as ur,Nn as dr,Nr as fr,Nt as pr,O as mr,P as hr,Pn as gr,Q as _r,Qn as vr,Rr as yr,Sn as br,T as xr,Ti as Sr,Tt as Cr,U as wr,Ui as Tr,Un as Er,V as Dr,Vi as Or,Vn as kr,Vr as Ar,Vt as jr,W as Mr,Wi as Nr,Wr as Pr,Xn as Fr,Xt as Ir,Y as Lr,Yr as Rr,Z as zr,a as Br,bt as Vr,c as Hr,ci as Ur,d as Wr,ei as Gr,en as Kr,er as qr,et as Jr,f as Yr,gi as Xr,gn as Zr,gr as Qr,gt as $r,h as ei,i as ti,it as ni,j as ri,jn as ii,k as ai,kt as oi,l as si,li as ci,m as li,mi as ui,mr as di,n as fi,o as pi,p as mi,pi as hi,pr as gi,q as _i,qn as vi,r as yi,rn as bi,s as xi,ti as Si,tr as Ci,u as wi,ui as Ti,un as Ei,ur as Di,wi as Oi,wn as ki,wt as Ai,x as ji,xi as Mi,xn as Ni,y as Pi,yn as Fi,yt as Ii,zn as Li,zr as Ri}from"./prop-types-LW3nz6ON.js";import{C as zi,S as Bi,d as Vi,g as Hi,l as Ui,m as Wi,o as Gi,p as Ki,t as qi,w as Ji,x as Yi}from"./button-DenIdY-r.js";import{a as Xi,c as Zi,d as Qi,f as $i,i as ea,l as ta,m as na,n as ra,o as ia,p as aa,r as oa,s as sa,t as ca,u as la}from"./agent-presence-DxGcS3q2.js";import{$ as ua,$t as da,A as fa,At as pa,B as ma,Bt as ha,C as ga,Ct as _a,D as va,Dt as ya,E as ba,F as xa,Ft as Sa,G as Ca,Gt as wa,H as Ta,Ht as Ea,I as Da,It as Oa,J as ka,Jt as Aa,K as ja,Kt as Ma,L as Na,Lt as Pa,M as Fa,Mt as Ia,N as La,Nt as Ra,O as za,Ot as Ba,P as Va,Pt as Ha,Q as Ua,Qt as Wa,R as Ga,Rt as Ka,S as qa,T as Ja,Tt as Ya,U as Xa,Ut as Za,V as Qa,Vt as $a,W as eo,Wt as to,X as no,Xt as ro,Y as io,Yt as ao,Z as oo,Zt as so,_t as co,an as lo,at as uo,b as fo,ct as po,dt as mo,en as ho,et as go,ft as _o,gt as vo,ht as yo,in as bo,it as xo,j as So,jt as Co,k as wo,kt as To,lt as Eo,m as Do,mt as Oo,nn as ko,nt as Ao,o as jo,on as Mo,ot as No,p as Po,pt as Fo,q as Io,qt as Lo,r as Ro,rt as zo,sn as Bo,t as Vo,tn as Ho,tt as Uo,u as Wo,ut as Go,vt as Ko,w as qo,x as Jo,y as Yo,yt as Xo,z as Zo,zt as Qo}from"./config-validation-events-CrZadlJb.js";import{i as $o,n as es,r as ts,t as ns}from"./toggle-group-Cs-1L92l.js";import{a as rs,b as is,c as as,i as os,n as ss,o as cs,s as ls,t as us,v as ds,x as fs,y as X}from"./dialog-B1es0EvU.js";import{a as ps,i as ms,n as hs,r as gs,t as _s}from"./collapsible-BhpeB6tu.js";import{t as vs}from"./checkbox-Co7Tjlri.js";import{t as ys}from"./label-DwEePOBC.js";import{n as bs,r as xs}from"./textarea-luaT-nOK.js";import{i as Ss,n as Cs,r as ws}from"./project-paths-CsGHlmFh.js";import{n as Ts,t as Es}from"./mcp-consent-store-CijO54Jd.js";import{$ as Ds,At as Os,Ct as ks,Dt as As,Ft as js,I as Ms,It as Ns,J as Ps,Mt as Fs,Ot as Is,Pt as Ls,Q as Rs,Tt as zs,X as Bs,Z as Vs,at as Hs,bt as Us,c as Ws,jt as Gs,k as Ks,w as qs}from"./dist-D2RGH7XO.js";import{n as Js}from"./dist-BiYnsAMa.js";import{n as Ys,o as Xs,r as Zs,t as Qs}from"./typing-burst-detector-PBiL5ySf.js";import{t as $s}from"./target-navigation-intent-D17qGD9f.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 ec(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.8.1`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-CuUV_174.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function tc(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=>{gn(e,()=>t.signal,()=>n=!0)},u=Mn(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?kn:un;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?rc:nc,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:nc(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 nc(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 rc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ic=class extends hn{#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||ac(),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=wn({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),_n.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ac(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var oc=class extends nn{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 ic({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=sc(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=sc(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=sc(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=sc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){_n.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=>rn(t,e))}findAll(e={}){return this.getAll().filter(t=>rn(e,t))}notify(e){_n.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return _n.batch(()=>Promise.all(e.map(e=>e.continue().catch(ln))))}};function sc(e){return e.options.scope?.id}var cc=class extends nn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??cn(r,t),a=this.get(i);return a||(a=new mn({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(){_n.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=>An(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>An(e,t)):t}notify(e){_n.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){_n.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){_n.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},lc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new cc,this.#t=e.mutationCache||new oc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=yn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=xn.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(an(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=fn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return _n.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;_n.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return _n.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=_n.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ln).catch(ln)}invalidateQueries(e,t={}){return _n.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=_n.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(ln)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ln)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(an(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ln).catch(ln)}fetchInfiniteQuery(e){return e.behavior=tc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ln).catch(ln)}ensureInfiniteQueryData(e){return e.behavior=tc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return xn.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(jn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{on(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(jn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{on(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||=cn(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===sn&&(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()}},uc=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}}}})),dc=t(((e,t)=>{t.exports=uc()})),fc=t((e=>{var t=dc(),n=r(),i=Ji();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 ee(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 K(){B(H),B(U),B(W)}function te(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 ne(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var q,re;function ie(e){if(q===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);q=t&&t[1]||``,re=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+q+e+re}var ae=!1;function oe(e,t){if(!e||ae)return``;ae=!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(`
5
5
  `),l=s.split(`
@@ -20,7 +20,7 @@ Error generating stack: `+e.message+`
20
20
  `}function H_(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;B_(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?V_(e,o.headerOptions):void 0)}}))}else{let s=B_(e,t,n,r,i,a,o);return s?V_(s,o?.headerOptions):void 0}}function U_(e,t,n,r,i,a){return H_(e,e,t,n,r,i,a)}function W_(e){let t=e.endsWith(`
21
21
  `),n=e.split(`
22
22
  `).map(e=>e+`
23
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function G_(e,t){return`${e}\u0000${t}`}function K_(e,t,n){let r=Ar(e).body,i=Ar(t).body;return r===i?``:U_(n,r,i,``,``,{context:3})}function q_(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ht(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=G_(t,r),a=n.get(e);if(a===void 0){let o=await fetch(`/api/history/${r}?docName=${encodeURIComponent(t)}`);if(i)return;if(!o.ok){s({status:`error`,diff:null});return}let c=await o.json();if(i)return;a=c.content??``,n.set(e,a)}if(i)return;let o=c.current?.document.getText(`source`).toString()??``,l=K_(a,o,t);if(i)return;s({status:`ready`,diff:l})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,err:e}),s({status:`error`,diff:null}))}})(),()=>{i=!0}},d=[e,t,n],r[3]=n,r[4]=t,r[5]=e,r[6]=u,r[7]=d):(u=r[6],d=r[7]),(0,Q.useEffect)(u,d),o}var J_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-BNQupLE1.js`),__vite__mapDeps([18,1,6,19]),import.meta.url)).ActivityPanelDiffView}));function Y_(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Y._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Y._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Y._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Y._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Y._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function X_(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Z_(e){return e.slice(0,7)}function Q_(e){return e.type===`upstream`?Y._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?Y._({id:`B2DrPb`}):e.author}function $_(e){let t=(0,$.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsx)(Qi,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(ia,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Xi,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(ta,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(la,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(sa,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(aa,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function ev(e){let t=(0,$.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(tt,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=Ci(i),t[1]=i,t[2]=a);let o=a,s=r?_r[o]??zr[o]:zr[o],c;t[3]!==s||t[4]!==i?(c=s??ii(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Z.jsx)($_,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Vc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(mc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(El,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(aa,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(mc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(El,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function tv(e){let t=(0,$.c)(23),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r),p=n.length;if(n.length===0)return null;let m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f(nv),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(De,{className:`size-3`}):(0,Z.jsx)(ps,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?Y._({id:`OKQe56`,values:{entryCount:p}}):Y._({id:`k9jDvw`,values:{entryCount:p}}),t[3]=p,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==d||t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[6]=d,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==a||t[12]!==s||t[13]!==n||t[14]!==d||t[15]!==c||t[16]!==i||t[17]!==u||t[18]!==l?(v=d&&n.map(e=>(0,Z.jsx)(mv,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[10]=o,t[11]=a,t[12]=s,t[13]=n,t[14]=d,t[15]=c,t[16]=i,t[17]=u,t[18]=l,t[19]=v):v=t[19];let y;return t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22],y}function nv(e){return!e}function rv(e){return e.checkpoint?e.checkpoint.kind:`save`}function iv(e){let t=rv(e);if(t===`save`)return Y._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${av(n)})`:``;return t===`bridge-merge-loss`?Y._({id:`uZAG7T`,values:{sizeSuffix:r}}):Y._({id:`_4rAQI`,values:{sizeSuffix:r}})}function av(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function ov(e){return e.type===`checkpoint`?rv(e)===`save`?`version`:`auto-save`:`wip`}function sv(e){let t=ov(e);return t===`version`?Y._({id:`RFQ1Yx`}):t===`auto-save`?Y._({id:`9Uv1CD`}):Y._({id:`Yea-K5`})}function cv(e){let t=ov(e);return t===`version`?Y._({id:`gg3Rpy`}):t===`auto-save`?Y._({id:`PXXeW8`}):Y._({id:`Pyp1NA`})}function lv(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function uv(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,c;t[0]===n?(o=t[1],c=t[2]):([o,...c]=n,t[0]=n,t[1]=o,t[2]=c);let l=c.length,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=u):u=t[3];let d;t[4]===o?d=t[5]:(d=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[u,o]}),t[4]=o,t[5]=d);let f;t[6]!==r||t[7]!==c?(f=r&&c.map(fv),t[6]=r,t[7]=c,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==d||t[11]!==f?(p=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[d,f]}),t[9]=a,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m;t[13]!==r||t[14]!==l||t[15]!==a||t[16]!==c.length?(m=c.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(dv)},children:[r?(0,Z.jsx)(De,{className:`size-3`}):(0,Z.jsx)(ps,{className:`size-3`}),r?(0,Z.jsx)(s,{id:`vLyv1R`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:l}})]}),t[13]=r,t[14]=l,t[15]=a,t[16]=c.length,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function dv(e){return!e}function fv(e,t){return(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function pv(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=q_(n,r,i),l;t[0]===c.status?l=t[1]:(l=c.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(F,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`38foVZ`})]}),t[0]=c.status,t[1]=l);let u;t[2]===c.status?u=t[3]:(u=c.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(s,{id:`vvWZnu`})}),t[2]=c.status,t[3]=u);let d;t[4]!==a||t[5]!==c.diff||t[6]!==c.status?(d=c.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(F,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(J_,{diff:c.diff,viewType:a})}),t[4]=a,t[5]=c.diff,t[6]=c.status,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[l,u,d]}),t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function mv(e){let t=(0,$.c)(130),{entry:n,prominent:r,isDark:a,diffLayout:o,cache:c,docName:l,expanded:u,onToggleExpanded:d,onRestoreSuccess:f}=e,p=r===void 0?!1:r,{_:m}=i(),h;t[0]===n.timestamp?h=t[1]:(h=Y_(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=Q_(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=X_(n.timestamp),t[4]=n.timestamp,t[5]=y);let b=y,x;t[6]===n.sha?x=t[7]:(x=Z_(n.sha),t[6]=n.sha,t[7]=x);let S=x,C=n.contributors.flatMap(hv),w;t[8]===n?w=t[9]:(w=lv(n),t[8]=n,t[9]=w);let T=w,[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(null),j=(0,Q.useId)(),M,N;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>A.current?.abort(),N=[],t[10]=M,t[11]=N):(M=t[10],N=t[11]),(0,Q.useEffect)(M,N);let P;t[12]!==n.sha||t[13]!==d?(P=()=>d(n.sha),t[12]=n.sha,t[13]=d,t[14]=P):P=t[14];let I=P,L;t[15]===D?L=t[16]:(L=function(){A.current?.abort(),A.current=null,k(!1),D(!1)},t[15]=D,t[16]=L);let R=L,z;t[17]!==m||t[18]!==l||t[19]!==n.sha||t[20]!==f||t[21]!==D?(z=async function(){k(!0);let e=new AbortController;A.current=e;let t=function(){e.signal.aborted||k(!1),A.current===e&&(A.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:l,commitSha:n.sha}),signal:e.signal})}catch(r){let i=r;!e.signal.aborted&&!(i instanceof DOMException&&i.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:l,sha:n.sha,err:i}),X.error(m({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)D(!1),f();else{let e=`HTTP ${r.status}`;try{let t=Ir.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:l,sha:n.sha,status:r.status,detail:e}),X.error(m({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=m,t[18]=l,t[19]=n.sha,t[20]=f,t[21]=D,t[22]=z):z=t[22];let B=z,V;t[23]!==n||t[24]!==a||t[25]!==p?(V=p?(()=>{let e=rv(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Or,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(Mc,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(kc,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(ev,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=V):V=t[26];let H=V,U=u?j:void 0,W=u?`bg-muted`:`hover:bg-muted/80`,G;t[27]===W?G=t[28]:(G=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,W],t[27]=W,t[28]=G);let ee=G.join(` `),K;t[29]===I?K=t[30]:(K=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I())},t[29]=I,t[30]=K);let te;t[31]===H?te=t[32]:(te=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:H}),t[31]=H,t[32]=te);let ne;t[33]!==v||t[34]!==n||t[35]!==p?(ne=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:iv(n)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:v})]}):(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:v}),t[33]=v,t[34]=n,t[35]=p,t[36]=ne):ne=t[36];let q;t[37]!==n.timestamp||t[38]!==g?(q=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:g}),t[37]=n.timestamp,t[38]=g,t[39]=q):q=t[39];let re;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=re):re=t[40];let ie;t[41]===n?ie=t[42]:(ie=sv(n),t[41]=n,t[42]=ie);let ae;t[43]===D?ae=t[44]:(ae=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=ae);let oe;t[45]===O?oe=t[46]:(oe=O?(0,Z.jsx)(F,{className:`size-3 animate-spin`}):(0,Z.jsx)($i,{className:`size-3`}),t[45]=O,t[46]=oe);let se;t[47]!==O||t[48]!==ie||t[49]!==ae||t[50]!==oe?(se=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":ie,disabled:O,onClick:ae,children:oe})}),t[47]=O,t[48]=ie,t[49]=ae,t[50]=oe,t[51]=se):se=t[51];let ce;t[52]===n?ce=t[53]:(ce=sv(n),t[52]=n,t[53]=ce);let le;t[54]===ce?le=t[55]:(le=(0,Z.jsx)(sr,{side:`top`,children:ce}),t[54]=ce,t[55]=le);let ue;t[56]!==se||t[57]!==le?(ue=(0,Z.jsxs)(ri,{children:[se,le]}),t[56]=se,t[57]=le,t[58]=ue):ue=t[58];let de;t[59]!==ne||t[60]!==q||t[61]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[ne,q,re,ue]}),t[59]=ne,t[60]=q,t[61]=ue,t[62]=de):de=t[62];let fe;t[63]===T?fe=t[64]:(fe=T.length>0&&(0,Z.jsx)(uv,{summaries:T}),t[63]=T,t[64]=fe);let pe=C.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:C.join(`, `),children:C.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),me;t[65]!==de||t[66]!==fe||t[67]!==pe?(me=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[de,fe,pe]}),t[65]=de,t[66]=fe,t[67]=pe,t[68]=me):me=t[68];let he;t[69]!==u||t[70]!==I||t[71]!==U||t[72]!==ee||t[73]!==K||t[74]!==te||t[75]!==me?(he=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":U,"data-testid":`timeline-entry-expand`,className:ee,onClick:I,onKeyDown:K,children:[te,me]}),t[69]=u,t[70]=I,t[71]=U,t[72]=ee,t[73]=K,t[74]=te,t[75]=me,t[76]=he):he=t[76];let ge;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(ge=u&&(0,Z.jsx)(pv,{sha:n.sha,docName:l,cache:c,diffLayout:o,panelId:j}),t[77]=c,t[78]=o,t[79]=j,t[80]=l,t[81]=n.sha,t[82]=u,t[83]=ge):ge=t[83];let _e;t[84]!==he||t[85]!==ge?(_e=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[he,ge]}),t[84]=he,t[85]=ge,t[86]=_e):_e=t[86];let ve;t[87]!==R||t[88]!==D?(ve=e=>{e?D(!0):R()},t[87]=R,t[88]=D,t[89]=ve):ve=t[89];let ye;t[90]===n?ye=t[91]:(ye=cv(n),t[90]=n,t[91]=ye);let be;t[92]===ye?be=t[93]:(be=(0,Z.jsx)(as,{children:ye}),t[92]=ye,t[93]=be);let xe;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(xe={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=xe):xe=t[98];let Se;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(Se={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=Se):Se=t[99];let Ce;t[100]===xe?Ce=t[101]:(Ce=(0,Z.jsx)(rs,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:xe,components:Se})}),t[100]=xe,t[101]=Ce);let we;t[102]!==be||t[103]!==Ce?(we=(0,Z.jsxs)(ls,{children:[be,Ce]}),t[102]=be,t[103]=Ce,t[104]=we):we=t[104];let Te;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=Te):Te=t[105];let Ee;t[106]===R?Ee=t[107]:(Ee=(0,Z.jsx)(qi,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:R,children:Te}),t[106]=R,t[107]=Ee);let De;t[108]===B?De=t[109]:(De=()=>B(),t[108]=B,t[109]=De);let Oe;t[110]===O?Oe=t[111]:(Oe=O?(0,Z.jsx)(F,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=Oe);let ke;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=ke):ke=t[112];let Ae;t[113]!==O||t[114]!==De||t[115]!==Oe?(Ae=(0,Z.jsxs)(qi,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:De,children:[Oe,ke]}),t[113]=O,t[114]=De,t[115]=Oe,t[116]=Ae):Ae=t[116];let je;t[117]!==Ee||t[118]!==Ae?(je=(0,Z.jsxs)(cs,{children:[Ee,Ae]}),t[117]=Ee,t[118]=Ae,t[119]=je):je=t[119];let Me;t[120]!==we||t[121]!==je?(Me=(0,Z.jsxs)(os,{children:[we,je]}),t[120]=we,t[121]=je,t[122]=Me):Me=t[122];let Ne;t[123]!==E||t[124]!==ve||t[125]!==Me?(Ne=(0,Z.jsx)(us,{open:E,onOpenChange:ve,children:Me}),t[123]=E,t[124]=ve,t[125]=Me,t[126]=Ne):Ne=t[126];let Pe;return t[127]!==_e||t[128]!==Ne?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[_e,Ne]}),t[127]=_e,t[128]=Ne,t[129]=Pe):Pe=t[129],Pe}function hv(e){return e.docs}function gv(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=Jn(),d=u===`dark`,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(null),[b]=(0,Q.useState)(bv),[x,S]=(0,Q.useState)(yv),C;t[1]===b?C=t[2]:(C=()=>{S(new Set),b.clear()},t[1]=b,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){S(new Set)},t[6]=D):D=t[6];let O=D,k,A;t[7]!==l||t[8]!==n?(k=()=>{if(!n){m([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){v(l({id:`brCtGB`}));return}let r=await t.json();if(e)return;m(r.entries??[]),v(null)}catch(t){let n=t;if(e)return;v(l({id:`brCtGB`})),console.error(`[timeline]`,n)}};return g(!0),t().finally(()=>{e||g(!1)}),y.current=setInterval(t,1e4),()=>{e=!0,y.current&&clearInterval(y.current)}},A=[n,l],t[7]=l,t[8]=n,t[9]=k,t[10]=A):(k=t[9],A=t[10]),(0,Q.useEffect)(k,A);let j,M,N,P,I,L,R,z;if(t[11]!==l||t[12]!==b||t[13]!==r||t[14]!==n||t[15]!==p||t[16]!==_||t[17]!==x||t[18]!==d||t[19]!==h||t[20]!==a||t[21]!==o||t[22]!==c){let e=[],i=[],u=!1;for(let t of p)t.type===`checkpoint`?(i.length>0&&(e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u}),i=[]),e.push({kind:`checkpoint`,entry:t}),u=!0):i.push(t);i.length>0&&e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u});let f;t[31]===p?f=t[32]:(f=p.some(vv),t[31]=p,t[32]=f);let m=!f,g=!h&&!_&&p.length>0;I=`flex h-full flex-col`;let v;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(En,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[33]=v):v=t[33];let y;t[34]!==l||t[35]!==r||t[36]!==g||t[37]!==a?(y=g&&(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsxs)(ns,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":l({id:`XvPJaT`}),variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(es,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(ul,{className:`size-3.5`})}),(0,Z.jsx)(es,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(Tc,{className:`size-3.5`})})]})}),(0,Z.jsx)(sr,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[34]=l,t[35]=r,t[36]=g,t[37]=a,t[38]=y):y=t[38];let S;t[39]===l?S=t[40]:(S=l({id:`IrYrzq`}),t[39]=l,t[40]=S);let C;t[41]===c?C=t[42]:(C=c?(0,Z.jsx)(F,{className:`size-4 animate-spin`}):(0,Z.jsx)(dl,{className:`size-4`}),t[41]=c,t[42]=C);let w;t[43]!==o||t[44]!==c||t[45]!==S||t[46]!==C?(w=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-sm`,onClick:o,disabled:c,"aria-label":S,className:`text-muted-foreground`,"data-testid":`timeline-save-version`,children:C})}),t[43]=o,t[44]=c,t[45]=S,t[46]=C,t[47]=w):w=t[47];let T;t[48]===c?T=t[49]:(T=(0,Z.jsx)(sr,{children:c?(0,Z.jsx)(s,{id:`uF9ruK`}):(0,Z.jsx)(s,{id:`IrYrzq`})}),t[48]=c,t[49]=T);let D;t[50]!==w||t[51]!==T?(D=(0,Z.jsxs)(ri,{children:[w,T]}),t[50]=w,t[51]=T,t[52]=D):D=t[52],t[53]!==y||t[54]!==D?(L=(0,Z.jsxs)(Cn,{children:[v,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,D]})]}),t[53]=y,t[54]=D,t[55]=L):L=t[55],R=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[56]!==l||t[57]!==h?(z=h&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":l({id:`o49mDZ`}),children:[1,2,3].map(_v)}),t[56]=l,t[57]=h,t[58]=z):z=t[58],t[59]!==_||t[60]!==h?(j=!h&&_&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:_})}),t[59]=_,t[60]=h,t[61]=j):j=t[61],t[62]!==p.length||t[63]!==_||t[64]!==h?(M=!h&&!_&&p.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Ta25TG`})})}),t[62]=p.length,t[63]=_,t[64]=h,t[65]=M):M=t[65],t[66]!==b||t[67]!==r||t[68]!==n||t[69]!==p||t[70]!==_||t[71]!==x||t[72]!==m||t[73]!==d||t[74]!==h?(N=!h&&!_&&m&&p.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:p.map(e=>(0,Z.jsx)(mv,{entry:e,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.sha),onToggleExpanded:E,onRestoreSuccess:O},e.sha))}),t[66]=b,t[67]=r,t[68]=n,t[69]=p,t[70]=_,t[71]=x,t[72]=m,t[73]=d,t[74]=h,t[75]=N):N=t[75],P=!h&&!_&&!m&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:e.map((e,t)=>e.kind===`checkpoint`?(0,Z.jsx)(mv,{entry:e.entry,prominent:!0,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.entry.sha),onToggleExpanded:E,onRestoreSuccess:O},e.entry.sha):(0,Z.jsx)(tv,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,isDark:d,diffLayout:r,cache:b,docName:n,expandedShas:x,onToggleExpanded:E,onRestoreSuccess:O},e.entries[0]?.sha??`wip-${t}`))}),t[11]=l,t[12]=b,t[13]=r,t[14]=n,t[15]=p,t[16]=_,t[17]=x,t[18]=d,t[19]=h,t[20]=a,t[21]=o,t[22]=c,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=I,t[28]=L,t[29]=R,t[30]=z}else j=t[23],M=t[24],N=t[25],P=t[26],I=t[27],L=t[28],R=t[29],z=t[30];let B;t[76]!==j||t[77]!==M||t[78]!==N||t[79]!==P||t[80]!==R||t[81]!==z?(B=(0,Z.jsxs)(`div`,{className:R,children:[z,j,M,N,P]}),t[76]=j,t[77]=M,t[78]=N,t[79]=P,t[80]=R,t[81]=z,t[82]=B):B=t[82];let V;return t[83]!==I||t[84]!==L||t[85]!==B?(V=(0,Z.jsxs)(`div`,{className:I,children:[L,B]}),t[83]=I,t[84]=L,t[85]=B,t[86]=V):V=t[86],V}function _v(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(pa,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(pa,{className:`h-3 w-28`}),(0,Z.jsx)(pa,{className:`h-3 w-40`})]})]},e)}function vv(e){return e.type===`checkpoint`}function yv(){return new Set}function bv(){return new ea(32)}var xv=[{id:`outline`,icon:Jc},{id:`links`,icon:be},{id:`graph`,icon:Zc},{id:`timeline`,icon:wc}];function Sv(e){return e===`outline`?Y._({id:`dD7NPy`}):e===`links`?Y._({id:`Rj01Fz`}):e===`graph`?Y._({id:`x2fr_j`}):Y._({id:`cklVjM`})}function Cv(){return n(()=>import(`./GraphPanel-DQPd07Df.js`),__vite__mapDeps([20,1,21,6,3,7,22,23,12,13,24,25,26,27,28,29,30,31,32,33]),import.meta.url)}var wv=(0,Q.lazy)(async()=>({default:(await Cv()).GraphPanel})),Tv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DBUlDDd_.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function Ev(e){let t=(0,$.c)(16),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c,onSaveVersion:l,saving:u}=e,{_:d}=i(),[f,p]=(0,Q.useState)(`unified`),m;t[0]!==d||t[1]!==a||t[2]!==c||t[3]!==o?(m=c===`doc`?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(ns,{type:`single`,variant:`outline`,value:a,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:xv.map(Dv)})}):null,t[0]=d,t[1]=a,t[2]=c,t[3]=o,t[4]=m):m=t[4];let h;t[5]!==a||t[6]!==f||t[7]!==n||t[8]!==r||t[9]!==c||t[10]!==l||t[11]!==u?(h=c===`doc`?(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-${a}`,"aria-labelledby":`tab-${a}`,className:`min-h-0 flex-1`,children:[a===`outline`&&(0,Z.jsx)(Zs,{docName:n,isSourceMode:r}),a===`links`&&(0,Z.jsx)(__,{docName:n}),a===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-lCAuQ`})}),children:(0,Z.jsx)(wv,{activeDocName:n})}),a===`timeline`&&(0,Z.jsx)(gv,{docName:n,diffLayout:f,onDiffLayoutChange:p,onSaveVersion:l,saving:u})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(Tv,{})})}),t[5]=a,t[6]=f,t[7]=n,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(Z.Fragment,{children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function Dv(e){let{id:t,icon:n}=e,r=Sv(t);return(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(es,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(hr,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(sr,{side:`bottom`,children:r})]},t)}function Ov(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function kv(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Av(e){return e/100*window.innerHeight}function jv(e){return e/100*window.innerWidth}function Mv(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Nv({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Mv(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=kv(t,i);break;case`em`:r=Ov(t,i);break;case`vh`:r=Av(i);break;case`vw`:r=jv(i);break}return r}function Pv(e){return parseFloat(e.toFixed(3))}function Fv({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Iv(e){let{panels:t}=e,n=Fv({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Pv(Nv({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Pv(Nv({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Pv(Nv({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Pv(Nv({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function Lv(e,t=`Assertion error`){if(!e)throw Error(t)}function Rv(e,t){return Array.from(t).sort(e===`horizontal`?zv:Bv)}function zv(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Bv(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Vv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Hv(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Uv({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Hv(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Lv(i,`No rect found`),i}var Wv;function Gv(){return Wv===void 0&&(Wv=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Wv}function Kv(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Rv(n,Array.from(t.children).filter(Vv).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,Uv({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Gv()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:Fv({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var qv=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},Jv=new Map,Yv=new qv;function Xv(e){Jv=new Map(Jv),Jv.delete(e)}function Zv(e,t){for(let[t]of Jv)if(t.id===e)return t}function Qv(e,t){for(let[t,n]of Jv)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function $v(){return Jv}function ey(e,t){return Yv.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function ty(e,t){let n=Jv.get(e);Jv=new Map(Jv),Jv.set(e,t),Yv.emit(`groupChange`,{group:e,prev:n,next:t})}function ny(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Hv(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function ry(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function iy(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:uy(e),b:uy(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Lv(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:ly(cy(n.a)),b:ly(cy(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var ay=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function oy(e){let t=getComputedStyle(dy(e)??e).display;return t===`flex`||t===`inline-flex`}function sy(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||oy(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||ay.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function cy(e){let t=e.length;for(;t--;){let n=e[t];if(Lv(n,`Missing node`),sy(n))return n}return null}function ly(e){return e&&Number(getComputedStyle(e).zIndex)||0}function uy(e){let t=[];for(;e;)t.push(e),e=dy(e);return t}function dy(e){let{parentNode:t}=e;return ry(t)?t.host:t}function fy(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function py({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Vv(n)||n.contains(e)||e.contains(n))return!0;if(iy(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(fy(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function my(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Kv(r),a=ny(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&py({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function hy(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function gy(e,t,n=0){return Math.abs(Pv(e)-Pv(t))<=n}function _y(e,t){return gy(e,t)?0:e>t?1:-1}function vy({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(_y(r,c)<0)if(a){let e=(i+c)/2;r=_y(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Pv(r),r}function yy({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(gy(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Lv(u!=null,`Invalid first pivot index`),Lv(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Lv(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Lv(n!=null,`Previous layout not found for panel index ${t}`),gy(n,i)){let t=o-n;_y(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Lv(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Lv(n!=null,`Previous layout not found for panel index ${t}`),gy(n,o)){let t=n-i;_y(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Lv(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&_y(i,c)<0)if(e>0){let t=c-o,n=t/2;_y(i+e,c)<0&&(e=_y(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;_y(i-e,c)<0&&(e=_y(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];Lv(e!=null,`Previous layout not found for panel index ${r}`);let a=vy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];Lv(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=vy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!gy(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(hy(c,l))return i;{let t=e<0?d:u,r=s[t];Lv(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=vy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!gy(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Lv(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=vy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(gy(i,s)||(t-=s-i,l[r]=s),gy(t,0))break;e>0?r--:r++}}}if(!gy(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function by(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||_y(e[n],t[n])!==0)return!1;return!0}function xy({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!gy(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Lv(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Lv(i!=null,`No layout data found for index ${e}`);let o=r[e];Lv(o!=null,`No layout data found for index ${e}`);let s=vy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!gy(a,0))for(let e=0;e<t.length;e++){let n=r[e];Lv(n!=null,`No layout data found for index ${e}`);let i=n+a,o=vy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,gy(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Sy({groupId:e,panelId:t}){let n=()=>{let t=$v();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=xy({layout:yy({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});by(l,p)||ty(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&gy(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Fv({group:t});o(Pv(Nv({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Cy(e){e.defaultPrevented||my(e,$v()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=Sy({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function wy(e){let t=$v();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Ty({groupId:e}){let t=()=>{let t=$v();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=xy({layout:e,panelConstraints:r});return n?o:(by(o,c)||ty(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Ey(e,t){let n=wy(e),r=Qv(n.id,!0),i=n.separators.find(t=>t.element===e);Lv(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Lv(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Ty({groupId:n.id}).getLayout(),c=xy({layout:yy({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});by(s,c)||ty(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Dy(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=wy(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Ey(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Ey(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Ey(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Ey(t,-5);break;case`End`:e.preventDefault(),Ey(t,100);break;case`Enter`:{e.preventDefault();let n=wy(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Qv(n.id,!0),o=n.separators.find(e=>e.element===t);Lv(o,`Matching separator not found`);let s=a.get(o);Lv(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Lv(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Ey(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=wy(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Lv(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Ey(t,-100);break}}var Oy={cursorFlags:0,state:`inactive`},ky=new qv;function Ay(){return Oy}function jy(e){return ky.addListener(`change`,e)}function My(e){let t=Oy,n={...Oy};n.cursorFlags=e,Oy=n,ky.emit(`change`,{prev:t,next:n})}function Ny(e){let t=Oy;Oy=e,ky.emit(`change`,{prev:t,next:e})}function Py(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=$v(),n=my(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Ny({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Fy=e=>e,Iy=()=>{},Ly=1,Ry=2,zy=4,By=8,Vy=3,Hy=12,Uy;function Wy(){return Uy===void 0&&(Uy=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Uy=!0)),Uy}function Gy({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Wy()){let t=(e&Ly)!==0,n=(e&Ry)!==0,r=(e&zy)!==0,i=(e&By)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return Wy()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Ky=new WeakMap;function qy(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Ky.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Ay();switch(r.state){case`active`:case`hover`:{let e=Gy({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}Ky.set(e,{prevStyle:t,styleSheet:n})}function Jy({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=yy({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(by(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ly:Ry;break;case`vertical`:s|=d<0?zy:By;break}}else ty(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Vy:c|=s&Vy,t.movementY===0?c|=o&Hy:c|=s&Hy,My(c),qy(e)}function Yy(e){let t=$v(),n=Ay();switch(n.state){case`active`:Jy({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Xy(e){if(e.defaultPrevented)return;let t=Ay(),n=$v();switch(t.state){case`active`:if(e.buttons===0){Ny({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Qv(e.group.id,!0);ty(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Jy({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=my(e,n);r.length===0?t.state!==`inactive`&&Ny({cursorFlags:0,state:`inactive`}):Ny({cursorFlags:0,hitRegions:r,state:`hover`}),qy(e.currentTarget);break}}}function Zy(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ay().state){case`hover`:Ny({cursorFlags:0,state:`inactive`})}}function Qy(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ay();switch(t.state){case`active`:Ny({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(qy(e.currentTarget),t.hitRegions.forEach(e=>{let t=Qv(e.group.id,!0);ty(e.group,t)}),e.preventDefault())}}function $y(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Pv(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Pv((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function eb(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Fv({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Pv(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function tb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function nb({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=Pv(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=Pv((r[e]??0)/a*l);else{let e=Pv(l/c.length);for(let t of c)u[t]=e}return u}function rb(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var ib=new Map;function ab(e){let t=!0;Lv(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=Fv({group:e});if(t===0)return;let n=Qv(e.id);if(!n)return;let r=Iv(e),i=n.defaultLayoutDeferred?$y(r):n.layout,a=xy({layout:nb({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&by(n.layout,a)&&tb(n.derivedPanelConstraints,r)&&n.groupSize===t)return;ty(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else eb(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Lv(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=Fv({group:e}),s=Iv(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(rb(e.panels,l)||(l=void 0));let u=xy({layout:e.mutableState.layouts[c]??l??$y(s),panelConstraints:s}),d=e.element.ownerDocument;ib.set(d,(ib.get(d)??0)+1);let f=new Map;return Kv(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),ty(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Lv(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,Dy)}),ib.get(d)===1&&(d.addEventListener(`dblclick`,Cy,!0),d.addEventListener(`pointerdown`,Py,!0),d.addEventListener(`pointerleave`,Yy),d.addEventListener(`pointermove`,Xy),d.addEventListener(`pointerout`,Zy),d.addEventListener(`pointerup`,Qy,!0)),function(){t=!1,ib.set(d,Math.max(0,(ib.get(d)??0)-1)),Xv(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Dy)}),ib.get(d)||(d.removeEventListener(`dblclick`,Cy,!0),d.removeEventListener(`pointerdown`,Py,!0),d.removeEventListener(`pointerleave`,Yy),d.removeEventListener(`pointermove`,Xy),d.removeEventListener(`pointerout`,Zy),d.removeEventListener(`pointerup`,Qy,!0)),a.disconnect()}}function ob(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function sb(e){let t=(0,Q.useId)();return`${e??t}`}var cb=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function lb(e){let t=(0,Q.useRef)(e);return cb(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function ub(...e){return lb(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function db(e){let t=(0,Q.useRef)({...e});return cb(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var fb=(0,Q.createContext)(null);function pb(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Fy});(0,Q.useImperativeHandle)(t,()=>n.current,[]),cb(()=>{Object.assign(n.current,Ty({groupId:e}))})}function mb({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=lb(e=>{by(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=lb(e=>{by(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=sb(s),v=(0,Q.useRef)(null),[y,b]=ob(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=ub(v,a);pb(_,o);let C=lb((e,t)=>{let r=Ay(),i=Zv(e),a=Qv(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=db({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Rv(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Rv(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Zv(_),i=Qv(_);r&&i&&ty(r,{...i,derivedPanelConstraints:Iv(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,Q.useRef)(null);return cb(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=ab(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Qv(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=ey(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=gy(t.collapsedSize,i[t.panelId]),a=gy(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Ay().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(fb.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}mb.displayName=`Group`;function hb(){let e=(0,Q.useContext)(fb);return Lv(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function gb(e,t){let{id:n}=hb(),r=(0,Q.useRef)({collapse:Iy,expand:Iy,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Iy});(0,Q.useImperativeHandle)(t,()=>r.current,[]),cb(()=>{Object.assign(r.current,Sy({groupId:n,panelId:e}))})}function _b({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=sb(c),_=db({disabled:a}),v=(0,Q.useRef)(null),y=ub(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=hb(),T=d!==null,E=lb((e,t,n)=>{d?.(e,c,n)});cb(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),gb(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>ey(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...vb,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}_b.displayName=`Panel`;var vb={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function yb(){return(0,Q.useRef)(null)}function bb({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=xy({layout:yy({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=xy({layout:yy({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function xb({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=sb(a),l=db({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=ub(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=hb(),x=v===`horizontal`?`vertical`:`horizontal`;cb(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=jy(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=ey(_,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(bb({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}xb.displayName=`Separator`;var Sb={name:`toml`,startState:function(){return{inString:!1,stringType:``,lhs:!0,inArray:0}},token:function(e,t){let n;if(!t.inString&&(n=e.match(/^('''|"""|'|")/))&&(t.stringType=n[0],t.inString=!0),e.sol()&&!t.inString&&t.inArray===0&&(t.lhs=!0),t.inString){for(;t.inString;)if(e.match(t.stringType))t.inString=!1;else if(e.peek()===`\\`)e.next(),e.next();else if(e.eol())break;else e.match(/^.[^\\\"\']*/);return t.lhs?`property`:`string`}else if(t.inArray&&e.peek()===`]`)return e.next(),t.inArray--,`bracket`;else if(t.lhs&&e.peek()===`[`&&e.skipTo(`]`))return e.next(),e.peek()===`]`&&e.next(),`atom`;else if(e.peek()===`#`)return e.skipToEnd(),`comment`;else if(e.eatSpace())return null;else if(t.lhs&&e.eatWhile(function(e){return e!=`=`&&e!=` `}))return`property`;else if(t.lhs&&e.peek()===`=`)return e.next(),t.lhs=!1,null;else if(!t.lhs&&e.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return`atom`;else if(!t.lhs&&(e.match(`true`)||e.match(`false`)))return`atom`;else if(!t.lhs&&e.peek()===`[`)return t.inArray++,e.next(),`bracket`;else if(!t.lhs&&e.match(/^\-?\d+(?:\.\d+)?/))return`number`;else e.eatSpace()||e.next();return null},languageData:{commentTokens:{line:`#`}}},Cb=$t({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),wb=ie({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Tb(e){switch(e.toLowerCase()){case`json`:return Js().language;case`toml`:return Ws.define(Sb);default:return null}}function Eb(e){let t=(0,$.c)(5),{_:n}=i(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`loading`},t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),s,c;return t[1]!==n||t[2]!==e?(s=()=>{let t=!1,r=new AbortController;return o({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:r.signal}).then(async e=>{if(!e.ok){let t=e.status;throw Error(n({id:`PauP7d`,values:{status:t}}))}return e.text()}).then(e=>{t||o({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||o({status:`error`,message:e instanceof Error?e.message:n({id:`ig5vUe`})})}),()=>{t=!0,r.abort()}},c=[e,n],t[1]=n,t[2]=e,t[3]=s,t[4]=c):(s=t[3],c=t[4]),(0,Q.useEffect)(s,c),a}function Db(e){let t=(0,$.c)(28),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:c}=Jn(),l=Eb(n),u=l.status===`loaded`?l.content:null,d,f;if(t[0]!==i||t[1]!==u||t[2]!==c?(d=()=>{if(!a.current||u===null)return;let e=Tb(i),t=c===`dark`?Cb:wb,n=[Qs,...e?[e]:[],Bs.editable.of(!0),As.readOnly.of(!0),Bs.lineWrapping,t],r=new Bs({state:As.create({doc:u,extensions:n}),parent:a.current});return o.current=r,()=>{r.destroy(),o.current=null}},f=[u,i,c],t[0]=i,t[1]=u,t[2]=c,t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f),l.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Md709y`,values:{fileName:r}})}),t[5]=r,t[6]=e);let n;return t[7]!==i||t[8]!==r||t[9]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loading`,"data-text-viewer-extension":i,children:e}),t[7]=i,t[8]=r,t[9]=e,t[10]=n):n=t[10],n}if(l.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(s,{id:`qdBUHP`,values:{fileName:r}})}),t[11]=r,t[12]=e);let a;t[13]===l.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:l.message}),t[13]=l.message,t[14]=a);let o;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`9npOH9`}),t[15]=o):o=t[15];let c;t[16]===n?c=t[17]:(c=(0,Z.jsx)(`a`,{href:n,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:o}),t[16]=n,t[17]=c);let u;return t[18]!==i||t[19]!==r||t[20]!==e||t[21]!==a||t[22]!==c?(u=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`error`,"data-text-viewer-extension":i,children:[e,a,c]}),t[18]=i,t[19]=r,t[20]=e,t[21]=a,t[22]=c,t[23]=u):u=t[23],u}let p;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[24]=p):p=t[24];let m;return t[25]!==i||t[26]!==r?(m=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":i,children:p}),t[25]=i,t[26]=r,t[27]=m):m=t[27],m}function Ob(e){return Qn(`/api/asset?path=${encodeURIComponent(e)}`)}function kb(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Ab(e){let t=(0,$.c)(28),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=Ob(n),t[0]=n,t[1]=o);let c=o,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u.includes(`.`)?u.split(`.`).pop()??``:``;if(f=e.length>0?e.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[12]!==u||t[13]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(nt,{src:c,title:u,fillContainer:!0})}),t[12]=u,t[13]=c,t[14]=e):e=t[14];let n;t[15]!==u||t[16]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[15]=u,t[16]=e,t[17]=n):n=t[17],p=n;break bb0}if(d===`text`){let r;t[18]===n?r=t[19]:(r=kb(n),t[18]=n,t[19]=r),p=(0,Z.jsx)(Db,{src:r,fileName:u,extension:e.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,t[9]=d,t[10]=f,t[11]=p}else d=t[9],f=t[10],p=t[11];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[20]!==d||t[21]!==f||t[22]!==u||t[23]!==c?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(St,{src:c,alt:u,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 text-center`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-md border bg-muted font-medium text-muted-foreground text-sm`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:u}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(qi,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsx)(`a`,{href:c,children:(0,Z.jsx)(s,{id:`9npOH9`})})}),(0,Z.jsx)(qi,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:(0,Z.jsx)(s,{id:`Ruuu3v`})})]})]})}),t[20]=d,t[21]=f,t[22]=u,t[23]=c,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:m}),t[25]=u,t[26]=m,t[27]=h):h=t[27],h}function jb(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(pa,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(pa,{className:`h-4 w-full`}),(0,Z.jsx)(pa,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}var Mb={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Nb(e){let t=(0,$.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=Jn(),s=Mb[r],c=s?(o===`dark`?_r[s]:void 0)??zr[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=Bi(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(Qi,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,Z.jsx)(Zi,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(ia,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function Pb(e){let{installState:t}=e;return t.installed===null?Y._({id:`IA6JW2`}):t.installed===!1?Y._({id:`5SwVv1`}):null}function Fb(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:Y._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:Y._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:Y._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function Ib(e){return Ni(e)}function Lb(e){return Y._({id:`h_HYHD`,values:{displayName:e}})}var Rb=`claude.ai`;async function zb(e,t=qh){(await t(Ni(e))).ok?X.success(Lb(Rb)):X.error(Y._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:Rb}}))}function Bb(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??qh,u=e.onWebFallbackSuccess??Hb,d=e.onWebFallbackError??Vb,{displayName:f}=r,p,m,h,g,_,v,y,b,x,S;if(t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==c||t[4]!==d||t[5]!==u||t[6]!==l||t[7]!==s||t[8]!==r||t[9]!==f){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Fb({target:r,installState:a,isElectronHost:o}),i=Pb({target:r,installState:a,isElectronHost:o}),C=()=>{e.tooltip&&l(e.tooltip.installAction.url)},w;t[20]!==d||t[21]!==u||t[22]!==l||t[23]!==s||t[24]!==r?(w=()=>{(async()=>{let e=await l(Ib(s));e.ok?u(r):d(r,e.detail??e.reason)})()},t[20]=d,t[21]=u,t[22]=l,t[23]=s,t[24]=r,t[25]=w):w=t[25];let T=w;if(e.enabled){let e=`open-in-agent-item-${r.id}`,i;t[26]!==n||t[27]!==f?(i=n({id:`NnQapF`,values:{targetDisplayName:f}}),t[26]=n,t[27]=f,t[28]=i):i=t[28];let a;t[29]===r.id?a=t[30]:(a=(0,Z.jsx)(Nb,{id:r.id,"aria-hidden":`true`}),t[29]=r.id,t[30]=a);let o;t[31]===r.displayName?o=t[32]:(o=(0,Z.jsx)(`span`,{children:r.displayName}),t[31]=r.displayName,t[32]=o);let s;t[33]!==c||t[34]!==i||t[35]!==a||t[36]!==o||t[37]!==e?(s=(0,Z.jsxs)(go,{onSelect:c,"data-testid":e,"aria-label":i,children:[a,o]}),t[33]=c,t[34]=i,t[35]=a,t[36]=o,t[37]=e,t[38]=s):s=t[38],S=s;break bb0}if(!e.tooltip){let e=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),a;t[39]===r.id?a=t[40]:(a=(0,Z.jsx)(Nb,{id:r.id,"aria-hidden":`true`}),t[39]=r.id,t[40]=a);let o;t[41]===r.displayName?o=t[42]:(o=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[41]=r.displayName,t[42]=o),S=(0,Z.jsxs)(go,{disabled:!0,"data-testid":`open-in-agent-item-${r.id}`,"aria-label":e,children:[a,o,i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null]});break bb0}let E=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),D=e.tooltip.webFallback?.label??``;m=zo;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(Nb,{id:r.id,"aria-hidden":`true`,className:`mr-2`}),t[43]=r.id,t[44]=k);let A;t[45]===r.displayName?A=t[46]:(A=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[45]=r.displayName,t[46]=A);let j;t[47]===i?j=t[48]:(j=i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null,t[47]=i,t[48]=j),t[49]!==E||t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==O?(x=(0,Z.jsxs)(uo,{"data-testid":O,"data-row-disabled":``,"aria-label":E,children:[k,A,j]}),t[49]=E,t[50]=k,t[51]=A,t[52]=j,t[53]=O,t[54]=x):x=t[54],p=xo,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(Uo,{className:`font-normal text-muted-foreground text-xs`,"data-testid":`open-in-agent-message-${r.id}`,children:e.tooltip.message}),t[55]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Ao,{}),t[55]=v):v=t[55],y=(0,Z.jsx)(go,{onSelect:C,"data-testid":`open-in-agent-install-${r.id}`,children:(0,Z.jsx)(`span`,{children:e.tooltip.installAction.label})}),b=e.tooltip.webFallback?(0,Z.jsxs)(go,{onSelect:T,"data-testid":`open-in-agent-web-fallback-${r.id}`,"aria-label":n({id:`lsOFZR`,values:{webFallbackLabel:D}}),children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:e.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:n({id:`Z9BoIy`})})]}):null}t[0]=n,t[1]=a,t[2]=o,t[3]=c,t[4]=d,t[5]=u,t[6]=l,t[7]=s,t[8]=r,t[9]=f,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}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];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[56]!==p||t[57]!==h||t[58]!==g||t[59]!==_||t[60]!==v||t[61]!==y||t[62]!==b?(C=(0,Z.jsxs)(p,{className:h,"data-testid":g,children:[_,v,y,b]}),t[56]=p,t[57]=h,t[58]=g,t[59]=_,t[60]=v,t[61]=y,t[62]=b,t[63]=C):C=t[63];let w;return t[64]!==m||t[65]!==x||t[66]!==C?(w=(0,Z.jsxs)(m,{children:[x,C]}),t[64]=m,t[65]=x,t[66]=C,t[67]=w):w=t[67],w}function Vb(){}function Hb(){}function Ub(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=Cg(),{dispatch:a}=fg(),o=Fo(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=$h({workspace:o});t[7]===n?s=t[8]:(s=Bi(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=bh.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(Wb,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{ng(t),i()}},t.id)}),t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`div`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Wb(e){let t=(0,$.c)(22),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(Nb,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===n.tagline?f=t[8]:(f=n.tagline?(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.tagline}):null,t[7]=n.tagline,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r===`missing`?(0,Z.jsx)($o,{"aria-hidden":`true`,className:`size-3`}):null,t[12]=r,t[13]=m);let h;t[14]!==c||t[15]!==m?(h=(0,Z.jsxs)(`p`,{className:`mt-auto inline-flex items-center gap-1 pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==o||t[19]!==p||t[20]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[p,h]}),t[17]=s,t[18]=o,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}var Gb=3100,Kb=3;function qb(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Kb;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var Jb={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},Yb=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function Xb(e,t={}){let n=t.rng??Math.random,r=t.colors??Yb,i=Jb[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var Zb=1.8,Qb=90,$b=16,ex=380,tx=.025,nx=.1,rx=.18,ix=400,ax=9.2736,ox=18.1799,sx=14.5244,cx={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function lx(e,t){let{halfWidth:n,apexLift:r}=cx[t];return`M${e-n} ${sx+.3} Q${e} ${sx-r}, ${e+n} ${sx+.3}`}function ux(e){let t=1.5,n=.3;return`M${e-t} ${sx-n} Q${e} ${sx+1.4}, ${e+t} ${sx-n}`}var dx=15,fx=15;function px(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function mx(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=qb(g,t);_(n),y(vx),S(Xb(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Gb)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(_x),S(Xb(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Gb))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/ex)),C=Math.max(-1,Math.min(1,b/ex)),w=S*$b,T=-C*$b,E=0,D=0;if(x>=1){let e=Math.min(x/Qb,1)*Zb;E=y/x*e,D=b/x*e}let O=Math.abs(T-r)<.01&&Math.abs(w-i)<.01&&Math.abs(E-a)<.01&&Math.abs(D-o)<.01;if(!m&&O)return;l(),r+=(T-r)*nx,i+=(w-i)*nx,u.style.transform=`perspective(${ix}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*rx,o+=(D-o)*rx;let k=i*tx,A=-r*tx,j=a+k,M=o+A;h.current.x=j,h.current.y=M,p.current?.setAttribute(`transform`,`translate(${j.toFixed(3)} ${M.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=Bi(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=Bi(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=Bi(`ok-blob-eye`,W),t[22]=W,t[23]=G);let ee;t[24]===G?ee=t[25]:(ee=(0,Z.jsx)(`ellipse`,{cx:ax,cy:sx,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=ee);let K=(F||T)&&`ok-blob-eye-hidden`,te;t[26]===K?te=t[27]:(te=Bi(`ok-blob-eye ok-blob-eye-right`,K),t[26]=K,t[27]=te);let ne;t[28]===te?ne=t[29]:(ne=(0,Z.jsx)(`ellipse`,{cx:ox,cy:sx,rx:1.2722,ry:1.9083,className:te}),t[28]=te,t[29]=ne);let q;t[30]===I?q=t[31]:(q=lx(ax,I),t[30]=I,t[31]=q);let re=(!F||T)&&`ok-blob-eye-hidden`,ie;t[32]===re?ie=t[33]:(ie=Bi(`ok-blob-happy-eye`,re),t[32]=re,t[33]=ie);let ae;t[34]!==q||t[35]!==ie?(ae=(0,Z.jsx)(`path`,{d:q,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[34]=q,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=lx(ox,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=Bi(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:ux(ax),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:ux(ox),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==ee||t[47]!==ne||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[ee,ne,ae,le,ue]}),t[46]=ee,t[47]=ne,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(hx)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:gx,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function hx(e){return(0,Z.jsx)(`circle`,{cx:dx+e.originDx,cy:fx+e.originDy,r:e.size,className:`ok-blob-firework`,style:px(e)},e.id)}function gx(e){return e.preventDefault()}function _x(e){return e+1}function vx(e){return e+1}function yx(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(mx,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function bx(){let e=(0,$.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=_a(`command-palette`),e[0]=t):t=e[0];let n=t,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(D,{children:n}),e[1]=r):r=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[r,` `,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A1taO8`})})]}),e[2]=i):i=e[2],i}var xx=`open-knowledge:create-top-level-file`;function Sx(){window.dispatchEvent(new CustomEvent(xx))}function Cx(e){let t=()=>e();return window.addEventListener(xx,t),()=>window.removeEventListener(xx,t)}function wx(){let e=(0,$.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(void 0),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(0),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(void 0),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(Ox);if(e)return;let r=t.ok?Cr.safeParse(n):null;r?.success?(o(kx(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=ji(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(u.current)}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(){clearTimeout(u.current),u.current=setTimeout(()=>c(Dx),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(Ex);if(!e.ok)return;let n=Cr.safeParse(t);n.success&&o(kx(n.data.documents))}).catch(Tx)},e[2]=p):p=e[2];let m=p,h=a!==null,g=a===0,_;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){n(e),e||i(void 0)},e[3]=_):_=e[3];let v=_,y;e[4]!==s||e[5]!==g||e[6]!==h?(y=h?g?(0,Z.jsx)(Ax,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(jx,{celebrateSignal:s,onAddStarterPack:()=>{n(!0)}}):null,e[4]=s,e[5]=g,e[6]=h,e[7]=y):y=e[7];let b;e[8]!==r||e[9]!==t?(b=(0,Z.jsx)(fh,{open:t,onOpenChange:v,onSeedApplied:m,initialPackId:r}),e[8]=r,e[9]=t,e[10]=b):b=e[10];let x;return e[11]!==y||e[12]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 sm:px-12 md:px-16 subtle-scrollbar`,children:[y,b]}),e[11]=y,e[12]=b,e[13]=x):x=e[13],x}function Tx(){}function Ex(){return null}function Dx(e){return e+1}function Ox(){return null}function kx(e){return Un(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function Ax(e){let t=(0,$.c)(16),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`ZmGmNh`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`W8uemY`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(yx,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===r?u=t[9]:(u=(0,Z.jsx)(ah,{onPackSelect:r}),t[8]=r,t[9]=u);let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(qi,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:Sx,children:(0,Z.jsx)(s,{id:`ensWZc`,components:{0:(0,Z.jsx)(Bo,{"aria-hidden":`true`,className:`size-3`})}})}),t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[u,d]}),t[11]=u,t[12]=f);let p;return t[13]!==l||t[14]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p}function jx(e){let t=(0,$.c)(19),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i();if(_h())return null;let o;t[0]===a?o=t[1]:(o=a({id:`8XS8nG`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`GjElCU`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(yx,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ub,{}),t[8]=u):u=t[8];let d,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),f=(0,Z.jsx)(s,{id:`IajAbS`}),t[9]=d,t[10]=f):(d=t[9],f=t[10]);let p;t[11]===r?p=t[12]:(p=(0,Z.jsxs)(qi,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[d,f]}),t[11]=r,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(bx,{}),t[13]=m):m=t[13];let h;t[14]===p?h=t[15]:(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[u,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[p,m]})]}),t[14]=p,t[15]=h);let g;return t[16]!==l||t[17]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function Mx(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function Nx(e){let t=(0,$.c)(83),{folderPath:n,state:r,onChange:a}=e,{_:o}=i(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(Ix,{}),(0,Z.jsx)(pa,{className:`h-7 w-full`}),(0,Z.jsx)(pa,{className:`h-7 w-full`}),(0,Z.jsx)(pa,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.folder.frontmatter_defaults?m=t[4]:(m=r.data.folder.frontmatter_defaults??{},t[3]=r.data.folder.frontmatter_defaults,t[4]=m);let h=m,g;t[5]===r.data.frontmatterLocal?g=t[6]:(g=r.data.frontmatterLocal??{},t[5]=r.data.frontmatterLocal,t[6]=g);let _=g,v=r.data.frontmatterSources,y;t[7]===r.data.folder.path?y=t[8]:(y=Mx(r.data.folder.path),t[7]=r.data.folder.path,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,A,j,M,N,P;if(t[9]!==o||t[10]!==u||t[11]!==c||t[12]!==b||t[13]!==n||t[14]!==_||t[15]!==h||t[16]!==a||t[17]!==f||t[18]!==v||t[19]!==r.data.schemaDeclarations||t[20]!==r.data.schemaLocal||t[21]!==r.data.schemaSources){let e=Object.keys(h),i=r.data.schemaDeclarations,m=r.data.schemaLocal??{},g=r.data.schemaSources,y=Object.keys(i).filter(e=>!Object.hasOwn(h,e)),F=async function(e,t){let r=await wo(n,{[e]:t});if(!r.ok){let{error:e}=r;X.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},I=async function(e){let t=await wo(n,{[e]:null});if(!t.ok){let{error:e}=t;X.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},L=function(e,t){let n=h[e];F(e,Da(n,t))},R;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){d({name:``,type:`text`,value:``,error:null,mode:e===void 0?`value`:e}),l(!1)},t[36]=R):R=t[36],C=R;let z;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):xa[e];return{...t,type:e,value:n,error:null}})},t[37]=z):z=t[37],T=z;let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){d(t=>t&&{...t,value:e})},t[38]=B):B=t[38],E=B;let V;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){d(t=>t&&{...t,name:e,error:null})},t[39]=V):V=t[39],w=V;let H;t[40]!==o||t[41]!==u||t[42]!==i||t[43]!==n||t[44]!==h||t[45]!==a?(H=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(u.mode===`declaration`){if(Object.hasOwn(i,e)){d({...u,error:o({id:`7-KLnW`,values:{trimmed:e}})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`mcWHC0`,values:{trimmed:e}})});return}let t=await fa(n,{[e]:{type:u.type}});if(!t.ok){d({...u,error:t.error});return}d(null),a();return}if(Qr(u.value)){d({...u,error:o({id:`hXUWyd`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=await wo(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[40]=o,t[41]=u,t[42]=i,t[43]=n,t[44]=h,t[45]=a,t[46]=H):H=t[46],D=H;let U=async function(e){let t=await fa(n,{[e]:null});if(!t.ok){X.error(t.error);return}a()},W=function(e){p({key:e,draft:e,error:null})},G=function(e){p(t=>t&&{...t,draft:e,error:null})},ee=async function(){if(!f)return;let e=f.draft.trim();if(!e){p({...f,error:o({id:`8_brI5`})});return}if(e===f.key){p(null);return}if(Object.hasOwn(h,e)){p({...f,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}if(Object.hasOwn(i,e)){p({...f,error:o({id:`3IKxHW`,values:{trimmed:e}})});return}let t=h[f.key],r=await wo(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},K=function(){p(null)};O=`rounded-lg border bg-card`,S=_s,M=!c,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>l(!e),t[47]=N):N=t[47];let te=`size-3 transition-transform ${c?``:`rotate-90`}`,ne;t[48]===te?ne=t[49]:(ne=(0,Z.jsx)(ps,{className:te,"aria-hidden":!0}),t[48]=te,t[49]=ne);let q;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[50]=q):q=t[50];let re;t[51]===ne?re=t[52]:(re=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[ne,q]}),t[51]=ne,t[52]=re);let ie;t[53]===b?ie=t[54]:(ie=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:Fx,children:b}),t[53]=b,t[54]=ie),t[55]!==re||t[56]!==ie?(P=(0,Z.jsxs)(gs,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[re,ie]}),t[55]=re,t[56]=ie,t[57]=P):P=t[57],x=hs,k=`px-2 py-2`,t[58]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DnYq8I`})}),t[58]=A):A=t[58],j=e.length===0&&y.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`4c_a6S`})}):(0,Z.jsxs)(Z.Fragment,{children:[e.map(e=>{let t=h[e],n=Object.hasOwn(_,e);return(0,Z.jsx)(La,{keyName:e,value:t,declared:Na(t,gi(t)),rename:n?{state:f?.key===e?f:null,onBegin:()=>W(e),onChangeDraft:G,onCommit:ee,onCancel:K}:void 0,badge:n?null:(0,Z.jsx)(Va,{source:v[e]??``}),isInherited:!n,onCommit:t=>void F(e,t),onChangeType:t=>L(e,t),onRemove:n?()=>void I(e):void 0},e)}),y.length>0&&e.length>0?(0,Z.jsx)(`div`,{className:`my-1 border-t border-dashed border-border`,"aria-hidden":!0}):null,y.map(e=>{let t=i[e],r=Object.hasOwn(m,e),o=t.type;return(0,Z.jsx)(La,{keyName:e,value:``,declared:o,badge:(0,Z.jsx)(Fa,{source:g[e]??``,inlineSource:!r,icon:(0,Z.jsx)(aa,{className:`size-2.5`,"aria-hidden":!0})}),isInherited:!r,valueHint:(0,Z.jsx)(`div`,{className:`flex h-7 items-center px-2 text-xs italic text-muted-foreground`,children:(0,Z.jsx)(s,{id:`E62FLF`})}),onCommit:Px,onChangeType:t=>{r&&fa(n,{[e]:{type:t}}).then(e=>{e.ok?a():X.error(e.error)})},onRemove:r?()=>void U(e):void 0},`__decl__${e}`)})]}),t[9]=o,t[10]=u,t[11]=c,t[12]=b,t[13]=n,t[14]=_,t[15]=h,t[16]=a,t[17]=f,t[18]=v,t[19]=r.data.schemaDeclarations,t[20]=r.data.schemaLocal,t[21]=r.data.schemaSources,t[22]=x,t[23]=S,t[24]=C,t[25]=w,t[26]=T,t[27]=E,t[28]=D,t[29]=O,t[30]=k,t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P}else x=t[22],S=t[23],C=t[24],w=t[25],T=t[26],E=t[27],D=t[28],O=t[29],k=t[30],A=t[31],j=t[32],M=t[33],N=t[34],P=t[35];let F;t[59]!==u||t[60]!==C||t[61]!==w||t[62]!==T||t[63]!==E||t[64]!==D?(F=u?(0,Z.jsx)(So,{draft:u,onChangeName:w,onChangeType:T,onChangeValue:E,onCommit:()=>void D(),onCancel:()=>d(null)}):(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(0,Z.jsxs)(qi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>C(`value`),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(fe,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`7IcK2R`})})]}),(0,Z.jsxs)(qi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`declare-field-trigger`,onClick:()=>C(`declaration`),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(aa,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`dZHyu7`})})]})]}),t[59]=u,t[60]=C,t[61]=w,t[62]=T,t[63]=E,t[64]=D,t[65]=F):F=t[65];let I;t[66]!==F||t[67]!==k||t[68]!==A||t[69]!==j?(I=(0,Z.jsxs)(`div`,{className:k,children:[A,j,F]}),t[66]=F,t[67]=k,t[68]=A,t[69]=j,t[70]=I):I=t[70];let L;t[71]!==x||t[72]!==I?(L=(0,Z.jsx)(x,{children:I}),t[71]=x,t[72]=I,t[73]=L):L=t[73];let R;t[74]!==S||t[75]!==L||t[76]!==M||t[77]!==N||t[78]!==P?(R=(0,Z.jsxs)(S,{open:M,onOpenChange:N,children:[P,L]}),t[74]=S,t[75]=L,t[76]=M,t[77]=N,t[78]=P,t[79]=R):R=t[79];let z;return t[80]!==O||t[81]!==R?(z=(0,Z.jsx)(`section`,{className:O,children:R}),t[80]=O,t[81]=R,t[82]=z):z=t[82],z}function Px(){}function Fx(e){return e.stopPropagation()}function Ix(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Lc,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function Lx(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function Rx(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=Lx(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function zx(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Bx(e,t){let n=`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:Rx(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:zx(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:Rx(e,t.pageTitles),children:a}}function Vx(e){let t=(0,$.c)(44),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})})}),(0,Z.jsx)(pa,{className:`h-12 w-full`}),(0,Z.jsx)(pa,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let h;t[3]===r.data.folder.templates_available?h=t[4]:(h=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})}),t[5]=_):_=t[5];let v;t[6]===g.length?v=t[7]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,(0,Z.jsx)(K,{className:`text-xs`,variant:`secondary`,children:g.length})]}),t[6]=g.length,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(qi,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[8]=y):y=t[8];let b;t[9]===v?b=t[10]:(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[v,y]}),t[9]=v,t[10]=b);let x;t[11]===g?x=t[12]:(x=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:g.map(e=>(0,Z.jsx)(qo,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Va,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=g,t[12]=x);let S;t[13]!==b||t[14]!==x?(S=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[b,x]}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e||c(null)},t[16]=C):C=t[16];let w;t[17]!==o||t[18]!==n||t[19]!==i?(w=(0,Z.jsx)(Ja,{folderPath:n,template:o,onOpenChange:C,onSaved:i}),t[17]=o,t[18]=n,t[19]=i,t[20]=w):w=t[20];let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||u(null)},t[21]=T):T=t[21];let E;t[22]!==l||t[23]!==i?(E=(0,Z.jsx)(ba,{template:l,onOpenChange:T,onDeleted:i}),t[22]=l,t[23]=i,t[24]=E):E=t[24];let D;t[25]===g?D=t[26]:(D=new Set(g.map(Hx)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(za,{folderPath:n,existingNames:D,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=D,t[31]=O):O=t[31];let k=d!==null,A;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||f(null)},t[32]=A):A=t[32];let j=d??void 0,M;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(M=(0,Z.jsx)(Hm,{open:k,onOpenChange:A,kind:`file`,initialDir:n,initialTemplate:j,folderConfig:a}),t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==E||t[39]!==O||t[40]!==M||t[41]!==S||t[42]!==w?(N=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,M]}),t[38]=E,t[39]=O,t[40]=M,t[41]=S,t[42]=w,t[43]=N):N=t[43],N}function Hx(e){return e.name}function Ux(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Bi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Bi(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function Wx(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=Bi(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Gx(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=Bi(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Kx(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=Bi(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function qx(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=Bi(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Jx(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=Bi(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yx(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Y._({id:`xOTzt5`});if(r<60)return Y._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Y._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Y._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Xx(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function Zx(e){let t=(0,$.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Z.jsx)(Pe,{className:`ml-1 size-3`}):(0,Z.jsx)(Jt,{className:`ml-1 size-3`}):(0,Z.jsx)(hc,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(qi,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function Qx(e){let t=(0,$.c)(92),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=wi(),d=To(n),{state:f,refresh:p}=d,[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(`name`),[v,y]=(0,Q.useState)(`asc`);if(o){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(pa,{className:`size-5 rounded`}),(0,Z.jsx)(pa,{className:`h-7 w-48`})]}),(0,Z.jsx)(pa,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(pa,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(pa,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(tS)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let b,x,S,C,w,T,E,D,O,k;if(t[7]!==r||t[8]!==f||t[9]!==d||t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==l||t[14]!==c||t[15]!==p||t[16]!==v||t[17]!==g){let e=Bx(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=Xx(e.children,g,v),o;t[28]===g?o=t[29]:(o=function(e){e===g?y(eS):(_(e),y(`asc`))},t[28]=g,t[29]=o);let m=o;k=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(je,{className:`size-5 text-muted-foreground`}),t[30]=A):A=t[30];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:e.title})]}),M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(qi,{onClick:()=>h(!0),children:[(0,Z.jsx)(fe,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[31]=M):M=t[31],t[32]===j?E=t[33]:(E=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,M]})}),t[32]=j,t[33]=E),t[34]!==f||t[35]!==n||t[36]!==p?(D=(0,Z.jsx)(Nx,{folderPath:n,state:f,onChange:p}),t[34]=f,t[35]=n,t[36]=p,t[37]=D):D=t[37],t[38]!==f||t[39]!==d||t[40]!==n||t[41]!==p?(O=(0,Z.jsx)(Vx,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[38]=f,t[39]=d,t[40]=n,t[41]=p,t[42]=O):O=t[42],w=`rounded-lg border`,x=Ux;let N=g===`name`?v===`asc`?`ascending`:`descending`:`none`,P;t[43]===r?P=t[44]:(P=r({id:`6YtxFj`}),t[43]=r,t[44]=P);let F;t[45]!==m||t[46]!==v||t[47]!==g||t[48]!==P?(F=(0,Z.jsx)(Zx,{label:P,sortKey:`name`,activeKey:g,activeDir:v,onSort:m}),t[45]=m,t[46]=v,t[47]=g,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==N||t[51]!==F?(I=(0,Z.jsx)(qx,{"aria-sort":N,children:F}),t[50]=N,t[51]=F,t[52]=I):I=t[52];let L=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,R;t[53]===r?R=t[54]:(R=r({id:`tgWuMB`}),t[53]=r,t[54]=R);let z;t[55]!==m||t[56]!==v||t[57]!==g||t[58]!==R?(z=(0,Z.jsx)(Zx,{label:R,sortKey:`modified`,activeKey:g,activeDir:v,onSort:m}),t[55]=m,t[56]=v,t[57]=g,t[58]=R,t[59]=z):z=t[59];let B;t[60]!==L||t[61]!==z?(B=(0,Z.jsx)(qx,{className:`w-32`,"aria-sort":L,children:z}),t[60]=L,t[61]=z,t[62]=B):B=t[62],t[63]!==I||t[64]!==B?(C=(0,Z.jsx)(Wx,{children:(0,Z.jsxs)(Kx,{children:[I,B]})}),t[63]=I,t[64]=B,t[65]=C):C=t[65],b=Gx,S=i.length?i.map($x):(0,Z.jsx)(Kx,{children:(0,Z.jsx)(Jx,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Pkw7J9`})})}),t[7]=r,t[8]=f,t[9]=d,t[10]=n,t[11]=a,t[12]=u,t[13]=l,t[14]=c,t[15]=p,t[16]=v,t[17]=g,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k}else b=t[18],x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],O=t[26],k=t[27];let A;t[66]!==b||t[67]!==S?(A=(0,Z.jsx)(b,{children:S}),t[66]=b,t[67]=S,t[68]=A):A=t[68];let j;t[69]!==x||t[70]!==C||t[71]!==A?(j=(0,Z.jsxs)(x,{children:[C,A]}),t[69]=x,t[70]=C,t[71]=A,t[72]=j):j=t[72];let M;t[73]!==j||t[74]!==w?(M=(0,Z.jsx)(`div`,{className:w,children:j}),t[73]=j,t[74]=w,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==T||t[78]!==E||t[79]!==D||t[80]!==O?(N=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,M]}),t[76]=M,t[77]=T,t[78]=E,t[79]=D,t[80]=O,t[81]=N):N=t[81];let P;t[82]!==N||t[83]!==k?(P=(0,Z.jsx)(`div`,{className:k,children:N}),t[82]=N,t[83]=k,t[84]=P):P=t[84];let F;t[85]!==m||t[86]!==d||t[87]!==n?(F=(0,Z.jsx)(Hm,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[85]=m,t[86]=d,t[87]=n,t[88]=F):F=t[88];let I;return t[89]!==P||t[90]!==F?(I=(0,Z.jsxs)(Z.Fragment,{children:[P,F]}),t[89]=P,t[90]=F,t[91]=I):I=t[91],I}function $x(e){return(0,Z.jsxs)(Kx,{children:[(0,Z.jsx)(Jx,{children:(0,Z.jsxs)(`a`,{href:xi(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(zc,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(xt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(Jx,{className:`text-muted-foreground`,children:e.kind===`file`?Yx(e.modified):`—`})]},e.path)}function eS(e){return e===`asc`?`desc`:`asc`}function tS(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(pa,{className:`size-4 rounded`}),(0,Z.jsx)(pa,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(pa,{className:`h-4 w-16`})})]},e)}function nS(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?c.current?.focus():l.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Nc,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(s,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,Z.jsx)(`h2`,{ref:l,id:`large-file-title`,tabIndex:p,className:`text-2xl font-light text-balance outline-none`,children:m}),t[5]=p,t[6]=h);let g;t[7]===r?g=t[8]:(g=vi(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=vi(i),t[9]=i,t[10]=_);let v;t[11]!==n||t[12]!==g||t[13]!==_?(v=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_GBioJ`,values:{0:g,1:_,docName:n}})}),t[11]=n,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,v]}),t[15]=h,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==a||t[19]!==o?(b=o?(0,Z.jsxs)(qi,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(na,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[f,y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function rS(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(iS),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>w(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let c;t[2]===n?c=t[3]:(c=function(){V(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=c);let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A67Uwj`})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(s,{id:`dEgA5A`}),t[5]=d):d=t[5];let f;return t[6]===l?f=t[7]:(f=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[u,(0,Z.jsx)(qi,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:l,children:d})]}),t[6]=l,t[7]=f),f}function iS(){return new Set}var aS=(0,Q.createContext)(null);function oS(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(sS),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{i(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},t[1]=s):s=t[1];let c=s,l;t[2]===r?l=t[3]:(l={addPropertySignal:r,requestAddProperty:o,clearAddProperty:c},t[2]=r,t[3]=l);let u=l,d;return t[4]!==n||t[5]!==u?(d=(0,Z.jsx)(aS,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function sS(){return new Map}function cS(){let e=(0,Q.use)(aS);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function lS(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var uS=lS(()=>n(()=>import(`./SettingsDialogBody-Ds0lg6RZ.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([44,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,45,8,16,11,13,23]),import.meta.url));function dS(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(s,{id:`hwFOFD`})}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:o})]}),t[4]=o,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(qi,{variant:`default`,onClick:fS,children:(0,Z.jsx)(s,{id:`HpK_8d`})}),t[6]=u):u=t[6];let d;return t[7]===l?d=t[8]:(d=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[l,u]}),t[7]=l,t[8]=d),d}function fS(){return window.location.reload()}function pS(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(W,{fallbackRender:hS,onError:mS,children:n}),t[0]=n,t[1]=r),r}function mS(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function hS(e){return(0,Z.jsx)(dS,{...e})}function gS(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function _S(e){let t=(0,$.c)(81),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=ht(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=vt(),{desktopPresent:f}=ga(),[p,m]=(0,Q.useState)(`preferences`),h,g;t[0]===n?(h=t[1],g=t[2]):(h=()=>{n&&m(`preferences`)},g=[n],t[0]=n,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=o!==null,v;t[3]===a?v=t[4]:(v=a({id:`7PzzBU`}),t[3]=a,t[4]=v);let y;t[5]===a?y=t[6]:(y=a({id:`Q6hhn8`}),t[5]=a,t[6]=y);let b;t[7]===y?b=t[8]:(b={id:`preferences`,label:y},t[7]=y,t[8]=b);let x;t[9]===a?x=t[10]:(x=a({id:`4KmEoC`}),t[9]=a,t[10]=x);let S;t[11]===x?S=t[12]:(S={id:`hotkeys`,label:x},t[11]=x,t[12]=S);let C;t[13]===a?C=t[14]:(C=a({id:`AeXO77`}),t[13]=a,t[14]=C);let w;t[15]===C?w=t[16]:(w={id:`account`,label:C},t[15]=C,t[16]=w);let T;t[17]!==b||t[18]!==S||t[19]!==w?(T=[b,S,w],t[17]=b,t[18]=S,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==T||t[22]!==v?(E={id:`user`,label:v,enabled:!0,items:T},t[21]=T,t[22]=v,t[23]=E):E=t[23];let D;t[24]===a?D=t[25]:(D=a({id:`ZWyHmq`}),t[24]=a,t[25]=D);let O;t[26]===a?O=t[27]:(O=a({id:`Nu4DdT`}),t[26]=a,t[27]=O);let k;t[28]===O?k=t[29]:(k={id:`sync`,label:O},t[28]=O,t[29]=k);let A;t[30]===a?A=t[31]:(A=a({id:`iTylMl`}),t[30]=a,t[31]=A);let j;t[32]===A?j=t[33]:(j={id:`project-templates`,label:A},t[32]=A,t[33]=j);let M;t[34]===a?M=t[35]:(M=a({id:`3zyg_A`}),t[34]=a,t[35]=M);let N;t[36]===M?N=t[37]:(N={id:`okignore`,label:M},t[36]=M,t[37]=N);let P;t[38]===a?P=t[39]:(P=a({id:`cs4mps`}),t[38]=a,t[39]=P);let F;t[40]===P?F=t[41]:(F={id:`sharing`,label:P},t[40]=P,t[41]=F);let I;t[42]!==k||t[43]!==j||t[44]!==N||t[45]!==F?(I=[k,j,N,F],t[42]=k,t[43]=j,t[44]=N,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==_||t[48]!==D||t[49]!==I?(L={id:`project`,label:D,enabled:_,items:I},t[47]=_,t[48]=D,t[49]=I,t[50]=L):L=t[50];let R;t[51]===a?R=t[52]:(R=a({id:`nbfdhU`}),t[51]=a,t[52]=R);let z;t[53]!==a||t[54]!==f?(z=[],t[53]=a,t[54]=f,t[55]=z):z=t[55];let B;t[56]!==R||t[57]!==z?(B={id:`integrations`,label:R,enabled:!0,items:z},t[56]=R,t[57]=z,t[58]=B):B=t[58];let V;t[59]!==E||t[60]!==L||t[61]!==B?(V=[E,L,B],t[59]=E,t[60]=L,t[61]=B,t[62]=V):V=t[62];let H=V,U;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(as,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[63]=U):U=t[63];let W;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(rs,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[64]=W):W=t[64];let G;t[65]!==p||t[66]!==H?(G=(0,Z.jsx)(vS,{groups:H,activeId:p,onSelect:m}),t[65]=p,t[66]=H,t[67]=G):G=t[67];let ee;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(xS,{}),t[68]=ee):ee=t[68];let K=l?c:null,te;t[69]!==p||t[70]!==u||t[71]!==d||t[72]!==K?(te=(0,Z.jsx)(`section`,{"aria-labelledby":`settings-dialog-title`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:(0,Z.jsx)(pS,{children:(0,Z.jsx)(Q.Suspense,{fallback:ee,children:(0,Z.jsx)(uS,{activeId:p,userBinding:K,okignoreBinding:u,okignoreSynced:d})})})}),t[69]=p,t[70]=u,t[71]=d,t[72]=K,t[73]=te):te=t[73];let ne;t[74]!==G||t[75]!==te?(ne=(0,Z.jsxs)(os,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[U,W,G,te]}),t[74]=G,t[75]=te,t[76]=ne):ne=t[76];let q;return t[77]!==r||t[78]!==n||t[79]!==ne?(q=(0,Z.jsx)(us,{open:n,onOpenChange:r,children:ne}),t[77]=r,t[78]=n,t[79]=ne,t[80]=q):q=t[80],q}function vS(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:a}=e,{_:o}=i(),s;t[0]===o?s=t[1]:(s=o({id:`y1t8bQ`}),t[0]=o,t[1]=s);let c;if(t[2]!==r||t[3]!==n||t[4]!==a){let e;t[6]!==r||t[7]!==a?(e=e=>(0,Z.jsx)(bS,{group:e,activeId:r,onSelect:a},e.id),t[6]=r,t[7]=a,t[8]=e):e=t[8],c=n.map(e),t[2]=r,t[3]=n,t[4]=a,t[5]=c}else c=t[5];let l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(yS,{}),t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==c?(u=(0,Z.jsxs)(`nav`,{"aria-label":s,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:[c,l]}),t[10]=s,t[11]=c,t[12]=u):u=t[12],u}function yS(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=gS(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:Bi(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(s,{id:`_PACVa`}),(0,Z.jsx)($o,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function bS(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,c=n.enabled?void 0:o,l=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,u;t[0]===l?u=t[1]:(u=Bi(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,l),t[0]=l,t[1]=u);let d;t[2]!==n.label||t[3]!==a||t[4]!==c||t[5]!==u?(d=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":c,className:u,children:n.label}),t[2]=n.label,t[3]=a,t[4]=c,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.enabled?(f=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(s,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=f):f=t[9];let p;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:Bi(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],p=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=p}else p=t[15];let m;t[21]!==a||t[22]!==p?(m=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:p}),t[21]=a,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==d||t[25]!==f||t[26]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[d,f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=h):h=t[27],h}function xS(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`GsBUCk`})}),n=(0,Z.jsx)(pa,{className:`h-5 w-32`}),r=(0,Z.jsx)(pa,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(pa,{className:`h-9 w-full`}),(0,Z.jsx)(pa,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function SS(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=Bi(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mb,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function CS(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)(_b,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function wS(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Bi(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(xb,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function TS(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=Bi(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var ES=Yi(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function DS(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=Bi(ES({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":a,className:o,onMouseDown:OS,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function OS(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Yi(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function kS(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=Bi(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function AS(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=Bi(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ms,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jS(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:a,replaceOpen:o,caseSensitive:c,wholeWord:l,current:u,total:d,onQueryChange:f,onReplacementChange:p,onReplaceOpenChange:m,onCaseSensitiveChange:h,onWholeWordChange:g,onNext:_,onPrevious:v,onReplaceCurrent:y,onReplaceAll:b,onClose:x}=e,{_:S}=i(),C=r.length>0,w=d>0,T;t[0]!==S||t[1]!==u||t[2]!==w||t[3]!==C||t[4]!==d?(T=C?w?`${u} / ${d}`:S({id:`Ev2r9A`}):``,t[0]=S,t[1]=u,t[2]=w,t[3]=C,t[4]=d,t[5]=T):T=t[5];let E=T,D;t[6]!==x||t[7]!==_||t[8]!==v?(D=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?v():_()):e.key===`Escape`&&(e.preventDefault(),x())},t[6]=x,t[7]=_,t[8]=v,t[9]=D):D=t[9];let O=D,k;t[10]!==x||t[11]!==y?(k=function(e){e.key===`Enter`?(e.preventDefault(),y()):e.key===`Escape`&&(e.preventDefault(),x())},t[10]=x,t[11]=y,t[12]=k):k=t[12];let A=k,j;t[13]===S?j=t[14]:(j=S({id:`MVxpbf`}),t[13]=S,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(s,{id:`KujtjC`})}),t[15]=M):M=t[15];let N;t[16]===f?N=t[17]:(N=e=>f(e.target.value),t[16]=f,t[17]=N);let P;t[18]===S?P=t[19]:(P=S({id:`KujtjC`}),t[18]=S,t[19]=P);let F;t[20]!==n||t[21]!==O||t[22]!==r||t[23]!==N||t[24]!==P?(F=(0,Z.jsx)(AS,{ref:n,id:`ok-find-input`,value:r,onChange:N,onKeyDown:O,placeholder:P,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=O,t[22]=r,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]===S?I=t[27]:(I=S({id:`-8PP0T`}),t[26]=S,t[27]=I);let L;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(xc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(ts,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":I,pressed:c,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:L})}),t[29]=c,t[30]=h,t[31]=I,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`-8PP0T`})}),t[33]=z):z=t[33];let B;t[34]===R?B=t[35]:(B=(0,Z.jsxs)(ri,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(Dl,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(ts,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":V,pressed:l,onPressedChange:g,className:`size-6 min-w-6 px-0`,children:H})}),t[39]=g,t[40]=V,t[41]=l,t[42]=U):U=t[42];let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=W):W=t[43];let G;t[44]===U?G=t[45]:(G=(0,Z.jsxs)(ri,{children:[U,W]}),t[44]=U,t[45]=G);let ee;t[46]!==B||t[47]!==G?(ee=(0,Z.jsxs)(DS,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=ee):ee=t[48];let K;t[49]!==ee||t[50]!==F?(K=(0,Z.jsxs)(TS,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,ee]}),t[49]=ee,t[50]=F,t[51]=K):K=t[51];let te;t[52]===E?te=t[53]:(te=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:E}),t[52]=E,t[53]=te);let ne;t[54]===S?ne=t[55]:(ne=S({id:`oqB2ez`}),t[54]=S,t[55]=ne);let q=!w,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(J,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let ie;t[57]!==v||t[58]!==ne||t[59]!==q?(ie=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ne,disabled:q,onClick:v,children:re})}),t[57]=v,t[58]=ne,t[59]=q,t[60]=ie):ie=t[60];let ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=ae):ae=t[61];let oe;t[62]===ie?oe=t[63]:(oe=(0,Z.jsxs)(ri,{children:[ie,ae]}),t[62]=ie,t[63]=oe);let se;t[64]===S?se=t[65]:(se=S({id:`SiUUCS`}),t[64]=S,t[65]=se);let ce=!w,le;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(De,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=le):le=t[66];let ue;t[67]!==_||t[68]!==se||t[69]!==ce?(ue=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":se,disabled:ce,onClick:_,children:le})}),t[67]=_,t[68]=se,t[69]=ce,t[70]=ue):ue=t[70];let de;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=de):de=t[71];let fe;t[72]===ue?fe=t[73]:(fe=(0,Z.jsxs)(ri,{children:[ue,de]}),t[72]=ue,t[73]=fe);let pe=o?`secondary`:`ghost`,me;t[74]!==S||t[75]!==o?(me=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=me):me=t[76];let he=o?`ok-replace-input`:void 0,ge;t[77]!==m||t[78]!==o?(ge=()=>m(!o),t[77]=m,t[78]=o,t[79]=ge):ge=t[79];let _e;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(ll,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=_e):_e=t[80];let ve;t[81]!==o||t[82]!==pe||t[83]!==me||t[84]!==he||t[85]!==ge?(ve=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:pe,size:`icon-sm`,"aria-label":me,"aria-expanded":o,"aria-controls":he,onClick:ge,children:_e})}),t[81]=o,t[82]=pe,t[83]=me,t[84]=he,t[85]=ge,t[86]=ve):ve=t[86];let ye;t[87]===o?ye=t[88]:(ye=(0,Z.jsx)(sr,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ye);let be;t[89]!==ve||t[90]!==ye?(be=(0,Z.jsxs)(ri,{children:[ve,ye]}),t[89]=ve,t[90]=ye,t[91]=be):be=t[91];let xe;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(xe=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(s,{id:`fqSfXY`})}),(0,Z.jsx)(ms,{id:`ok-replace-input`,value:a,onChange:e=>p(e.target.value),onKeyDown:A,placeholder:S({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(ll,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(cl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`dr1vFs`})})]})]}):null,t[92]=S,t[93]=A,t[94]=w,t[95]=b,t[96]=y,t[97]=p,t[98]=o,t[99]=a,t[100]=xe):xe=t[100];let Se;t[101]===S?Se=t[102]:(Se=S({id:`wJo9oS`}),t[101]=S,t[102]=Se);let Ce;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(is,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Ce):Ce=t[103];let we;t[104]!==x||t[105]!==Se?(we=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Se,onClick:x,children:Ce})}),t[104]=x,t[105]=Se,t[106]=we):we=t[106];let Te;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Te):Te=t[107];let Ee;t[108]===we?Ee=t[109]:(Ee=(0,Z.jsxs)(ri,{children:[we,Te]}),t[108]=we,t[109]=Ee);let Oe;return t[110]!==K||t[111]!==te||t[112]!==oe||t[113]!==fe||t[114]!==j||t[115]!==be||t[116]!==xe||t[117]!==Ee?(Oe=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":j,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[M,K,te,oe,fe,be,xe,Ee]}),t[110]=K,t[111]=te,t[112]=oe,t[113]=fe,t[114]=j,t[115]=be,t[116]=xe,t[117]=Ee,t[118]=Oe):Oe=t[118],Oe}var MS={current:0,total:0},NS=120,PS=100;function FS(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?tn(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(ge,n,IS)}function IS(){return null}function LS(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
23
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function G_(e,t){return`${e}\u0000${t}`}function K_(e,t,n){let r=Ar(e).body,i=Ar(t).body;return r===i?``:U_(n,r,i,``,``,{context:3})}function q_(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ht(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=G_(t,r),a=n.get(e);if(a===void 0){let o=await fetch(`/api/history/${r}?docName=${encodeURIComponent(t)}`);if(i)return;if(!o.ok){s({status:`error`,diff:null});return}let c=await o.json();if(i)return;a=c.content??``,n.set(e,a)}if(i)return;let o=c.current?.document.getText(`source`).toString()??``,l=K_(a,o,t);if(i)return;s({status:`ready`,diff:l})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,err:e}),s({status:`error`,diff:null}))}})(),()=>{i=!0}},d=[e,t,n],r[3]=n,r[4]=t,r[5]=e,r[6]=u,r[7]=d):(u=r[6],d=r[7]),(0,Q.useEffect)(u,d),o}var J_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-BNQupLE1.js`),__vite__mapDeps([18,1,6,19]),import.meta.url)).ActivityPanelDiffView}));function Y_(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Y._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Y._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Y._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Y._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Y._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function X_(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Z_(e){return e.slice(0,7)}function Q_(e){return e.type===`upstream`?Y._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?Y._({id:`B2DrPb`}):e.author}function $_(e){let t=(0,$.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsx)(Qi,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(ia,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Xi,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(ta,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(la,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(sa,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(aa,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function ev(e){let t=(0,$.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(tt,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=Ci(i),t[1]=i,t[2]=a);let o=a,s=r?_r[o]??zr[o]:zr[o],c;t[3]!==s||t[4]!==i?(c=s??ii(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Z.jsx)($_,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Vc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(mc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(El,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(aa,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(mc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(El,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function tv(e){let t=(0,$.c)(23),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r),p=n.length;if(n.length===0)return null;let m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>f(nv),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(De,{className:`size-3`}):(0,Z.jsx)(ps,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?Y._({id:`OKQe56`,values:{entryCount:p}}):Y._({id:`k9jDvw`,values:{entryCount:p}}),t[3]=p,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==d||t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[6]=d,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==a||t[12]!==s||t[13]!==n||t[14]!==d||t[15]!==c||t[16]!==i||t[17]!==u||t[18]!==l?(v=d&&n.map(e=>(0,Z.jsx)(mv,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[10]=o,t[11]=a,t[12]=s,t[13]=n,t[14]=d,t[15]=c,t[16]=i,t[17]=u,t[18]=l,t[19]=v):v=t[19];let y;return t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22],y}function nv(e){return!e}function rv(e){return e.checkpoint?e.checkpoint.kind:`save`}function iv(e){let t=rv(e);if(t===`save`)return Y._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${av(n)})`:``;return t===`bridge-merge-loss`?Y._({id:`uZAG7T`,values:{sizeSuffix:r}}):Y._({id:`_4rAQI`,values:{sizeSuffix:r}})}function av(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function ov(e){return e.type===`checkpoint`?rv(e)===`save`?`version`:`auto-save`:`wip`}function sv(e){let t=ov(e);return t===`version`?Y._({id:`RFQ1Yx`}):t===`auto-save`?Y._({id:`9Uv1CD`}):Y._({id:`Yea-K5`})}function cv(e){let t=ov(e);return t===`version`?Y._({id:`gg3Rpy`}):t===`auto-save`?Y._({id:`PXXeW8`}):Y._({id:`Pyp1NA`})}function lv(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function uv(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,c;t[0]===n?(o=t[1],c=t[2]):([o,...c]=n,t[0]=n,t[1]=o,t[2]=c);let l=c.length,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=u):u=t[3];let d;t[4]===o?d=t[5]:(d=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[u,o]}),t[4]=o,t[5]=d);let f;t[6]!==r||t[7]!==c?(f=r&&c.map(fv),t[6]=r,t[7]=c,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==d||t[11]!==f?(p=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[d,f]}),t[9]=a,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m;t[13]!==r||t[14]!==l||t[15]!==a||t[16]!==c.length?(m=c.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(dv)},children:[r?(0,Z.jsx)(De,{className:`size-3`}):(0,Z.jsx)(ps,{className:`size-3`}),r?(0,Z.jsx)(s,{id:`vLyv1R`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:l}})]}),t[13]=r,t[14]=l,t[15]=a,t[16]=c.length,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function dv(e){return!e}function fv(e,t){return(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function pv(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=q_(n,r,i),l;t[0]===c.status?l=t[1]:(l=c.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(F,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`38foVZ`})]}),t[0]=c.status,t[1]=l);let u;t[2]===c.status?u=t[3]:(u=c.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(s,{id:`vvWZnu`})}),t[2]=c.status,t[3]=u);let d;t[4]!==a||t[5]!==c.diff||t[6]!==c.status?(d=c.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(F,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(J_,{diff:c.diff,viewType:a})}),t[4]=a,t[5]=c.diff,t[6]=c.status,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[l,u,d]}),t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function mv(e){let t=(0,$.c)(130),{entry:n,prominent:r,isDark:a,diffLayout:o,cache:c,docName:l,expanded:u,onToggleExpanded:d,onRestoreSuccess:f}=e,p=r===void 0?!1:r,{_:m}=i(),h;t[0]===n.timestamp?h=t[1]:(h=Y_(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=Q_(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=X_(n.timestamp),t[4]=n.timestamp,t[5]=y);let b=y,x;t[6]===n.sha?x=t[7]:(x=Z_(n.sha),t[6]=n.sha,t[7]=x);let S=x,C=n.contributors.flatMap(hv),w;t[8]===n?w=t[9]:(w=lv(n),t[8]=n,t[9]=w);let T=w,[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(null),j=(0,Q.useId)(),M,N;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>A.current?.abort(),N=[],t[10]=M,t[11]=N):(M=t[10],N=t[11]),(0,Q.useEffect)(M,N);let P;t[12]!==n.sha||t[13]!==d?(P=()=>d(n.sha),t[12]=n.sha,t[13]=d,t[14]=P):P=t[14];let I=P,L;t[15]===D?L=t[16]:(L=function(){A.current?.abort(),A.current=null,k(!1),D(!1)},t[15]=D,t[16]=L);let R=L,z;t[17]!==m||t[18]!==l||t[19]!==n.sha||t[20]!==f||t[21]!==D?(z=async function(){k(!0);let e=new AbortController;A.current=e;let t=function(){e.signal.aborted||k(!1),A.current===e&&(A.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:l,commitSha:n.sha}),signal:e.signal})}catch(r){let i=r;!e.signal.aborted&&!(i instanceof DOMException&&i.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:l,sha:n.sha,err:i}),X.error(m({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)D(!1),f();else{let e=`HTTP ${r.status}`;try{let t=Ir.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:l,sha:n.sha,status:r.status,detail:e}),X.error(m({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=m,t[18]=l,t[19]=n.sha,t[20]=f,t[21]=D,t[22]=z):z=t[22];let B=z,V;t[23]!==n||t[24]!==a||t[25]!==p?(V=p?(()=>{let e=rv(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Or,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(Mc,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(kc,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(ev,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=V):V=t[26];let H=V,U=u?j:void 0,W=u?`bg-muted`:`hover:bg-muted/80`,G;t[27]===W?G=t[28]:(G=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,W],t[27]=W,t[28]=G);let ee=G.join(` `),K;t[29]===I?K=t[30]:(K=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I())},t[29]=I,t[30]=K);let te;t[31]===H?te=t[32]:(te=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:H}),t[31]=H,t[32]=te);let ne;t[33]!==v||t[34]!==n||t[35]!==p?(ne=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:iv(n)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:v})]}):(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:v}),t[33]=v,t[34]=n,t[35]=p,t[36]=ne):ne=t[36];let q;t[37]!==n.timestamp||t[38]!==g?(q=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:g}),t[37]=n.timestamp,t[38]=g,t[39]=q):q=t[39];let re;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=re):re=t[40];let ie;t[41]===n?ie=t[42]:(ie=sv(n),t[41]=n,t[42]=ie);let ae;t[43]===D?ae=t[44]:(ae=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=ae);let oe;t[45]===O?oe=t[46]:(oe=O?(0,Z.jsx)(F,{className:`size-3 animate-spin`}):(0,Z.jsx)($i,{className:`size-3`}),t[45]=O,t[46]=oe);let se;t[47]!==O||t[48]!==ie||t[49]!==ae||t[50]!==oe?(se=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":ie,disabled:O,onClick:ae,children:oe})}),t[47]=O,t[48]=ie,t[49]=ae,t[50]=oe,t[51]=se):se=t[51];let ce;t[52]===n?ce=t[53]:(ce=sv(n),t[52]=n,t[53]=ce);let le;t[54]===ce?le=t[55]:(le=(0,Z.jsx)(sr,{side:`top`,children:ce}),t[54]=ce,t[55]=le);let ue;t[56]!==se||t[57]!==le?(ue=(0,Z.jsxs)(ri,{children:[se,le]}),t[56]=se,t[57]=le,t[58]=ue):ue=t[58];let de;t[59]!==ne||t[60]!==q||t[61]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[ne,q,re,ue]}),t[59]=ne,t[60]=q,t[61]=ue,t[62]=de):de=t[62];let fe;t[63]===T?fe=t[64]:(fe=T.length>0&&(0,Z.jsx)(uv,{summaries:T}),t[63]=T,t[64]=fe);let pe=C.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:C.join(`, `),children:C.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),me;t[65]!==de||t[66]!==fe||t[67]!==pe?(me=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[de,fe,pe]}),t[65]=de,t[66]=fe,t[67]=pe,t[68]=me):me=t[68];let he;t[69]!==u||t[70]!==I||t[71]!==U||t[72]!==ee||t[73]!==K||t[74]!==te||t[75]!==me?(he=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":U,"data-testid":`timeline-entry-expand`,className:ee,onClick:I,onKeyDown:K,children:[te,me]}),t[69]=u,t[70]=I,t[71]=U,t[72]=ee,t[73]=K,t[74]=te,t[75]=me,t[76]=he):he=t[76];let ge;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(ge=u&&(0,Z.jsx)(pv,{sha:n.sha,docName:l,cache:c,diffLayout:o,panelId:j}),t[77]=c,t[78]=o,t[79]=j,t[80]=l,t[81]=n.sha,t[82]=u,t[83]=ge):ge=t[83];let _e;t[84]!==he||t[85]!==ge?(_e=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[he,ge]}),t[84]=he,t[85]=ge,t[86]=_e):_e=t[86];let ve;t[87]!==R||t[88]!==D?(ve=e=>{e?D(!0):R()},t[87]=R,t[88]=D,t[89]=ve):ve=t[89];let ye;t[90]===n?ye=t[91]:(ye=cv(n),t[90]=n,t[91]=ye);let be;t[92]===ye?be=t[93]:(be=(0,Z.jsx)(as,{children:ye}),t[92]=ye,t[93]=be);let xe;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(xe={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=xe):xe=t[98];let Se;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(Se={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=Se):Se=t[99];let Ce;t[100]===xe?Ce=t[101]:(Ce=(0,Z.jsx)(rs,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:xe,components:Se})}),t[100]=xe,t[101]=Ce);let we;t[102]!==be||t[103]!==Ce?(we=(0,Z.jsxs)(ls,{children:[be,Ce]}),t[102]=be,t[103]=Ce,t[104]=we):we=t[104];let Te;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=Te):Te=t[105];let Ee;t[106]===R?Ee=t[107]:(Ee=(0,Z.jsx)(qi,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:R,children:Te}),t[106]=R,t[107]=Ee);let De;t[108]===B?De=t[109]:(De=()=>B(),t[108]=B,t[109]=De);let Oe;t[110]===O?Oe=t[111]:(Oe=O?(0,Z.jsx)(F,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=Oe);let ke;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=ke):ke=t[112];let Ae;t[113]!==O||t[114]!==De||t[115]!==Oe?(Ae=(0,Z.jsxs)(qi,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:De,children:[Oe,ke]}),t[113]=O,t[114]=De,t[115]=Oe,t[116]=Ae):Ae=t[116];let je;t[117]!==Ee||t[118]!==Ae?(je=(0,Z.jsxs)(cs,{children:[Ee,Ae]}),t[117]=Ee,t[118]=Ae,t[119]=je):je=t[119];let Me;t[120]!==we||t[121]!==je?(Me=(0,Z.jsxs)(os,{children:[we,je]}),t[120]=we,t[121]=je,t[122]=Me):Me=t[122];let Ne;t[123]!==E||t[124]!==ve||t[125]!==Me?(Ne=(0,Z.jsx)(us,{open:E,onOpenChange:ve,children:Me}),t[123]=E,t[124]=ve,t[125]=Me,t[126]=Ne):Ne=t[126];let Pe;return t[127]!==_e||t[128]!==Ne?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[_e,Ne]}),t[127]=_e,t[128]=Ne,t[129]=Pe):Pe=t[129],Pe}function hv(e){return e.docs}function gv(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=Jn(),d=u===`dark`,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(null),[b]=(0,Q.useState)(bv),[x,S]=(0,Q.useState)(yv),C;t[1]===b?C=t[2]:(C=()=>{S(new Set),b.clear()},t[1]=b,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){S(new Set)},t[6]=D):D=t[6];let O=D,k,A;t[7]!==l||t[8]!==n?(k=()=>{if(!n){m([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){v(l({id:`brCtGB`}));return}let r=await t.json();if(e)return;m(r.entries??[]),v(null)}catch(t){let n=t;if(e)return;v(l({id:`brCtGB`})),console.error(`[timeline]`,n)}};return g(!0),t().finally(()=>{e||g(!1)}),y.current=setInterval(t,1e4),()=>{e=!0,y.current&&clearInterval(y.current)}},A=[n,l],t[7]=l,t[8]=n,t[9]=k,t[10]=A):(k=t[9],A=t[10]),(0,Q.useEffect)(k,A);let j,M,N,P,I,L,R,z;if(t[11]!==l||t[12]!==b||t[13]!==r||t[14]!==n||t[15]!==p||t[16]!==_||t[17]!==x||t[18]!==d||t[19]!==h||t[20]!==a||t[21]!==o||t[22]!==c){let e=[],i=[],u=!1;for(let t of p)t.type===`checkpoint`?(i.length>0&&(e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u}),i=[]),e.push({kind:`checkpoint`,entry:t}),u=!0):i.push(t);i.length>0&&e.push({kind:`wip-group`,entries:i,isPreCheckpoint:!u});let f;t[31]===p?f=t[32]:(f=p.some(vv),t[31]=p,t[32]=f);let m=!f,g=!h&&!_&&p.length>0;I=`flex h-full flex-col`;let v;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(En,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[33]=v):v=t[33];let y;t[34]!==l||t[35]!==r||t[36]!==g||t[37]!==a?(y=g&&(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsxs)(ns,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":l({id:`XvPJaT`}),variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(es,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(ul,{className:`size-3.5`})}),(0,Z.jsx)(es,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(Tc,{className:`size-3.5`})})]})}),(0,Z.jsx)(sr,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[34]=l,t[35]=r,t[36]=g,t[37]=a,t[38]=y):y=t[38];let S;t[39]===l?S=t[40]:(S=l({id:`IrYrzq`}),t[39]=l,t[40]=S);let C;t[41]===c?C=t[42]:(C=c?(0,Z.jsx)(F,{className:`size-4 animate-spin`}):(0,Z.jsx)(dl,{className:`size-4`}),t[41]=c,t[42]=C);let w;t[43]!==o||t[44]!==c||t[45]!==S||t[46]!==C?(w=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-sm`,onClick:o,disabled:c,"aria-label":S,className:`text-muted-foreground`,"data-testid":`timeline-save-version`,children:C})}),t[43]=o,t[44]=c,t[45]=S,t[46]=C,t[47]=w):w=t[47];let T;t[48]===c?T=t[49]:(T=(0,Z.jsx)(sr,{children:c?(0,Z.jsx)(s,{id:`uF9ruK`}):(0,Z.jsx)(s,{id:`IrYrzq`})}),t[48]=c,t[49]=T);let D;t[50]!==w||t[51]!==T?(D=(0,Z.jsxs)(ri,{children:[w,T]}),t[50]=w,t[51]=T,t[52]=D):D=t[52],t[53]!==y||t[54]!==D?(L=(0,Z.jsxs)(Cn,{children:[v,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,D]})]}),t[53]=y,t[54]=D,t[55]=L):L=t[55],R=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[56]!==l||t[57]!==h?(z=h&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":l({id:`o49mDZ`}),children:[1,2,3].map(_v)}),t[56]=l,t[57]=h,t[58]=z):z=t[58],t[59]!==_||t[60]!==h?(j=!h&&_&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:_})}),t[59]=_,t[60]=h,t[61]=j):j=t[61],t[62]!==p.length||t[63]!==_||t[64]!==h?(M=!h&&!_&&p.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Ta25TG`})})}),t[62]=p.length,t[63]=_,t[64]=h,t[65]=M):M=t[65],t[66]!==b||t[67]!==r||t[68]!==n||t[69]!==p||t[70]!==_||t[71]!==x||t[72]!==m||t[73]!==d||t[74]!==h?(N=!h&&!_&&m&&p.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:p.map(e=>(0,Z.jsx)(mv,{entry:e,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.sha),onToggleExpanded:E,onRestoreSuccess:O},e.sha))}),t[66]=b,t[67]=r,t[68]=n,t[69]=p,t[70]=_,t[71]=x,t[72]=m,t[73]=d,t[74]=h,t[75]=N):N=t[75],P=!h&&!_&&!m&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:e.map((e,t)=>e.kind===`checkpoint`?(0,Z.jsx)(mv,{entry:e.entry,prominent:!0,isDark:d,diffLayout:r,cache:b,docName:n,expanded:x.has(e.entry.sha),onToggleExpanded:E,onRestoreSuccess:O},e.entry.sha):(0,Z.jsx)(tv,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,isDark:d,diffLayout:r,cache:b,docName:n,expandedShas:x,onToggleExpanded:E,onRestoreSuccess:O},e.entries[0]?.sha??`wip-${t}`))}),t[11]=l,t[12]=b,t[13]=r,t[14]=n,t[15]=p,t[16]=_,t[17]=x,t[18]=d,t[19]=h,t[20]=a,t[21]=o,t[22]=c,t[23]=j,t[24]=M,t[25]=N,t[26]=P,t[27]=I,t[28]=L,t[29]=R,t[30]=z}else j=t[23],M=t[24],N=t[25],P=t[26],I=t[27],L=t[28],R=t[29],z=t[30];let B;t[76]!==j||t[77]!==M||t[78]!==N||t[79]!==P||t[80]!==R||t[81]!==z?(B=(0,Z.jsxs)(`div`,{className:R,children:[z,j,M,N,P]}),t[76]=j,t[77]=M,t[78]=N,t[79]=P,t[80]=R,t[81]=z,t[82]=B):B=t[82];let V;return t[83]!==I||t[84]!==L||t[85]!==B?(V=(0,Z.jsxs)(`div`,{className:I,children:[L,B]}),t[83]=I,t[84]=L,t[85]=B,t[86]=V):V=t[86],V}function _v(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(pa,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(pa,{className:`h-3 w-28`}),(0,Z.jsx)(pa,{className:`h-3 w-40`})]})]},e)}function vv(e){return e.type===`checkpoint`}function yv(){return new Set}function bv(){return new ea(32)}var xv=[{id:`outline`,icon:Jc},{id:`links`,icon:be},{id:`graph`,icon:Zc},{id:`timeline`,icon:wc}];function Sv(e){return e===`outline`?Y._({id:`dD7NPy`}):e===`links`?Y._({id:`Rj01Fz`}):e===`graph`?Y._({id:`x2fr_j`}):Y._({id:`cklVjM`})}function Cv(){return n(()=>import(`./GraphPanel-CvKl6isv.js`),__vite__mapDeps([20,1,21,6,3,7,22,23,12,13,24,25,26,27,28,29,30,31,32,33]),import.meta.url)}var wv=(0,Q.lazy)(async()=>({default:(await Cv()).GraphPanel})),Tv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-Q1f1O1VR.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function Ev(e){let t=(0,$.c)(16),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c,onSaveVersion:l,saving:u}=e,{_:d}=i(),[f,p]=(0,Q.useState)(`unified`),m;t[0]!==d||t[1]!==a||t[2]!==c||t[3]!==o?(m=c===`doc`?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(ns,{type:`single`,variant:`outline`,value:a,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:xv.map(Dv)})}):null,t[0]=d,t[1]=a,t[2]=c,t[3]=o,t[4]=m):m=t[4];let h;t[5]!==a||t[6]!==f||t[7]!==n||t[8]!==r||t[9]!==c||t[10]!==l||t[11]!==u?(h=c===`doc`?(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-${a}`,"aria-labelledby":`tab-${a}`,className:`min-h-0 flex-1`,children:[a===`outline`&&(0,Z.jsx)(Zs,{docName:n,isSourceMode:r}),a===`links`&&(0,Z.jsx)(__,{docName:n}),a===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-lCAuQ`})}),children:(0,Z.jsx)(wv,{activeDocName:n})}),a===`timeline`&&(0,Z.jsx)(gv,{docName:n,diffLayout:f,onDiffLayoutChange:p,onSaveVersion:l,saving:u})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(Tv,{})})}),t[5]=a,t[6]=f,t[7]=n,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(Z.Fragment,{children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function Dv(e){let{id:t,icon:n}=e,r=Sv(t);return(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(es,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(hr,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(sr,{side:`bottom`,children:r})]},t)}function Ov(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function kv(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Av(e){return e/100*window.innerHeight}function jv(e){return e/100*window.innerWidth}function Mv(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function Nv({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Mv(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=kv(t,i);break;case`em`:r=Ov(t,i);break;case`vh`:r=Av(i);break;case`vw`:r=jv(i);break}return r}function Pv(e){return parseFloat(e.toFixed(3))}function Fv({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Iv(e){let{panels:t}=e,n=Fv({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=Pv(Nv({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Pv(Nv({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Pv(Nv({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Pv(Nv({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function Lv(e,t=`Assertion error`){if(!e)throw Error(t)}function Rv(e,t){return Array.from(t).sort(e===`horizontal`?zv:Bv)}function zv(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Bv(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Vv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Hv(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Uv({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Hv(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Lv(i,`No rect found`),i}var Wv;function Gv(){return Wv===void 0&&(Wv=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Wv}function Kv(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Rv(n,Array.from(t.children).filter(Vv).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,Uv({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Gv()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:Fv({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var qv=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},Jv=new Map,Yv=new qv;function Xv(e){Jv=new Map(Jv),Jv.delete(e)}function Zv(e,t){for(let[t]of Jv)if(t.id===e)return t}function Qv(e,t){for(let[t,n]of Jv)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function $v(){return Jv}function ey(e,t){return Yv.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function ty(e,t){let n=Jv.get(e);Jv=new Map(Jv),Jv.set(e,t),Yv.emit(`groupChange`,{group:e,prev:n,next:t})}function ny(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Hv(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function ry(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function iy(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:uy(e),b:uy(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Lv(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:ly(cy(n.a)),b:ly(cy(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var ay=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function oy(e){let t=getComputedStyle(dy(e)??e).display;return t===`flex`||t===`inline-flex`}function sy(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||oy(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||ay.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function cy(e){let t=e.length;for(;t--;){let n=e[t];if(Lv(n,`Missing node`),sy(n))return n}return null}function ly(e){return e&&Number(getComputedStyle(e).zIndex)||0}function uy(e){let t=[];for(;e;)t.push(e),e=dy(e);return t}function dy(e){let{parentNode:t}=e;return ry(t)?t.host:t}function fy(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function py({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Vv(n)||n.contains(e)||e.contains(n))return!0;if(iy(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(fy(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function my(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Kv(r),a=ny(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&py({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function hy(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function gy(e,t,n=0){return Math.abs(Pv(e)-Pv(t))<=n}function _y(e,t){return gy(e,t)?0:e>t?1:-1}function vy({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(_y(r,c)<0)if(a){let e=(i+c)/2;r=_y(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Pv(r),r}function yy({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(gy(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Lv(u!=null,`Invalid first pivot index`),Lv(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Lv(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Lv(n!=null,`Previous layout not found for panel index ${t}`),gy(n,i)){let t=o-n;_y(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Lv(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Lv(n!=null,`Previous layout not found for panel index ${t}`),gy(n,o)){let t=n-i;_y(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Lv(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&_y(i,c)<0)if(e>0){let t=c-o,n=t/2;_y(i+e,c)<0&&(e=_y(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;_y(i-e,c)<0&&(e=_y(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];Lv(e!=null,`Previous layout not found for panel index ${r}`);let a=vy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];Lv(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=vy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!gy(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(hy(c,l))return i;{let t=e<0?d:u,r=s[t];Lv(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=vy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!gy(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Lv(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=vy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(gy(i,s)||(t-=s-i,l[r]=s),gy(t,0))break;e>0?r--:r++}}}if(!gy(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function by(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||_y(e[n],t[n])!==0)return!1;return!0}function xy({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!gy(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Lv(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Lv(i!=null,`No layout data found for index ${e}`);let o=r[e];Lv(o!=null,`No layout data found for index ${e}`);let s=vy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!gy(a,0))for(let e=0;e<t.length;e++){let n=r[e];Lv(n!=null,`No layout data found for index ${e}`);let i=n+a,o=vy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,gy(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Sy({groupId:e,panelId:t}){let n=()=>{let t=$v();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=xy({layout:yy({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});by(l,p)||ty(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&gy(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Fv({group:t});o(Pv(Nv({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Cy(e){e.defaultPrevented||my(e,$v()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=Sy({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function wy(e){let t=$v();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Ty({groupId:e}){let t=()=>{let t=$v();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=xy({layout:e,panelConstraints:r});return n?o:(by(o,c)||ty(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Ey(e,t){let n=wy(e),r=Qv(n.id,!0),i=n.separators.find(t=>t.element===e);Lv(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Lv(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Ty({groupId:n.id}).getLayout(),c=xy({layout:yy({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});by(s,c)||ty(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Dy(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=wy(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Ey(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Ey(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Ey(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Ey(t,-5);break;case`End`:e.preventDefault(),Ey(t,100);break;case`Enter`:{e.preventDefault();let n=wy(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Qv(n.id,!0),o=n.separators.find(e=>e.element===t);Lv(o,`Matching separator not found`);let s=a.get(o);Lv(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Lv(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Ey(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=wy(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Lv(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Ey(t,-100);break}}var Oy={cursorFlags:0,state:`inactive`},ky=new qv;function Ay(){return Oy}function jy(e){return ky.addListener(`change`,e)}function My(e){let t=Oy,n={...Oy};n.cursorFlags=e,Oy=n,ky.emit(`change`,{prev:t,next:n})}function Ny(e){let t=Oy;Oy=e,ky.emit(`change`,{prev:t,next:e})}function Py(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=$v(),n=my(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Ny({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Fy=e=>e,Iy=()=>{},Ly=1,Ry=2,zy=4,By=8,Vy=3,Hy=12,Uy;function Wy(){return Uy===void 0&&(Uy=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Uy=!0)),Uy}function Gy({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Wy()){let t=(e&Ly)!==0,n=(e&Ry)!==0,r=(e&zy)!==0,i=(e&By)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return Wy()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Ky=new WeakMap;function qy(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Ky.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Ay();switch(r.state){case`active`:case`hover`:{let e=Gy({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}Ky.set(e,{prevStyle:t,styleSheet:n})}function Jy({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=yy({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(by(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ly:Ry;break;case`vertical`:s|=d<0?zy:By;break}}else ty(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Vy:c|=s&Vy,t.movementY===0?c|=o&Hy:c|=s&Hy,My(c),qy(e)}function Yy(e){let t=$v(),n=Ay();switch(n.state){case`active`:Jy({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Xy(e){if(e.defaultPrevented)return;let t=Ay(),n=$v();switch(t.state){case`active`:if(e.buttons===0){Ny({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Qv(e.group.id,!0);ty(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Jy({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=my(e,n);r.length===0?t.state!==`inactive`&&Ny({cursorFlags:0,state:`inactive`}):Ny({cursorFlags:0,hitRegions:r,state:`hover`}),qy(e.currentTarget);break}}}function Zy(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ay().state){case`hover`:Ny({cursorFlags:0,state:`inactive`})}}function Qy(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ay();switch(t.state){case`active`:Ny({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(qy(e.currentTarget),t.hitRegions.forEach(e=>{let t=Qv(e.group.id,!0);ty(e.group,t)}),e.preventDefault())}}function $y(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Pv(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Pv((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function eb(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Fv({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Pv(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function tb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function nb({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=Pv(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=Pv((r[e]??0)/a*l);else{let e=Pv(l/c.length);for(let t of c)u[t]=e}return u}function rb(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var ib=new Map;function ab(e){let t=!0;Lv(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=Fv({group:e});if(t===0)return;let n=Qv(e.id);if(!n)return;let r=Iv(e),i=n.defaultLayoutDeferred?$y(r):n.layout,a=xy({layout:nb({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&by(n.layout,a)&&tb(n.derivedPanelConstraints,r)&&n.groupSize===t)return;ty(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else eb(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Lv(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=Fv({group:e}),s=Iv(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(rb(e.panels,l)||(l=void 0));let u=xy({layout:e.mutableState.layouts[c]??l??$y(s),panelConstraints:s}),d=e.element.ownerDocument;ib.set(d,(ib.get(d)??0)+1);let f=new Map;return Kv(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),ty(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Lv(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,Dy)}),ib.get(d)===1&&(d.addEventListener(`dblclick`,Cy,!0),d.addEventListener(`pointerdown`,Py,!0),d.addEventListener(`pointerleave`,Yy),d.addEventListener(`pointermove`,Xy),d.addEventListener(`pointerout`,Zy),d.addEventListener(`pointerup`,Qy,!0)),function(){t=!1,ib.set(d,Math.max(0,(ib.get(d)??0)-1)),Xv(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Dy)}),ib.get(d)||(d.removeEventListener(`dblclick`,Cy,!0),d.removeEventListener(`pointerdown`,Py,!0),d.removeEventListener(`pointerleave`,Yy),d.removeEventListener(`pointermove`,Xy),d.removeEventListener(`pointerout`,Zy),d.removeEventListener(`pointerup`,Qy,!0)),a.disconnect()}}function ob(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function sb(e){let t=(0,Q.useId)();return`${e??t}`}var cb=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function lb(e){let t=(0,Q.useRef)(e);return cb(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function ub(...e){return lb(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function db(e){let t=(0,Q.useRef)({...e});return cb(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var fb=(0,Q.createContext)(null);function pb(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Fy});(0,Q.useImperativeHandle)(t,()=>n.current,[]),cb(()=>{Object.assign(n.current,Ty({groupId:e}))})}function mb({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=lb(e=>{by(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=lb(e=>{by(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=sb(s),v=(0,Q.useRef)(null),[y,b]=ob(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=ub(v,a);pb(_,o);let C=lb((e,t)=>{let r=Ay(),i=Zv(e),a=Qv(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=db({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Rv(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Rv(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Zv(_),i=Qv(_);r&&i&&ty(r,{...i,derivedPanelConstraints:Iv(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,Q.useRef)(null);return cb(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=ab(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Qv(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=ey(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=gy(t.collapsedSize,i[t.panelId]),a=gy(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Ay().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(fb.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}mb.displayName=`Group`;function hb(){let e=(0,Q.useContext)(fb);return Lv(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function gb(e,t){let{id:n}=hb(),r=(0,Q.useRef)({collapse:Iy,expand:Iy,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Iy});(0,Q.useImperativeHandle)(t,()=>r.current,[]),cb(()=>{Object.assign(r.current,Sy({groupId:n,panelId:e}))})}function _b({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=sb(c),_=db({disabled:a}),v=(0,Q.useRef)(null),y=ub(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=hb(),T=d!==null,E=lb((e,t,n)=>{d?.(e,c,n)});cb(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),gb(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>ey(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...vb,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}_b.displayName=`Panel`;var vb={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function yb(){return(0,Q.useRef)(null)}function bb({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=xy({layout:yy({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=xy({layout:yy({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function xb({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=sb(a),l=db({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=ub(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=hb(),x=v===`horizontal`?`vertical`:`horizontal`;cb(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=jy(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=ey(_,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(bb({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}xb.displayName=`Separator`;var Sb={name:`toml`,startState:function(){return{inString:!1,stringType:``,lhs:!0,inArray:0}},token:function(e,t){let n;if(!t.inString&&(n=e.match(/^('''|"""|'|")/))&&(t.stringType=n[0],t.inString=!0),e.sol()&&!t.inString&&t.inArray===0&&(t.lhs=!0),t.inString){for(;t.inString;)if(e.match(t.stringType))t.inString=!1;else if(e.peek()===`\\`)e.next(),e.next();else if(e.eol())break;else e.match(/^.[^\\\"\']*/);return t.lhs?`property`:`string`}else if(t.inArray&&e.peek()===`]`)return e.next(),t.inArray--,`bracket`;else if(t.lhs&&e.peek()===`[`&&e.skipTo(`]`))return e.next(),e.peek()===`]`&&e.next(),`atom`;else if(e.peek()===`#`)return e.skipToEnd(),`comment`;else if(e.eatSpace())return null;else if(t.lhs&&e.eatWhile(function(e){return e!=`=`&&e!=` `}))return`property`;else if(t.lhs&&e.peek()===`=`)return e.next(),t.lhs=!1,null;else if(!t.lhs&&e.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return`atom`;else if(!t.lhs&&(e.match(`true`)||e.match(`false`)))return`atom`;else if(!t.lhs&&e.peek()===`[`)return t.inArray++,e.next(),`bracket`;else if(!t.lhs&&e.match(/^\-?\d+(?:\.\d+)?/))return`number`;else e.eatSpace()||e.next();return null},languageData:{commentTokens:{line:`#`}}},Cb=$t({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),wb=ie({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Tb(e){switch(e.toLowerCase()){case`json`:return Js().language;case`toml`:return Ws.define(Sb);default:return null}}function Eb(e){let t=(0,$.c)(5),{_:n}=i(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`loading`},t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),s,c;return t[1]!==n||t[2]!==e?(s=()=>{let t=!1,r=new AbortController;return o({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:r.signal}).then(async e=>{if(!e.ok){let t=e.status;throw Error(n({id:`PauP7d`,values:{status:t}}))}return e.text()}).then(e=>{t||o({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||o({status:`error`,message:e instanceof Error?e.message:n({id:`ig5vUe`})})}),()=>{t=!0,r.abort()}},c=[e,n],t[1]=n,t[2]=e,t[3]=s,t[4]=c):(s=t[3],c=t[4]),(0,Q.useEffect)(s,c),a}function Db(e){let t=(0,$.c)(28),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:c}=Jn(),l=Eb(n),u=l.status===`loaded`?l.content:null,d,f;if(t[0]!==i||t[1]!==u||t[2]!==c?(d=()=>{if(!a.current||u===null)return;let e=Tb(i),t=c===`dark`?Cb:wb,n=[Qs,...e?[e]:[],Bs.editable.of(!0),As.readOnly.of(!0),Bs.lineWrapping,t],r=new Bs({state:As.create({doc:u,extensions:n}),parent:a.current});return o.current=r,()=>{r.destroy(),o.current=null}},f=[u,i,c],t[0]=i,t[1]=u,t[2]=c,t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f),l.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Md709y`,values:{fileName:r}})}),t[5]=r,t[6]=e);let n;return t[7]!==i||t[8]!==r||t[9]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loading`,"data-text-viewer-extension":i,children:e}),t[7]=i,t[8]=r,t[9]=e,t[10]=n):n=t[10],n}if(l.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(s,{id:`qdBUHP`,values:{fileName:r}})}),t[11]=r,t[12]=e);let a;t[13]===l.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:l.message}),t[13]=l.message,t[14]=a);let o;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`9npOH9`}),t[15]=o):o=t[15];let c;t[16]===n?c=t[17]:(c=(0,Z.jsx)(`a`,{href:n,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:o}),t[16]=n,t[17]=c);let u;return t[18]!==i||t[19]!==r||t[20]!==e||t[21]!==a||t[22]!==c?(u=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`error`,"data-text-viewer-extension":i,children:[e,a,c]}),t[18]=i,t[19]=r,t[20]=e,t[21]=a,t[22]=c,t[23]=u):u=t[23],u}let p;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[24]=p):p=t[24];let m;return t[25]!==i||t[26]!==r?(m=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":i,children:p}),t[25]=i,t[26]=r,t[27]=m):m=t[27],m}function Ob(e){return Qn(`/api/asset?path=${encodeURIComponent(e)}`)}function kb(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Ab(e){let t=(0,$.c)(28),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=Ob(n),t[0]=n,t[1]=o);let c=o,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u.includes(`.`)?u.split(`.`).pop()??``:``;if(f=e.length>0?e.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[12]!==u||t[13]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(nt,{src:c,title:u,fillContainer:!0})}),t[12]=u,t[13]=c,t[14]=e):e=t[14];let n;t[15]!==u||t[16]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[15]=u,t[16]=e,t[17]=n):n=t[17],p=n;break bb0}if(d===`text`){let r;t[18]===n?r=t[19]:(r=kb(n),t[18]=n,t[19]=r),p=(0,Z.jsx)(Db,{src:r,fileName:u,extension:e.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,t[9]=d,t[10]=f,t[11]=p}else d=t[9],f=t[10],p=t[11];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[20]!==d||t[21]!==f||t[22]!==u||t[23]!==c?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(St,{src:c,alt:u,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 text-center`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-md border bg-muted font-medium text-muted-foreground text-sm`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:u}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(qi,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsx)(`a`,{href:c,children:(0,Z.jsx)(s,{id:`9npOH9`})})}),(0,Z.jsx)(qi,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:(0,Z.jsx)(s,{id:`Ruuu3v`})})]})]})}),t[20]=d,t[21]=f,t[22]=u,t[23]=c,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:m}),t[25]=u,t[26]=m,t[27]=h):h=t[27],h}function jb(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(pa,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(pa,{className:`h-4 w-full`}),(0,Z.jsx)(pa,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}var Mb={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Nb(e){let t=(0,$.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=Jn(),s=Mb[r],c=s?(o===`dark`?_r[s]:void 0)??zr[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=Bi(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(Qi,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,Z.jsx)(Zi,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(ia,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function Pb(e){let{installState:t}=e;return t.installed===null?Y._({id:`IA6JW2`}):t.installed===!1?Y._({id:`5SwVv1`}):null}function Fb(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:Y._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:Y._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:Y._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function Ib(e){return Ni(e)}function Lb(e){return Y._({id:`h_HYHD`,values:{displayName:e}})}var Rb=`claude.ai`;async function zb(e,t=qh){(await t(Ni(e))).ok?X.success(Lb(Rb)):X.error(Y._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:Rb}}))}function Bb(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??qh,u=e.onWebFallbackSuccess??Hb,d=e.onWebFallbackError??Vb,{displayName:f}=r,p,m,h,g,_,v,y,b,x,S;if(t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==c||t[4]!==d||t[5]!==u||t[6]!==l||t[7]!==s||t[8]!==r||t[9]!==f){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Fb({target:r,installState:a,isElectronHost:o}),i=Pb({target:r,installState:a,isElectronHost:o}),C=()=>{e.tooltip&&l(e.tooltip.installAction.url)},w;t[20]!==d||t[21]!==u||t[22]!==l||t[23]!==s||t[24]!==r?(w=()=>{(async()=>{let e=await l(Ib(s));e.ok?u(r):d(r,e.detail??e.reason)})()},t[20]=d,t[21]=u,t[22]=l,t[23]=s,t[24]=r,t[25]=w):w=t[25];let T=w;if(e.enabled){let e=`open-in-agent-item-${r.id}`,i;t[26]!==n||t[27]!==f?(i=n({id:`NnQapF`,values:{targetDisplayName:f}}),t[26]=n,t[27]=f,t[28]=i):i=t[28];let a;t[29]===r.id?a=t[30]:(a=(0,Z.jsx)(Nb,{id:r.id,"aria-hidden":`true`}),t[29]=r.id,t[30]=a);let o;t[31]===r.displayName?o=t[32]:(o=(0,Z.jsx)(`span`,{children:r.displayName}),t[31]=r.displayName,t[32]=o);let s;t[33]!==c||t[34]!==i||t[35]!==a||t[36]!==o||t[37]!==e?(s=(0,Z.jsxs)(go,{onSelect:c,"data-testid":e,"aria-label":i,children:[a,o]}),t[33]=c,t[34]=i,t[35]=a,t[36]=o,t[37]=e,t[38]=s):s=t[38],S=s;break bb0}if(!e.tooltip){let e=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),a;t[39]===r.id?a=t[40]:(a=(0,Z.jsx)(Nb,{id:r.id,"aria-hidden":`true`}),t[39]=r.id,t[40]=a);let o;t[41]===r.displayName?o=t[42]:(o=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[41]=r.displayName,t[42]=o),S=(0,Z.jsxs)(go,{disabled:!0,"data-testid":`open-in-agent-item-${r.id}`,"aria-label":e,children:[a,o,i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null]});break bb0}let E=n(i?{id:`If0crP`,values:{targetDisplayName:f,hint:i}}:{id:`NnQapF`,values:{targetDisplayName:f}}),D=e.tooltip.webFallback?.label??``;m=zo;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(Nb,{id:r.id,"aria-hidden":`true`,className:`mr-2`}),t[43]=r.id,t[44]=k);let A;t[45]===r.displayName?A=t[46]:(A=(0,Z.jsx)(`span`,{className:`flex-1`,children:r.displayName}),t[45]=r.displayName,t[46]=A);let j;t[47]===i?j=t[48]:(j=i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:i}):null,t[47]=i,t[48]=j),t[49]!==E||t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==O?(x=(0,Z.jsxs)(uo,{"data-testid":O,"data-row-disabled":``,"aria-label":E,children:[k,A,j]}),t[49]=E,t[50]=k,t[51]=A,t[52]=j,t[53]=O,t[54]=x):x=t[54],p=xo,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(Uo,{className:`font-normal text-muted-foreground text-xs`,"data-testid":`open-in-agent-message-${r.id}`,children:e.tooltip.message}),t[55]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Ao,{}),t[55]=v):v=t[55],y=(0,Z.jsx)(go,{onSelect:C,"data-testid":`open-in-agent-install-${r.id}`,children:(0,Z.jsx)(`span`,{children:e.tooltip.installAction.label})}),b=e.tooltip.webFallback?(0,Z.jsxs)(go,{onSelect:T,"data-testid":`open-in-agent-web-fallback-${r.id}`,"aria-label":n({id:`lsOFZR`,values:{webFallbackLabel:D}}),children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:e.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:n({id:`Z9BoIy`})})]}):null}t[0]=n,t[1]=a,t[2]=o,t[3]=c,t[4]=d,t[5]=u,t[6]=l,t[7]=s,t[8]=r,t[9]=f,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}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];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let C;t[56]!==p||t[57]!==h||t[58]!==g||t[59]!==_||t[60]!==v||t[61]!==y||t[62]!==b?(C=(0,Z.jsxs)(p,{className:h,"data-testid":g,children:[_,v,y,b]}),t[56]=p,t[57]=h,t[58]=g,t[59]=_,t[60]=v,t[61]=y,t[62]=b,t[63]=C):C=t[63];let w;return t[64]!==m||t[65]!==x||t[66]!==C?(w=(0,Z.jsxs)(m,{children:[x,C]}),t[64]=m,t[65]=x,t[66]=C,t[67]=w):w=t[67],w}function Vb(){}function Hb(){}function Ub(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=Cg(),{dispatch:a}=fg(),o=Fo(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=$h({workspace:o});t[7]===n?s=t[8]:(s=Bi(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=bh.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(Wb,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{ng(t),i()}},t.id)}),t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`div`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Wb(e){let t=(0,$.c)(22),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(Nb,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===n.tagline?f=t[8]:(f=n.tagline?(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.tagline}):null,t[7]=n.tagline,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r===`missing`?(0,Z.jsx)($o,{"aria-hidden":`true`,className:`size-3`}):null,t[12]=r,t[13]=m);let h;t[14]!==c||t[15]!==m?(h=(0,Z.jsxs)(`p`,{className:`mt-auto inline-flex items-center gap-1 pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==o||t[19]!==p||t[20]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[p,h]}),t[17]=s,t[18]=o,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}var Gb=3100,Kb=3;function qb(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Kb;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var Jb={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},Yb=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function Xb(e,t={}){let n=t.rng??Math.random,r=t.colors??Yb,i=Jb[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var Zb=1.8,Qb=90,$b=16,ex=380,tx=.025,nx=.1,rx=.18,ix=400,ax=9.2736,ox=18.1799,sx=14.5244,cx={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function lx(e,t){let{halfWidth:n,apexLift:r}=cx[t];return`M${e-n} ${sx+.3} Q${e} ${sx-r}, ${e+n} ${sx+.3}`}function ux(e){let t=1.5,n=.3;return`M${e-t} ${sx-n} Q${e} ${sx+1.4}, ${e+t} ${sx-n}`}var dx=15,fx=15;function px(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function mx(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=qb(g,t);_(n),y(vx),S(Xb(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Gb)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(_x),S(Xb(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Gb))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/ex)),C=Math.max(-1,Math.min(1,b/ex)),w=S*$b,T=-C*$b,E=0,D=0;if(x>=1){let e=Math.min(x/Qb,1)*Zb;E=y/x*e,D=b/x*e}let O=Math.abs(T-r)<.01&&Math.abs(w-i)<.01&&Math.abs(E-a)<.01&&Math.abs(D-o)<.01;if(!m&&O)return;l(),r+=(T-r)*nx,i+=(w-i)*nx,u.style.transform=`perspective(${ix}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*rx,o+=(D-o)*rx;let k=i*tx,A=-r*tx,j=a+k,M=o+A;h.current.x=j,h.current.y=M,p.current?.setAttribute(`transform`,`translate(${j.toFixed(3)} ${M.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=Bi(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=Bi(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=Bi(`ok-blob-eye`,W),t[22]=W,t[23]=G);let ee;t[24]===G?ee=t[25]:(ee=(0,Z.jsx)(`ellipse`,{cx:ax,cy:sx,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=ee);let K=(F||T)&&`ok-blob-eye-hidden`,te;t[26]===K?te=t[27]:(te=Bi(`ok-blob-eye ok-blob-eye-right`,K),t[26]=K,t[27]=te);let ne;t[28]===te?ne=t[29]:(ne=(0,Z.jsx)(`ellipse`,{cx:ox,cy:sx,rx:1.2722,ry:1.9083,className:te}),t[28]=te,t[29]=ne);let q;t[30]===I?q=t[31]:(q=lx(ax,I),t[30]=I,t[31]=q);let re=(!F||T)&&`ok-blob-eye-hidden`,ie;t[32]===re?ie=t[33]:(ie=Bi(`ok-blob-happy-eye`,re),t[32]=re,t[33]=ie);let ae;t[34]!==q||t[35]!==ie?(ae=(0,Z.jsx)(`path`,{d:q,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[34]=q,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=lx(ox,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=Bi(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:ux(ax),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:ux(ox),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==ee||t[47]!==ne||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[ee,ne,ae,le,ue]}),t[46]=ee,t[47]=ne,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(hx)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:gx,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function hx(e){return(0,Z.jsx)(`circle`,{cx:dx+e.originDx,cy:fx+e.originDy,r:e.size,className:`ok-blob-firework`,style:px(e)},e.id)}function gx(e){return e.preventDefault()}function _x(e){return e+1}function vx(e){return e+1}function yx(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(mx,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function bx(){let e=(0,$.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=_a(`command-palette`),e[0]=t):t=e[0];let n=t,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(D,{children:n}),e[1]=r):r=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[r,` `,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A1taO8`})})]}),e[2]=i):i=e[2],i}var xx=`open-knowledge:create-top-level-file`;function Sx(){window.dispatchEvent(new CustomEvent(xx))}function Cx(e){let t=()=>e();return window.addEventListener(xx,t),()=>window.removeEventListener(xx,t)}function wx(){let e=(0,$.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(void 0),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(0),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(void 0),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(Ox);if(e)return;let r=t.ok?Cr.safeParse(n):null;r?.success?(o(kx(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=ji(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(u.current)}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(){clearTimeout(u.current),u.current=setTimeout(()=>c(Dx),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(Ex);if(!e.ok)return;let n=Cr.safeParse(t);n.success&&o(kx(n.data.documents))}).catch(Tx)},e[2]=p):p=e[2];let m=p,h=a!==null,g=a===0,_;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){n(e),e||i(void 0)},e[3]=_):_=e[3];let v=_,y;e[4]!==s||e[5]!==g||e[6]!==h?(y=h?g?(0,Z.jsx)(Ax,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(jx,{celebrateSignal:s,onAddStarterPack:()=>{n(!0)}}):null,e[4]=s,e[5]=g,e[6]=h,e[7]=y):y=e[7];let b;e[8]!==r||e[9]!==t?(b=(0,Z.jsx)(fh,{open:t,onOpenChange:v,onSeedApplied:m,initialPackId:r}),e[8]=r,e[9]=t,e[10]=b):b=e[10];let x;return e[11]!==y||e[12]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 sm:px-12 md:px-16 subtle-scrollbar`,children:[y,b]}),e[11]=y,e[12]=b,e[13]=x):x=e[13],x}function Tx(){}function Ex(){return null}function Dx(e){return e+1}function Ox(){return null}function kx(e){return Un(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function Ax(e){let t=(0,$.c)(16),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`ZmGmNh`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`W8uemY`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(yx,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===r?u=t[9]:(u=(0,Z.jsx)(ah,{onPackSelect:r}),t[8]=r,t[9]=u);let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(qi,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:Sx,children:(0,Z.jsx)(s,{id:`ensWZc`,components:{0:(0,Z.jsx)(Bo,{"aria-hidden":`true`,className:`size-3`})}})}),t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[u,d]}),t[11]=u,t[12]=f);let p;return t[13]!==l||t[14]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15],p}function jx(e){let t=(0,$.c)(19),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i();if(_h())return null;let o;t[0]===a?o=t[1]:(o=a({id:`8XS8nG`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`GjElCU`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(yx,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ub,{}),t[8]=u):u=t[8];let d,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),f=(0,Z.jsx)(s,{id:`IajAbS`}),t[9]=d,t[10]=f):(d=t[9],f=t[10]);let p;t[11]===r?p=t[12]:(p=(0,Z.jsxs)(qi,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[d,f]}),t[11]=r,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(bx,{}),t[13]=m):m=t[13];let h;t[14]===p?h=t[15]:(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[u,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[p,m]})]}),t[14]=p,t[15]=h);let g;return t[16]!==l||t[17]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function Mx(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function Nx(e){let t=(0,$.c)(83),{folderPath:n,state:r,onChange:a}=e,{_:o}=i(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(Ix,{}),(0,Z.jsx)(pa,{className:`h-7 w-full`}),(0,Z.jsx)(pa,{className:`h-7 w-full`}),(0,Z.jsx)(pa,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.folder.frontmatter_defaults?m=t[4]:(m=r.data.folder.frontmatter_defaults??{},t[3]=r.data.folder.frontmatter_defaults,t[4]=m);let h=m,g;t[5]===r.data.frontmatterLocal?g=t[6]:(g=r.data.frontmatterLocal??{},t[5]=r.data.frontmatterLocal,t[6]=g);let _=g,v=r.data.frontmatterSources,y;t[7]===r.data.folder.path?y=t[8]:(y=Mx(r.data.folder.path),t[7]=r.data.folder.path,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,A,j,M,N,P;if(t[9]!==o||t[10]!==u||t[11]!==c||t[12]!==b||t[13]!==n||t[14]!==_||t[15]!==h||t[16]!==a||t[17]!==f||t[18]!==v||t[19]!==r.data.schemaDeclarations||t[20]!==r.data.schemaLocal||t[21]!==r.data.schemaSources){let e=Object.keys(h),i=r.data.schemaDeclarations,m=r.data.schemaLocal??{},g=r.data.schemaSources,y=Object.keys(i).filter(e=>!Object.hasOwn(h,e)),F=async function(e,t){let r=await wo(n,{[e]:t});if(!r.ok){let{error:e}=r;X.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},I=async function(e){let t=await wo(n,{[e]:null});if(!t.ok){let{error:e}=t;X.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},L=function(e,t){let n=h[e];F(e,Da(n,t))},R;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){d({name:``,type:`text`,value:``,error:null,mode:e===void 0?`value`:e}),l(!1)},t[36]=R):R=t[36],C=R;let z;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):xa[e];return{...t,type:e,value:n,error:null}})},t[37]=z):z=t[37],T=z;let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){d(t=>t&&{...t,value:e})},t[38]=B):B=t[38],E=B;let V;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){d(t=>t&&{...t,name:e,error:null})},t[39]=V):V=t[39],w=V;let H;t[40]!==o||t[41]!==u||t[42]!==i||t[43]!==n||t[44]!==h||t[45]!==a?(H=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(u.mode===`declaration`){if(Object.hasOwn(i,e)){d({...u,error:o({id:`7-KLnW`,values:{trimmed:e}})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`mcWHC0`,values:{trimmed:e}})});return}let t=await fa(n,{[e]:{type:u.type}});if(!t.ok){d({...u,error:t.error});return}d(null),a();return}if(Qr(u.value)){d({...u,error:o({id:`hXUWyd`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=await wo(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[40]=o,t[41]=u,t[42]=i,t[43]=n,t[44]=h,t[45]=a,t[46]=H):H=t[46],D=H;let U=async function(e){let t=await fa(n,{[e]:null});if(!t.ok){X.error(t.error);return}a()},W=function(e){p({key:e,draft:e,error:null})},G=function(e){p(t=>t&&{...t,draft:e,error:null})},ee=async function(){if(!f)return;let e=f.draft.trim();if(!e){p({...f,error:o({id:`8_brI5`})});return}if(e===f.key){p(null);return}if(Object.hasOwn(h,e)){p({...f,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}if(Object.hasOwn(i,e)){p({...f,error:o({id:`3IKxHW`,values:{trimmed:e}})});return}let t=h[f.key],r=await wo(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},K=function(){p(null)};O=`rounded-lg border bg-card`,S=_s,M=!c,t[47]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>l(!e),t[47]=N):N=t[47];let te=`size-3 transition-transform ${c?``:`rotate-90`}`,ne;t[48]===te?ne=t[49]:(ne=(0,Z.jsx)(ps,{className:te,"aria-hidden":!0}),t[48]=te,t[49]=ne);let q;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[50]=q):q=t[50];let re;t[51]===ne?re=t[52]:(re=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[ne,q]}),t[51]=ne,t[52]=re);let ie;t[53]===b?ie=t[54]:(ie=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:Fx,children:b}),t[53]=b,t[54]=ie),t[55]!==re||t[56]!==ie?(P=(0,Z.jsxs)(gs,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[re,ie]}),t[55]=re,t[56]=ie,t[57]=P):P=t[57],x=hs,k=`px-2 py-2`,t[58]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DnYq8I`})}),t[58]=A):A=t[58],j=e.length===0&&y.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`4c_a6S`})}):(0,Z.jsxs)(Z.Fragment,{children:[e.map(e=>{let t=h[e],n=Object.hasOwn(_,e);return(0,Z.jsx)(La,{keyName:e,value:t,declared:Na(t,gi(t)),rename:n?{state:f?.key===e?f:null,onBegin:()=>W(e),onChangeDraft:G,onCommit:ee,onCancel:K}:void 0,badge:n?null:(0,Z.jsx)(Va,{source:v[e]??``}),isInherited:!n,onCommit:t=>void F(e,t),onChangeType:t=>L(e,t),onRemove:n?()=>void I(e):void 0},e)}),y.length>0&&e.length>0?(0,Z.jsx)(`div`,{className:`my-1 border-t border-dashed border-border`,"aria-hidden":!0}):null,y.map(e=>{let t=i[e],r=Object.hasOwn(m,e),o=t.type;return(0,Z.jsx)(La,{keyName:e,value:``,declared:o,badge:(0,Z.jsx)(Fa,{source:g[e]??``,inlineSource:!r,icon:(0,Z.jsx)(aa,{className:`size-2.5`,"aria-hidden":!0})}),isInherited:!r,valueHint:(0,Z.jsx)(`div`,{className:`flex h-7 items-center px-2 text-xs italic text-muted-foreground`,children:(0,Z.jsx)(s,{id:`E62FLF`})}),onCommit:Px,onChangeType:t=>{r&&fa(n,{[e]:{type:t}}).then(e=>{e.ok?a():X.error(e.error)})},onRemove:r?()=>void U(e):void 0},`__decl__${e}`)})]}),t[9]=o,t[10]=u,t[11]=c,t[12]=b,t[13]=n,t[14]=_,t[15]=h,t[16]=a,t[17]=f,t[18]=v,t[19]=r.data.schemaDeclarations,t[20]=r.data.schemaLocal,t[21]=r.data.schemaSources,t[22]=x,t[23]=S,t[24]=C,t[25]=w,t[26]=T,t[27]=E,t[28]=D,t[29]=O,t[30]=k,t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P}else x=t[22],S=t[23],C=t[24],w=t[25],T=t[26],E=t[27],D=t[28],O=t[29],k=t[30],A=t[31],j=t[32],M=t[33],N=t[34],P=t[35];let F;t[59]!==u||t[60]!==C||t[61]!==w||t[62]!==T||t[63]!==E||t[64]!==D?(F=u?(0,Z.jsx)(So,{draft:u,onChangeName:w,onChangeType:T,onChangeValue:E,onCommit:()=>void D(),onCancel:()=>d(null)}):(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:[(0,Z.jsxs)(qi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>C(`value`),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(fe,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`7IcK2R`})})]}),(0,Z.jsxs)(qi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`declare-field-trigger`,onClick:()=>C(`declaration`),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(aa,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`dZHyu7`})})]})]}),t[59]=u,t[60]=C,t[61]=w,t[62]=T,t[63]=E,t[64]=D,t[65]=F):F=t[65];let I;t[66]!==F||t[67]!==k||t[68]!==A||t[69]!==j?(I=(0,Z.jsxs)(`div`,{className:k,children:[A,j,F]}),t[66]=F,t[67]=k,t[68]=A,t[69]=j,t[70]=I):I=t[70];let L;t[71]!==x||t[72]!==I?(L=(0,Z.jsx)(x,{children:I}),t[71]=x,t[72]=I,t[73]=L):L=t[73];let R;t[74]!==S||t[75]!==L||t[76]!==M||t[77]!==N||t[78]!==P?(R=(0,Z.jsxs)(S,{open:M,onOpenChange:N,children:[P,L]}),t[74]=S,t[75]=L,t[76]=M,t[77]=N,t[78]=P,t[79]=R):R=t[79];let z;return t[80]!==O||t[81]!==R?(z=(0,Z.jsx)(`section`,{className:O,children:R}),t[80]=O,t[81]=R,t[82]=z):z=t[82],z}function Px(){}function Fx(e){return e.stopPropagation()}function Ix(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Lc,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function Lx(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function Rx(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=Lx(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function zx(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Bx(e,t){let n=`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:Rx(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:zx(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:Rx(e,t.pageTitles),children:a}}function Vx(e){let t=(0,$.c)(44),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})})}),(0,Z.jsx)(pa,{className:`h-12 w-full`}),(0,Z.jsx)(pa,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let h;t[3]===r.data.folder.templates_available?h=t[4]:(h=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})}),t[5]=_):_=t[5];let v;t[6]===g.length?v=t[7]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,(0,Z.jsx)(K,{className:`text-xs`,variant:`secondary`,children:g.length})]}),t[6]=g.length,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(qi,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[8]=y):y=t[8];let b;t[9]===v?b=t[10]:(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[v,y]}),t[9]=v,t[10]=b);let x;t[11]===g?x=t[12]:(x=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:g.map(e=>(0,Z.jsx)(qo,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Va,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=g,t[12]=x);let S;t[13]!==b||t[14]!==x?(S=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[b,x]}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e||c(null)},t[16]=C):C=t[16];let w;t[17]!==o||t[18]!==n||t[19]!==i?(w=(0,Z.jsx)(Ja,{folderPath:n,template:o,onOpenChange:C,onSaved:i}),t[17]=o,t[18]=n,t[19]=i,t[20]=w):w=t[20];let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||u(null)},t[21]=T):T=t[21];let E;t[22]!==l||t[23]!==i?(E=(0,Z.jsx)(ba,{template:l,onOpenChange:T,onDeleted:i}),t[22]=l,t[23]=i,t[24]=E):E=t[24];let D;t[25]===g?D=t[26]:(D=new Set(g.map(Hx)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(za,{folderPath:n,existingNames:D,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=D,t[31]=O):O=t[31];let k=d!==null,A;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||f(null)},t[32]=A):A=t[32];let j=d??void 0,M;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(M=(0,Z.jsx)(Hm,{open:k,onOpenChange:A,kind:`file`,initialDir:n,initialTemplate:j,folderConfig:a}),t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==E||t[39]!==O||t[40]!==M||t[41]!==S||t[42]!==w?(N=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,M]}),t[38]=E,t[39]=O,t[40]=M,t[41]=S,t[42]=w,t[43]=N):N=t[43],N}function Hx(e){return e.name}function Ux(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Bi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Bi(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function Wx(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=Bi(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Gx(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=Bi(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Kx(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=Bi(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function qx(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=Bi(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Jx(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=Bi(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yx(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Y._({id:`xOTzt5`});if(r<60)return Y._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Y._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Y._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Xx(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function Zx(e){let t=(0,$.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Z.jsx)(Pe,{className:`ml-1 size-3`}):(0,Z.jsx)(Jt,{className:`ml-1 size-3`}):(0,Z.jsx)(hc,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(qi,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function Qx(e){let t=(0,$.c)(92),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=wi(),d=To(n),{state:f,refresh:p}=d,[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(`name`),[v,y]=(0,Q.useState)(`asc`);if(o){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(pa,{className:`size-5 rounded`}),(0,Z.jsx)(pa,{className:`h-7 w-48`})]}),(0,Z.jsx)(pa,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(pa,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(pa,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(tS)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let b,x,S,C,w,T,E,D,O,k;if(t[7]!==r||t[8]!==f||t[9]!==d||t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==l||t[14]!==c||t[15]!==p||t[16]!==v||t[17]!==g){let e=Bx(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=Xx(e.children,g,v),o;t[28]===g?o=t[29]:(o=function(e){e===g?y(eS):(_(e),y(`asc`))},t[28]=g,t[29]=o);let m=o;k=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(je,{className:`size-5 text-muted-foreground`}),t[30]=A):A=t[30];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:e.title})]}),M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(qi,{onClick:()=>h(!0),children:[(0,Z.jsx)(fe,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[31]=M):M=t[31],t[32]===j?E=t[33]:(E=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,M]})}),t[32]=j,t[33]=E),t[34]!==f||t[35]!==n||t[36]!==p?(D=(0,Z.jsx)(Nx,{folderPath:n,state:f,onChange:p}),t[34]=f,t[35]=n,t[36]=p,t[37]=D):D=t[37],t[38]!==f||t[39]!==d||t[40]!==n||t[41]!==p?(O=(0,Z.jsx)(Vx,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[38]=f,t[39]=d,t[40]=n,t[41]=p,t[42]=O):O=t[42],w=`rounded-lg border`,x=Ux;let N=g===`name`?v===`asc`?`ascending`:`descending`:`none`,P;t[43]===r?P=t[44]:(P=r({id:`6YtxFj`}),t[43]=r,t[44]=P);let F;t[45]!==m||t[46]!==v||t[47]!==g||t[48]!==P?(F=(0,Z.jsx)(Zx,{label:P,sortKey:`name`,activeKey:g,activeDir:v,onSort:m}),t[45]=m,t[46]=v,t[47]=g,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==N||t[51]!==F?(I=(0,Z.jsx)(qx,{"aria-sort":N,children:F}),t[50]=N,t[51]=F,t[52]=I):I=t[52];let L=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,R;t[53]===r?R=t[54]:(R=r({id:`tgWuMB`}),t[53]=r,t[54]=R);let z;t[55]!==m||t[56]!==v||t[57]!==g||t[58]!==R?(z=(0,Z.jsx)(Zx,{label:R,sortKey:`modified`,activeKey:g,activeDir:v,onSort:m}),t[55]=m,t[56]=v,t[57]=g,t[58]=R,t[59]=z):z=t[59];let B;t[60]!==L||t[61]!==z?(B=(0,Z.jsx)(qx,{className:`w-32`,"aria-sort":L,children:z}),t[60]=L,t[61]=z,t[62]=B):B=t[62],t[63]!==I||t[64]!==B?(C=(0,Z.jsx)(Wx,{children:(0,Z.jsxs)(Kx,{children:[I,B]})}),t[63]=I,t[64]=B,t[65]=C):C=t[65],b=Gx,S=i.length?i.map($x):(0,Z.jsx)(Kx,{children:(0,Z.jsx)(Jx,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Pkw7J9`})})}),t[7]=r,t[8]=f,t[9]=d,t[10]=n,t[11]=a,t[12]=u,t[13]=l,t[14]=c,t[15]=p,t[16]=v,t[17]=g,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k}else b=t[18],x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],O=t[26],k=t[27];let A;t[66]!==b||t[67]!==S?(A=(0,Z.jsx)(b,{children:S}),t[66]=b,t[67]=S,t[68]=A):A=t[68];let j;t[69]!==x||t[70]!==C||t[71]!==A?(j=(0,Z.jsxs)(x,{children:[C,A]}),t[69]=x,t[70]=C,t[71]=A,t[72]=j):j=t[72];let M;t[73]!==j||t[74]!==w?(M=(0,Z.jsx)(`div`,{className:w,children:j}),t[73]=j,t[74]=w,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==T||t[78]!==E||t[79]!==D||t[80]!==O?(N=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,M]}),t[76]=M,t[77]=T,t[78]=E,t[79]=D,t[80]=O,t[81]=N):N=t[81];let P;t[82]!==N||t[83]!==k?(P=(0,Z.jsx)(`div`,{className:k,children:N}),t[82]=N,t[83]=k,t[84]=P):P=t[84];let F;t[85]!==m||t[86]!==d||t[87]!==n?(F=(0,Z.jsx)(Hm,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[85]=m,t[86]=d,t[87]=n,t[88]=F):F=t[88];let I;return t[89]!==P||t[90]!==F?(I=(0,Z.jsxs)(Z.Fragment,{children:[P,F]}),t[89]=P,t[90]=F,t[91]=I):I=t[91],I}function $x(e){return(0,Z.jsxs)(Kx,{children:[(0,Z.jsx)(Jx,{children:(0,Z.jsxs)(`a`,{href:xi(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(zc,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(xt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(Jx,{className:`text-muted-foreground`,children:e.kind===`file`?Yx(e.modified):`—`})]},e.path)}function eS(e){return e===`asc`?`desc`:`asc`}function tS(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(pa,{className:`size-4 rounded`}),(0,Z.jsx)(pa,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(pa,{className:`h-4 w-16`})})]},e)}function nS(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?c.current?.focus():l.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Nc,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(s,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,Z.jsx)(`h2`,{ref:l,id:`large-file-title`,tabIndex:p,className:`text-2xl font-light text-balance outline-none`,children:m}),t[5]=p,t[6]=h);let g;t[7]===r?g=t[8]:(g=vi(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=vi(i),t[9]=i,t[10]=_);let v;t[11]!==n||t[12]!==g||t[13]!==_?(v=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_GBioJ`,values:{0:g,1:_,docName:n}})}),t[11]=n,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,v]}),t[15]=h,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==a||t[19]!==o?(b=o?(0,Z.jsxs)(qi,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(na,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[f,y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function rS(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(iS),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>w(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let c;t[2]===n?c=t[3]:(c=function(){V(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=c);let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A67Uwj`})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(s,{id:`dEgA5A`}),t[5]=d):d=t[5];let f;return t[6]===l?f=t[7]:(f=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[u,(0,Z.jsx)(qi,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:l,children:d})]}),t[6]=l,t[7]=f),f}function iS(){return new Set}var aS=(0,Q.createContext)(null);function oS(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(sS),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{i(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},t[1]=s):s=t[1];let c=s,l;t[2]===r?l=t[3]:(l={addPropertySignal:r,requestAddProperty:o,clearAddProperty:c},t[2]=r,t[3]=l);let u=l,d;return t[4]!==n||t[5]!==u?(d=(0,Z.jsx)(aS,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function sS(){return new Map}function cS(){let e=(0,Q.use)(aS);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function lS(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var uS=lS(()=>n(()=>import(`./SettingsDialogBody-B582h2g9.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([44,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,45,8,16,11,13,23]),import.meta.url));function dS(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(s,{id:`hwFOFD`})}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:o})]}),t[4]=o,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(qi,{variant:`default`,onClick:fS,children:(0,Z.jsx)(s,{id:`HpK_8d`})}),t[6]=u):u=t[6];let d;return t[7]===l?d=t[8]:(d=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[l,u]}),t[7]=l,t[8]=d),d}function fS(){return window.location.reload()}function pS(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(W,{fallbackRender:hS,onError:mS,children:n}),t[0]=n,t[1]=r),r}function mS(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function hS(e){return(0,Z.jsx)(dS,{...e})}function gS(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function _S(e){let t=(0,$.c)(81),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=ht(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=vt(),{desktopPresent:f}=ga(),[p,m]=(0,Q.useState)(`preferences`),h,g;t[0]===n?(h=t[1],g=t[2]):(h=()=>{n&&m(`preferences`)},g=[n],t[0]=n,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=o!==null,v;t[3]===a?v=t[4]:(v=a({id:`7PzzBU`}),t[3]=a,t[4]=v);let y;t[5]===a?y=t[6]:(y=a({id:`Q6hhn8`}),t[5]=a,t[6]=y);let b;t[7]===y?b=t[8]:(b={id:`preferences`,label:y},t[7]=y,t[8]=b);let x;t[9]===a?x=t[10]:(x=a({id:`4KmEoC`}),t[9]=a,t[10]=x);let S;t[11]===x?S=t[12]:(S={id:`hotkeys`,label:x},t[11]=x,t[12]=S);let C;t[13]===a?C=t[14]:(C=a({id:`AeXO77`}),t[13]=a,t[14]=C);let w;t[15]===C?w=t[16]:(w={id:`account`,label:C},t[15]=C,t[16]=w);let T;t[17]!==b||t[18]!==S||t[19]!==w?(T=[b,S,w],t[17]=b,t[18]=S,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==T||t[22]!==v?(E={id:`user`,label:v,enabled:!0,items:T},t[21]=T,t[22]=v,t[23]=E):E=t[23];let D;t[24]===a?D=t[25]:(D=a({id:`ZWyHmq`}),t[24]=a,t[25]=D);let O;t[26]===a?O=t[27]:(O=a({id:`Nu4DdT`}),t[26]=a,t[27]=O);let k;t[28]===O?k=t[29]:(k={id:`sync`,label:O},t[28]=O,t[29]=k);let A;t[30]===a?A=t[31]:(A=a({id:`iTylMl`}),t[30]=a,t[31]=A);let j;t[32]===A?j=t[33]:(j={id:`project-templates`,label:A},t[32]=A,t[33]=j);let M;t[34]===a?M=t[35]:(M=a({id:`3zyg_A`}),t[34]=a,t[35]=M);let N;t[36]===M?N=t[37]:(N={id:`okignore`,label:M},t[36]=M,t[37]=N);let P;t[38]===a?P=t[39]:(P=a({id:`cs4mps`}),t[38]=a,t[39]=P);let F;t[40]===P?F=t[41]:(F={id:`sharing`,label:P},t[40]=P,t[41]=F);let I;t[42]!==k||t[43]!==j||t[44]!==N||t[45]!==F?(I=[k,j,N,F],t[42]=k,t[43]=j,t[44]=N,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==_||t[48]!==D||t[49]!==I?(L={id:`project`,label:D,enabled:_,items:I},t[47]=_,t[48]=D,t[49]=I,t[50]=L):L=t[50];let R;t[51]===a?R=t[52]:(R=a({id:`nbfdhU`}),t[51]=a,t[52]=R);let z;t[53]!==a||t[54]!==f?(z=[],t[53]=a,t[54]=f,t[55]=z):z=t[55];let B;t[56]!==R||t[57]!==z?(B={id:`integrations`,label:R,enabled:!0,items:z},t[56]=R,t[57]=z,t[58]=B):B=t[58];let V;t[59]!==E||t[60]!==L||t[61]!==B?(V=[E,L,B],t[59]=E,t[60]=L,t[61]=B,t[62]=V):V=t[62];let H=V,U;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(as,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[63]=U):U=t[63];let W;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(rs,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[64]=W):W=t[64];let G;t[65]!==p||t[66]!==H?(G=(0,Z.jsx)(vS,{groups:H,activeId:p,onSelect:m}),t[65]=p,t[66]=H,t[67]=G):G=t[67];let ee;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(xS,{}),t[68]=ee):ee=t[68];let K=l?c:null,te;t[69]!==p||t[70]!==u||t[71]!==d||t[72]!==K?(te=(0,Z.jsx)(`section`,{"aria-labelledby":`settings-dialog-title`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:(0,Z.jsx)(pS,{children:(0,Z.jsx)(Q.Suspense,{fallback:ee,children:(0,Z.jsx)(uS,{activeId:p,userBinding:K,okignoreBinding:u,okignoreSynced:d})})})}),t[69]=p,t[70]=u,t[71]=d,t[72]=K,t[73]=te):te=t[73];let ne;t[74]!==G||t[75]!==te?(ne=(0,Z.jsxs)(os,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[U,W,G,te]}),t[74]=G,t[75]=te,t[76]=ne):ne=t[76];let q;return t[77]!==r||t[78]!==n||t[79]!==ne?(q=(0,Z.jsx)(us,{open:n,onOpenChange:r,children:ne}),t[77]=r,t[78]=n,t[79]=ne,t[80]=q):q=t[80],q}function vS(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:a}=e,{_:o}=i(),s;t[0]===o?s=t[1]:(s=o({id:`y1t8bQ`}),t[0]=o,t[1]=s);let c;if(t[2]!==r||t[3]!==n||t[4]!==a){let e;t[6]!==r||t[7]!==a?(e=e=>(0,Z.jsx)(bS,{group:e,activeId:r,onSelect:a},e.id),t[6]=r,t[7]=a,t[8]=e):e=t[8],c=n.map(e),t[2]=r,t[3]=n,t[4]=a,t[5]=c}else c=t[5];let l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(yS,{}),t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==c?(u=(0,Z.jsxs)(`nav`,{"aria-label":s,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:[c,l]}),t[10]=s,t[11]=c,t[12]=u):u=t[12],u}function yS(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=gS(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:Bi(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(s,{id:`_PACVa`}),(0,Z.jsx)($o,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function bS(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,c=n.enabled?void 0:o,l=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,u;t[0]===l?u=t[1]:(u=Bi(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,l),t[0]=l,t[1]=u);let d;t[2]!==n.label||t[3]!==a||t[4]!==c||t[5]!==u?(d=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":c,className:u,children:n.label}),t[2]=n.label,t[3]=a,t[4]=c,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.enabled?(f=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(s,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=f):f=t[9];let p;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:Bi(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],p=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=p}else p=t[15];let m;t[21]!==a||t[22]!==p?(m=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:p}),t[21]=a,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==d||t[25]!==f||t[26]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[d,f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=h):h=t[27],h}function xS(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`GsBUCk`})}),n=(0,Z.jsx)(pa,{className:`h-5 w-32`}),r=(0,Z.jsx)(pa,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(pa,{className:`h-9 w-full`}),(0,Z.jsx)(pa,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function SS(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=Bi(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mb,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function CS(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)(_b,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function wS(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Bi(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(xb,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function TS(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=Bi(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var ES=Yi(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function DS(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=Bi(ES({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":a,className:o,onMouseDown:OS,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function OS(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Yi(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function kS(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=Bi(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function AS(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=Bi(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ms,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jS(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:a,replaceOpen:o,caseSensitive:c,wholeWord:l,current:u,total:d,onQueryChange:f,onReplacementChange:p,onReplaceOpenChange:m,onCaseSensitiveChange:h,onWholeWordChange:g,onNext:_,onPrevious:v,onReplaceCurrent:y,onReplaceAll:b,onClose:x}=e,{_:S}=i(),C=r.length>0,w=d>0,T;t[0]!==S||t[1]!==u||t[2]!==w||t[3]!==C||t[4]!==d?(T=C?w?`${u} / ${d}`:S({id:`Ev2r9A`}):``,t[0]=S,t[1]=u,t[2]=w,t[3]=C,t[4]=d,t[5]=T):T=t[5];let E=T,D;t[6]!==x||t[7]!==_||t[8]!==v?(D=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?v():_()):e.key===`Escape`&&(e.preventDefault(),x())},t[6]=x,t[7]=_,t[8]=v,t[9]=D):D=t[9];let O=D,k;t[10]!==x||t[11]!==y?(k=function(e){e.key===`Enter`?(e.preventDefault(),y()):e.key===`Escape`&&(e.preventDefault(),x())},t[10]=x,t[11]=y,t[12]=k):k=t[12];let A=k,j;t[13]===S?j=t[14]:(j=S({id:`MVxpbf`}),t[13]=S,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(s,{id:`KujtjC`})}),t[15]=M):M=t[15];let N;t[16]===f?N=t[17]:(N=e=>f(e.target.value),t[16]=f,t[17]=N);let P;t[18]===S?P=t[19]:(P=S({id:`KujtjC`}),t[18]=S,t[19]=P);let F;t[20]!==n||t[21]!==O||t[22]!==r||t[23]!==N||t[24]!==P?(F=(0,Z.jsx)(AS,{ref:n,id:`ok-find-input`,value:r,onChange:N,onKeyDown:O,placeholder:P,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=O,t[22]=r,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]===S?I=t[27]:(I=S({id:`-8PP0T`}),t[26]=S,t[27]=I);let L;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(xc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(ts,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":I,pressed:c,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:L})}),t[29]=c,t[30]=h,t[31]=I,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`-8PP0T`})}),t[33]=z):z=t[33];let B;t[34]===R?B=t[35]:(B=(0,Z.jsxs)(ri,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(Dl,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(ts,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":V,pressed:l,onPressedChange:g,className:`size-6 min-w-6 px-0`,children:H})}),t[39]=g,t[40]=V,t[41]=l,t[42]=U):U=t[42];let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=W):W=t[43];let G;t[44]===U?G=t[45]:(G=(0,Z.jsxs)(ri,{children:[U,W]}),t[44]=U,t[45]=G);let ee;t[46]!==B||t[47]!==G?(ee=(0,Z.jsxs)(DS,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=ee):ee=t[48];let K;t[49]!==ee||t[50]!==F?(K=(0,Z.jsxs)(TS,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,ee]}),t[49]=ee,t[50]=F,t[51]=K):K=t[51];let te;t[52]===E?te=t[53]:(te=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:E}),t[52]=E,t[53]=te);let ne;t[54]===S?ne=t[55]:(ne=S({id:`oqB2ez`}),t[54]=S,t[55]=ne);let q=!w,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(J,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let ie;t[57]!==v||t[58]!==ne||t[59]!==q?(ie=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ne,disabled:q,onClick:v,children:re})}),t[57]=v,t[58]=ne,t[59]=q,t[60]=ie):ie=t[60];let ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=ae):ae=t[61];let oe;t[62]===ie?oe=t[63]:(oe=(0,Z.jsxs)(ri,{children:[ie,ae]}),t[62]=ie,t[63]=oe);let se;t[64]===S?se=t[65]:(se=S({id:`SiUUCS`}),t[64]=S,t[65]=se);let ce=!w,le;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(De,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=le):le=t[66];let ue;t[67]!==_||t[68]!==se||t[69]!==ce?(ue=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":se,disabled:ce,onClick:_,children:le})}),t[67]=_,t[68]=se,t[69]=ce,t[70]=ue):ue=t[70];let de;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=de):de=t[71];let fe;t[72]===ue?fe=t[73]:(fe=(0,Z.jsxs)(ri,{children:[ue,de]}),t[72]=ue,t[73]=fe);let pe=o?`secondary`:`ghost`,me;t[74]!==S||t[75]!==o?(me=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=me):me=t[76];let he=o?`ok-replace-input`:void 0,ge;t[77]!==m||t[78]!==o?(ge=()=>m(!o),t[77]=m,t[78]=o,t[79]=ge):ge=t[79];let _e;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(ll,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=_e):_e=t[80];let ve;t[81]!==o||t[82]!==pe||t[83]!==me||t[84]!==he||t[85]!==ge?(ve=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:pe,size:`icon-sm`,"aria-label":me,"aria-expanded":o,"aria-controls":he,onClick:ge,children:_e})}),t[81]=o,t[82]=pe,t[83]=me,t[84]=he,t[85]=ge,t[86]=ve):ve=t[86];let ye;t[87]===o?ye=t[88]:(ye=(0,Z.jsx)(sr,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ye);let be;t[89]!==ve||t[90]!==ye?(be=(0,Z.jsxs)(ri,{children:[ve,ye]}),t[89]=ve,t[90]=ye,t[91]=be):be=t[91];let xe;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(xe=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(s,{id:`fqSfXY`})}),(0,Z.jsx)(ms,{id:`ok-replace-input`,value:a,onChange:e=>p(e.target.value),onKeyDown:A,placeholder:S({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(ll,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(cl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`dr1vFs`})})]})]}):null,t[92]=S,t[93]=A,t[94]=w,t[95]=b,t[96]=y,t[97]=p,t[98]=o,t[99]=a,t[100]=xe):xe=t[100];let Se;t[101]===S?Se=t[102]:(Se=S({id:`wJo9oS`}),t[101]=S,t[102]=Se);let Ce;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(is,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Ce):Ce=t[103];let we;t[104]!==x||t[105]!==Se?(we=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Se,onClick:x,children:Ce})}),t[104]=x,t[105]=Se,t[106]=we):we=t[106];let Te;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Te):Te=t[107];let Ee;t[108]===we?Ee=t[109]:(Ee=(0,Z.jsxs)(ri,{children:[we,Te]}),t[108]=we,t[109]=Ee);let Oe;return t[110]!==K||t[111]!==te||t[112]!==oe||t[113]!==fe||t[114]!==j||t[115]!==be||t[116]!==xe||t[117]!==Ee?(Oe=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":j,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[M,K,te,oe,fe,be,xe,Ee]}),t[110]=K,t[111]=te,t[112]=oe,t[113]=fe,t[114]=j,t[115]=be,t[116]=xe,t[117]=Ee,t[118]=Oe):Oe=t[118],Oe}var MS={current:0,total:0},NS=120,PS=100;function FS(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?tn(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(ge,n,IS)}function IS(){return null}function LS(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
24
24
  `,`
25
25
  `).trim();return i.length===0||i.length>NS||i.includes(`
26
26
  `)?null:i}function RS(e){let t=mt(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function zS(e,t){return e.current===t.current&&e.total===t.total}function BS(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(MS)}function VS(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=h(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 HS(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=FS(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)(MS),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(WS))},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(US)},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(MS);return}if(!u.open||r){i.commands.clearFindMatches(),p(MS);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=RS(i);p(t=>zS(t,e)?t:e)},PS);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=mt(i.state),t=RS(i);p(e=>zS(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=LS(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(Ba(t,`find`)){t.preventDefault(),u.open?BS(i,d,p):e(!1);return}if(Ba(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=Ba(t,`find-next`),n=Ba(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&VS(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),BS(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=mt(i.state),t=RS(i);p(e=>zS(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(){BS(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()&&VS(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()&&VS(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)&&VS(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)&&VS(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,ee,K,te;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),ee=e=>d(t=>({...t,replaceOpen:e})),K=e=>d(t=>({...t,caseSensitive:e})),te=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=ee,t[66]=K,t[67]=te):(W=t[63],G=t[64],ee=t[65],K=t[66],te=t[67]);let ne;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(ne=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(jS,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:ee,onCaseSensitiveChange:K,onWholeWordChange:te,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=ne):ne=t[80],ne}function US(e){return{...e,open:!1,activeIndex:0}}function WS(e){return{...e,activeIndex:0}}var GS={words:0,chars:0,tokens:0},KS=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,qS=/[\p{L}\p{N}]/u,JS=new Set([`text`,`inlineCode`,`code`,`tag`]),YS=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),XS=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function ZS(e,t){if(!e)return;let n=e.type;if(!YS.has(n)){if(JS.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
@@ -28,7 +28,7 @@ Error generating stack: `+e.message+`
28
28
  `)&&t.push(`
29
29
  `)}}}}function QS(e){try{let t=Me().parseToMdast(e),n=[];return ZS(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function $S(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))qS.test(n)&&t++;return t}function eC(e){let t=globalThis.Intl.Segmenter;if(!t)return $S(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function tC(e){let t=KS.test(e)?1.5:4;return Math.ceil(e.length/t)}function nC(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=Ar(e);if(!t.trim())return{words:0,chars:0,tokens:0};let n=QS(t);return n?{words:KS.test(n)?eC(n):$S(n),chars:n.length,tokens:tC(n)}:{words:0,chars:0,tokens:0}}var rC=300;function iC(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(GS),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(GS);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(nC(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,rC)};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 aC(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function oC(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=()=>aC(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(aC(i));let t=()=>s(aC(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}var sC=`ok-doc-panel-width-v1`;function cC(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function lC(e){try{let t=(e??localStorage).getItem(sC);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?cC(n):320}catch{return 320}}function uC(e,t){try{(t??localStorage).setItem(sC,String(cC(e)))}catch{}}function dC(){try{return typeof localStorage>`u`?320:lC()}catch{return 320}}var fC=1024,pC=1280,mC={left:fC,right:pC};function hC(e,t,n){return e==null?t>=mC[n]?`above`:`below`:`embedded`}function gC(e){return e===`above`?`open`:`collapsed`}var _C=`ok-sidebar-pins-v2`;function vC(e){return e===`open`||e===`collapsed`}function yC(e){return e===`above`||e===`below`||e===`embedded`}function bC(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!yC(e)||!vC(t[e]))return!1;return!0}function xC(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return bC(n.left)&&(r.left=n.left),bC(n.right)&&(r.right=n.right),r}function SC(e){try{let t=(e??localStorage).getItem(_C);return t==null?{}:xC(t)}catch{return{}}}function CC(e,t){try{t.setItem(_C,JSON.stringify(e))}catch{}}function wC(e,t,n){return n[e]?.[t]??gC(t)}function TC(e,t,n,r){let i=r??localStorage,a=SC(i);return a[e]={...a[e],[t]:n},CC(a,i),a}function EC(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`?DC: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 DC(e){return e===`synced`?`synced`:`connected`}var OC=rr;function kC(e,t={}){let n=At(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var AC=200,jC=`Outside any block`;function MC(e){let t=(0,$.c)(5),{editor:n}=e,r=Ne(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?NC(n,r):o.current?jC:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},AC),()=>{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 NC(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=kC(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=kC(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 PC(){let[e]=(0,Q.useState)(Fr);return e}function FC({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:nr(e.display_name),color:ii(e.id,pr),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:ii(e.id,pr),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function IC(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 LC=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&ui(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Mr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(tr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(_i(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Pn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Lr(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Dr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(qn(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ir(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=Xr(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Ln){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 Rr){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():IC(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&wr(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()}},RC=e=>new Oi({key:typeof e.pluginKey==`string`?new Sr(e.pluginKey):e.pluginKey,view:t=>new LC({view:t,...e})});Si.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[RC({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 zC=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 ci(e,{textSerializers:Ti(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Mr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(tr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(_i(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Pn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Lr(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Dr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(qn(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ir(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=Xr(this.view,e.from,e.to);wr({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()}},BC=e=>new Oi({key:typeof e.pluginKey==`string`?new Sr(e.pluginKey):e.pluginKey,view:t=>new zC({view:t,...e})});Si.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?[BC({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 VC(e,t){return e??new Sr(t)}var HC=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,UC=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),WC=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(`.`)),GC=new Set([`children`,`className`,`style`]),KC=new Set([`tabIndex`]),qC=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),JC={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function YC(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function XC(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function ZC(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||qC.has(e)}function QC(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function $C(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:JC[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function ew(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 tw(e){return KC.has(e)}function nw(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function rw(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 iw(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||WC.has(e)?String(t):`${t}px`}function aw(e,t){UC.has(t)||e.style.removeProperty(QC(t))}function ow(e,t,n){UC.has(t)||e.style.setProperty(QC(t),iw(t,n))}function sw(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(GC.has(r)||!ZC(r)||YC(r,t[r])||YC(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=XC(r);if(a==null||a===!1){tw(r)&&rw(e,r),e.removeAttribute(o);return}if(a===!0){tw(r)&&nw(e,r,!0),e.setAttribute(o,``);return}if(tw(r)){nw(e,r,a);return}e.setAttribute(o,String(a))})}function cw(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function lw(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){aw(e,t);return}ow(e,t,a)}})}function uw(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(!YC(t,n))return;let{eventName:i,options:a}=$C(t),o=t=>{n(ew(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function dw(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);HC(()=>{let i=n.current;return cw(e,i.className,t.className),lw(e,i.style,t.style),sw(e,i,t),r.current=uw(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 fw=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)(VC(e,`bubbleMenu`)).current;dw(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Kt(),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=RC({...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,vc.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)(VC(e,`floatingMenu`)).current;dw(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Kt(),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=BC({...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,vc.createPortal)(s,u.current)});var pw=[{name:`paragraph`,label:`Text`,icon:il,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:_t,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Lt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:We,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Tt,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:Se,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:N,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:O,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:gl,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function mw(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:hw},t[0]=n,t[1]=r);let{current:i,activeStates:a}=le(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Z.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Z.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(De,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsxs)(qi,{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=pw.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(go,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:e.label})]},e.name)}),t[10]=a,t[11]=n,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(ua,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==u||t[16]!==f?(p=(0,Z.jsxs)(oo,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function hw(e){let t=Object.fromEntries(pw.map(t=>[t.name,t.isActive(e.editor)]));return{current:pw.find(e=>t[e.name])??pw[0],activeStates:t}}function gw(e){let t=(0,$.c)(17),{installStates:n,onPick:r}=e,{_:a}=i(),[o,c]=(0,Q.useState)(``),l;if(t[0]!==a||t[1]!==n||t[2]!==o||t[3]!==r){let e;t[5]===n?e=t[6]:(e=e=>n[e.id]?.installed===!0,t[5]=n,t[6]=e);let i=bh.filter(e),u=bh.some(e=>n[e.id]?.installed==null),d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`font-mono text-xs uppercase tracking-wide text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EVnzPs`})}),t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>c(e.target.value),t[8]=f):f=t[8];let p;t[9]===a?p=t[10]:(p=a({id:`Rah7yq`}),t[9]=a,t[10]=p);let m;t[11]===a?m=t[12]:(m=a({id:`ZBt4rI`}),t[11]=a,t[12]=m);let h;t[13]!==o||t[14]!==p||t[15]!==m?(h=(0,Z.jsx)(ms,{value:o,onChange:f,placeholder:p,"aria-label":m,"data-testid":`edit-with-ai-instruction`}),t[13]=o,t[14]=p,t[15]=m,t[16]=h):h=t[16],l=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,h,i.length>0?(0,Z.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:i.map(e=>(0,Z.jsxs)(qi,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,"data-testid":`edit-with-ai-target-${e.id}`,onClick:()=>r(e,o),children:[(0,Z.jsx)(Nb,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:e.displayName})]},e.id))}):(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`edit-with-ai-empty`,"aria-live":`polite`,children:u?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=a,t[1]=n,t[2]=o,t[3]=r,t[4]=l}else l=t[4];return l}function _w(e){let t=(0,$.c)(23),{resolveSelection:n,children:r}=e,{_:a}=i(),{states:o,refresh:s}=Cg(),{dispatch:c}=fg(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),m;t[0]!==a||t[1]!==s||t[2]!==n?(m=e=>{if(e){let e;try{e=n()}catch(e){console.error(`Edit with AI: could not read the selection`,e),X.error(a({id:`-RXIMO`}));return}f(e),s()}u(e)},t[0]=a,t[1]=s,t[2]=n,t[3]=m):m=t[3];let h=m,g;t[4]!==a||t[5]!==c||t[6]!==d?(g=(e,t)=>{if(d!==null){let n=tg({docName:d.docName,workspace:d.workspace,instruction:t,selectionMarkdown:d.selectionMarkdown});n===null?X.error(a({id:`_VRtd7`})):c(e.id,n)}u(!1)},t[4]=a,t[5]=c,t[6]=d,t[7]=g):g=t[7];let _=g,v;t[8]===r?v=t[9]:(v=(0,Z.jsx)(H,{asChild:!0,children:r}),t[8]=r,t[9]=v);let y;t[10]===a?y=t[11]:(y=a({id:`EVnzPs`}),t[10]=a,t[11]=y);let b;t[12]!==_||t[13]!==o?(b=(0,Z.jsx)(gw,{installStates:o,onPick:_}),t[12]=_,t[13]=o,t[14]=b):b=t[14];let x;t[15]!==y||t[16]!==b?(x=(0,Z.jsx)(B,{align:`start`,"aria-label":y,"data-testid":`edit-with-ai-popover`,children:b}),t[15]=y,t[16]=b,t[17]=x):x=t[17];let S;return t[18]!==h||t[19]!==l||t[20]!==v||t[21]!==x?(S=(0,Z.jsxs)(p,{open:l,onOpenChange:h,children:[v,x]}),t[18]=h,t[19]=l,t[20]=v,t[21]=x,t[22]=S):S=t[22],S}function vw(e){let t=ne(e.state.selection.content(),e.state.schema);return Me().serialize(t).trim()}function yw(e){let t=(0,$.c)(7),{editor:n}=e,r=Fo();if(!hi())return null;let i;t[0]!==n||t[1]!==r?(i=()=>({docName:Je(n),workspace:r,selectionMarkdown:vw(n)}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Xo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(qi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[(0,Z.jsx)(aa,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`EVnzPs`})})]}),t[4]=c):c=t[4];let l;return t[5]===a?l=t[6]:(l=(0,Z.jsxs)(Z.Fragment,{children:[o,(0,Z.jsx)(_w,{resolveSelection:a,children:c})]}),t[5]=a,t[6]=l),l}function bw(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 xw(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:Pt(typeof n.src==`string`?n.src:``)}function Sw(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 Cw(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:ww},t[0]=n,t[1]=a),le(a)===null)return null;let o;t[2]===r?o=t[3]:(o=r({id:`WcWS__`}),t[2]=r,t[3]=o);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault();let t=bw(n);t&&Sw(t,xw(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Mo,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-xs`,"aria-label":o,className:`text-accent-foreground`,onMouseDown:c,children:l})}),t[7]=o,t[8]=c,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(sr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`WcWS__`})}),t[10]=d):d=t[10];let f;return t[11]===u?f=t[12]:(f=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(ri,{children:[u,d]})}),t[11]=u,t[12]=f),f}function ww(e){return bw(e.editor)}function Tw(e){return bw(e)!==null}var Ew=[{value:`left`,label:`Align left`,icon:ae},{value:`center`,label:`Align center`,icon:g},{value:`right`,label:`Align right`,icon:en}];function Dw(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Xt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function Ow(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:kw},t[0]=n,t[1]=r);let i=le(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=Ew.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{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(!Xt.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(Ln.create(u.doc,s)),Ut(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(sr,{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 kw(e){return Dw(e.editor)}function Aw(e){return Dw(e)!==null}var jw=[{name:`bold`,icon:_c,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:Uc,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:wl,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:bl,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:qe,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Hc,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function Mw(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Nw},t[0]=n,t[1]=r);let i=le(r),a;t[2]!==i||t[3]!==n?(a=jw.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{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)(sr,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(D,{"aria-label":Ya(e.shortcutId),children:_a(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 Nw(e){return Object.fromEntries(jw.map(t=>[t.name,t.isActive(e.editor)]))}function Pw(e){let t=(0,$.c)(63),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:f,pages:p}=wi(),m;t[0]===n?m=t[1]:(m=n.isActive(`link`),t[0]=n,t[1]=m);let h=m,g;t[2]===n?g=t[3]:(g=n.getAttributes(`link`).href??``,t[2]=n,t[3]=g);let _=g,v,y;t[4]===n?(v=t[5],y=t[6]):(v=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},y=[n],t[4]=n,t[5]=v,t[6]=y),(0,Q.useEffect)(v,y);let b,x;t[7]!==_||t[8]!==a?(b=()=>{a&&(l(_),requestAnimationFrame(()=>u.current?.focus()))},x=[a,_],t[7]=_,t[8]=a,t[9]=b,t[10]=x):(b=t[9],x=t[10]),(0,Q.useEffect)(b,x);let C;t[11]!==n||t[12]!==h||t[13]!==c?(C=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():h&&n.chain().focus().unsetLink().run(),o(!1)},t[11]=n,t[12]=h,t[13]=c,t[14]=C):C=t[14];let w=C,T;t[15]===n?T=t[16]:(T=function(){n.chain().focus().unsetLink().run(),o(!1)},t[15]=n,t[16]=T);let E=T,O;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(S(e.path,null))},t[17]=O):O=t[17];let k=O,j;t[18]!==w||t[19]!==n?(j=function(e){e.key===`Enter`&&(e.preventDefault(),w()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[18]=w,t[19]=n,t[20]=j):j=t[20];let M=j;if(a){let e;t[21]===r?e=t[22]:(e=r({id:`ZsGpr_`}),t[21]=r,t[22]=e);let n;t[23]===r?n=t[24]:(n=r({id:`roAe2K`}),t[23]=r,t[24]=n);let i;t[25]!==d||t[26]!==M||t[27]!==f||t[28]!==p||t[29]!==e||t[30]!==n||t[31]!==c?(i=(0,Z.jsx)(ot,{ref:u,type:`text`,placeholder:e,value:c,pages:p,folderPaths:d,loading:f,onValueChange:l,onSuggestionSelect:k,onKeyDown:M,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[25]=d,t[26]=M,t[27]=f,t[28]=p,t[29]=e,t[30]=n,t[31]=c,t[32]=i):i=t[32];let a;t[33]===r?a=t[34]:(a=r({id:`tP5DDk`}),t[33]=r,t[34]=a);let o;t[35]===w?o=t[36]:(o=()=>{w()},t[35]=w,t[36]=o);let m;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Oc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[37]=m):m=t[37];let g;t[38]!==a||t[39]!==o?(g=(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:m}),t[38]=a,t[39]=o,t[40]=g):g=t[40];let v;t[41]!==i||t[42]!==g?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,g]}),t[41]=i,t[42]=g,t[43]=v):v=t[43];let y;t[44]!==r||t[45]!==_||t[46]!==h||t[47]!==E?(y=h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),A(_)},children:(0,Z.jsx)($o,{className:`size-3.5`})})}),(0,Z.jsx)(sr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),E()},children:(0,Z.jsx)(R,{className:`size-3.5`})})}),(0,Z.jsx)(sr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[44]=r,t[45]=_,t[46]=h,t[47]=E,t[48]=y):y=t[48];let b;return t[49]!==v||t[50]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[v,y]}),t[49]=v,t[50]=y,t[51]=b):b=t[51],b}let N;t[52]===r?N=t[53]:(N=r({id:`p0Iq25`}),t[52]=r,t[53]=N);let P=h?`bg-accent text-primary`:`text-accent-foreground`,F,I;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e.preventDefault(),o(!0)},I=(0,Z.jsx)(Gc,{className:`size-3.5`}),t[54]=F,t[55]=I):(F=t[54],I=t[55]);let L;t[56]!==N||t[57]!==P?(L=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-xs`,"aria-label":N,className:P,onMouseDown:F,children:I})}),t[56]=N,t[57]=P,t[58]=L):L=t[58];let z;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(s,{id:`yzF66j`}),t[59]=z):z=t[59];let B;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(sr,{side:`bottom`,sideOffset:8,children:[z,(0,Z.jsx)(D,{children:_a(`command-palette`)})]}),t[60]=B):B=t[60];let V;return t[61]===L?V=t[62]:(V=(0,Z.jsxs)(ri,{children:[L,B]}),t[61]=L,t[62]=V),V}function Fw({editor:e}){if(mt(e.state).query||e.isActive(`codeBlock`))return!1;if(Aw(e)||Tw(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 Iw(e){let t=(0,$.c)(22),{editor:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),s;t[0]===n?s=t[1]:(s={editor:n,selector:Vw},t[0]=n,t[1]=s);let c=le(s),l;t[2]===n?l=t[3]:(l={editor:n,selector:Bw},t[2]=n,t[3]=l);let u=le(l),d;t[4]!==n.state||t[5]!==n.view?(d=()=>{try{let{from:e,to:t}=n.state.selection;return Xr(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=d):d=t[6];let f;if(t[7]!==n.view.dom||t[8]!==d){let e={getBoundingClientRect:d,contextElement:n.view.dom};f=()=>{let t=r.current;t&&(o.current?.(),o.current=Yn(e,t,()=>{wr(e,t,{placement:`top`,strategy:`fixed`,middleware:[_i(8),Mr(),tr({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(zw)}))},t[7]=n.view.dom,t[8]=d,t[9]=f}else f=t[9];let p=f,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{o.current?.(),o.current=null,a(Rw)},t[10]=m):m=t[10];let h=m,g;t[11]===p?g=t[12]:(g={onShow:p,onHide:h,strategy:`fixed`},t[11]=p,t[12]=g);let _;t[13]!==n||t[14]!==u||t[15]!==c||t[16]!==i?(_=c?(0,Z.jsx)(Ow,{editor:n},`${i}-img-align`):u?(0,Z.jsx)(Cw,{editor:n},`${i}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mw,{editor:n}),(0,Z.jsx)(Xo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Mw,{editor:n},i),(0,Z.jsx)(Xo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Pw,{editor:n},`${i}-link`),(0,Z.jsx)(yw,{editor:n},`${i}-edit-ai`)]}),t[13]=n,t[14]=u,t[15]=c,t[16]=i,t[17]=_):_=t[17];let v;return t[18]!==n||t[19]!==g||t[20]!==_?(v=(0,Z.jsx)(fw,{ref:r,editor:n,"data-testid":`bubble-menu-bar`,appendTo:Lw,shouldShow:Fw,updateDelay:250,options:g,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:_}),t[18]=n,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function Lw(){return document.body}function Rw(e){return e+1}function zw(){}function Bw(e){return Tw(e.editor)}function Vw(e){return Aw(e.editor)}function Hw(e){return[...e?[{label:`Toggle header column`,icon:Ec,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:na,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:Bo,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:R,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Bc,run:e=>e.chain().focus().deleteTable().run()}]}function Uw(e){return[...e?[{label:`Toggle header row`,icon:xl,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:Pe,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:Jt,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:R,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Bc,run:e=>e.chain().focus().deleteTable().run()}]}function Ww(e){if(!e.isEditable||mt(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 Gw(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 Yn(r,e,()=>{wr(r,e,{strategy:`absolute`,placement:t,middleware:[_i(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(Kw)})},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`?jc:lo,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)(No,{asChild:!0,children:(0,Z.jsx)(qi,{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)(Ao,{}),(0,Z.jsxs)(go,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[13]=n,t[14]=e),g=a.map(e),t[10]=n,t[11]=a,t[12]=g}else g=t[12];let _;t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Z.jsx)(ua,{align:m,side:h,className:`w-auto min-w-44 whitespace-nowrap`,children:g}),t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==_||t[20]!==p?(v=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(oo,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function Kw(){}function qw(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=Ww(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=Hw(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)(Gw,{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=Uw(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)(Gw,{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}var Jw=new WeakMap;function Yw(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=kr(e.color),n.textContent=e.name,t.append(n),t}var Xw={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},Zw=100,Qw=100,$w=3,eT=250;function tT(){let e=new jr({extensions:In});return{mdManager:e,text:we({mdManager:e}),html:ye({mdManager:e}),paste:Ge({mdManager:e}),drop:l({mdManager:e})}}function nT(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...Ct.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),OC.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),rt.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),Si.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[Ht]}}),Si.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[Le(e,{cursorBuilder:Yw})]}})]}function rT(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{Jw.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=Jw.get(e);if(Jw.delete(e),r==null)return;let i=performance.now();b(`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:(e,t)=>n.drop(e,t)},extensions:yp(nT(e))}}function iT(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=Ur(nT({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=Mt(t.document.getXmlFragment(`default`),a);return{...rT({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var aT=e=>{let t=(0,$.c)(21),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(Xw),c=PC(),{principal:l,activeDocName:u}=ht(),d=n.configuration.name??``,[f]=(0,Q.useState)(tT),p;t[0]!==f||t[1]!==r||t[2]!==n?(p=()=>()=>({editor:new Gr(iT({provider:n,placeholder:r,clipboard:f,ctorStart:performance.now()})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=f,t[1]=r,t[2]=n,t[3]=p):p=t[3];let[m]=(0,Q.useState)(p),h,g;if(t[4]!==m||t[5]!==d||t[6]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=z(d)??crypto.randomUUID();h=Q.use,g=te({docName:d,mountId:r,construct:m,sizeStats:e}),t[4]=m,t[5]=d,t[6]=n.document,t[7]=h,t[8]=g}else h=t[7],g=t[8];let _=h(g),v=_.editor,y,b;t[9]===_?(y=t[10],b=t[11]):(y=()=>()=>{ee(_)},b=[_],t[9]=_,t[10]=y,t[11]=b),(0,Q.useEffect)(y,b);let x;return t[12]!==u||t[13]!==d||t[14]!==v||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==l||t[19]!==n?(x=(0,Z.jsx)(oT,{provider:n,isSourceMode:i,docName:d,activeDocName:u,identity:c,principal:l,editor:v,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[12]=u,t[13]=d,t[14]=v,t[15]=c,t[16]=i,t[17]=a,t[18]=l,t[19]=n,t[20]=x):x=t[20],x},oT=e=>{let t=(0,$.c)(85),{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;t[0]===d?(p=t[1],m=t[2]):(p=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},m=[d],t[0]=d,t[1]=p,t[2]=m),(0,Q.useLayoutEffect)(p,m);let g;t[3]!==c||t[4]!==n.configuration.name?(g=()=>(wt(c,n.configuration.name??null),()=>{wt(c,null)}),t[3]=c,t[4]=n.configuration.name,t[5]=g):g=t[5];let v;t[6]!==c||t[7]!==n?(v=[c,n],t[6]=c,t[7]=n,t[8]=v):v=t[8],(0,Q.useEffect)(g,v);let y;t[9]!==c||t[10]!==n.configuration.name?(y=()=>{let e=n.configuration.name;if(e)return _(e,c),()=>k(e,c)},t[9]=c,t[10]=n.configuration.name,t[11]=y):y=t[11];let x;t[12]!==c||t[13]!==n?(x=[c,n],t[12]=c,t[13]=n,t[14]=x):x=t[14],(0,Q.useEffect)(y,x);let S;t[15]!==c||t[16]!==n.configuration.name?(S=()=>{},t[15]=c,t[16]=n.configuration.name,t[17]=S):S=t[17];let C;t[18]!==c||t[19]!==n?(C=[c,n],t[18]=c,t[19]=n,t[20]=C):C=t[20],(0,Q.useEffect)(S,C);let w,T;t[21]===c?(w=t[22],T=t[23]):(T=()=>{let e=sT,t=null,n=()=>{if(t||c.isDestroyed)return;let n=h(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 h(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},w=[c],t[21]=c,t[22]=w,t[23]=T),(0,Q.useEffect)(T,w);let E,D;t[24]!==i||t[25]!==c?(E=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!h(c))return;e=!0;let t=ct(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})),b(`ok/editor/selection-restore-failed`,{docName:i,message:n})}ue(i)};if(h(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},D=[c,i],t[24]=i,t[25]=c,t[26]=E,t[27]=D):(E=t[26],D=t[27]),(0,Q.useEffect)(E,D);let O,A;t[28]!==u||t[29]!==n.document||t[30]!==l?(O=()=>{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)},oi)};c(Xw);let f=()=>{if(Er(e),!vr(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`?vr(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)}},A=[n.document,u,l],t[28]=u,t[29]=n.document,t[30]=l,t[31]=O,t[32]=A):(O=t[31],A=t[32]),(0,Q.useEffect)(O,A);let j,M;t[33]!==a||t[34]!==i||t[35]!==c||t[36]!==n?(j=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<Zw){e+=1,t=window.setTimeout(p,Qw);return}r=null,o=null,e=0},u=function(e){let t=h(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=$w,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,eT)))};t=window.setTimeout(o,eT)};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=fi(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},g=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,g),c.on(`transaction`,g),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,g),c.off(`transaction`,g),window.removeEventListener(`hashchange`,m)}},M=[n,c,i,a],t[33]=a,t[34]=i,t[35]=c,t[36]=n,t[37]=j,t[38]=M):(j=t[37],M=t[38]),(0,Q.useEffect)(j,M);let N,P;t[39]===c?(N=t[40],P=t[41]):(N=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=h(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(Ys,e),()=>window.removeEventListener(Ys,e)},P=[c],t[39]=c,t[40]=N,t[41]=P),(0,Q.useEffect)(N,P);let F;t[42]!==a||t[43]!==i||t[44]!==o||t[45]!==r||t[46]!==s||t[47]!==n.awareness?(F=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:FC({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[42]=a,t[43]=i,t[44]=o,t[45]=r,t[46]=s,t[47]=n.awareness,t[48]=F):F=t[48];let I;t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==r||t[53]!==s||t[54]!==n?(I=[n,i,a,o,s,r],t[49]=a,t[50]=i,t[51]=o,t[52]=r,t[53]=s,t[54]=n,t[55]=I):I=t[55],(0,Q.useEffect)(F,I);let L,R;t[56]!==c||t[57]!==r?(L=()=>(Ae(c,r),()=>{Ae(c,!1)}),R=[c,r],t[56]=c,t[57]=r,t[58]=L,t[59]=R):(L=t[58],R=t[59]),(0,Q.useEffect)(L,R);let z;t[60]!==c||t[61]!==r?(z=!r&&(0,Z.jsx)(Iw,{editor:c}),t[60]=c,t[61]=r,t[62]=z):z=t[62];let B;t[63]!==c||t[64]!==r?(B=!r&&(0,Z.jsx)(qw,{editor:c}),t[63]=c,t[64]=r,t[65]=B):B=t[65];let V;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[66]=V):V=t[66];let H;t[67]===c?H=t[68]:(H=(0,Z.jsx)(se,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[67]=c,t[68]=H);let U;t[69]!==d||t[70]!==H?(U=(0,vc.createPortal)(H,d),t[69]=d,t[70]=H,t[71]=U):U=t[71];let W;t[72]===c?W=t[73]:(W=(0,Z.jsx)(MC,{editor:c}),t[72]=c,t[73]=W);let G;t[74]===c?G=t[75]:(G=ze(c),t[74]=c,t[75]=G);let ee;t[76]===G.store?ee=t[77]:(ee=(0,Z.jsx)(dt,{store:G.store}),t[76]=G.store,t[77]=ee);let K;return t[78]!==z||t[79]!==B||t[80]!==U||t[81]!==W||t[82]!==ee||t[83]!==l?(K=(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:[z,B,V,U,W,ee]}),t[78]=z,t[79]=B,t[80]=U,t[81]=W,t[82]=ee,t[83]=l,t[84]=K):K=t[84],K};function sT(){return me()}var cT=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 lT(e,t,n,r,i,a){if(e==r)return[];let o=yT(e,t,n,r,i,a),s=bT(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 cT(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new cT(t,t+o,i,i),new cT(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 cT(t,t,i,i+o),new cT(n,n,i+o+c,a)]}if(c==1||l==1)return[new cT(t,n,i,a)];let u=ST(e,t,n,r,i,a);if(u){let[o,s,c]=u;return lT(e,t,o,r,i,s).concat(lT(e,o+c,n,r,s+c,a))}return pT(e,t,n,r,i,a)}var uT=1e9,dT=0,fT=!1;function pT(e,t,n,r,i,a){let o=n-t,s=a-i;if(uT<1e9&&Math.min(o,s)>uT*16||dT>0&&Date.now()>dT)return Math.min(o,s)>uT*64?[new cT(t,n,i,a)]:CT(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);hT.reset(c),gT.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:gT,f=d?null:hT;for(let p=0;p<c;p++){if(p>uT||dT>0&&!(p&63)&&Date.now()>dT)return CT(e,t,n,r,i,a);let m=hT.advance(p,o,s,c,d,!1,l)||gT.advance(p,o,s,c,f,!0,u);if(m)return _T(e,t,n,t+m[0],r,i,a,i+m[1])}return[new cT(t,n,i,a)]}var mT=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}},hT=new mT,gT=new mT;function _T(e,t,n,r,i,a,o,s){let c=!1;return!RT(e,r)&&++r==n&&(c=!0),!RT(i,s)&&++s==o&&(c=!0),c?[new cT(t,n,a,o)]:lT(e,t,r,i,a,s).concat(lT(e,r,n,i,s,o))}function vT(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function yT(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=vT(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-+!RT(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function bT(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=vT(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-+!RT(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function xT(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;;){RT(e,s)||s++;let u=s+o;if(RT(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=yT(e,u,n,r,i+f+d.length,a),c=bT(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 ST(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=ST(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:xT(e,t,n,r,i,a,Math.floor(o/4),-1)}function CT(e,t,n,r,i,a){fT=!0;let o=n-t,s=a-i,c;if(o<s){let s=xT(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=xT(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new cT(t,n,i,a)];let[l,u,d]=c;return lT(e,t,l,r,i,u).concat(lT(e,l+d,n,r,u+d,a))}function wT(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 cT(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function TT(e,t,n){for(;;){wT(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=yT(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new cT(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=bT(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new cT(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 cT(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 cT(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function ET(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=NT(t,a.fromA,l),f=MT(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 cT(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=MT(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new cT(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=NT(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new cT(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=FT(n,a.fromB,a.toB),r,o=t<0?-1:PT(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=FT(t,a.fromA,a.toA),r,o=n<0?-1:PT(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 wT(e,3),e}var DT;try{DT=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function OT(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function kT(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!OT(n):DT?!IT(n)||t==e.length-1?+!!DT.test(String.fromCharCode(n)):DT.test(e.slice(t,t+2))?2:0:0}function AT(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!OT(n):DT?!LT(n)||t==1?+!!DT.test(String.fromCharCode(n)):DT.test(e.slice(t-2,t))?2:0:0}var jT=8;function MT(e,t,n){if(t==e.length||!AT(e,t))return t;for(let r=t,i=t+n,a=0;a<jT;a++){let t=kT(e,r);if(!t||r+t>i)return r;r+=t}return t}function NT(e,t,n){if(!t||!kT(e,t))return t;for(let r=t,i=t-n,a=0;a<jT;a++){let t=AT(e,r);if(!t||r-t<i)return r;r-=t}return t}function PT(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function FT(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var IT=e=>e>=55296&&e<=56319,LT=e=>e>=56320&&e<=57343;function RT(e,t){return!t||t==e.length||!IT(e.charCodeAt(t-1))||!LT(e.charCodeAt(t))}function zT(e,t,n){let r=n?.override;return r?r(e,t):(uT=(n?.scanLimit??1e9)>>1,dT=n?.timeout?Date.now()+n.timeout:0,fT=!1,TT(e,t,lT(e,0,e.length,t,0,t.length)))}function BT(){return!fT}function VT(e,t,n){return ET(zT(e,t,n),e,t)}var HT=Is.define({combine:e=>e[0]}),UT=Ls.define(),WT=Is.define(),GT=js.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(UT)&&(e=n.value);for(let n of t.state.facet(WT))e=n(e,t);return e}});function KT(e){let t=e.field(GT,!1);if(!t)return null;let n=e.facet(HT);return{chunks:t,side:n?n.side:null}}var qT=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 XT(VT(e.toString(),t.toString(),n),e,t,0,0,BT())}static updateA(e,t,n,r,i){return eE($T(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return eE($T(e,r,!1,t.length),e,t,n,i)}};function JT(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 YT(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 XT(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=JT(c.fromA+r,c.fromB+i,t,n),[d,f]=YT(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]=JT(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]=YT(a.toA+r,a.toB+i,t,n),s++}o.push(new qT(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var ZT=1e3;function QT(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 $T(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>ZT&&([l,d]=QT(e,a-ZT,n,!0)),o<t.length-ZT&&([u,f]=QT(e,o+ZT,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 eE(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=VT(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of XT(h,n,r,d,f,BT()))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 tE={scanLimit:500},nE=Rs.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=fE(e))}update(e){(e.docChanged||e.viewportChanged||iE(e.startState,e.state)||aE(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=fE(e.view))}},{decorations:e=>e.deco}),rE=Os.low(Hs({class:`cm-changeGutter`,markers:e=>e.plugin(nE)?.gutter||Gs.empty}));function iE(e,t){return e.field(GT,!1)!=t.field(GT,!1)}function aE(e,t){return e.facet(HT)!=t.facet(HT)}var oE=Ps.line({class:`cm-changedLine`}),sE=Ps.mark({class:`cm-changedText`}),cE=Ps.mark({tagName:`ins`,class:`cm-insertedLine`}),lE=Ps.mark({tagName:`del`,class:`cm-deletedLine`}),uE=new class extends Vs{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function dE(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,oE),i.add(o,s,n?lE:cE),a&&a.add(o,o,uE);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,oE),a&&a.add(u,u,uE);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,sE),s<t)c++;else break}u=t}}}function fE(e){let t=e.state.field(GT),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(HT),o=n==`a`,s=new Fs,c=i?new Fs: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))&&dE(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var pE=class extends Ds{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}},mE=Ls.define({map:(e,t)=>e.map(t)}),hE=js.define({create:()=>Ps.none,update:(e,t)=>{for(let e of t.effects)if(e.is(mE))return e.value;return e.map(t.changes)},provide:e=>Bs.decorations.from(e)}),gE=.01;function _E(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 vE(e,t,n){let r=new Fs,i=new Fs,a=e.state.field(hE).iter(),o=t.state.field(hE).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<-gE?(l-=n,r.add(s,s,Ps.widget({widget:new pE(-n),block:!0,side:-1}))):n>gE&&(u+=n,i.add(c,c,Ps.widget({widget:new pE(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<gE?r.add(e.state.doc.length,e.state.doc.length,Ps.widget({widget:new pE(-p),block:!0,side:1})):p>gE&&i.add(t.state.doc.length,t.state.doc.length,Ps.widget({widget:new pE(p),block:!0,side:1}));let m=r.finish(),h=i.finish();_E(m,e.state.field(hE))||e.dispatch({effects:mE.of(m)}),_E(h,t.state.field(hE))||t.dispatch({effects:mE.of(h)})}var yE=Ls.define({map:(e,t)=>t.mapPos(e)}),bE=class extends Ds{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:yE.of(n)});let{side:r,sibling:i}=e.state.facet(HT);i&&i().dispatch({effects:yE.of(xE(n,e.state.field(GT),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function xE(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 SE=js.define({create(e){return Ps.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(yE)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Bs.decorations.from(e)});function CE({margin:e=3,minSize:t=4}){return SE.init(n=>wE(n,e,t))}function wE(e,t,n){let r=new Fs,i=e.facet(HT).side==`a`,a=e.field(GT),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,Ps.replace({widget:new bE(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var TE=Bs.styleModule.of(new Us({".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`}})),EE=Bs.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`}}),DE=new zs,OE=new zs,kE=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||tE;let t=[Os.low(nE),EE,TE,hE,Bs.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(mE)))&&this.measure()})],n=[HT.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(rE);let r=As.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Bs.editorAttributes.of({class:`cm-merge-a`}),OE.of(n),t]}),i=[HT.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(rE);let a=As.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Bs.editorAttributes.of({class:`cm-merge-b`}),OE.of(i),t]});this.chunks=qT.build(r.doc,a.doc,this.diffConf);let o=[GT.init(()=>this.chunks),DE.of(e.collapseUnchanged?CE(e.collapseUnchanged):[])];r=r.update({effects:Ls.appendConfig.of(o)}).state,a=a.update({effects:Ls.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 Bs({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Bs({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),ks.empty(e[0].startState.doc.length));this.chunks=t==this.a?qT.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):qT.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:UT.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:UT.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(HT),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(OE.reconfigure([HT.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?rE:[]])),a.push(OE.reconfigure([HT.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?rE:[]]))}if(r){let t=DE.reconfigure(e.collapseUnchanged?CE(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(){vE(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=AE(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=AE(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 AE(e){let t=e.nextSibling;return e.remove(),t}var jE=new class extends Vs{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},ME=Os.low(Hs({class:`cm-changeGutter`,markers:e=>e.plugin(nE)?.gutter||Gs.empty,widgetMarker:(e,t)=>t instanceof LE?jE:null}));function NE(e){let t=typeof e.original==`string`?Ns.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||tE;return[Os.low(nE),HE,EE,Bs.editorAttributes.of({class:`cm-merge-b`}),WT.of((e,t)=>{let r=t.effects.find(e=>e.is(PE));return r&&(e=qT.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=qT.updateB(e,t.state.field(FE),t.newDoc,t.changes,n)),e}),HT.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?JE:void 0,side:`b`}),FE.init(()=>t),e.gutter===!1?[]:ME,e.collapseUnchanged?CE(e.collapseUnchanged):[],GT.init(e=>qT.build(t,e.doc,n))]}var PE=Ls.define(),FE=js.define({create:()=>Ns.empty,update(e,t){for(let n of t.effects)n.is(PE)&&(e=n.value.doc);return e}}),IE=new WeakMap,LE=class extends Ds{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 RE(e,t,n){let r=IE.get(t.changes);if(r)return r;let i=Ps.widget({block:!0,side:-1,widget:new LE(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(HT),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(),zE(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),BE(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(FE).sliceString(t.fromA,t.endA),u=a&&e.facet(Ks),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;Ms(t,{style:t=>qs(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 IE.set(t.changes,i),i}function zE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(GT).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(FE);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=ks.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:PE.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function BE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(GT).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(FE).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 VE(e){let t=new Fs;for(let n of e.field(GT)){let r=e.facet(HT).overrideChunk&&WE(e,n);t.add(n.fromB,n.fromB,RE(e,n,!!r))}return t.finish()}var HE=js.define({create:e=>VE(e),update(e,t){return t.state.field(GT,!1)==t.startState.field(GT,!1)?e:VE(t.state)},provide:e=>Bs.decorations.from(e)}),UE=new WeakMap;function WE(e,t){let n=UE.get(t);if(n!==void 0)return n;n=null;let r=e.field(FE),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(Ps.widget({widget:new GE(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(sE.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return UE.set(t,n),n}var GE=class extends Ds{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}},KE=new class extends Vs{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},qE=Ps.line({class:`cm-inlineChangedLine`});function JE(e,t,n,r){let i=WE(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,KE),n.add(o.from,o.from,qE);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 YE=$t({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),XE=ie({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),ZE=Bs.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 QE({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 $E(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Jn(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?YE:XE,u=[Bs.editable.of(!1),As.readOnly.of(!0)],d=[Qs,de(),...u,l,Bs.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new Bs({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=QE({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new Bs({doc:p,extensions:[Qs,de(),Bs.editable.of(!1),l,ZE,Bs.lineWrapping,NE({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),Bs.updateListener.of(e=>{let t=KT(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=KT(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new kE({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new Bs({doc:p,extensions:[...d,NE({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof Bs)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof Bs)||M(e)},t[13]=A):A=t[13];let j=A,N=b===0,P;t[14]!==f||t[15]!==b?(P=b===null?``:b===0?f({id:`lPzyrU`}):Y._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=P):P=t[16];let F=P,I;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=I):I=t[17];let L;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,vc.createPortal)((0,Z.jsx)(qi,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),L=C.map(e),t[18]=f,t[19]=C,t[20]=L}else L=t[20];let R;t[23]!==N||t[24]!==o||t[25]!==F||t[26]!==d||t[27]!==u?(R=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${N?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:F}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(qi,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(qi,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(qi,{variant:`default`,size:`sm`,disabled:!N,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=N,t[24]=o,t[25]=F,t[26]=d,t[27]=u,t[28]=R):R=t[28];let z;return t[29]!==R||t[30]!==L?(z=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[I,L,R]}),t[29]=R,t[30]=L,t[31]=z):z=t[31],z}async function eD(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 tD(e,t){return eD(e,`content`,t)}async function nD(e){return eD(e,`mine`)}async function rD(e){return eD(e,`theirs`)}async function iD(e){return eD(e,`delete`)}async function aD(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 oD(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=qa(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Br(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),aD(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await tD(u,e);t.ok||X.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),X.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)($E,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(iD),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(qi,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(rD),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(qi,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)($E,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(nD),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(qi,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(iD),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(qi,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)($E,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function sD(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(zt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var cD=`__back-nav__`;function lD(e){return e instanceof Ie||e instanceof yt||e instanceof ke||e instanceof $e||e instanceof jt||e instanceof at?e.docName:null}function uD(e){if(e instanceof Ie){let t=e.docName;return{title:Y._({id:`Jejur6`}),summary:Y._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof yt){let t=e.docName;return{title:Y._({id:`V7QxyT`}),summary:Y._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof ke){let t=e.docName;return{title:Y._({id:`1di5fu`}),summary:Y._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof $e){let t=e.docName;return{title:Y._({id:`wvbc1r`}),summary:Y._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:Y._({id:`Gfr4fu`}),summary:Y._({id:`j6LB7S`})};if(e instanceof at){let t=e.docName;return{title:Y._({id:`vv7kpg`}),summary:Y._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Y._({id:`W5A0Ly`});return{title:Y._({id:`29VNqC`}),summary:t}}function dD(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=uD(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(mx,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(qi,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(qi,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(lD(n)??i),o(a),r(cD))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function fD(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)(dD,{...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]===cD){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}: ${uD(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)(W,{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 pD(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=er(t);return{map:n,keys:Kn(t),parseError:r}}function mD(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>pD(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=Fi(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Ze(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ft(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(hD,{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)(gD,{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 hD(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 gD(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function _D(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=er(t);return{map:n,keys:Kn(t),parseError:r}}function vD(e){let t=(0,$.c)(199),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>_D(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Fi(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]===j?M=t[9]:(M=wD(j),t[8]=j,t[9]=M);let N=M,P;t[10]===j?P=t[11]:(P=SD(j),t[10]=j,t[11]=P);let F=To(N?null:P),I;t[12]!==F||t[13]!==N?(I=!N&&F.state.status===`ready`?F.state.data.folder.frontmatter_defaults??{}:{},t[12]=F,t[13]=N,t[14]=I):I=t[14];let L=I,R;t[15]!==F||t[16]!==N?(R=!N&&F.state.status===`ready`?F.state.data.frontmatterSources:{},t[15]=F,t[16]=N,t[17]=R):R=t[17];let z=R,B;t[18]!==F||t[19]!==N?(B=!N&&F.state.status===`ready`?F.state.data.schemaDeclarations:{},t[18]=F,t[19]=N,t[20]=B):B=t[20];let V=B,H;t[21]!==F||t[22]!==N?(H=!N&&F.state.status===`ready`?F.state.data.schemaSources:{},t[21]=F,t[22]=N,t[23]=H):H=t[23];let U=H,W;t[24]!==r||t[25]!==a?(W=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=ar(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[24]=r,t[25]=a,t[26]=W):W=t[26];let G=W,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[27]=ee):ee=t[27];let K=ee,te;t[28]===r?te=t[29]:(te=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[28]=r,t[29]=te);let ne=te,q;t[30]!==G||t[31]!==ne?(q=function(e,t){K(e),ne(G({[e]:t}),[e])},t[30]=G,t[31]=ne,t[32]=q):q=t[32];let re=q,ie;t[33]!==G||t[34]!==ne?(ie=function(e){K(e),ne(G({[e]:null}),[e])},t[33]=G,t[34]=ne,t[35]=ie):ie=t[35];let ae=ie,oe;t[36]!==r||t[37]!==a?(oe=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=ar(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[36]=r,t[37]=a,t[38]=oe):oe=t[38];let se=oe,ce;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(ce=function(e,t){return`${e} ${t}`},t[39]=ce):ce=t[39];let le=ce,ue;t[40]!==a||t[41]!==m?(ue=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>le(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[40]=a,t[41]=m,t[42]=ue):ue=t[42];let de=ue,pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe={activationConstraint:{distance:4}},t[43]=pe):pe=t[43];let me;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(me={coordinateGetter:Qa},t[44]=me):me=t[44];let he=io(ka(ja,pe),ka(Ca,me)),ge;t[45]!==L||t[46]!==re||t[47]!==p?(ge=function(e,t){let n=p[e]??TD(L[e]);if(n===void 0)return;b(n=>({...n,[e]:t}));let r=Da(n,t);(!Object.hasOwn(p,e)||!xD(n,r))&&re(e,r)},t[45]=L,t[46]=re,t[47]=p,t[48]=ge):ge=t[48];let _e=ge,ve;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[49]=ve):ve=t[49];let ye=ve,{addPropertySignal:be,clearAddProperty:xe}=cS(),Se;t[50]!==be||t[51]!==j?(Se=be.get(j)??0,t[50]=be,t[51]=j,t[52]=Se):Se=t[52];let Ce=Se,we,Te;t[53]===Ce?(we=t[54],Te=t[55]):(we=()=>{Ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},Te=[Ce],t[53]=Ce,t[54]=we,t[55]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[56]!==xe||t[57]!==j?(Ee=()=>()=>xe(j),De=[j,xe],t[56]=xe,t[57]=j,t[58]=Ee,t[59]=De):(Ee=t[58],De=t[59]),(0,Q.useEffect)(Ee,De);let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):xa[e];return{...t,type:e,value:n,error:null}})},t[60]=Oe):Oe=t[60];let ke=Oe,Ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=function(e){S(t=>t&&{...t,value:e})},t[61]=Ae):Ae=t[61];let je=Ae,Me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Me=function(e){S(t=>t&&{...t,name:e,error:null})},t[62]=Me):Me=t[62];let Ne=Me,Pe;t[63]!==r||t[64]!==x||t[65]!==G||t[66]!==p?(Pe=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=G({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[63]=r,t[64]=x,t[65]=G,t[66]=p,t[67]=Pe):Pe=t[67];let Fe=Pe,Ie;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=function(){S(null)},t[68]=Ie):Ie=t[68];let Le=Ie,Re;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(e){w({key:e,draft:e,error:null})},t[69]=Re):Re=t[69];let ze=Re,Be;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Be=function(e){w(t=>t&&{...t,draft:e,error:null})},t[70]=Be):Be=t[70];let Ve=Be,He;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(He=function(){w(null)},t[71]=He):He=t[71];let Ue=He,We;t[72]!==r||t[73]!==p||t[74]!==se||t[75]!==C?(We=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=se(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),K(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[72]=r,t[73]=p,t[74]=se,t[75]=C,t[76]=We):We=t[76];let Ge=We,Ke;t[77]!==p||t[78]!==m?(Ke=m.length>0?m:Object.keys(p),t[77]=p,t[78]=m,t[79]=Ke):Ke=t[79];let qe=Ke,Je;if(t[80]!==qe){Je=new Map;for(let e of qe)Je.set(e,(Je.get(e)??0)+1);t[80]=qe,t[81]=Je}else Je=t[81];let Ye,J,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot;if(t[82]!==x||t[83]!==L||t[84]!==z||t[85]!==g||t[86]!==re||t[87]!==Ge||t[88]!==Je||t[89]!==E||t[90]!==de||t[91]!==p||t[92]!==y||t[93]!==h||t[94]!==ae||t[95]!==C||t[96]!==qe||t[97]!==k||t[98]!==V||t[99]!==U||t[100]!==he||t[101]!==_e){ot=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(L).filter(e=>!Object.hasOwn(p,e)).sort(),n=Object.keys(V).filter(e=>!Object.hasOwn(p,e)&&!Object.hasOwn(L,e)).sort();if(qe.length===0&&e.length===0&&n.length===0&&!x&&!h){ot=null;break bb0}it=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,at=`property-panel`,J=_s,tt=!g,t[115]===Symbol.for(`react.memo_cache_sentinel`)?(nt=e=>_(!e),t[115]=nt):nt=t[115];let r=!g,i;t[116]===r?i=t[117]:(i=(0,Z.jsx)(ps,{"data-expanded":r,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[116]=r,t[117]=i);let a;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[118]=a):a=t[118],t[119]===i?rt=t[120]:(rt=(0,Z.jsx)(gs,{asChild:!0,children:(0,Z.jsxs)(qi,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[i,a]})}),t[119]=i,t[120]=rt),Ye=hs,Xe=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[121]===h?Ze=t[122]:(Ze=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Or,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[121]=h,t[122]=Ze);let o;if(t[123]!==qe){let e;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>le(e,t),t[125]=e):e=t[125],o=qe.map(e),t[123]=qe,t[124]=o}else o=t[124];let c;if(t[126]!==re||t[127]!==Ge||t[128]!==Je||t[129]!==E||t[130]!==p||t[131]!==y||t[132]!==ae||t[133]!==C||t[134]!==qe||t[135]!==k||t[136]!==_e){let e;t[138]!==re||t[139]!==Ge||t[140]!==Je||t[141]!==E||t[142]!==p||t[143]!==y||t[144]!==ae||t[145]!==C||t[146]!==k||t[147]!==_e?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??gi(n),i=C?.key===e?C:null,a=(Je.get(e)??0)>1;return(0,Z.jsx)(La,{sortableId:le(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>ze(e),onChangeDraft:Ve,onCommit:Ge,onCancel:Ue},onCommit:t=>re(e,t),onChangeType:t=>_e(e,t),onRemove:()=>ae(e)},`${e}-${t}`)},t[138]=re,t[139]=Ge,t[140]=Je,t[141]=E,t[142]=p,t[143]=y,t[144]=ae,t[145]=C,t[146]=k,t[147]=_e,t[148]=e):e=t[148],c=qe.map(e),t[126]=re,t[127]=Ge,t[128]=Je,t[129]=E,t[130]=p,t[131]=y,t[132]=ae,t[133]=C,t[134]=qe,t[135]=k,t[136]=_e,t[137]=c}else c=t[137];let l;t[149]!==o||t[150]!==c?(l=(0,Z.jsx)(Ga,{items:o,strategy:Xa,children:c}),t[149]=o,t[150]=c,t[151]=l):l=t[151],t[152]!==de||t[153]!==he||t[154]!==l?(Qe=(0,Z.jsx)(eo,{sensors:he,collisionDetection:Io,onDragEnd:de,children:l}),t[152]=de,t[153]=he,t[154]=l,t[155]=Qe):Qe=t[155];let u;t[156]!==L||t[157]!==z||t[158]!==re||t[159]!==E||t[160]!==k||t[161]!==_e?(u=e=>{let t=L[e],n=TD(t),r=gi(n),i=z[e]??``;return(0,Z.jsx)(La,{keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isInherited:!0,badge:(0,Z.jsx)(Va,{source:i}),onCommit:t=>re(e,t),onChangeType:t=>_e(e,t)},`inherited-${e}`)},t[156]=L,t[157]=z,t[158]=re,t[159]=E,t[160]=k,t[161]=_e,t[162]=u):u=t[162],$e=e.map(u);let d;t[163]!==re||t[164]!==E||t[165]!==k||t[166]!==V||t[167]!==U?(d=e=>{let t=V[e].type,n=U[e]??``;return(0,Z.jsx)(La,{keyName:e,value:t===`date`?``:xa[t],declared:t,error:E[e]??null,resetCounter:k[e]??0,badge:(0,Z.jsx)(Fa,{source:n}),onCommit:t=>re(e,t),onChangeType:bD,typeReadOnly:!0},`declared-${e}`)},t[163]=re,t[164]=E,t[165]=k,t[166]=V,t[167]=U,t[168]=d):d=t[168],et=n.map(d)}t[82]=x,t[83]=L,t[84]=z,t[85]=g,t[86]=re,t[87]=Ge,t[88]=Je,t[89]=E,t[90]=de,t[91]=p,t[92]=y,t[93]=h,t[94]=ae,t[95]=C,t[96]=qe,t[97]=k,t[98]=V,t[99]=U,t[100]=he,t[101]=_e,t[102]=Ye,t[103]=J,t[104]=Xe,t[105]=Ze,t[106]=Qe,t[107]=$e,t[108]=et,t[109]=tt,t[110]=nt,t[111]=rt,t[112]=it,t[113]=at,t[114]=ot}else Ye=t[102],J=t[103],Xe=t[104],Ze=t[105],Qe=t[106],$e=t[107],et=t[108],tt=t[109],nt=t[110],rt=t[111],it=t[112],at=t[113],ot=t[114];if(ot!==Symbol.for(`react.early_return_sentinel`))return ot;let st;t[169]!==L||t[170]!==re||t[171]!==E||t[172]!==p||t[173]!==k||t[174]!==V?(st=!Object.hasOwn(p,`tags`)&&!Object.hasOwn(L,`tags`)&&!Object.hasOwn(V,`tags`)?(0,Z.jsx)(La,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>re(`tags`,e),onChangeType:yD},`virtual-tags`):null,t[169]=L,t[170]=re,t[171]=E,t[172]=p,t[173]=k,t[174]=V,t[175]=st):st=t[175];let ct;t[176]!==r||t[177]!==x||t[178]!==Fe?(ct=x?(0,Z.jsx)(So,{draft:x,onChangeName:Ne,onChangeType:ke,onChangeValue:je,onCommit:Fe,onCancel:Le}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(qi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ye,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(fe,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[176]=r,t[177]=x,t[178]=Fe,t[179]=ct):ct=t[179];let lt;t[180]!==Ye||t[181]!==Xe||t[182]!==Ze||t[183]!==Qe||t[184]!==$e||t[185]!==et||t[186]!==st||t[187]!==ct?(lt=(0,Z.jsxs)(Ye,{className:Xe,children:[Ze,Qe,$e,et,st,ct]}),t[180]=Ye,t[181]=Xe,t[182]=Ze,t[183]=Qe,t[184]=$e,t[185]=et,t[186]=st,t[187]=ct,t[188]=lt):lt=t[188];let ut;t[189]!==J||t[190]!==tt||t[191]!==nt||t[192]!==rt||t[193]!==lt?(ut=(0,Z.jsxs)(J,{open:tt,onOpenChange:nt,children:[rt,lt]}),t[189]=J,t[190]=tt,t[191]=nt,t[192]=rt,t[193]=lt,t[194]=ut):ut=t[194];let dt;return t[195]!==it||t[196]!==at||t[197]!==ut?(dt=(0,Z.jsx)(`div`,{className:it,"data-testid":at,children:ut}),t[195]=it,t[196]=at,t[197]=ut,t[198]=dt):dt=t[198],dt}function yD(){}function bD(){}function xD(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function SD(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var CD=/(^|\/)\.ok\/templates\//;function wD(e){return CD.test(e)}function TD(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}var ED=G(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function DD(e){let t=e.threshold??ED;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function OD(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var kD=G(`ACTIVITY_MOUNT_LIMIT`,3);function AD(){return n(()=>import(`./SourceEditor-DypG3lee.js`),__vite__mapDeps([46,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,47,24]),import.meta.url)}var jD=(0,Q.lazy)(async()=>({default:(await AD()).SourceEditor}));function MD(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ke(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 ND(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Y._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Y._({id:`Sc1bKE`,values:{docName:e}}):Y._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Y._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Y._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Y._({id:`bmC18N`,values:{docName:e}}):Y._({id:`pAgkuZ`,values:{docName:e}})}:null}function PD(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(x,{name:`activity-pool`,children:(0,Z.jsx)(FD,{...e})}),t[0]=e,t[1]=n),n}function FD(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}=wi(),f=MD(c,n,kD),p=(0,Q.useRef)(``),h=f.map(ID).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)j(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;oe(e,t&&t.length>0?t:crypto.randomUUID())}b(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,m(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)(HD,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let x=f.map(y),S;return t[13]===x?S=t[14]:(S=(0,Z.jsx)(Z.Fragment,{children:x}),t[13]=x,t[14]=S),S}function ID(e){return e.docName}function LD(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&&b(`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&&(b(`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&&b(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function RD(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)(jb,{}),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)(jD,{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 zD(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)(ko,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(F,{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)(qi,{type:`button`,onClick:BD,children:[(0,Z.jsx)(ko,{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 BD(){return window.location.reload()}function VD(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 HD(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=ND(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=oC(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==y?(S=()=>{i&&!_?v(!0):!i&&!y&&x(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=DD({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&b(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let k;t[19]===n.docName?k=t[20]:(k=()=>ct(n.docName),t[19]=n.docName,t[20]=k);let[A]=(0,Q.useState)(k),j=A?.html??null,[M,N]=(0,Q.useState)(!1),P,F;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==M||t[26]!==i||t[27]!==g?(P=()=>{OD({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(b(`ok/cold/first-toggle`,{docName:n.docName,mountId:z(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=M,t[26]=i,t[27]=g,t[28]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=A?.scrollTop,B;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==j?(B=f?(0,Z.jsx)(zD,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(fD,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(VD,{html:j}):(0,Z.jsx)(jb,{}),children:(0,Z.jsx)(sD,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(oD,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(mD,{provider:n.provider}),!i&&(0,Z.jsx)(vD,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(RD,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(aT,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=j,t[44]=B):B=t[44];let V;t[45]!==r||t[46]!==R||t[47]!==B?(V=(0,Z.jsx)(LD,{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 UD(e){let t=(0,$.c)(36),{stats:n}=e,{_:r}=i(),{words:a,chars:o,tokens:c}=n,l;t[0]===r?l=t[1]:(l=r({id:`L1ZE3M`}),t[0]=r,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(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[2]=u):u=t[2];let d;t[3]===n.words?d=t[4]:(d=n.words.toLocaleString(),t[3]=n.words,t[4]=d);let f;t[5]===d?f=t[6]:(f=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d}),t[5]=d,t[6]=f);let p;t[7]===a?p=t[8]:(p=(0,Z.jsx)(s,{id:`gljvbT`,values:{words:a}}),t[7]=a,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,` `,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.chars?h=t[13]:(h=n.chars.toLocaleString(),t[12]=n.chars,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:h}),t[14]=h,t[15]=g);let _;t[16]===o?_=t[17]:(_=(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:o}}),t[16]=o,t[17]=_);let v;t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`span`,{children:[g,` `,_]}),t[18]=g,t[19]=_,t[20]=v):v=t[20];let y=n.tokens>0?`~`:``,b;t[21]===n.tokens?b=t[22]:(b=n.tokens.toLocaleString(),t[21]=n.tokens,t[22]=b);let x;t[23]===b?x=t[24]:(x=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:b}),t[23]=b,t[24]=x);let S;t[25]===c?S=t[26]:(S=(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:c}}),t[25]=c,t[26]=S);let C;t[27]!==y||t[28]!==x||t[29]!==S?(C=(0,Z.jsxs)(`span`,{children:[y,x,` `,S]}),t[27]=y,t[28]=x,t[29]=S,t[30]=C):C=t[30];let w;return t[31]!==l||t[32]!==v||t[33]!==C||t[34]!==m?(w=(0,Z.jsxs)(`section`,{"aria-label":l,className:`relative flex h-6 shrink-0 items-center justify-end gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[u,m,v,C]}),t[31]=l,t[32]=v,t[33]=C,t[34]=m,t[35]=w):w=t[35],w}function WD(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=Bi(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function GD(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=Bi(`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 KD(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=Bi(`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 qD(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=Bi(`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 JD(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=Bi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(ps,{}),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 YD=1,XD=2,ZD=4;function QD(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=y(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>ZD?[...u.slice(0,YD).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(YD,-XD)},...u.slice(-XD).map((e,t)=>d(e,u.length-XD+t))]:u.map((e,t)=>d(e,t));a=WD,t[8]===r?c=t[9]:(c=Bi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=GD,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map($D)}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 $D(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(JD,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(KD,{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)(jc,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(KD,{className:`min-w-0`,children:(0,Z.jsx)(qD,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var eO={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`},tO=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`,...eO,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},nO=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)(tO,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},rO=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)(tO,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function iO(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=_a(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=Ya(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(QD,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(hr,{children:(0,Z.jsx)(rO,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(es,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(ri,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(nO,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(es,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(sr,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(ri,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(ns,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(qi,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(hr,{children:(0,Z.jsx)(qc,{})})}),(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=ri,h=qi,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)(hr,{children:u?(0,Z.jsx)(nl,{}):(0,Z.jsx)(tl,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(sr,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function aO(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var oO=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DBUlDDd_.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function sO(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(lO,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(cO,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(x,{name:`editor-area`,children:(0,Z.jsxs)(oS,{children:[n,r]})}),t[3]=n,t[4]=i),i}function cO(){let e=(0,$.c)(5),t=Th(),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)(_S,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function lO(e){let t=(0,$.c)(143),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,onSaveVersion:c,saving:l}=e,{_:u}=i(),{activeDocName:d,activeProvider:f,activeTarget:p,recycleDocument:m,docPanelMode:h,docPanelAgentId:g,docPanelExpandSignal:_}=ht(),{openDocumentTransition:v}=Dt(),{requestAddProperty:y}=cS(),b=iC(f,d),x=EC(f),S=x===`connected`||x===`synced`,C=oC(d)===`conflict`,w=(0,Q.useDeferredValue)(d),T=p?.kind===`missing`,E=!!d&&p?.kind!==`folder`,D;t[0]!==u||t[1]!==T?(D=T?u({id:`K-a33w`}):void 0,t[0]=u,t[1]=T,t[2]=D):D=t[2];let O=D,[k]=(0,Q.useState)(dO),A=k!==null,j;t[3]===k?j=t[4]:(j=()=>hC(k,window.innerWidth,`right`),t[3]=k,t[4]=j);let[M,N]=(0,Q.useState)(j),P=(0,Q.useRef)(M),F,I;t[5]===M?(F=t[6],I=t[7]):(F=()=>{P.current=M},I=[M],t[5]=M,t[6]=F,t[7]=I),(0,Q.useEffect)(F,I);let L=yb(),R;t[8]===M?R=t[9]:(R=()=>wC(`right`,M,SC())===`collapsed`,t[8]=M,t[9]=R);let[z]=(0,Q.useState)(R),[B,V]=(0,Q.useState)(z),H=(0,Q.useRef)(B),W,G;t[10]===B?(W=t[11],G=t[12]):(W=()=>{H.current=B},G=[B],t[10]=B,t[11]=W,t[12]=G),(0,Q.useEffect)(W,G);let[ee,K]=(0,Q.useState)(!1),te=(0,Q.useRef)(!1),[ne]=(0,Q.useState)(uO),q=(0,Q.useRef)(ne),re=(0,Q.useRef)(null),ie;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e){re.current!=null&&clearTimeout(re.current),re.current=setTimeout(()=>{uC(e),re.current=null},100)},t[13]=ie):ie=t[13];let ae=ie,oe,se;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>()=>{re.current!=null&&clearTimeout(re.current)},oe=[],t[14]=oe,t[15]=se):(oe=t[14],se=t[15]),(0,Q.useEffect)(se,oe);let[ce,le]=(0,Q.useState)(null),ue;t[16]!==B||t[17]!==L?(ue=function(){if(L.current==null)return;let e=P.current;B?(TC(`right`,e,`open`),L.current?.expand()):(TC(`right`,e,`collapsed`),L.current?.collapse())},t[16]=B,t[17]=L,t[18]=ue):ue=t[18];let de=ue,fe,pe;t[19]!==k||t[20]!==L?(fe=()=>{let e=window.matchMedia(`(min-width: ${pC}px)`),t=()=>{let e=hC(k,window.innerWidth,`right`);N(e);let t=wC(`right`,e,SC())===`collapsed`;V(t),t?L.current?.collapse():L.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},pe=[k,L],t[19]=k,t[20]=L,t[21]=fe,t[22]=pe):(fe=t[21],pe=t[22]),(0,Q.useEffect)(fe,pe);let me,he;t[23]!==ce||t[24]!==A||t[25]!==L?(me=()=>{if(ce==null||A)return;let e=new ResizeObserver(()=>{H.current||te.current||L.current?.resize(`${q.current}px`)});return e.observe(ce),()=>e.disconnect()},he=[ce,A,L],t[23]=ce,t[24]=A,t[25]=L,t[26]=me,t[27]=he):(me=t[26],he=t[27]),(0,Q.useEffect)(me,he);let ge,_e;t[28]!==o||t[29]!==L?(ge=()=>{let e=e=>{o(e),L.current?.expand()},t=km();return t&&e(t),jm(t=>{km(),e(t)})},_e=[o,L],t[28]=o,t[29]=L,t[30]=ge,t[31]=_e):(ge=t[30],_e=t[31]),(0,Q.useEffect)(ge,_e);let ve,ye;t[32]!==_||t[33]!==L?(ve=()=>{_!==0&&L.current?.expand()},ye=[_,L],t[32]=_,t[33]=L,t[34]=ve,t[35]=ye):(ve=t[34],ye=t[35]),(0,Q.useEffect)(ve,ye);let be,xe;t[36]===B?(be=t[37],xe=t[38]):(be=()=>{if(!B||!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()},xe=[B],t[36]=B,t[37]=be,t[38]=xe),(0,Q.useLayoutEffect)(be,xe);let Se,Ce;t[39]===B?(Se=t[40],Ce=t[41]):(Se=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!B})},Ce=[B],t[39]=B,t[40]=Se,t[41]=Ce),(0,Q.useEffect)(Se,Ce);let we,Te;t[42]===de?(we=t[43],Te=t[44]):(we=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&de()})},Te=[de],t[42]=de,t[43]=we,t[44]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[45]===de?(Ee=t[46],De=t[47]):(Ee=()=>{if(window.okDesktop!=null)return;let e=e=>{Ba(e,`toggle-document-panel`)&&(e.preventDefault(),de())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},De=[de],t[45]=de,t[46]=Ee,t[47]=De),(0,Q.useEffect)(Ee,De);let Oe=(0,Q.useRef)(null),[ke,Ae]=(0,Q.useState)(null),je=p?.kind===`large-file`?p.docName:d,Me,Ne;t[48]===je?(Me=t[49],Ne=t[50]):(Me=()=>{if(je&&je!==Oe.current){let e=Oe.current;Oe.current=je,Ae(e)}},Ne=[je],t[48]=je,t[49]=Me,t[50]=Ne),(0,Q.useEffect)(Me,Ne);let Pe;t[51]===v?Pe=t[52]:(Pe=function(e){let t=xi(e);window.location.hash===t?v(e):window.location.hash=t},t[51]=v,t[52]=Pe);let Fe=Pe;if(p?.kind===`large-file`){let e;t[53]!==Fe||t[54]!==ke?(e=ke?{previousDocName:ke,onNavigateBack:Fe}:void 0,t[53]=Fe,t[54]=ke,t[55]=e):e=t[55];let n;return t[56]!==p.docName||t[57]!==p.limit||t[58]!==p.size||t[59]!==e?(n=(0,Z.jsx)(nS,{docName:p.docName,size:p.size,limit:p.limit,backNav:e}),t[56]=p.docName,t[57]=p.limit,t[58]=p.size,t[59]=e,t[60]=n):n=t[60],n}if(p?.kind===`folder`){if(!(h===`agent`&&g!==null)){let e;return t[61]===p.folderPath?e=t[62]:(e=(0,Z.jsx)(Qx,{folderPath:p.folderPath}),t[61]=p.folderPath,t[62]=e),e}let e;t[63]===p.folderPath?e=t[64]:(e=(0,Z.jsx)(CS,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(Qx,{folderPath:p.folderPath})}),t[63]=p.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(wS,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(CS,{defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(oO,{showBackButton:!1})})}),t[66]=r):r=t[66];let i;return t[67]===e?i=t[68]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(SS,{orientation:`horizontal`,children:[e,n,r]})}),t[67]=e,t[68]=i),i}if(p?.kind===`asset`){let e;return t[69]!==p.assetPath||t[70]!==p.mediaKind?(e=(0,Z.jsx)(Ab,{assetPath:p.assetPath,mediaKind:p.mediaKind},p.assetPath),t[69]=p.assetPath,t[70]=p.mediaKind,t[71]=e):e=t[71],e}if(!f||!d){if((typeof window<`u`?ti(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(jb,{}),t[72]=e):e=t[72],e}let e;return t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(wx,{}),t[73]=e):e=t[73],e}let Ie=n===`source`,Le=!S,Re=B,ze;t[74]!==d||t[75]!==y?(ze=function(){d&&y(d)},t[74]=d,t[75]=y,t[76]=ze):ze=t[76];let Ve=ze,He=w??d,Ue=ke??void 0,We;t[77]!==O||t[78]!==Ie||t[79]!==Fe||t[80]!==m||t[81]!==He||t[82]!==Ue?(We=(0,Z.jsx)(PD,{activeDocName:He,isSourceMode:Ie,editorPlaceholder:O,previousDocName:Ue,onNavigateBack:Fe,onRecycle:m}),t[77]=O,t[78]=Ie,t[79]=Fe,t[80]=m,t[81]=He,t[82]=Ue,t[83]=We):We=t[83];let Ge;t[84]!==d||t[85]!==Ie?(Ge=(0,Z.jsx)(HS,{activeDocName:d,isSourceMode:Ie}),t[84]=d,t[85]=Ie,t[86]=Ge):Ge=t[86];let Ke;t[87]!==d||t[88]!==w?(Ke=aO({activeDocName:d,deferredActiveDocName:w,mountResolved:d!==null&&U(d),syncResolved:d!==null&&Be(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(jb,{}),d===null?null:(0,Z.jsx)(rS,{docName:d})]}):null,t[87]=d,t[88]=w,t[89]=Ke):Ke=t[89];let qe;t[90]!==We||t[91]!==Ge||t[92]!==Ke?(qe=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[We,Ge,Ke]}),t[90]=We,t[91]=Ge,t[92]=Ke,t[93]=qe):qe=t[93];let Je;t[94]!==d||t[95]!==C||t[96]!==Re||t[97]!==Ie||t[98]!==r||t[99]!==Ve||t[100]!==Le||t[101]!==de?(Je=!C&&(0,Z.jsx)(iO,{activeDocName:d,isSourceMode:Ie,sourceDisabled:Le,onModeChange:r,showAddPropertyButton:!Ie,onAddProperty:Ve,isPanelCollapsed:Re,onTogglePanel:de}),t[94]=d,t[95]=C,t[96]=Re,t[97]=Ie,t[98]=r,t[99]=Ve,t[100]=Le,t[101]=de,t[102]=Je):Je=t[102];let Ye;t[103]!==qe||t[104]!==Je?(Ye=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[qe,Je]}),t[103]=qe,t[104]=Je,t[105]=Ye):Ye=t[105];let J;t[106]!==E||t[107]!==b?(J=E&&(0,Z.jsx)(UD,{stats:b}),t[106]=E,t[107]=b,t[108]=J):J=t[108];let Xe;t[109]!==Ye||t[110]!==J?(Xe=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[Ye,J]}),t[109]=Ye,t[110]=J,t[111]=Xe):Xe=t[111];let Ze=Xe,Qe=ee||void 0,$e;t[112]===z?$e=t[113]:($e=z?{defaultSize:`100%`}:{},t[112]=z,t[113]=$e);let et=ee?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,tt;t[114]!==Ze||t[115]!==$e||t[116]!==et?(tt=(0,Z.jsx)(CS,{minSize:`30%`,...$e,className:et,children:Ze}),t[114]=Ze,t[115]=$e,t[116]=et,t[117]=tt):tt=t[117];let nt=A&&B,rt;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(rt=()=>{K(!0),te.current=!0;let e=()=>{K(!1),te.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[118]=rt):rt=t[118];let it;t[119]===nt?it=t[120]:(it=(0,Z.jsx)(wS,{withHandle:!0,disabled:nt,onPointerDown:rt}),t[119]=nt,t[120]=it);let at=z?0:`${ne}px`,ot;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(ot=e=>{V(e.asPercentage===0),e.inPixels>0&&te.current&&(q.current=e.inPixels,ae(e.inPixels))},t[121]=ot):ot=t[121];let st=!ee&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ct;t[122]===st?ct=t[123]:(ct=Bi(`flex flex-col bg-muted/20`,st),t[122]=st,t[123]=ct);let lt;t[124]!==d||t[125]!==a||t[126]!==h||t[127]!==Ie||t[128]!==o||t[129]!==c||t[130]!==l?(lt=(0,Z.jsx)(Ev,{docName:d,isSourceMode:Ie,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l}),t[124]=d,t[125]=a,t[126]=h,t[127]=Ie,t[128]=o,t[129]=c,t[130]=l,t[131]=lt):lt=t[131];let ut;t[132]!==B||t[133]!==L||t[134]!==at||t[135]!==ct||t[136]!==lt?(ut=(0,Z.jsx)(CS,{id:`doc-panel`,panelRef:L,defaultSize:at,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:ot,inert:B,className:ct,children:lt}),t[132]=B,t[133]=L,t[134]=at,t[135]=ct,t[136]=lt,t[137]=ut):ut=t[137];let dt;return t[138]!==Qe||t[139]!==tt||t[140]!==it||t[141]!==ut?(dt=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:le,children:(0,Z.jsxs)(SS,{orientation:`horizontal`,"data-dragging":Qe,children:[tt,it,ut]})}),t[138]=Qe,t[139]=tt,t[140]=it,t[141]=ut,t[142]=dt):dt=t[142],dt}function uO(){return dC()}function dO(){return Zn()}function fO(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function pO(e){let{value:t,unit:n}=fO(e);return n===`rem`?t*16:t}function mO(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var hO=3600*24*7;function gO(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?_O:m,O=g===void 0?hO:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,ee;t[3]===y?(G=t[4],ee=t[5]):(G=()=>{H.current=y},ee=[y],t[3]=y,t[4]=G,t[5]=ee),(0,Q.useEffect)(G,ee);let K=pO(b),te;t[6]===x?te=t[7]:(te=pO(x),t[6]=x,t[7]=te);let ne=te,q;t[8]!==E||t[9]!==k?(q=function(e){E&&(P.current=!0,j.current=H.current?0:pO(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]=q):q=t[10];let re=q,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ne||t[18]!==K||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{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}=fO(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<=K*w;else if(e<=K){let n=K*(w-1);t=K-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>K*T){a();let t=n(r,M.current,j.current,s),c=Math.max(K,Math.min(ne,t)),u=mO(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(K,Math.min(ne,u)),f=mO(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)}},ae=[i,a,D,K,ne,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ne,t[18]=K,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function _O(){}var vO=3600*24*7,yO=`18rem`,bO=`3rem`,xO=`app-file-sidebar`,SO=`14.625rem`,CO=`32rem`,wO=`sidebar_width`,TO=/^\d+(?:\.\d+)?(?:rem|px)$/,EO=Q.createContext(null);function DO(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${wO}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return TO.test(n)?n:e}function OO(){let e=Q.use(EO);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function kO(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?yO:c,[u]=Q.useState(jO),d;t[8]===u?d=t[9]:(d=()=>hC(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>DO(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=SC();return wC(`left`,hC(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),TC(`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(AO)},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: ${fC}px)`),t=()=>{let e=hC(u,window.innerWidth,`left`);p(e),C(wC(`left`,e,SC())===`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(xO)?.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=>{Ba(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":bO,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Bi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let ee;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(ee=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=ee):ee=t[54];let K;return t[55]!==H||t[56]!==ee?(K=(0,Z.jsx)(EO.Provider,{value:H,children:ee}),t[55]=H,t[56]=ee,t[57]=K):K=t[57],K}function AO(e){return!e}function jO(){return Zn()}function MO(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=OO();if(d===`none`){let e;t[7]===r?e=t[8]:(e=Bi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=Bi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,x;t[20]!==r||t[21]!==b?(x=Bi(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:xO,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function NO(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=OO(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=Ya(`toggle-files-sidebar`);l=qi,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=xO,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=Bi(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(T,{}):(0,Z.jsx)(el,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function PO(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=OO(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:SO,maxResizeWidth:CO,setIsDraggingRail:h,widthCookieName:wO,widthCookieMaxAge:vO},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=gO(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=Bi(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function FO(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}=OO(),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=Bi(`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 IO(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=Bi(`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 LO(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=Bi(`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 RO(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=Bi(`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 zO(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=Bi(`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 BO(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=Bi(`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 VO=Yi(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function HO(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?Hi:`button`,{state:m}=OO(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Bi(VO({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)(hr,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(sr,{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)(ri,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function UO(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 WO(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 GO=1e3,KO=!1;function qO(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function JO(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:ca(i)?a=i:(a=void 0,KO||(KO=!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`&&(qO({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=WO(i),{current:c,crossDoc:l}=a?ra(a,n,Date.now()):{current:[],crossDoc:[]},u=YO,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>UO(e.current,p)&&UO(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,GO);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 YO(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var XO=`sync-status`;function ZO(e,t){let n=(0,$.c)(5),{_:r}=i(),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]!==e?(c=()=>{s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t&&(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current?(o.current=!0,X.warning(r({id:`HGNCsl`}),{id:XO,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,X.success(r({id:`GhjUB_`}),{id:XO,duration:3e3})))},l=[e,t,r],n[0]=r,n[1]=t,n[2]=e,n[3]=c,n[4]=l):(c=n[3],l=n[4]),(0,Q.useEffect)(c,l)}var QO=4,$O=3,ek={Bird:gc,Cat:Sc,Dog:Ac,Fish:Fc,Mouse:sl,Rabbit:ol,Shrimp:ml,Snail:hl,Squirrel:vl,Turtle:Cl};Object.freeze(Object.keys(ek));function tk(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(ek,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var nk={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function rk(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=tk(n),c=s.kind===`animal`?ek[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=$n(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=kr(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(sr,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(ri,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function ik(e){let t=nk[e.icon];return e.displayName||t||Y._({id:`iEQQyu`})}function ak(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 ok(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=ht(),{presence:u,agentId:d}=n,f=ik(u),p=ak(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(oa,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(oa,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)(hr,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(sr,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(ri,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function sk(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?Y._({id:`9euN0m`,values:{count:n}}):Y._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(H,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(rk,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(ok,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(B,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let m;return t[18]!==u||t[19]!==f?(m=(0,Z.jsxs)(p,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=m):m=t[20],m}function ck(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(rk,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(ok,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function lk(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ht(),{current:s,crossDoc:c}=JO(t,r,n);if(ZO(EC(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,QO),n;e[6]===s?n=e[7]:(n=s.slice(QO),e[6]=s,e[7]=n);let r=n,u=c.slice(0,$O),d;e[8]===c?d=e[9]:(d=c.slice($O),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=>ck(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)(sk,{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=>ck(e,p,!0,m)),f.length>0?(0,Z.jsx)(sk,{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 uk=`.md`,dk=/\.(md|mdx)$/i;function fk(e,t=uk){return`${e}${t}`}function pk(e){return Pk(e).replace(dk,``)}function mk(e){return ai(e)?_k(e.path):Bn(e)?e.path:fk(e.docName,e.docExt)}function hk(e){let t=Pk(e).match(dk);return t?`.${t[1].toLowerCase()}`:void 0}function gk(e){return Pk(e)}function _k(e){let t=Pk(e.trim());return t?`${t}/`:``}function vk(e){return e.endsWith(`/`)?gk(e):pk(e)}function yk(e){return e.map(mk)}function bk(e){return[...e].sort().join(`\0`)}function xk(e){return bk(yk(e))}function Sk(e){let t=new Set;for(let n of e){if(ai(n)){let e=_k(n.path);e&&t.add(e)}let e=(ai(n)||Bn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=ai(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function Ck(e){if(!e)return[];let t=Pk(e.replace(dk,``)).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 wk(e,t,n){let r=hk(e);if(r)return r;let i=n.find(e=>mr(e)&&e.docName===t);return i?i.docExt??uk:Nk(e).includes(`.`)?void 0:uk}function Tk(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(!Bn(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 Ek(e,t,n){if(hk(e))return null;let r=n.find(e=>Bn(e)&&e.path===t);return r?r.path:Nk(e).includes(`.`)?t:Tk(t,n)}function Dk(e,t){let n=e.kind===`directory`,r=n?gk(e.path):pk(e.path);if(n)return{kind:`folder`,name:Pk(Nk(e.path)).replace(dk,``),path:r,treePath:kk(e.path,!0)};let i=Ek(e.path,r,t);if(i)return{kind:`asset`,name:Pk(Nk(i)),path:i,treePath:i};let a=wk(e.path,r,t);return{kind:`file`,name:Pk(Nk(e.path)).replace(dk,``),path:r,treePath:kk(e.path,!1),docExt:a}}function Ok(e){return e.kind===`directory`?gk(e.path):e.path}function kk(e,t){return t?_k(e):dk.test(e)?e:`${e}${uk}`}function Ak(e,t,n){let r=_k(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}${uk}`;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 jk(e,t){return e===`file`?kk(t,!1):`${gk(t)}/index${uk}`}function Mk(e,t){return t.kind===`root`||t.directoryPath==null?Nk(e):`${t.directoryPath}${Nk(e)}`}function Nk(e){let t=Pk(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Pk(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Fk(e,t){return t.trim()}function Ik(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function Lk(e,t){let n=Fk(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function Rk(e,t,n=[],r=[]){if(t.length===0&&n.length===0&&r.length===0)return e;let i=new Map(t.map(e=>[e.fromDocName,e.toDocName])),a=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>mr(e)?{...e,docName:i.get(e.docName)??e.docName}:ai(e)?{...e,path:Gk(e.path,n)}:Bn(e)?{...e,path:a.get(e.path)??Gk(e.path,n)}:e)}function zk(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=>mr(e)?!i.has(e.docName)&&!Yk(e.docName,n):ai(e)?!Yk(e.path,n):Bn(e)?!a.has(e.path)&&!Yk(e.path,n):!0)}function Bk(e,t){if(e.kind!==`asset`||t.some(t=>Bn(t)&&t.path===e.path))return e;let n=Tk(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function Vk(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>Kk(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>mr(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=>ai(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(mr(i)){let e=Jk(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(ai(i)){let e=qk(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function Hk(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function Uk(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function Wk(e,t){let n=e.kind===`file`?fk(e.path,e.docExt):e.path;return Xh(t.contentDir,n,t.pathSeparator)}function Gk(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 Kk(e,t){return mr(e)&&mr(t)?e.docName===t.docName:ai(e)&&ai(t)||Bn(e)&&Bn(t)?e.path===t.path:!1}function qk(e,t,n){return e===t?n:Jk(e,t,n)}function Jk(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function Yk(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function Xk(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)(Bu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function Zk(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=Bi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Vu,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Qk(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)(Ju,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function $k(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=Bi(`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)(Hu,{children:(0,Z.jsx)(Uu,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function eA(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=Bi(`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)(Wu,{"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 tA(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=Bi(`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)(ps,{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)(Yu,{"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 nA(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=Bi(`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)(Xu,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rA(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=Bi(`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)(Ku,{children:(0,Z.jsx)(fs,{})})}),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)(Gu,{"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 iA(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=Bi(`-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)(qu,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var aA=[`.md`,`.mdx`],oA=`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`,sA=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,cA=Bi(sA,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),lA=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,uA=`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 focus-visible:opacity-100`;function dA(e){return Bi(uA,e?`opacity-100`:`pointer-events-none opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`)}function fA(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function pA(e){let t=xi(e);window.location.hash!==t&&(window.location.hash=t)}function mA(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function hA(e,t){let n=[t,...aA].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 gA(e){let t=(0,$.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({tabId:o,disabled:n,ref:r,style:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]!==n||t[7]!==o?(s={id:o,disabled:n},t[6]=n,t[7]=o,t[8]=s):s=t[8];let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=Ta(s),m;t[9]===d?m=t[10]:(m=no.Transform.toString(d),t[9]=d,t[10]=m);let h=p?.5:i?.opacity,g=p?1:i?.zIndex,_;t[11]!==i||t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==f?(_={...i,transform:m,transition:f,opacity:h,zIndex:g},t[11]=i,t[12]=m,t[13]=h,t[14]=g,t[15]=f,t[16]=_):_=t[16];let v=_,y;t[17]!==r||t[18]!==u?(y=function(e){u(e),typeof r==`function`?r(e):r&&`current`in r&&(r.current=e)},t[17]=r,t[18]=u,t[19]=y):y=t[19];let b=y,x;return t[20]!==c||t[21]!==b||t[22]!==l||t[23]!==a||t[24]!==v?(x=(0,Z.jsx)(`div`,{ref:b,style:v,...a,...c,...l}),t[20]=c,t[21]=b,t[22]=l,t[23]=a,t[24]=v,t[25]=x):x=t[25],x}function _A(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=Gt(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=Gt(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(Zk,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(eA,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(eA,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(eA,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(iA,{}),(0,Z.jsx)(eA,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)($k,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(Xk,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function vA(e){let t=(0,$.c)(20),{accessibleLabel:n,closeTab:r,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=i();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)(al,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(qi,{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]!==r||t[14]!==o?(u=e=>{e.stopPropagation(),r(o)},t[13]=r,t[14]=o,t[15]=u):u=t[15];let d;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(is,{"aria-hidden":`true`}),t[16]=d):d=t[16];let f;return t[17]!==l||t[18]!==u?(f=(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:`mr-1.5`,onClick:u,children:d}),t[17]=l,t[18]=u,t[19]=f):f=t[19],f}function yA(e){let t=(0,$.c)(1),{docName:n}=e;if(oC(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Or,{"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 bA(){let e=(0,$.c)(69),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:b,pinnedTabIds:x,remapTabsForRename:S,reorderTabs:C,unpinTab:w,visibleTabIds:T}=ht(),{_:E}=i(),{pageMeta:D}=wi(),O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(null),H=(0,Q.useRef)(t),U;e[0]!==n||e[1]!==t||e[2]!==a?(U=n??(a?ce(a):t?Oe(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=U):U=e[3];let W=U,G;e[4]!==r||e[5]!==W||e[6]!==h||e[7]!==g||e[8]!==v?(G=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:W?`${W}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=W,e[6]=h,e[7]=g,e[8]=v,e[9]=G):G=e[9];let ee=G,K,te;e[10]===t?(K=e[11],te=e[12]):(K=()=>{H.current=t},te=[t],e[10]=t,e[11]=K,e[12]=te),(0,Q.useEffect)(K,te);let ne,q;e[13]===ee?(ne=e[14],q=e[15]):(ne=()=>{ee&&(O.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[ee],e[13]=ee,e[14]=ne,e[15]=q),(0,Q.useEffect)(ne,q);let re,ie;e[16]===k?(re=e[17],ie=e[18]):(re=()=>{k&&(R.current?.focus(),R.current?.select())},ie=[k],e[16]=k,e[17]=re,e[18]=ie),(0,Q.useEffect)(re,ie);let ae,oe;e[19]!==v||e[20]!==k?(ae=()=>{!k||v.includes(k.tabId)||(B.current=!0,V.current=null,A(null),M(``),F(null),L(!1))},oe=[v,k],e[19]=v,e[20]=k,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);B.current=!1,V.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),F(null)},le=function(){B.current=!0,V.current=null,A(null),M(``),F(null),L(!1)},ue=async function(){if(B.current){B.current=!1;return}if(z.current)return;let e=k?.docName;if(!e){le();return}let t=Fk(`file`,hA(j,D.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){le();return}if(t===V.current){R.current?.focus();return}if(!Ik(t)){F(E({id:`P8yDjG`})),R.current?.focus();return}let i=Lk({kind:`file`,path:e,name:r},t);z.current=!0,L(!0),F(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(B.current){L(!1),z.current=!1;return}let r=await Et(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),z.current=!1,V.current=t,R.current?.focus();return}let a=P(Kr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=H.current,s=Hk(o,a);qt(a);let c=!0;try{let e=Uk(a,p(),m);await Promise.all(e.map(e=>l(e))),S(a),Pi([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),X.error(E({id:`MUBR8r`}))}B.current=!0,A(null),M(``),F(null),L(!1),z.current=!1,V.current=null,c&&s&&s!==o&&pA(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(E({id:`HIb0vl`})),L(!1),z.current=!1,V.current=t,R.current?.focus()}},de=typeof window<`u`&&window.okDesktop!=null,pe;e[23]===g?pe=e[24]:(pe=new Set(g),e[23]=g,e[24]=pe);let me=pe,he;e[25]!==u||e[26]!==f||e[27]!==me?(he=function(e){let t=[],n=[];for(let r of e)me.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[25]=u,e[26]=f,e[27]=me,e[28]=he):he=e[28];let ge=he,_e;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(_e={activationConstraint:{distance:8}},e[29]=_e):_e=e[29];let ve;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(ve={coordinateGetter:Qa},e[30]=ve):ve=e[30];let ye=io(ka(ja,_e),ka(Ca,ve)),be;e[31]!==C||e[32]!==T?(be=function(e){let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=T.indexOf(t),i=T.indexOf(n);r<0||i<0||r===i||C(Zo([...T],r,i),t)},e[31]=C,e[32]=T,e[33]=be):be=e[33];let xe=be,Se=de?``:void 0,Ce;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=Bi(`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]`,de&&`[-webkit-app-region:drag]`),e[34]=Ce):Ce=e[34];let we=mA,Te;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Te=Bi(`flex items-end gap-1`,de&&`[-webkit-app-region:no-drag]`),e[35]=Te):Te=e[35];let Ee=eo,De=Io,ke;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(ke={container:typeof document<`u`?document.body:void 0},e[36]=ke):ke=e[36];let Ae=Ga,je;e[37]===T?je=e[38]:(je=[...T],e[37]=T,e[38]=je);let Me=ma,Ne=T.map(e=>{if(me.has(e)){let t=e===r;return(0,Z.jsx)(_A,{tabId:e,canPin:!1,openTabs:T,closeTab:u,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(gA,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Bi(oA,t?sA:cA),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:lA,onClick:()=>c(e),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:dA(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(is,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=Fe(e),n=e===W,i=x.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=y(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(_A,{tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(gA,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Bi(oA,n?sA:cA),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:lA,onClick:()=>{o(e)},children:[s&&(0,Z.jsx)(`span`,{className:Bi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Bi(`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)(vA,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=y(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(_A,{tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(gA,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Bi(oA,n?sA:cA),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:lA,onClick:()=>{o(e)},children:[s?(0,Z.jsx)(`span`,{className:Bi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Bi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(vA,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})},e)}let a=t.docName,l=D.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=y(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=k?.tabId===e,S=`editor-tab-rename-error-${fA(a)}`;return(0,Z.jsx)(_A,{disabled:v,tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsx)(gA,{tabId:e,disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Bi(oA,n?sA:cA,v&&N&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(TS,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(AS,{ref:R,value:j,disabled:I,"aria-label":E({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?S:void 0,"aria-busy":I||void 0,title:N??a,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{M(hA(e.target.value,l)),F(null),V.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ue()):e.key===`Escape`&&(e.preventDefault(),le())},onBlur:ue}),(0,Z.jsx)(DS,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(kS,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),N?(0,Z.jsx)(`span`,{id:S,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:lA,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,a)},children:[(0,Z.jsx)(yA,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(vA,{accessibleLabel:g,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})})},e)}),Pe;e[39]!==Ae||e[40]!==je||e[41]!==Me||e[42]!==Ne?(Pe=(0,Z.jsx)(Ae,{items:je,strategy:Me,children:Ne}),e[39]=Ae,e[40]=je,e[41]=Me,e[42]=Ne,e[43]=Pe):Pe=e[43];let Ie;e[44]!==Ee||e[45]!==xe||e[46]!==ye||e[47]!==De||e[48]!==ke||e[49]!==Pe?(Ie=(0,Z.jsx)(Ee,{sensors:ye,collisionDetection:De,onDragEnd:xe,accessibility:ke,children:Pe}),e[44]=Ee,e[45]=xe,e[46]=ye,e[47]=De,e[48]=ke,e[49]=Pe,e[50]=Ie):Ie=e[50];let Le;e[51]===E?Le=e[52]:(Le=E({id:`3YvS-c`}),e[51]=E,e[52]=Le);let Re;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(fe,{"aria-hidden":`true`}),e[53]=Re):Re=e[53];let ze;e[54]!==_||e[55]!==Le?(ze=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Le,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Re})}),e[54]=_,e[55]=Le,e[56]=ze):ze=e[56];let Be;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[57]=Be):Be=e[57];let Ve;e[58]===ze?Ve=e[59]:(Ve=(0,Z.jsxs)(ri,{children:[ze,Be]}),e[58]=ze,e[59]=Ve);let He;e[60]!==Te||e[61]!==Ie||e[62]!==Ve?(He=(0,Z.jsxs)(`div`,{className:Te,children:[Ie,Ve]}),e[60]=Te,e[61]=Ie,e[62]=Ve,e[63]=He):He=e[63];let Ue;return e[64]!==Se||e[65]!==Ce||e[66]!==we||e[67]!==He?(Ue=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":Se,className:Ce,onWheel:we,children:He}),e[64]=Se,e[65]=Ce,e[66]=we,e[67]=He,e[68]=Ue):Ue=e[68],Ue}function xA(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 SA(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 CA=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Zt},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:Ad},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Xn},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:xA},{label:`Twitter`,href:`https://x.com/inkeep`,icon:SA}],wA=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(pt,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(H,{asChild:!0,children:(0,Z.jsxs)(qi,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(ri,{children:[o,(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=CA.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>so(e,r),onAuxClick:e=>so(e,r),className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-4 shrink-0`}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let m;e[10]!==u||e[11]!==f?(m=(0,Z.jsxs)(B,{align:`end`,className:`w-64 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=m):m=e[12];let h;return e[13]!==n||e[14]!==m?(h=(0,Z.jsxs)(p,{open:n,onOpenChange:r,children:[c,m]}),e[13]=n,e[14]=m,e[15]=h):h=e[15],h};function TA(e){let t=(0,$.c)(63),{input:n}=e,{_:r}=i(),{states:a,refresh:o}=Cg(),{dispatch:c}=fg(),{merged:l}=vt(),u=l?.appearance?.preview?.autoOpen??!0,[d,f]=(0,Q.useState)(!1);if(_h())return null;let p=typeof window<`u`&&window.okDesktop!=null,m;t[0]===o?m=t[1]:(m=e=>{f(e),e&&o()},t[0]=o,t[1]=m);let h=m,g=n===null,_;t[2]!==u||t[3]!==n?(_=n!==null&&n.docContext!==null?dr(n.docContext.relativePath,u):``,t[2]=u,t[3]=n,t[4]=_):_=t[4];let v=_,y;t[5]!==c||t[6]!==n?(y=e=>{n!==null&&c(e.id,n)},t[5]=c,t[6]=n,t[7]=y):y=t[7];let b=y,x,S,C,w,T,E,D,O,k,A,j,M;if(t[8]!==h||t[9]!==b||t[10]!==n||t[11]!==d||t[12]!==v||t[13]!==a||t[14]!==g){let e;t[27]===a?e=t[28]:(e=e=>a[e.id]?.installed===!0,t[27]=a,t[28]=e);let r=bh.filter(e);C=a[`claude-code`]?.installed===!0;let i;t[29]!==n||t[30]!==v?(i=()=>{n!==null&&zb(v)},t[29]=n,t[30]=v,t[31]=i):i=t[31],w=i,S=oo,M=d,T=h;let o,c;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(aa,{className:`size-3.5`}),c=(0,Z.jsx)(s,{id:`xWEvuo`}),t[32]=o,t[33]=c):(o=t[32],c=t[33]);let l;t[34]===g?l=t[35]:(l=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsxs)(qi,{variant:`ghost`,size:`sm`,disabled:g,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,children:[o,c]})})}),t[34]=g,t[35]=l);let u;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`xWEvuo`})}),t[36]=u):u=t[36],t[37]===l?E=t[38]:(E=(0,Z.jsxs)(ri,{children:[l,u]}),t[37]=l,t[38]=E),x=ua,D=`end`,O=`min-w-[220px]`,k=`open-in-agent-menu`,t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Uo,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`O7_W_a`})}),t[39]=A):A=t[39];let f;t[40]!==b||t[41]!==v||t[42]!==a?(f=e=>{let t=a[e.id];return(0,Z.jsx)(Bb,{target:e,installState:t,isElectronHost:p,prompt:v,onSelect:()=>b(e)},e.id)},t[40]=b,t[41]=v,t[42]=a,t[43]=f):f=t[43],j=r.map(f),t[8]=h,t[9]=b,t[10]=n,t[11]=d,t[12]=v,t[13]=a,t[14]=g,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E,t[21]=D,t[22]=O,t[23]=k,t[24]=A,t[25]=j,t[26]=M}else x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20],D=t[21],O=t[22],k=t[23],A=t[24],j=t[25],M=t[26];let N;t[44]!==r||t[45]!==C||t[46]!==w||t[47]!==n?(N=C?null:(0,Z.jsxs)(go,{onSelect:w,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":r({id:`aA51jP`}),children:[(0,Z.jsx)(ut,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}),t[44]=r,t[45]=C,t[46]=w,t[47]=n,t[48]=N):N=t[48];let P;t[49]!==x||t[50]!==N||t[51]!==D||t[52]!==O||t[53]!==k||t[54]!==A||t[55]!==j?(P=(0,Z.jsxs)(x,{align:D,className:O,"data-testid":k,children:[A,j,N]}),t[49]=x,t[50]=N,t[51]=D,t[52]=O,t[53]=k,t[54]=A,t[55]=j,t[56]=P):P=t[56];let F;return t[57]!==S||t[58]!==T||t[59]!==E||t[60]!==P||t[61]!==M?(F=(0,Z.jsxs)(S,{open:M,onOpenChange:T,children:[E,P]}),t[57]=S,t[58]=T,t[59]=E,t[60]=P,t[61]=M,t[62]=F):F=t[62],F}var EA=50,DA=()=>{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,uS.preload()},EA))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=xh)},u=(0,Z.jsx)(fl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsxs)(qi,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(ri,{children:[d,(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function OA(e){let t=(0,$.c)(32),{onClickWhenNoRemote:n}=e,{_:r}=i(),{activeDocName:a}=ht(),{status:o}=_o(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),m,h;if(t[0]===u?(m=t[1],h=t[2]):(m=()=>{!u||!f.current||(f.current.focus(),f.current.select())},h=[u],t[0]=u,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h),!a)return null;let g=o?.hasRemote===!0,_;t[3]!==r||t[4]!==a||t[5]!==c||t[6]!==g||t[7]!==n?(_=async function(){if(!c&&a){l(!0),d(null);try{let e=await fo({docName:a,hasRemote:g,onClickWhenNoRemote:n},{clipboardWrite:Jo,toastSuccess:NA,toastError:MA,logEvent:jA});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{X.error(r({id:`u3YnKw`}))}l(!1)}},t[3]=r,t[4]=a,t[5]=c,t[6]=g,t[7]=n,t[8]=_):_=t[8];let v=_,y=u!==null,b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||d(null)},t[9]=b):b=t[9];let x;t[10]===r?x=t[11]:(x=r({id:`F4IYWe`}),t[10]=r,t[11]=x);let S,C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(pl,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[12]=S,t[13]=C):(S=t[12],C=t[13]);let w;t[14]!==c||t[15]!==v||t[16]!==x?(w=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(it,{asChild:!0,children:(0,Z.jsxs)(qi,{variant:`ghost`,size:`sm`,"aria-label":x,onClick:v,disabled:c,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})})}),t[14]=c,t[15]=v,t[16]=x,t[17]=w):w=t[17];let T;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`Z8lGw6`})}),t[18]=T):T=t[18];let E;t[19]===w?E=t[20]:(E=(0,Z.jsxs)(ri,{children:[w,T]}),t[19]=w,t[20]=E);let D;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[21]=D):D=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[22]=O):O=t[22];let k=u??``,A;t[23]===r?A=t[24]:(A=r({id:`5-FeN2`}),t[23]=r,t[24]=A);let j;t[25]!==k||t[26]!==A?(j=(0,Z.jsxs)(B,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[D,O,(0,Z.jsx)(ms,{ref:f,readOnly:!0,value:k,onFocus:AA,onClick:kA,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":A})]}),t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;return t[28]!==E||t[29]!==j||t[30]!==y?(M=(0,Z.jsxs)(p,{open:y,onOpenChange:b,children:[E,j]}),t[28]=E,t[29]=j,t[30]=y,t[31]=M):M=t[31],M}function kA(e){return e.currentTarget.select()}function AA(e){return e.currentTarget.select()}function jA(e){return console.log(e)}function MA(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function NA(e){return X.success(e)}function PA(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a}=e,{_:o}=i(),{activeDocName:c,activeTarget:l}=ht(),{state:u}=OO(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=_a(`toggle-files-sidebar`),t[0]=d):d=t[0];let f=d,p=_a(`command-palette`),m=Fo(),[h,g]=(0,Q.useState)(!1),_;bb0:{if(l===null){let e;t[1]===m?e=t[2]:(e=$h({workspace:m}),t[1]=m,t[2]=e),_=e;break bb0}if(l.kind===`folder`){if(!m){_=null;break bb0}let e;t[3]!==l.folderPath||t[4]!==m?(e=eg({folderRelativePath:l.folderPath,workspace:m}),t[3]=l.folderPath,t[4]=m,t[5]=e):e=t[5],_=e;break bb0}let e;t[6]!==c||t[7]!==m?(e=Qh({docName:c,workspace:m}),t[6]=c,t[7]=m,t[8]=e):e=t[8],_=e}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=u===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[78px]`,C;t[9]===S?C=t[10]:(C=Bi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,y&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[9]=S,t[10]=C);let w;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(NO,{className:Bi(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),t[11]=w):w=t[11];let T;t[12]===u?T=t[13]:(T=(0,Z.jsxs)(ri,{children:[w,(0,Z.jsx)(sr,{children:u===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:f}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:f}})})]}),t[12]=u,t[13]=T);let E=b&&a&&(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":o({id:`IN4UX8`,values:{searchShortcut:p}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Bi(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(he,{"aria-hidden":`true`})})}),(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:p}})})]}),D,O;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Xo,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),O=(0,Z.jsx)(bA,{}),t[14]=D,t[15]=O):(D=t[14],O=t[15]);let k;t[16]!==T||t[17]!==E?(k=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[T,E,D,O]}),t[16]=T,t[17]=E,t[18]=k):k=t[18];let A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(A=Bi(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[19]=A):A=t[19];let j;t[20]===v?j=t[21]:(j=(0,Z.jsx)(TA,{input:v}),t[20]=v,t[21]=j);let M;t[22]===g?M=t[23]:(M=(0,Z.jsx)(OA,{onClickWhenNoRemote:()=>g(!0)}),t[22]=g,t[23]=M);let N;t[24]!==h||t[25]!==g?(N=(0,Z.jsx)(Yo,{open:h,onOpenChange:g}),t[24]=h,t[25]=g,t[26]=N):N=t[26];let P;t[27]!==r||t[28]!==n?(P=(0,Z.jsx)(Do,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=P):P=t[29];let F,I,L,R,z;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(lk,{}),I=(0,Z.jsx)(Xo,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),L=(0,Z.jsx)($u,{}),R=(0,Z.jsx)(DA,{}),z=(0,Z.jsx)(wA,{}),t[30]=F,t[31]=I,t[32]=L,t[33]=R,t[34]=z):(F=t[30],I=t[31],L=t[32],R=t[33],z=t[34]);let B;t[35]!==j||t[36]!==M||t[37]!==N||t[38]!==P?(B=(0,Z.jsxs)(`div`,{className:A,children:[j,M,N,P,F,I,L,R,z]}),t[35]=j,t[36]=M,t[37]=N,t[38]=P,t[39]=B):B=t[39];let V;return t[40]!==k||t[41]!==B||t[42]!==x||t[43]!==C?(V=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:C,children:[k,B]}),t[40]=k,t[41]=B,t[42]=x,t[43]=C,t[44]=V):V=t[44],V}function FA(e){let t=(0,$.c)(38),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,{_:a}=i(),[o,s]=e_(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(xv[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),b=mo(),{projectLocalConfig:x,projectLocalSynced:S}=vt(),{activeDocName:C}=ht(),w=b?.hasRemote,T=b?.pushPermission?.checkStatus,E;t[2]!==v||t[3]!==x||t[4]!==S||t[5]!==w||t[6]!==T?(E=i_({autoSyncOnboardingDismissed:v,hasRemote:w,projectLocalSynced:S,projectLocalConfig:x,pushPermissionCheckStatus:T}),t[2]=v,t[3]=x,t[4]=S,t[5]=w,t[6]=T,t[7]=E):E=t[7];let D=E,O,k;t[8]===C?(O=t[9],k=t[10]):(O=()=>{let e=function(e){let t=e.detail;t&&C&&Xs(C,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(Kg,e),()=>window.removeEventListener(Kg,e)},k=[C],t[8]=C,t[9]=O,t[10]=k),(0,Q.useEffect)(O,k),t_(b?.pausedReason);let A;t[11]===s?A=t[12]:(A=function(e){l(e),s(e)},t[11]=s,t[12]=A);let j=A,M;t[13]===a?M=t[14]:(M=async function(){_(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?X.success(a({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),X.error(a({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),X.error(a({id:`q7zsRM`}))}_(!1)},t[13]=a,t[14]=M);let N=M,P,F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{p(`auth`),d(!0)},P=()=>{p(`identity`),d(!0)},t[15]=P,t[16]=F):(P=t[15],F=t[16]);let I;t[17]===r?I=t[18]:(I=(0,Z.jsx)(PA,{onSignIn:F,onSetIdentity:P,onOpenSearch:r}),t[17]=r,t[18]=I);let L;t[19]!==m||t[20]!==c||t[21]!==j||t[22]!==N||t[23]!==g?(L=(0,Z.jsx)(sO,{editorMode:c,onModeChange:j,activeTab:m,onActiveTabChange:h,onSaveVersion:N,saving:g}),t[19]=m,t[20]=c,t[21]=j,t[22]=N,t[23]=g,t[24]=L):L=t[24];let R=f===`identity`,z;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{d(!1)},t[25]=z):z=t[25];let B;t[26]!==u||t[27]!==R?(B=(0,Z.jsx)(Ra,{open:u,onOpenChange:d,identityPrompt:R,onSuccess:z}),t[26]=u,t[27]=R,t[28]=B):B=t[28];let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>y(!0),t[29]=V):V=t[29];let H;t[30]===D?H=t[31]:(H=(0,Z.jsx)(n_,{open:D,onResolved:V}),t[30]=D,t[31]=H);let U;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Ug,{}),t[32]=U):U=t[32];let W;return t[33]!==I||t[34]!==L||t[35]!==B||t[36]!==H?(W=(0,Z.jsxs)(Z.Fragment,{children:[I,L,B,H,U]}),t[33]=I,t[34]=L,t[35]=B,t[36]=H,t[37]=W):W=t[37],W}function IA(e){let t=xi(Br(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function LA(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=qa();if(n)return null;if(r!==null){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)(Or,{"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)(Or,{"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(RA),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 RA(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(qi,{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:()=>IA(e.file),children:[(0,Z.jsx)(Or,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var zA=`<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;Ms(t,{style:t=>qs(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 IE.set(t.changes,i),i}function zE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(GT).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(FE);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=ks.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:PE.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function BE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(GT).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(FE).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 VE(e){let t=new Fs;for(let n of e.field(GT)){let r=e.facet(HT).overrideChunk&&WE(e,n);t.add(n.fromB,n.fromB,RE(e,n,!!r))}return t.finish()}var HE=js.define({create:e=>VE(e),update(e,t){return t.state.field(GT,!1)==t.startState.field(GT,!1)?e:VE(t.state)},provide:e=>Bs.decorations.from(e)}),UE=new WeakMap;function WE(e,t){let n=UE.get(t);if(n!==void 0)return n;n=null;let r=e.field(FE),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(Ps.widget({widget:new GE(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(sE.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return UE.set(t,n),n}var GE=class extends Ds{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}},KE=new class extends Vs{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},qE=Ps.line({class:`cm-inlineChangedLine`});function JE(e,t,n,r){let i=WE(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,KE),n.add(o.from,o.from,qE);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 YE=$t({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),XE=ie({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),ZE=Bs.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 QE({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 $E(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Jn(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?YE:XE,u=[Bs.editable.of(!1),As.readOnly.of(!0)],d=[Qs,de(),...u,l,Bs.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new Bs({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=QE({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new Bs({doc:p,extensions:[Qs,de(),Bs.editable.of(!1),l,ZE,Bs.lineWrapping,NE({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),Bs.updateListener.of(e=>{let t=KT(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=KT(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new kE({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new Bs({doc:p,extensions:[...d,NE({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof Bs)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof Bs)||M(e)},t[13]=A):A=t[13];let j=A,N=b===0,P;t[14]!==f||t[15]!==b?(P=b===null?``:b===0?f({id:`lPzyrU`}):Y._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=P):P=t[16];let F=P,I;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=I):I=t[17];let L;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,vc.createPortal)((0,Z.jsx)(qi,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),L=C.map(e),t[18]=f,t[19]=C,t[20]=L}else L=t[20];let R;t[23]!==N||t[24]!==o||t[25]!==F||t[26]!==d||t[27]!==u?(R=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${N?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:F}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(qi,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(qi,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(qi,{variant:`default`,size:`sm`,disabled:!N,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=N,t[24]=o,t[25]=F,t[26]=d,t[27]=u,t[28]=R):R=t[28];let z;return t[29]!==R||t[30]!==L?(z=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[I,L,R]}),t[29]=R,t[30]=L,t[31]=z):z=t[31],z}async function eD(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 tD(e,t){return eD(e,`content`,t)}async function nD(e){return eD(e,`mine`)}async function rD(e){return eD(e,`theirs`)}async function iD(e){return eD(e,`delete`)}async function aD(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 oD(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=qa(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Br(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),aD(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await tD(u,e);t.ok||X.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),X.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)($E,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(iD),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(qi,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(rD),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(qi,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)($E,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(nD),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(qi,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(iD),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(qi,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)($E,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function sD(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(zt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var cD=`__back-nav__`;function lD(e){return e instanceof Ie||e instanceof yt||e instanceof ke||e instanceof $e||e instanceof jt||e instanceof at?e.docName:null}function uD(e){if(e instanceof Ie){let t=e.docName;return{title:Y._({id:`Jejur6`}),summary:Y._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof yt){let t=e.docName;return{title:Y._({id:`V7QxyT`}),summary:Y._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof ke){let t=e.docName;return{title:Y._({id:`1di5fu`}),summary:Y._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof $e){let t=e.docName;return{title:Y._({id:`wvbc1r`}),summary:Y._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:Y._({id:`Gfr4fu`}),summary:Y._({id:`j6LB7S`})};if(e instanceof at){let t=e.docName;return{title:Y._({id:`vv7kpg`}),summary:Y._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Y._({id:`W5A0Ly`});return{title:Y._({id:`29VNqC`}),summary:t}}function dD(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=uD(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(mx,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(qi,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(qi,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(lD(n)??i),o(a),r(cD))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function fD(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)(dD,{...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]===cD){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}: ${uD(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)(W,{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 pD(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=er(t);return{map:n,keys:Kn(t),parseError:r}}function mD(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>pD(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=Fi(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Ze(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ft(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(hD,{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)(gD,{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 hD(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 gD(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function _D(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=er(t);return{map:n,keys:Kn(t),parseError:r}}function vD(e){let t=(0,$.c)(199),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>_D(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Fi(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]===j?M=t[9]:(M=wD(j),t[8]=j,t[9]=M);let N=M,P;t[10]===j?P=t[11]:(P=SD(j),t[10]=j,t[11]=P);let F=To(N?null:P),I;t[12]!==F||t[13]!==N?(I=!N&&F.state.status===`ready`?F.state.data.folder.frontmatter_defaults??{}:{},t[12]=F,t[13]=N,t[14]=I):I=t[14];let L=I,R;t[15]!==F||t[16]!==N?(R=!N&&F.state.status===`ready`?F.state.data.frontmatterSources:{},t[15]=F,t[16]=N,t[17]=R):R=t[17];let z=R,B;t[18]!==F||t[19]!==N?(B=!N&&F.state.status===`ready`?F.state.data.schemaDeclarations:{},t[18]=F,t[19]=N,t[20]=B):B=t[20];let V=B,H;t[21]!==F||t[22]!==N?(H=!N&&F.state.status===`ready`?F.state.data.schemaSources:{},t[21]=F,t[22]=N,t[23]=H):H=t[23];let U=H,W;t[24]!==r||t[25]!==a?(W=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=ar(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[24]=r,t[25]=a,t[26]=W):W=t[26];let G=W,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[27]=ee):ee=t[27];let K=ee,te;t[28]===r?te=t[29]:(te=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[28]=r,t[29]=te);let ne=te,q;t[30]!==G||t[31]!==ne?(q=function(e,t){K(e),ne(G({[e]:t}),[e])},t[30]=G,t[31]=ne,t[32]=q):q=t[32];let re=q,ie;t[33]!==G||t[34]!==ne?(ie=function(e){K(e),ne(G({[e]:null}),[e])},t[33]=G,t[34]=ne,t[35]=ie):ie=t[35];let ae=ie,oe;t[36]!==r||t[37]!==a?(oe=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=ar(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[36]=r,t[37]=a,t[38]=oe):oe=t[38];let se=oe,ce;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(ce=function(e,t){return`${e} ${t}`},t[39]=ce):ce=t[39];let le=ce,ue;t[40]!==a||t[41]!==m?(ue=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>le(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[40]=a,t[41]=m,t[42]=ue):ue=t[42];let de=ue,pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe={activationConstraint:{distance:4}},t[43]=pe):pe=t[43];let me;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(me={coordinateGetter:Qa},t[44]=me):me=t[44];let he=io(ka(ja,pe),ka(Ca,me)),ge;t[45]!==L||t[46]!==re||t[47]!==p?(ge=function(e,t){let n=p[e]??TD(L[e]);if(n===void 0)return;b(n=>({...n,[e]:t}));let r=Da(n,t);(!Object.hasOwn(p,e)||!xD(n,r))&&re(e,r)},t[45]=L,t[46]=re,t[47]=p,t[48]=ge):ge=t[48];let _e=ge,ve;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[49]=ve):ve=t[49];let ye=ve,{addPropertySignal:be,clearAddProperty:xe}=cS(),Se;t[50]!==be||t[51]!==j?(Se=be.get(j)??0,t[50]=be,t[51]=j,t[52]=Se):Se=t[52];let Ce=Se,we,Te;t[53]===Ce?(we=t[54],Te=t[55]):(we=()=>{Ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},Te=[Ce],t[53]=Ce,t[54]=we,t[55]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[56]!==xe||t[57]!==j?(Ee=()=>()=>xe(j),De=[j,xe],t[56]=xe,t[57]=j,t[58]=Ee,t[59]=De):(Ee=t[58],De=t[59]),(0,Q.useEffect)(Ee,De);let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):xa[e];return{...t,type:e,value:n,error:null}})},t[60]=Oe):Oe=t[60];let ke=Oe,Ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=function(e){S(t=>t&&{...t,value:e})},t[61]=Ae):Ae=t[61];let je=Ae,Me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Me=function(e){S(t=>t&&{...t,name:e,error:null})},t[62]=Me):Me=t[62];let Ne=Me,Pe;t[63]!==r||t[64]!==x||t[65]!==G||t[66]!==p?(Pe=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=G({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[63]=r,t[64]=x,t[65]=G,t[66]=p,t[67]=Pe):Pe=t[67];let Fe=Pe,Ie;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=function(){S(null)},t[68]=Ie):Ie=t[68];let Le=Ie,Re;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(e){w({key:e,draft:e,error:null})},t[69]=Re):Re=t[69];let ze=Re,Be;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Be=function(e){w(t=>t&&{...t,draft:e,error:null})},t[70]=Be):Be=t[70];let Ve=Be,He;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(He=function(){w(null)},t[71]=He):He=t[71];let Ue=He,We;t[72]!==r||t[73]!==p||t[74]!==se||t[75]!==C?(We=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=se(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),K(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[72]=r,t[73]=p,t[74]=se,t[75]=C,t[76]=We):We=t[76];let Ge=We,Ke;t[77]!==p||t[78]!==m?(Ke=m.length>0?m:Object.keys(p),t[77]=p,t[78]=m,t[79]=Ke):Ke=t[79];let qe=Ke,Je;if(t[80]!==qe){Je=new Map;for(let e of qe)Je.set(e,(Je.get(e)??0)+1);t[80]=qe,t[81]=Je}else Je=t[81];let Ye,J,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot;if(t[82]!==x||t[83]!==L||t[84]!==z||t[85]!==g||t[86]!==re||t[87]!==Ge||t[88]!==Je||t[89]!==E||t[90]!==de||t[91]!==p||t[92]!==y||t[93]!==h||t[94]!==ae||t[95]!==C||t[96]!==qe||t[97]!==k||t[98]!==V||t[99]!==U||t[100]!==he||t[101]!==_e){ot=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(L).filter(e=>!Object.hasOwn(p,e)).sort(),n=Object.keys(V).filter(e=>!Object.hasOwn(p,e)&&!Object.hasOwn(L,e)).sort();if(qe.length===0&&e.length===0&&n.length===0&&!x&&!h){ot=null;break bb0}it=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,at=`property-panel`,J=_s,tt=!g,t[115]===Symbol.for(`react.memo_cache_sentinel`)?(nt=e=>_(!e),t[115]=nt):nt=t[115];let r=!g,i;t[116]===r?i=t[117]:(i=(0,Z.jsx)(ps,{"data-expanded":r,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[116]=r,t[117]=i);let a;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[118]=a):a=t[118],t[119]===i?rt=t[120]:(rt=(0,Z.jsx)(gs,{asChild:!0,children:(0,Z.jsxs)(qi,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[i,a]})}),t[119]=i,t[120]=rt),Ye=hs,Xe=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[121]===h?Ze=t[122]:(Ze=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Or,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[121]=h,t[122]=Ze);let o;if(t[123]!==qe){let e;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>le(e,t),t[125]=e):e=t[125],o=qe.map(e),t[123]=qe,t[124]=o}else o=t[124];let c;if(t[126]!==re||t[127]!==Ge||t[128]!==Je||t[129]!==E||t[130]!==p||t[131]!==y||t[132]!==ae||t[133]!==C||t[134]!==qe||t[135]!==k||t[136]!==_e){let e;t[138]!==re||t[139]!==Ge||t[140]!==Je||t[141]!==E||t[142]!==p||t[143]!==y||t[144]!==ae||t[145]!==C||t[146]!==k||t[147]!==_e?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??gi(n),i=C?.key===e?C:null,a=(Je.get(e)??0)>1;return(0,Z.jsx)(La,{sortableId:le(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>ze(e),onChangeDraft:Ve,onCommit:Ge,onCancel:Ue},onCommit:t=>re(e,t),onChangeType:t=>_e(e,t),onRemove:()=>ae(e)},`${e}-${t}`)},t[138]=re,t[139]=Ge,t[140]=Je,t[141]=E,t[142]=p,t[143]=y,t[144]=ae,t[145]=C,t[146]=k,t[147]=_e,t[148]=e):e=t[148],c=qe.map(e),t[126]=re,t[127]=Ge,t[128]=Je,t[129]=E,t[130]=p,t[131]=y,t[132]=ae,t[133]=C,t[134]=qe,t[135]=k,t[136]=_e,t[137]=c}else c=t[137];let l;t[149]!==o||t[150]!==c?(l=(0,Z.jsx)(Ga,{items:o,strategy:Xa,children:c}),t[149]=o,t[150]=c,t[151]=l):l=t[151],t[152]!==de||t[153]!==he||t[154]!==l?(Qe=(0,Z.jsx)(eo,{sensors:he,collisionDetection:Io,onDragEnd:de,children:l}),t[152]=de,t[153]=he,t[154]=l,t[155]=Qe):Qe=t[155];let u;t[156]!==L||t[157]!==z||t[158]!==re||t[159]!==E||t[160]!==k||t[161]!==_e?(u=e=>{let t=L[e],n=TD(t),r=gi(n),i=z[e]??``;return(0,Z.jsx)(La,{keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isInherited:!0,badge:(0,Z.jsx)(Va,{source:i}),onCommit:t=>re(e,t),onChangeType:t=>_e(e,t)},`inherited-${e}`)},t[156]=L,t[157]=z,t[158]=re,t[159]=E,t[160]=k,t[161]=_e,t[162]=u):u=t[162],$e=e.map(u);let d;t[163]!==re||t[164]!==E||t[165]!==k||t[166]!==V||t[167]!==U?(d=e=>{let t=V[e].type,n=U[e]??``;return(0,Z.jsx)(La,{keyName:e,value:t===`date`?``:xa[t],declared:t,error:E[e]??null,resetCounter:k[e]??0,badge:(0,Z.jsx)(Fa,{source:n}),onCommit:t=>re(e,t),onChangeType:bD,typeReadOnly:!0},`declared-${e}`)},t[163]=re,t[164]=E,t[165]=k,t[166]=V,t[167]=U,t[168]=d):d=t[168],et=n.map(d)}t[82]=x,t[83]=L,t[84]=z,t[85]=g,t[86]=re,t[87]=Ge,t[88]=Je,t[89]=E,t[90]=de,t[91]=p,t[92]=y,t[93]=h,t[94]=ae,t[95]=C,t[96]=qe,t[97]=k,t[98]=V,t[99]=U,t[100]=he,t[101]=_e,t[102]=Ye,t[103]=J,t[104]=Xe,t[105]=Ze,t[106]=Qe,t[107]=$e,t[108]=et,t[109]=tt,t[110]=nt,t[111]=rt,t[112]=it,t[113]=at,t[114]=ot}else Ye=t[102],J=t[103],Xe=t[104],Ze=t[105],Qe=t[106],$e=t[107],et=t[108],tt=t[109],nt=t[110],rt=t[111],it=t[112],at=t[113],ot=t[114];if(ot!==Symbol.for(`react.early_return_sentinel`))return ot;let st;t[169]!==L||t[170]!==re||t[171]!==E||t[172]!==p||t[173]!==k||t[174]!==V?(st=!Object.hasOwn(p,`tags`)&&!Object.hasOwn(L,`tags`)&&!Object.hasOwn(V,`tags`)?(0,Z.jsx)(La,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>re(`tags`,e),onChangeType:yD},`virtual-tags`):null,t[169]=L,t[170]=re,t[171]=E,t[172]=p,t[173]=k,t[174]=V,t[175]=st):st=t[175];let ct;t[176]!==r||t[177]!==x||t[178]!==Fe?(ct=x?(0,Z.jsx)(So,{draft:x,onChangeName:Ne,onChangeType:ke,onChangeValue:je,onCommit:Fe,onCancel:Le}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(qi,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ye,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(fe,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[176]=r,t[177]=x,t[178]=Fe,t[179]=ct):ct=t[179];let lt;t[180]!==Ye||t[181]!==Xe||t[182]!==Ze||t[183]!==Qe||t[184]!==$e||t[185]!==et||t[186]!==st||t[187]!==ct?(lt=(0,Z.jsxs)(Ye,{className:Xe,children:[Ze,Qe,$e,et,st,ct]}),t[180]=Ye,t[181]=Xe,t[182]=Ze,t[183]=Qe,t[184]=$e,t[185]=et,t[186]=st,t[187]=ct,t[188]=lt):lt=t[188];let ut;t[189]!==J||t[190]!==tt||t[191]!==nt||t[192]!==rt||t[193]!==lt?(ut=(0,Z.jsxs)(J,{open:tt,onOpenChange:nt,children:[rt,lt]}),t[189]=J,t[190]=tt,t[191]=nt,t[192]=rt,t[193]=lt,t[194]=ut):ut=t[194];let dt;return t[195]!==it||t[196]!==at||t[197]!==ut?(dt=(0,Z.jsx)(`div`,{className:it,"data-testid":at,children:ut}),t[195]=it,t[196]=at,t[197]=ut,t[198]=dt):dt=t[198],dt}function yD(){}function bD(){}function xD(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function SD(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var CD=/(^|\/)\.ok\/templates\//;function wD(e){return CD.test(e)}function TD(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}var ED=G(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function DD(e){let t=e.threshold??ED;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function OD(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var kD=G(`ACTIVITY_MOUNT_LIMIT`,3);function AD(){return n(()=>import(`./SourceEditor-SBPJy4qz.js`),__vite__mapDeps([46,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,47,24]),import.meta.url)}var jD=(0,Q.lazy)(async()=>({default:(await AD()).SourceEditor}));function MD(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ke(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 ND(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Y._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Y._({id:`Sc1bKE`,values:{docName:e}}):Y._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Y._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Y._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Y._({id:`bmC18N`,values:{docName:e}}):Y._({id:`pAgkuZ`,values:{docName:e}})}:null}function PD(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(x,{name:`activity-pool`,children:(0,Z.jsx)(FD,{...e})}),t[0]=e,t[1]=n),n}function FD(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}=wi(),f=MD(c,n,kD),p=(0,Q.useRef)(``),h=f.map(ID).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)j(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;oe(e,t&&t.length>0?t:crypto.randomUUID())}b(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,m(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)(HD,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let x=f.map(y),S;return t[13]===x?S=t[14]:(S=(0,Z.jsx)(Z.Fragment,{children:x}),t[13]=x,t[14]=S),S}function ID(e){return e.docName}function LD(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&&b(`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&&(b(`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&&b(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function RD(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)(jb,{}),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)(jD,{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 zD(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)(ko,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(F,{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)(qi,{type:`button`,onClick:BD,children:[(0,Z.jsx)(ko,{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 BD(){return window.location.reload()}function VD(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 HD(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=ND(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=oC(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==y?(S=()=>{i&&!_?v(!0):!i&&!y&&x(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=DD({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&b(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let k;t[19]===n.docName?k=t[20]:(k=()=>ct(n.docName),t[19]=n.docName,t[20]=k);let[A]=(0,Q.useState)(k),j=A?.html??null,[M,N]=(0,Q.useState)(!1),P,F;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==M||t[26]!==i||t[27]!==g?(P=()=>{OD({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(b(`ok/cold/first-toggle`,{docName:n.docName,mountId:z(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=M,t[26]=i,t[27]=g,t[28]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=A?.scrollTop,B;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==j?(B=f?(0,Z.jsx)(zD,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(fD,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(VD,{html:j}):(0,Z.jsx)(jb,{}),children:(0,Z.jsx)(sD,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(oD,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(mD,{provider:n.provider}),!i&&(0,Z.jsx)(vD,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(RD,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(aT,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=j,t[44]=B):B=t[44];let V;t[45]!==r||t[46]!==R||t[47]!==B?(V=(0,Z.jsx)(LD,{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 UD(e){let t=(0,$.c)(36),{stats:n}=e,{_:r}=i(),{words:a,chars:o,tokens:c}=n,l;t[0]===r?l=t[1]:(l=r({id:`L1ZE3M`}),t[0]=r,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(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[2]=u):u=t[2];let d;t[3]===n.words?d=t[4]:(d=n.words.toLocaleString(),t[3]=n.words,t[4]=d);let f;t[5]===d?f=t[6]:(f=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d}),t[5]=d,t[6]=f);let p;t[7]===a?p=t[8]:(p=(0,Z.jsx)(s,{id:`gljvbT`,values:{words:a}}),t[7]=a,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,` `,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.chars?h=t[13]:(h=n.chars.toLocaleString(),t[12]=n.chars,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:h}),t[14]=h,t[15]=g);let _;t[16]===o?_=t[17]:(_=(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:o}}),t[16]=o,t[17]=_);let v;t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`span`,{children:[g,` `,_]}),t[18]=g,t[19]=_,t[20]=v):v=t[20];let y=n.tokens>0?`~`:``,b;t[21]===n.tokens?b=t[22]:(b=n.tokens.toLocaleString(),t[21]=n.tokens,t[22]=b);let x;t[23]===b?x=t[24]:(x=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:b}),t[23]=b,t[24]=x);let S;t[25]===c?S=t[26]:(S=(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:c}}),t[25]=c,t[26]=S);let C;t[27]!==y||t[28]!==x||t[29]!==S?(C=(0,Z.jsxs)(`span`,{children:[y,x,` `,S]}),t[27]=y,t[28]=x,t[29]=S,t[30]=C):C=t[30];let w;return t[31]!==l||t[32]!==v||t[33]!==C||t[34]!==m?(w=(0,Z.jsxs)(`section`,{"aria-label":l,className:`relative flex h-6 shrink-0 items-center justify-end gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[u,m,v,C]}),t[31]=l,t[32]=v,t[33]=C,t[34]=m,t[35]=w):w=t[35],w}function WD(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=Bi(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function GD(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=Bi(`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 KD(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=Bi(`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 qD(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=Bi(`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 JD(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=Bi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(ps,{}),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 YD=1,XD=2,ZD=4;function QD(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=y(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>ZD?[...u.slice(0,YD).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(YD,-XD)},...u.slice(-XD).map((e,t)=>d(e,u.length-XD+t))]:u.map((e,t)=>d(e,t));a=WD,t[8]===r?c=t[9]:(c=Bi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=GD,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map($D)}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 $D(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(JD,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(KD,{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)(jc,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(KD,{className:`min-w-0`,children:(0,Z.jsx)(qD,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var eO={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`},tO=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`,...eO,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},nO=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)(tO,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},rO=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)(tO,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function iO(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=_a(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=Ya(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(QD,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(hr,{children:(0,Z.jsx)(rO,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(es,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(ri,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(nO,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(es,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(sr,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(ri,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(ns,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(qi,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(hr,{children:(0,Z.jsx)(qc,{})})}),(0,Z.jsx)(sr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=ri,h=qi,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)(hr,{children:u?(0,Z.jsx)(nl,{}):(0,Z.jsx)(tl,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(sr,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function aO(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var oO=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-Q1f1O1VR.js`),__vite__mapDeps([34,1,2,35,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,43]),import.meta.url)).ActivityModeContent}));function sO(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(lO,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(cO,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(x,{name:`editor-area`,children:(0,Z.jsxs)(oS,{children:[n,r]})}),t[3]=n,t[4]=i),i}function cO(){let e=(0,$.c)(5),t=Th(),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)(_S,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function lO(e){let t=(0,$.c)(143),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,onSaveVersion:c,saving:l}=e,{_:u}=i(),{activeDocName:d,activeProvider:f,activeTarget:p,recycleDocument:m,docPanelMode:h,docPanelAgentId:g,docPanelExpandSignal:_}=ht(),{openDocumentTransition:v}=Dt(),{requestAddProperty:y}=cS(),b=iC(f,d),x=EC(f),S=x===`connected`||x===`synced`,C=oC(d)===`conflict`,w=(0,Q.useDeferredValue)(d),T=p?.kind===`missing`,E=!!d&&p?.kind!==`folder`,D;t[0]!==u||t[1]!==T?(D=T?u({id:`K-a33w`}):void 0,t[0]=u,t[1]=T,t[2]=D):D=t[2];let O=D,[k]=(0,Q.useState)(dO),A=k!==null,j;t[3]===k?j=t[4]:(j=()=>hC(k,window.innerWidth,`right`),t[3]=k,t[4]=j);let[M,N]=(0,Q.useState)(j),P=(0,Q.useRef)(M),F,I;t[5]===M?(F=t[6],I=t[7]):(F=()=>{P.current=M},I=[M],t[5]=M,t[6]=F,t[7]=I),(0,Q.useEffect)(F,I);let L=yb(),R;t[8]===M?R=t[9]:(R=()=>wC(`right`,M,SC())===`collapsed`,t[8]=M,t[9]=R);let[z]=(0,Q.useState)(R),[B,V]=(0,Q.useState)(z),H=(0,Q.useRef)(B),W,G;t[10]===B?(W=t[11],G=t[12]):(W=()=>{H.current=B},G=[B],t[10]=B,t[11]=W,t[12]=G),(0,Q.useEffect)(W,G);let[ee,K]=(0,Q.useState)(!1),te=(0,Q.useRef)(!1),[ne]=(0,Q.useState)(uO),q=(0,Q.useRef)(ne),re=(0,Q.useRef)(null),ie;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e){re.current!=null&&clearTimeout(re.current),re.current=setTimeout(()=>{uC(e),re.current=null},100)},t[13]=ie):ie=t[13];let ae=ie,oe,se;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>()=>{re.current!=null&&clearTimeout(re.current)},oe=[],t[14]=oe,t[15]=se):(oe=t[14],se=t[15]),(0,Q.useEffect)(se,oe);let[ce,le]=(0,Q.useState)(null),ue;t[16]!==B||t[17]!==L?(ue=function(){if(L.current==null)return;let e=P.current;B?(TC(`right`,e,`open`),L.current?.expand()):(TC(`right`,e,`collapsed`),L.current?.collapse())},t[16]=B,t[17]=L,t[18]=ue):ue=t[18];let de=ue,fe,pe;t[19]!==k||t[20]!==L?(fe=()=>{let e=window.matchMedia(`(min-width: ${pC}px)`),t=()=>{let e=hC(k,window.innerWidth,`right`);N(e);let t=wC(`right`,e,SC())===`collapsed`;V(t),t?L.current?.collapse():L.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},pe=[k,L],t[19]=k,t[20]=L,t[21]=fe,t[22]=pe):(fe=t[21],pe=t[22]),(0,Q.useEffect)(fe,pe);let me,he;t[23]!==ce||t[24]!==A||t[25]!==L?(me=()=>{if(ce==null||A)return;let e=new ResizeObserver(()=>{H.current||te.current||L.current?.resize(`${q.current}px`)});return e.observe(ce),()=>e.disconnect()},he=[ce,A,L],t[23]=ce,t[24]=A,t[25]=L,t[26]=me,t[27]=he):(me=t[26],he=t[27]),(0,Q.useEffect)(me,he);let ge,_e;t[28]!==o||t[29]!==L?(ge=()=>{let e=e=>{o(e),L.current?.expand()},t=km();return t&&e(t),jm(t=>{km(),e(t)})},_e=[o,L],t[28]=o,t[29]=L,t[30]=ge,t[31]=_e):(ge=t[30],_e=t[31]),(0,Q.useEffect)(ge,_e);let ve,ye;t[32]!==_||t[33]!==L?(ve=()=>{_!==0&&L.current?.expand()},ye=[_,L],t[32]=_,t[33]=L,t[34]=ve,t[35]=ye):(ve=t[34],ye=t[35]),(0,Q.useEffect)(ve,ye);let be,xe;t[36]===B?(be=t[37],xe=t[38]):(be=()=>{if(!B||!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()},xe=[B],t[36]=B,t[37]=be,t[38]=xe),(0,Q.useLayoutEffect)(be,xe);let Se,Ce;t[39]===B?(Se=t[40],Ce=t[41]):(Se=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!B})},Ce=[B],t[39]=B,t[40]=Se,t[41]=Ce),(0,Q.useEffect)(Se,Ce);let we,Te;t[42]===de?(we=t[43],Te=t[44]):(we=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&de()})},Te=[de],t[42]=de,t[43]=we,t[44]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[45]===de?(Ee=t[46],De=t[47]):(Ee=()=>{if(window.okDesktop!=null)return;let e=e=>{Ba(e,`toggle-document-panel`)&&(e.preventDefault(),de())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},De=[de],t[45]=de,t[46]=Ee,t[47]=De),(0,Q.useEffect)(Ee,De);let Oe=(0,Q.useRef)(null),[ke,Ae]=(0,Q.useState)(null),je=p?.kind===`large-file`?p.docName:d,Me,Ne;t[48]===je?(Me=t[49],Ne=t[50]):(Me=()=>{if(je&&je!==Oe.current){let e=Oe.current;Oe.current=je,Ae(e)}},Ne=[je],t[48]=je,t[49]=Me,t[50]=Ne),(0,Q.useEffect)(Me,Ne);let Pe;t[51]===v?Pe=t[52]:(Pe=function(e){let t=xi(e);window.location.hash===t?v(e):window.location.hash=t},t[51]=v,t[52]=Pe);let Fe=Pe;if(p?.kind===`large-file`){let e;t[53]!==Fe||t[54]!==ke?(e=ke?{previousDocName:ke,onNavigateBack:Fe}:void 0,t[53]=Fe,t[54]=ke,t[55]=e):e=t[55];let n;return t[56]!==p.docName||t[57]!==p.limit||t[58]!==p.size||t[59]!==e?(n=(0,Z.jsx)(nS,{docName:p.docName,size:p.size,limit:p.limit,backNav:e}),t[56]=p.docName,t[57]=p.limit,t[58]=p.size,t[59]=e,t[60]=n):n=t[60],n}if(p?.kind===`folder`){if(!(h===`agent`&&g!==null)){let e;return t[61]===p.folderPath?e=t[62]:(e=(0,Z.jsx)(Qx,{folderPath:p.folderPath}),t[61]=p.folderPath,t[62]=e),e}let e;t[63]===p.folderPath?e=t[64]:(e=(0,Z.jsx)(CS,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(Qx,{folderPath:p.folderPath})}),t[63]=p.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(wS,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(CS,{defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(oO,{showBackButton:!1})})}),t[66]=r):r=t[66];let i;return t[67]===e?i=t[68]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(SS,{orientation:`horizontal`,children:[e,n,r]})}),t[67]=e,t[68]=i),i}if(p?.kind===`asset`){let e;return t[69]!==p.assetPath||t[70]!==p.mediaKind?(e=(0,Z.jsx)(Ab,{assetPath:p.assetPath,mediaKind:p.mediaKind},p.assetPath),t[69]=p.assetPath,t[70]=p.mediaKind,t[71]=e):e=t[71],e}if(!f||!d){if((typeof window<`u`?ti(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(jb,{}),t[72]=e):e=t[72],e}let e;return t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(wx,{}),t[73]=e):e=t[73],e}let Ie=n===`source`,Le=!S,Re=B,ze;t[74]!==d||t[75]!==y?(ze=function(){d&&y(d)},t[74]=d,t[75]=y,t[76]=ze):ze=t[76];let Ve=ze,He=w??d,Ue=ke??void 0,We;t[77]!==O||t[78]!==Ie||t[79]!==Fe||t[80]!==m||t[81]!==He||t[82]!==Ue?(We=(0,Z.jsx)(PD,{activeDocName:He,isSourceMode:Ie,editorPlaceholder:O,previousDocName:Ue,onNavigateBack:Fe,onRecycle:m}),t[77]=O,t[78]=Ie,t[79]=Fe,t[80]=m,t[81]=He,t[82]=Ue,t[83]=We):We=t[83];let Ge;t[84]!==d||t[85]!==Ie?(Ge=(0,Z.jsx)(HS,{activeDocName:d,isSourceMode:Ie}),t[84]=d,t[85]=Ie,t[86]=Ge):Ge=t[86];let Ke;t[87]!==d||t[88]!==w?(Ke=aO({activeDocName:d,deferredActiveDocName:w,mountResolved:d!==null&&U(d),syncResolved:d!==null&&Be(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(jb,{}),d===null?null:(0,Z.jsx)(rS,{docName:d})]}):null,t[87]=d,t[88]=w,t[89]=Ke):Ke=t[89];let qe;t[90]!==We||t[91]!==Ge||t[92]!==Ke?(qe=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[We,Ge,Ke]}),t[90]=We,t[91]=Ge,t[92]=Ke,t[93]=qe):qe=t[93];let Je;t[94]!==d||t[95]!==C||t[96]!==Re||t[97]!==Ie||t[98]!==r||t[99]!==Ve||t[100]!==Le||t[101]!==de?(Je=!C&&(0,Z.jsx)(iO,{activeDocName:d,isSourceMode:Ie,sourceDisabled:Le,onModeChange:r,showAddPropertyButton:!Ie,onAddProperty:Ve,isPanelCollapsed:Re,onTogglePanel:de}),t[94]=d,t[95]=C,t[96]=Re,t[97]=Ie,t[98]=r,t[99]=Ve,t[100]=Le,t[101]=de,t[102]=Je):Je=t[102];let Ye;t[103]!==qe||t[104]!==Je?(Ye=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[qe,Je]}),t[103]=qe,t[104]=Je,t[105]=Ye):Ye=t[105];let J;t[106]!==E||t[107]!==b?(J=E&&(0,Z.jsx)(UD,{stats:b}),t[106]=E,t[107]=b,t[108]=J):J=t[108];let Xe;t[109]!==Ye||t[110]!==J?(Xe=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[Ye,J]}),t[109]=Ye,t[110]=J,t[111]=Xe):Xe=t[111];let Ze=Xe,Qe=ee||void 0,$e;t[112]===z?$e=t[113]:($e=z?{defaultSize:`100%`}:{},t[112]=z,t[113]=$e);let et=ee?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,tt;t[114]!==Ze||t[115]!==$e||t[116]!==et?(tt=(0,Z.jsx)(CS,{minSize:`30%`,...$e,className:et,children:Ze}),t[114]=Ze,t[115]=$e,t[116]=et,t[117]=tt):tt=t[117];let nt=A&&B,rt;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(rt=()=>{K(!0),te.current=!0;let e=()=>{K(!1),te.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[118]=rt):rt=t[118];let it;t[119]===nt?it=t[120]:(it=(0,Z.jsx)(wS,{withHandle:!0,disabled:nt,onPointerDown:rt}),t[119]=nt,t[120]=it);let at=z?0:`${ne}px`,ot;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(ot=e=>{V(e.asPercentage===0),e.inPixels>0&&te.current&&(q.current=e.inPixels,ae(e.inPixels))},t[121]=ot):ot=t[121];let st=!ee&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ct;t[122]===st?ct=t[123]:(ct=Bi(`flex flex-col bg-muted/20`,st),t[122]=st,t[123]=ct);let lt;t[124]!==d||t[125]!==a||t[126]!==h||t[127]!==Ie||t[128]!==o||t[129]!==c||t[130]!==l?(lt=(0,Z.jsx)(Ev,{docName:d,isSourceMode:Ie,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l}),t[124]=d,t[125]=a,t[126]=h,t[127]=Ie,t[128]=o,t[129]=c,t[130]=l,t[131]=lt):lt=t[131];let ut;t[132]!==B||t[133]!==L||t[134]!==at||t[135]!==ct||t[136]!==lt?(ut=(0,Z.jsx)(CS,{id:`doc-panel`,panelRef:L,defaultSize:at,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:ot,inert:B,className:ct,children:lt}),t[132]=B,t[133]=L,t[134]=at,t[135]=ct,t[136]=lt,t[137]=ut):ut=t[137];let dt;return t[138]!==Qe||t[139]!==tt||t[140]!==it||t[141]!==ut?(dt=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:le,children:(0,Z.jsxs)(SS,{orientation:`horizontal`,"data-dragging":Qe,children:[tt,it,ut]})}),t[138]=Qe,t[139]=tt,t[140]=it,t[141]=ut,t[142]=dt):dt=t[142],dt}function uO(){return dC()}function dO(){return Zn()}function fO(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function pO(e){let{value:t,unit:n}=fO(e);return n===`rem`?t*16:t}function mO(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var hO=3600*24*7;function gO(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?_O:m,O=g===void 0?hO:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,ee;t[3]===y?(G=t[4],ee=t[5]):(G=()=>{H.current=y},ee=[y],t[3]=y,t[4]=G,t[5]=ee),(0,Q.useEffect)(G,ee);let K=pO(b),te;t[6]===x?te=t[7]:(te=pO(x),t[6]=x,t[7]=te);let ne=te,q;t[8]!==E||t[9]!==k?(q=function(e){E&&(P.current=!0,j.current=H.current?0:pO(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]=q):q=t[10];let re=q,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ne||t[18]!==K||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{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}=fO(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<=K*w;else if(e<=K){let n=K*(w-1);t=K-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>K*T){a();let t=n(r,M.current,j.current,s),c=Math.max(K,Math.min(ne,t)),u=mO(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(K,Math.min(ne,u)),f=mO(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)}},ae=[i,a,D,K,ne,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ne,t[18]=K,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function _O(){}var vO=3600*24*7,yO=`18rem`,bO=`3rem`,xO=`app-file-sidebar`,SO=`14.625rem`,CO=`32rem`,wO=`sidebar_width`,TO=/^\d+(?:\.\d+)?(?:rem|px)$/,EO=Q.createContext(null);function DO(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${wO}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return TO.test(n)?n:e}function OO(){let e=Q.use(EO);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function kO(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?yO:c,[u]=Q.useState(jO),d;t[8]===u?d=t[9]:(d=()=>hC(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>DO(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=SC();return wC(`left`,hC(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),TC(`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(AO)},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: ${fC}px)`),t=()=>{let e=hC(u,window.innerWidth,`left`);p(e),C(wC(`left`,e,SC())===`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(xO)?.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=>{Ba(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":bO,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Bi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let ee;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(ee=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=ee):ee=t[54];let K;return t[55]!==H||t[56]!==ee?(K=(0,Z.jsx)(EO.Provider,{value:H,children:ee}),t[55]=H,t[56]=ee,t[57]=K):K=t[57],K}function AO(e){return!e}function jO(){return Zn()}function MO(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=OO();if(d===`none`){let e;t[7]===r?e=t[8]:(e=Bi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=Bi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,x;t[20]!==r||t[21]!==b?(x=Bi(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:xO,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function NO(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=OO(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=Ya(`toggle-files-sidebar`);l=qi,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=xO,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=Bi(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(T,{}):(0,Z.jsx)(el,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function PO(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=OO(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:SO,maxResizeWidth:CO,setIsDraggingRail:h,widthCookieName:wO,widthCookieMaxAge:vO},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=gO(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=Bi(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function FO(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}=OO(),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=Bi(`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 IO(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=Bi(`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 LO(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=Bi(`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 RO(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=Bi(`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 zO(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=Bi(`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 BO(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=Bi(`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 VO=Yi(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function HO(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?Hi:`button`,{state:m}=OO(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Bi(VO({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)(hr,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(sr,{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)(ri,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function UO(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 WO(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 GO=1e3,KO=!1;function qO(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function JO(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:ca(i)?a=i:(a=void 0,KO||(KO=!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`&&(qO({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=WO(i),{current:c,crossDoc:l}=a?ra(a,n,Date.now()):{current:[],crossDoc:[]},u=YO,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>UO(e.current,p)&&UO(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,GO);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 YO(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var XO=`sync-status`;function ZO(e,t){let n=(0,$.c)(5),{_:r}=i(),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]!==e?(c=()=>{s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t&&(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current?(o.current=!0,X.warning(r({id:`HGNCsl`}),{id:XO,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,X.success(r({id:`GhjUB_`}),{id:XO,duration:3e3})))},l=[e,t,r],n[0]=r,n[1]=t,n[2]=e,n[3]=c,n[4]=l):(c=n[3],l=n[4]),(0,Q.useEffect)(c,l)}var QO=4,$O=3,ek={Bird:gc,Cat:Sc,Dog:Ac,Fish:Fc,Mouse:sl,Rabbit:ol,Shrimp:ml,Snail:hl,Squirrel:vl,Turtle:Cl};Object.freeze(Object.keys(ek));function tk(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(ek,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var nk={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function rk(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=tk(n),c=s.kind===`animal`?ek[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=$n(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=kr(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(sr,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(ri,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function ik(e){let t=nk[e.icon];return e.displayName||t||Y._({id:`iEQQyu`})}function ak(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 ok(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=ht(),{presence:u,agentId:d}=n,f=ik(u),p=ak(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(oa,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(oa,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)(hr,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(sr,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(ri,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function sk(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?Y._({id:`9euN0m`,values:{count:n}}):Y._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(H,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(rk,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(ok,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(B,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let m;return t[18]!==u||t[19]!==f?(m=(0,Z.jsxs)(p,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=m):m=t[20],m}function ck(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(rk,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(ok,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function lk(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ht(),{current:s,crossDoc:c}=JO(t,r,n);if(ZO(EC(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,QO),n;e[6]===s?n=e[7]:(n=s.slice(QO),e[6]=s,e[7]=n);let r=n,u=c.slice(0,$O),d;e[8]===c?d=e[9]:(d=c.slice($O),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=>ck(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)(sk,{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=>ck(e,p,!0,m)),f.length>0?(0,Z.jsx)(sk,{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 uk=`.md`,dk=/\.(md|mdx)$/i;function fk(e,t=uk){return`${e}${t}`}function pk(e){return Pk(e).replace(dk,``)}function mk(e){return ai(e)?_k(e.path):Bn(e)?e.path:fk(e.docName,e.docExt)}function hk(e){let t=Pk(e).match(dk);return t?`.${t[1].toLowerCase()}`:void 0}function gk(e){return Pk(e)}function _k(e){let t=Pk(e.trim());return t?`${t}/`:``}function vk(e){return e.endsWith(`/`)?gk(e):pk(e)}function yk(e){return e.map(mk)}function bk(e){return[...e].sort().join(`\0`)}function xk(e){return bk(yk(e))}function Sk(e){let t=new Set;for(let n of e){if(ai(n)){let e=_k(n.path);e&&t.add(e)}let e=(ai(n)||Bn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=ai(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function Ck(e){if(!e)return[];let t=Pk(e.replace(dk,``)).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 wk(e,t,n){let r=hk(e);if(r)return r;let i=n.find(e=>mr(e)&&e.docName===t);return i?i.docExt??uk:Nk(e).includes(`.`)?void 0:uk}function Tk(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(!Bn(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 Ek(e,t,n){if(hk(e))return null;let r=n.find(e=>Bn(e)&&e.path===t);return r?r.path:Nk(e).includes(`.`)?t:Tk(t,n)}function Dk(e,t){let n=e.kind===`directory`,r=n?gk(e.path):pk(e.path);if(n)return{kind:`folder`,name:Pk(Nk(e.path)).replace(dk,``),path:r,treePath:kk(e.path,!0)};let i=Ek(e.path,r,t);if(i)return{kind:`asset`,name:Pk(Nk(i)),path:i,treePath:i};let a=wk(e.path,r,t);return{kind:`file`,name:Pk(Nk(e.path)).replace(dk,``),path:r,treePath:kk(e.path,!1),docExt:a}}function Ok(e){return e.kind===`directory`?gk(e.path):e.path}function kk(e,t){return t?_k(e):dk.test(e)?e:`${e}${uk}`}function Ak(e,t,n){let r=_k(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}${uk}`;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 jk(e,t){return e===`file`?kk(t,!1):`${gk(t)}/index${uk}`}function Mk(e,t){return t.kind===`root`||t.directoryPath==null?Nk(e):`${t.directoryPath}${Nk(e)}`}function Nk(e){let t=Pk(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Pk(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Fk(e,t){return t.trim()}function Ik(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function Lk(e,t){let n=Fk(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function Rk(e,t,n=[],r=[]){if(t.length===0&&n.length===0&&r.length===0)return e;let i=new Map(t.map(e=>[e.fromDocName,e.toDocName])),a=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>mr(e)?{...e,docName:i.get(e.docName)??e.docName}:ai(e)?{...e,path:Gk(e.path,n)}:Bn(e)?{...e,path:a.get(e.path)??Gk(e.path,n)}:e)}function zk(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=>mr(e)?!i.has(e.docName)&&!Yk(e.docName,n):ai(e)?!Yk(e.path,n):Bn(e)?!a.has(e.path)&&!Yk(e.path,n):!0)}function Bk(e,t){if(e.kind!==`asset`||t.some(t=>Bn(t)&&t.path===e.path))return e;let n=Tk(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function Vk(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>Kk(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>mr(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=>ai(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(mr(i)){let e=Jk(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(ai(i)){let e=qk(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function Hk(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function Uk(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function Wk(e,t){let n=e.kind===`file`?fk(e.path,e.docExt):e.path;return Xh(t.contentDir,n,t.pathSeparator)}function Gk(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 Kk(e,t){return mr(e)&&mr(t)?e.docName===t.docName:ai(e)&&ai(t)||Bn(e)&&Bn(t)?e.path===t.path:!1}function qk(e,t,n){return e===t?n:Jk(e,t,n)}function Jk(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function Yk(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function Xk(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)(Bu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function Zk(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=Bi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Vu,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Qk(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)(Ju,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function $k(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=Bi(`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)(Hu,{children:(0,Z.jsx)(Uu,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function eA(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=Bi(`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)(Wu,{"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 tA(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=Bi(`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)(ps,{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)(Yu,{"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 nA(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=Bi(`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)(Xu,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rA(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=Bi(`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)(Ku,{children:(0,Z.jsx)(fs,{})})}),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)(Gu,{"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 iA(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=Bi(`-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)(qu,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var aA=[`.md`,`.mdx`],oA=`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`,sA=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,cA=Bi(sA,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),lA=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,uA=`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 focus-visible:opacity-100`;function dA(e){return Bi(uA,e?`opacity-100`:`pointer-events-none opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`)}function fA(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function pA(e){let t=xi(e);window.location.hash!==t&&(window.location.hash=t)}function mA(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function hA(e,t){let n=[t,...aA].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 gA(e){let t=(0,$.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({tabId:o,disabled:n,ref:r,style:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]!==n||t[7]!==o?(s={id:o,disabled:n},t[6]=n,t[7]=o,t[8]=s):s=t[8];let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=Ta(s),m;t[9]===d?m=t[10]:(m=no.Transform.toString(d),t[9]=d,t[10]=m);let h=p?.5:i?.opacity,g=p?1:i?.zIndex,_;t[11]!==i||t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==f?(_={...i,transform:m,transition:f,opacity:h,zIndex:g},t[11]=i,t[12]=m,t[13]=h,t[14]=g,t[15]=f,t[16]=_):_=t[16];let v=_,y;t[17]!==r||t[18]!==u?(y=function(e){u(e),typeof r==`function`?r(e):r&&`current`in r&&(r.current=e)},t[17]=r,t[18]=u,t[19]=y):y=t[19];let b=y,x;return t[20]!==c||t[21]!==b||t[22]!==l||t[23]!==a||t[24]!==v?(x=(0,Z.jsx)(`div`,{ref:b,style:v,...a,...c,...l}),t[20]=c,t[21]=b,t[22]=l,t[23]=a,t[24]=v,t[25]=x):x=t[25],x}function _A(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=Gt(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=Gt(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(Zk,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(eA,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(eA,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(eA,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(iA,{}),(0,Z.jsx)(eA,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)($k,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(Xk,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function vA(e){let t=(0,$.c)(20),{accessibleLabel:n,closeTab:r,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=i();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)(al,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(qi,{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]!==r||t[14]!==o?(u=e=>{e.stopPropagation(),r(o)},t[13]=r,t[14]=o,t[15]=u):u=t[15];let d;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(is,{"aria-hidden":`true`}),t[16]=d):d=t[16];let f;return t[17]!==l||t[18]!==u?(f=(0,Z.jsx)(qi,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:`mr-1.5`,onClick:u,children:d}),t[17]=l,t[18]=u,t[19]=f):f=t[19],f}function yA(e){let t=(0,$.c)(1),{docName:n}=e;if(oC(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Or,{"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 bA(){let e=(0,$.c)(69),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:b,pinnedTabIds:x,remapTabsForRename:S,reorderTabs:C,unpinTab:w,visibleTabIds:T}=ht(),{_:E}=i(),{pageMeta:D}=wi(),O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(null),H=(0,Q.useRef)(t),U;e[0]!==n||e[1]!==t||e[2]!==a?(U=n??(a?ce(a):t?Oe(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=U):U=e[3];let W=U,G;e[4]!==r||e[5]!==W||e[6]!==h||e[7]!==g||e[8]!==v?(G=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:W?`${W}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=W,e[6]=h,e[7]=g,e[8]=v,e[9]=G):G=e[9];let ee=G,K,te;e[10]===t?(K=e[11],te=e[12]):(K=()=>{H.current=t},te=[t],e[10]=t,e[11]=K,e[12]=te),(0,Q.useEffect)(K,te);let ne,q;e[13]===ee?(ne=e[14],q=e[15]):(ne=()=>{ee&&(O.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[ee],e[13]=ee,e[14]=ne,e[15]=q),(0,Q.useEffect)(ne,q);let re,ie;e[16]===k?(re=e[17],ie=e[18]):(re=()=>{k&&(R.current?.focus(),R.current?.select())},ie=[k],e[16]=k,e[17]=re,e[18]=ie),(0,Q.useEffect)(re,ie);let ae,oe;e[19]!==v||e[20]!==k?(ae=()=>{!k||v.includes(k.tabId)||(B.current=!0,V.current=null,A(null),M(``),F(null),L(!1))},oe=[v,k],e[19]=v,e[20]=k,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);B.current=!1,V.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),F(null)},le=function(){B.current=!0,V.current=null,A(null),M(``),F(null),L(!1)},ue=async function(){if(B.current){B.current=!1;return}if(z.current)return;let e=k?.docName;if(!e){le();return}let t=Fk(`file`,hA(j,D.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){le();return}if(t===V.current){R.current?.focus();return}if(!Ik(t)){F(E({id:`P8yDjG`})),R.current?.focus();return}let i=Lk({kind:`file`,path:e,name:r},t);z.current=!0,L(!0),F(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(B.current){L(!1),z.current=!1;return}let r=await Et(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),z.current=!1,V.current=t,R.current?.focus();return}let a=P(Kr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=H.current,s=Hk(o,a);qt(a);let c=!0;try{let e=Uk(a,p(),m);await Promise.all(e.map(e=>l(e))),S(a),Pi([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),X.error(E({id:`MUBR8r`}))}B.current=!0,A(null),M(``),F(null),L(!1),z.current=!1,V.current=null,c&&s&&s!==o&&pA(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(E({id:`HIb0vl`})),L(!1),z.current=!1,V.current=t,R.current?.focus()}},de=typeof window<`u`&&window.okDesktop!=null,pe;e[23]===g?pe=e[24]:(pe=new Set(g),e[23]=g,e[24]=pe);let me=pe,he;e[25]!==u||e[26]!==f||e[27]!==me?(he=function(e){let t=[],n=[];for(let r of e)me.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[25]=u,e[26]=f,e[27]=me,e[28]=he):he=e[28];let ge=he,_e;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(_e={activationConstraint:{distance:8}},e[29]=_e):_e=e[29];let ve;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(ve={coordinateGetter:Qa},e[30]=ve):ve=e[30];let ye=io(ka(ja,_e),ka(Ca,ve)),be;e[31]!==C||e[32]!==T?(be=function(e){let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=T.indexOf(t),i=T.indexOf(n);r<0||i<0||r===i||C(Zo([...T],r,i),t)},e[31]=C,e[32]=T,e[33]=be):be=e[33];let xe=be,Se=de?``:void 0,Ce;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=Bi(`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]`,de&&`[-webkit-app-region:drag]`),e[34]=Ce):Ce=e[34];let we=mA,Te;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Te=Bi(`flex items-end gap-1`,de&&`[-webkit-app-region:no-drag]`),e[35]=Te):Te=e[35];let Ee=eo,De=Io,ke;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(ke={container:typeof document<`u`?document.body:void 0},e[36]=ke):ke=e[36];let Ae=Ga,je;e[37]===T?je=e[38]:(je=[...T],e[37]=T,e[38]=je);let Me=ma,Ne=T.map(e=>{if(me.has(e)){let t=e===r;return(0,Z.jsx)(_A,{tabId:e,canPin:!1,openTabs:T,closeTab:u,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(gA,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Bi(oA,t?sA:cA),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:lA,onClick:()=>c(e),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:dA(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(is,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=Fe(e),n=e===W,i=x.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=y(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(_A,{tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(gA,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Bi(oA,n?sA:cA),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:lA,onClick:()=>{o(e)},children:[s&&(0,Z.jsx)(`span`,{className:Bi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Bi(`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)(vA,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=y(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(_A,{tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(gA,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Bi(oA,n?sA:cA),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:lA,onClick:()=>{o(e)},children:[s?(0,Z.jsx)(`span`,{className:Bi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Bi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(vA,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})},e)}let a=t.docName,l=D.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=y(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=k?.tabId===e,S=`editor-tab-rename-error-${fA(a)}`;return(0,Z.jsx)(_A,{disabled:v,tabId:e,openTabs:T,closeTab:d,closeTabs:ge,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsx)(gA,{tabId:e,disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Bi(oA,n?sA:cA,v&&N&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(TS,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(AS,{ref:R,value:j,disabled:I,"aria-label":E({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?S:void 0,"aria-busy":I||void 0,title:N??a,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{M(hA(e.target.value,l)),F(null),V.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ue()):e.key===`Escape`&&(e.preventDefault(),le())},onBlur:ue}),(0,Z.jsx)(DS,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(kS,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),N?(0,Z.jsx)(`span`,{id:S,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:lA,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,a)},children:[(0,Z.jsx)(yA,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(vA,{accessibleLabel:g,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})})},e)}),Pe;e[39]!==Ae||e[40]!==je||e[41]!==Me||e[42]!==Ne?(Pe=(0,Z.jsx)(Ae,{items:je,strategy:Me,children:Ne}),e[39]=Ae,e[40]=je,e[41]=Me,e[42]=Ne,e[43]=Pe):Pe=e[43];let Ie;e[44]!==Ee||e[45]!==xe||e[46]!==ye||e[47]!==De||e[48]!==ke||e[49]!==Pe?(Ie=(0,Z.jsx)(Ee,{sensors:ye,collisionDetection:De,onDragEnd:xe,accessibility:ke,children:Pe}),e[44]=Ee,e[45]=xe,e[46]=ye,e[47]=De,e[48]=ke,e[49]=Pe,e[50]=Ie):Ie=e[50];let Le;e[51]===E?Le=e[52]:(Le=E({id:`3YvS-c`}),e[51]=E,e[52]=Le);let Re;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(fe,{"aria-hidden":`true`}),e[53]=Re):Re=e[53];let ze;e[54]!==_||e[55]!==Le?(ze=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Le,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Re})}),e[54]=_,e[55]=Le,e[56]=ze):ze=e[56];let Be;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[57]=Be):Be=e[57];let Ve;e[58]===ze?Ve=e[59]:(Ve=(0,Z.jsxs)(ri,{children:[ze,Be]}),e[58]=ze,e[59]=Ve);let He;e[60]!==Te||e[61]!==Ie||e[62]!==Ve?(He=(0,Z.jsxs)(`div`,{className:Te,children:[Ie,Ve]}),e[60]=Te,e[61]=Ie,e[62]=Ve,e[63]=He):He=e[63];let Ue;return e[64]!==Se||e[65]!==Ce||e[66]!==we||e[67]!==He?(Ue=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":Se,className:Ce,onWheel:we,children:He}),e[64]=Se,e[65]=Ce,e[66]=we,e[67]=He,e[68]=Ue):Ue=e[68],Ue}function xA(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 SA(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 CA=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Zt},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:Ad},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Xn},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:xA},{label:`Twitter`,href:`https://x.com/inkeep`,icon:SA}],wA=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(pt,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(H,{asChild:!0,children:(0,Z.jsxs)(qi,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(ri,{children:[o,(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=CA.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>so(e,r),onAuxClick:e=>so(e,r),className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-4 shrink-0`}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let m;e[10]!==u||e[11]!==f?(m=(0,Z.jsxs)(B,{align:`end`,className:`w-64 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=m):m=e[12];let h;return e[13]!==n||e[14]!==m?(h=(0,Z.jsxs)(p,{open:n,onOpenChange:r,children:[c,m]}),e[13]=n,e[14]=m,e[15]=h):h=e[15],h};function TA(e){let t=(0,$.c)(63),{input:n}=e,{_:r}=i(),{states:a,refresh:o}=Cg(),{dispatch:c}=fg(),{merged:l}=vt(),u=l?.appearance?.preview?.autoOpen??!0,[d,f]=(0,Q.useState)(!1);if(_h())return null;let p=typeof window<`u`&&window.okDesktop!=null,m;t[0]===o?m=t[1]:(m=e=>{f(e),e&&o()},t[0]=o,t[1]=m);let h=m,g=n===null,_;t[2]!==u||t[3]!==n?(_=n!==null&&n.docContext!==null?dr(n.docContext.relativePath,u):``,t[2]=u,t[3]=n,t[4]=_):_=t[4];let v=_,y;t[5]!==c||t[6]!==n?(y=e=>{n!==null&&c(e.id,n)},t[5]=c,t[6]=n,t[7]=y):y=t[7];let b=y,x,S,C,w,T,E,D,O,k,A,j,M;if(t[8]!==h||t[9]!==b||t[10]!==n||t[11]!==d||t[12]!==v||t[13]!==a||t[14]!==g){let e;t[27]===a?e=t[28]:(e=e=>a[e.id]?.installed===!0,t[27]=a,t[28]=e);let r=bh.filter(e);C=a[`claude-code`]?.installed===!0;let i;t[29]!==n||t[30]!==v?(i=()=>{n!==null&&zb(v)},t[29]=n,t[30]=v,t[31]=i):i=t[31],w=i,S=oo,M=d,T=h;let o,c;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(aa,{className:`size-3.5`}),c=(0,Z.jsx)(s,{id:`xWEvuo`}),t[32]=o,t[33]=c):(o=t[32],c=t[33]);let l;t[34]===g?l=t[35]:(l=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsxs)(qi,{variant:`ghost`,size:`sm`,disabled:g,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,children:[o,c]})})}),t[34]=g,t[35]=l);let u;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`xWEvuo`})}),t[36]=u):u=t[36],t[37]===l?E=t[38]:(E=(0,Z.jsxs)(ri,{children:[l,u]}),t[37]=l,t[38]=E),x=ua,D=`end`,O=`min-w-[220px]`,k=`open-in-agent-menu`,t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Uo,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`O7_W_a`})}),t[39]=A):A=t[39];let f;t[40]!==b||t[41]!==v||t[42]!==a?(f=e=>{let t=a[e.id];return(0,Z.jsx)(Bb,{target:e,installState:t,isElectronHost:p,prompt:v,onSelect:()=>b(e)},e.id)},t[40]=b,t[41]=v,t[42]=a,t[43]=f):f=t[43],j=r.map(f),t[8]=h,t[9]=b,t[10]=n,t[11]=d,t[12]=v,t[13]=a,t[14]=g,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E,t[21]=D,t[22]=O,t[23]=k,t[24]=A,t[25]=j,t[26]=M}else x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20],D=t[21],O=t[22],k=t[23],A=t[24],j=t[25],M=t[26];let N;t[44]!==r||t[45]!==C||t[46]!==w||t[47]!==n?(N=C?null:(0,Z.jsxs)(go,{onSelect:w,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":r({id:`aA51jP`}),children:[(0,Z.jsx)(ut,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}),t[44]=r,t[45]=C,t[46]=w,t[47]=n,t[48]=N):N=t[48];let P;t[49]!==x||t[50]!==N||t[51]!==D||t[52]!==O||t[53]!==k||t[54]!==A||t[55]!==j?(P=(0,Z.jsxs)(x,{align:D,className:O,"data-testid":k,children:[A,j,N]}),t[49]=x,t[50]=N,t[51]=D,t[52]=O,t[53]=k,t[54]=A,t[55]=j,t[56]=P):P=t[56];let F;return t[57]!==S||t[58]!==T||t[59]!==E||t[60]!==P||t[61]!==M?(F=(0,Z.jsxs)(S,{open:M,onOpenChange:T,children:[E,P]}),t[57]=S,t[58]=T,t[59]=E,t[60]=P,t[61]=M,t[62]=F):F=t[62],F}var EA=50,DA=()=>{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,uS.preload()},EA))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=xh)},u=(0,Z.jsx)(fl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsxs)(qi,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(ri,{children:[d,(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function OA(e){let t=(0,$.c)(32),{onClickWhenNoRemote:n}=e,{_:r}=i(),{activeDocName:a}=ht(),{status:o}=_o(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),m,h;if(t[0]===u?(m=t[1],h=t[2]):(m=()=>{!u||!f.current||(f.current.focus(),f.current.select())},h=[u],t[0]=u,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h),!a)return null;let g=o?.hasRemote===!0,_;t[3]!==r||t[4]!==a||t[5]!==c||t[6]!==g||t[7]!==n?(_=async function(){if(!c&&a){l(!0),d(null);try{let e=await fo({docName:a,hasRemote:g,onClickWhenNoRemote:n},{clipboardWrite:Jo,toastSuccess:NA,toastError:MA,logEvent:jA});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{X.error(r({id:`u3YnKw`}))}l(!1)}},t[3]=r,t[4]=a,t[5]=c,t[6]=g,t[7]=n,t[8]=_):_=t[8];let v=_,y=u!==null,b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||d(null)},t[9]=b):b=t[9];let x;t[10]===r?x=t[11]:(x=r({id:`F4IYWe`}),t[10]=r,t[11]=x);let S,C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(pl,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[12]=S,t[13]=C):(S=t[12],C=t[13]);let w;t[14]!==c||t[15]!==v||t[16]!==x?(w=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(it,{asChild:!0,children:(0,Z.jsxs)(qi,{variant:`ghost`,size:`sm`,"aria-label":x,onClick:v,disabled:c,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})})}),t[14]=c,t[15]=v,t[16]=x,t[17]=w):w=t[17];let T;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`Z8lGw6`})}),t[18]=T):T=t[18];let E;t[19]===w?E=t[20]:(E=(0,Z.jsxs)(ri,{children:[w,T]}),t[19]=w,t[20]=E);let D;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[21]=D):D=t[21];let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[22]=O):O=t[22];let k=u??``,A;t[23]===r?A=t[24]:(A=r({id:`5-FeN2`}),t[23]=r,t[24]=A);let j;t[25]!==k||t[26]!==A?(j=(0,Z.jsxs)(B,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[D,O,(0,Z.jsx)(ms,{ref:f,readOnly:!0,value:k,onFocus:AA,onClick:kA,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":A})]}),t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;return t[28]!==E||t[29]!==j||t[30]!==y?(M=(0,Z.jsxs)(p,{open:y,onOpenChange:b,children:[E,j]}),t[28]=E,t[29]=j,t[30]=y,t[31]=M):M=t[31],M}function kA(e){return e.currentTarget.select()}function AA(e){return e.currentTarget.select()}function jA(e){return console.log(e)}function MA(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function NA(e){return X.success(e)}function PA(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a}=e,{_:o}=i(),{activeDocName:c,activeTarget:l}=ht(),{state:u}=OO(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=_a(`toggle-files-sidebar`),t[0]=d):d=t[0];let f=d,p=_a(`command-palette`),m=Fo(),[h,g]=(0,Q.useState)(!1),_;bb0:{if(l===null){let e;t[1]===m?e=t[2]:(e=$h({workspace:m}),t[1]=m,t[2]=e),_=e;break bb0}if(l.kind===`folder`){if(!m){_=null;break bb0}let e;t[3]!==l.folderPath||t[4]!==m?(e=eg({folderRelativePath:l.folderPath,workspace:m}),t[3]=l.folderPath,t[4]=m,t[5]=e):e=t[5],_=e;break bb0}let e;t[6]!==c||t[7]!==m?(e=Qh({docName:c,workspace:m}),t[6]=c,t[7]=m,t[8]=e):e=t[8],_=e}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=u===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[78px]`,C;t[9]===S?C=t[10]:(C=Bi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,y&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[9]=S,t[10]=C);let w;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(NO,{className:Bi(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),t[11]=w):w=t[11];let T;t[12]===u?T=t[13]:(T=(0,Z.jsxs)(ri,{children:[w,(0,Z.jsx)(sr,{children:u===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:f}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:f}})})]}),t[12]=u,t[13]=T);let E=b&&a&&(0,Z.jsxs)(ri,{children:[(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":o({id:`IN4UX8`,values:{searchShortcut:p}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Bi(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(he,{"aria-hidden":`true`})})}),(0,Z.jsx)(sr,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:p}})})]}),D,O;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Xo,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),O=(0,Z.jsx)(bA,{}),t[14]=D,t[15]=O):(D=t[14],O=t[15]);let k;t[16]!==T||t[17]!==E?(k=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[T,E,D,O]}),t[16]=T,t[17]=E,t[18]=k):k=t[18];let A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(A=Bi(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[19]=A):A=t[19];let j;t[20]===v?j=t[21]:(j=(0,Z.jsx)(TA,{input:v}),t[20]=v,t[21]=j);let M;t[22]===g?M=t[23]:(M=(0,Z.jsx)(OA,{onClickWhenNoRemote:()=>g(!0)}),t[22]=g,t[23]=M);let N;t[24]!==h||t[25]!==g?(N=(0,Z.jsx)(Yo,{open:h,onOpenChange:g}),t[24]=h,t[25]=g,t[26]=N):N=t[26];let P;t[27]!==r||t[28]!==n?(P=(0,Z.jsx)(Do,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=P):P=t[29];let F,I,L,R,z;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(lk,{}),I=(0,Z.jsx)(Xo,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),L=(0,Z.jsx)($u,{}),R=(0,Z.jsx)(DA,{}),z=(0,Z.jsx)(wA,{}),t[30]=F,t[31]=I,t[32]=L,t[33]=R,t[34]=z):(F=t[30],I=t[31],L=t[32],R=t[33],z=t[34]);let B;t[35]!==j||t[36]!==M||t[37]!==N||t[38]!==P?(B=(0,Z.jsxs)(`div`,{className:A,children:[j,M,N,P,F,I,L,R,z]}),t[35]=j,t[36]=M,t[37]=N,t[38]=P,t[39]=B):B=t[39];let V;return t[40]!==k||t[41]!==B||t[42]!==x||t[43]!==C?(V=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:C,children:[k,B]}),t[40]=k,t[41]=B,t[42]=x,t[43]=C,t[44]=V):V=t[44],V}function FA(e){let t=(0,$.c)(38),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,{_:a}=i(),[o,s]=e_(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(xv[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),b=mo(),{projectLocalConfig:x,projectLocalSynced:S}=vt(),{activeDocName:C}=ht(),w=b?.hasRemote,T=b?.pushPermission?.checkStatus,E;t[2]!==v||t[3]!==x||t[4]!==S||t[5]!==w||t[6]!==T?(E=i_({autoSyncOnboardingDismissed:v,hasRemote:w,projectLocalSynced:S,projectLocalConfig:x,pushPermissionCheckStatus:T}),t[2]=v,t[3]=x,t[4]=S,t[5]=w,t[6]=T,t[7]=E):E=t[7];let D=E,O,k;t[8]===C?(O=t[9],k=t[10]):(O=()=>{let e=function(e){let t=e.detail;t&&C&&Xs(C,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(Kg,e),()=>window.removeEventListener(Kg,e)},k=[C],t[8]=C,t[9]=O,t[10]=k),(0,Q.useEffect)(O,k),t_(b?.pausedReason);let A;t[11]===s?A=t[12]:(A=function(e){l(e),s(e)},t[11]=s,t[12]=A);let j=A,M;t[13]===a?M=t[14]:(M=async function(){_(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?X.success(a({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),X.error(a({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),X.error(a({id:`q7zsRM`}))}_(!1)},t[13]=a,t[14]=M);let N=M,P,F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{p(`auth`),d(!0)},P=()=>{p(`identity`),d(!0)},t[15]=P,t[16]=F):(P=t[15],F=t[16]);let I;t[17]===r?I=t[18]:(I=(0,Z.jsx)(PA,{onSignIn:F,onSetIdentity:P,onOpenSearch:r}),t[17]=r,t[18]=I);let L;t[19]!==m||t[20]!==c||t[21]!==j||t[22]!==N||t[23]!==g?(L=(0,Z.jsx)(sO,{editorMode:c,onModeChange:j,activeTab:m,onActiveTabChange:h,onSaveVersion:N,saving:g}),t[19]=m,t[20]=c,t[21]=j,t[22]=N,t[23]=g,t[24]=L):L=t[24];let R=f===`identity`,z;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{d(!1)},t[25]=z):z=t[25];let B;t[26]!==u||t[27]!==R?(B=(0,Z.jsx)(Ra,{open:u,onOpenChange:d,identityPrompt:R,onSuccess:z}),t[26]=u,t[27]=R,t[28]=B):B=t[28];let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>y(!0),t[29]=V):V=t[29];let H;t[30]===D?H=t[31]:(H=(0,Z.jsx)(n_,{open:D,onResolved:V}),t[30]=D,t[31]=H);let U;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Ug,{}),t[32]=U):U=t[32];let W;return t[33]!==I||t[34]!==L||t[35]!==B||t[36]!==H?(W=(0,Z.jsxs)(Z.Fragment,{children:[I,L,B,H,U]}),t[33]=I,t[34]=L,t[35]=B,t[36]=H,t[37]=W):W=t[37],W}function IA(e){let t=xi(Br(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function LA(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=qa();if(n)return null;if(r!==null){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)(Or,{"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)(Or,{"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(RA),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 RA(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(qi,{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:()=>IA(e.file),children:[(0,Z.jsx)(Or,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var zA=`<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="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06" fill="currentcolor"/>
34
34
  </symbol>
@@ -1908,10 +1908,10 @@ Error generating stack: `+e.message+`
1908
1908
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z'/></svg>") center / contain no-repeat;
1909
1909
  pointer-events: none;
1910
1910
  }
1911
- `;function xV(e){wV(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-item-section="content"]`),r=t.closest(`[data-type="item"]`);if(!n||!r)return;let i=r.dataset.itemPath??``;if(i.endsWith(`/`))return;let a=tV(i);a&&(TV(n,a),r.getAttribute(`data-ok-renaming`)!==a&&r.setAttribute(hV,a),SV(a),!t.hasAttribute(gV)&&(EV(t,a),t.setAttribute(gV,``)))}function SV(e){_V=e,vV!==null&&clearTimeout(vV),vV=setTimeout(CV,yV)}function CV(){_V=null,vV!==null&&(clearTimeout(vV),vV=null)}function wV(e){let t=e.querySelectorAll(`[${hV}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(hV);if(!t){e.removeAttribute(hV);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(hV);continue}let r=tV(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(hV)}if(_V===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||tV(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==_V&&e.setAttribute(hV,_V))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&CV()}function TV(e,t){let n=e.querySelector(`[${mV}]`);n||(n=e.ownerDocument.createElement(`span`),n.setAttribute(mV,``),n.setAttribute(`aria-hidden`,`true`),e.appendChild(n)),n.textContent!==t&&(n.textContent=t)}function EV(e,t){let n=e.value;if(!n.toLowerCase().endsWith(t.toLowerCase()))return;let r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;if(!r)return;let i=n.slice(0,-t.length);r.call(e,i),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.setSelectionRange(0,i.length)}function DV(e){let{focusedIndex:t,itemHeight:n,viewportHeight:r,currentScrollTop:i}=e;if(t<0)return null;let a=Math.max(0,e.topInset??0),o=t*n,s=o+n;if(o<i+a){let e=Math.max(0,o-a);return e===i?null:e}if(s>i+r){let e=s-r;return e===i?null:e}return null}function OV(e,t){let n=t.getFocusedIndex();if(n<0)return;let r=e?.querySelector(Xj)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-scroll]`);if(!r)return;let i=t.getItemHeight(),a=DV({focusedIndex:n,itemHeight:i,viewportHeight:r.clientHeight,currentScrollTop:r.scrollTop,topInset:i});a!==null&&(r.scrollTop=a)}function kV(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function AV(e,t,n={}){if(!e)return kV(t);let r=Wr(e);if(t&&r!==t)return kV(t);switch(e.kind){case`doc`:return kV(t??e.docName);case`large-file`:return kV(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?kV(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function jV(e,t){if(!e)return{kind:`none`};let n=t.find(t=>mk(t)===e);if(n&&Bn(n))return{kind:`asset`,path:n.path,hash:pi(n.path),mediaKind:n.mediaKind};let r=vk(e);return e.endsWith(`/`)?t.some(e=>ai(e)?e.path===r||e.path.startsWith(`${r}/`):(Bn(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>mr(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var MV=`You can restore this file from the Trash.`;function NV(e){let t=MV,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function PV(e,t){return e===`web`?null:NV(t)}function FV(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}var IV=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function LV(e){return typeof e==`string`&&IV.includes(e)?e:`system-error`}function RV(e){switch(e){case`not-found`:return Y._({id:`v41fCm`});case`permission-denied`:return Y._({id:`sJK6pq`});case`system-error`:return Y._({id:`Jqqevv`});case`path-escape`:return Y._({id:`WL6puM`})}}function zV(e){let t=RV(e.reason),n=e.detail;return n?Y._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Y._({id:`dTaauv`,values:{reason:t}})}function BV(e){return e.kind===`folder`?`${e.name}/`:e.name}function VV(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?BV(l):``;d=c?Y._({id:`5qNxOe`,values:{count:u}}):l?`${Y._({id:`E_BHoD`,values:{targetName:e}})}\n${zV(l)}`:Y._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(as,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(ls,{children:[p,(0,Z.jsx)(rs,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let h;t[7]!==n||t[8]!==c?(h=c?(0,Z.jsx)(ss,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(HV)})}):null,t[7]=n,t[8]=c,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=g):g=t[10];let _;t[11]!==r||t[12]!==o?(_=(0,Z.jsx)(qi,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:g}),t[11]=r,t[12]=o,t[13]=_):_=t[13];let v;t[14]===r?v=t[15]:(v=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=v);let y;t[16]!==r||t[17]!==a||t[18]!==v?(y=(0,Z.jsx)(qi,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:v}),t[16]=r,t[17]=a,t[18]=v,t[19]=y):y=t[19];let b;t[20]===r?b=t[21]:(b=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=b);let x;t[22]!==r||t[23]!==i||t[24]!==b?(x=(0,Z.jsx)(qi,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:b}),t[22]=r,t[23]=i,t[24]=b,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==_||t[28]!==y?(S=(0,Z.jsxs)(cs,{children:[_,y,x]}),t[26]=x,t[27]=_,t[28]=y,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h?(C=(0,Z.jsxs)(os,{className:`sm:max-w-md`,children:[m,h,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=C):C=t[33],C}function HV(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:BV(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:zV(e)})]},e.path)}function UV(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=To(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,c;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=Fm(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),c=n;break bb0}let l;t[16]!==i||t[17]!==r?(l=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=l):l=t[18],o=n.map(l)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=c}else o=t[9],c=t[10];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[19]===o?l=t[20]:(l=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=l),l}function WV(e){return e?.isDirectory()?e:null}function GV(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function KV(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=WV(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}GV(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}async function qV(e,t){let n={"not-found":Y._({id:`vY54W_`}),"spawn-error":Y._({id:`ktATCe`}),timeout:Y._({id:`wrzAcD`}),"path-escape":Y._({id:`kDuh1E`}),"ipc-error":Y._({id:`jjmuxV`})},r;try{r=await e.shell.openInTerminal(t)}catch(e){console.warn(`[shell] openInTerminal IPC threw`,{dirAbsPath:t,err:e}),X.error(Y._({id:`DYwdxG`}),{description:n[`ipc-error`]});return}r.ok||(console.warn(`[shell] openInTerminal failed`,{reason:r.reason,dirAbsPath:t}),X.error(Y._({id:`DYwdxG`}),{description:n[r.reason]}))}var JV=`open-knowledge:file-tree-menu-action-delete`,YV=`open-knowledge:file-tree-menu-action-rename`,XV=`open-knowledge:file-tree-menu-action-duplicate`;function ZV(e){window.dispatchEvent(new CustomEvent(JV,{detail:{target:e}}))}function QV(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(JV,t),()=>window.removeEventListener(JV,t)}function $V(e){window.dispatchEvent(new CustomEvent(YV,{detail:{target:e}}))}function eH(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(YV,t),()=>window.removeEventListener(YV,t)}function tH(e){window.dispatchEvent(new CustomEvent(XV,{detail:{target:e}}))}function nH(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(XV,t),()=>window.removeEventListener(XV,t)}function rH(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var iH={Accept:`application/x-ndjson, application/json`};function aH(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var oH=class extends Error{};function sH(e){return typeof e==`object`&&!!e&&`type`in e}async function cH(e){let t=e.body;if(!t)throw new oH(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch(e){return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,{line:t,err:e}),!1}if(sH(n)){if(n.type===`error`)throw new oH(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return n.type===`complete`?(a=n.truncated===!0,!0):!1}let r=Ai.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1},c=!1;try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
1911
+ `;function xV(e){wV(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-item-section="content"]`),r=t.closest(`[data-type="item"]`);if(!n||!r)return;let i=r.dataset.itemPath??``;if(i.endsWith(`/`))return;let a=tV(i);a&&(TV(n,a),r.getAttribute(`data-ok-renaming`)!==a&&r.setAttribute(hV,a),SV(a),!t.hasAttribute(gV)&&(EV(t,a),t.setAttribute(gV,``)))}function SV(e){_V=e,vV!==null&&clearTimeout(vV),vV=setTimeout(CV,yV)}function CV(){_V=null,vV!==null&&(clearTimeout(vV),vV=null)}function wV(e){let t=e.querySelectorAll(`[${hV}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(hV);if(!t){e.removeAttribute(hV);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(hV);continue}let r=tV(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(hV)}if(_V===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||tV(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==_V&&e.setAttribute(hV,_V))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&CV()}function TV(e,t){let n=e.querySelector(`[${mV}]`);n||(n=e.ownerDocument.createElement(`span`),n.setAttribute(mV,``),n.setAttribute(`aria-hidden`,`true`),e.appendChild(n)),n.textContent!==t&&(n.textContent=t)}function EV(e,t){let n=e.value;if(!n.toLowerCase().endsWith(t.toLowerCase()))return;let r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;if(!r)return;let i=n.slice(0,-t.length);r.call(e,i),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.setSelectionRange(0,i.length)}function DV(e){let{focusedIndex:t,itemHeight:n,viewportHeight:r,currentScrollTop:i}=e;if(t<0)return null;let a=Math.max(0,e.topInset??0),o=t*n,s=o+n;if(o<i+a){let e=Math.max(0,o-a);return e===i?null:e}if(s>i+r){let e=s-r;return e===i?null:e}return null}function OV(e,t){let n=t.getFocusedIndex();if(n<0)return;let r=e?.querySelector(Xj)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-scroll]`);if(!r)return;let i=t.getItemHeight(),a=DV({focusedIndex:n,itemHeight:i,viewportHeight:r.clientHeight,currentScrollTop:r.scrollTop,topInset:i});a!==null&&(r.scrollTop=a)}function kV(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function AV(e,t,n={}){if(!e)return kV(t);let r=Wr(e);if(t&&r!==t)return kV(t);switch(e.kind){case`doc`:return kV(t??e.docName);case`large-file`:return kV(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?kV(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function jV(e,t){if(!e)return{kind:`none`};let n=t.find(t=>mk(t)===e);if(n&&Bn(n))return{kind:`asset`,path:n.path,hash:pi(n.path),mediaKind:n.mediaKind};let r=vk(e);return e.endsWith(`/`)?t.some(e=>ai(e)?e.path===r||e.path.startsWith(`${r}/`):(Bn(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>mr(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var MV=`You can restore this file from the Trash.`;function NV(e){let t=MV,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function PV(e,t){return e===`web`?null:NV(t)}function FV(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}var IV=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function LV(e){return typeof e==`string`&&IV.includes(e)?e:`system-error`}function RV(e){switch(e){case`not-found`:return Y._({id:`v41fCm`});case`permission-denied`:return Y._({id:`sJK6pq`});case`system-error`:return Y._({id:`Jqqevv`});case`path-escape`:return Y._({id:`WL6puM`})}}function zV(e){let t=RV(e.reason),n=e.detail;return n?Y._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Y._({id:`dTaauv`,values:{reason:t}})}function BV(e){return e.kind===`folder`?`${e.name}/`:e.name}function VV(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?BV(l):``;d=c?Y._({id:`5qNxOe`,values:{count:u}}):l?`${Y._({id:`E_BHoD`,values:{targetName:e}})}\n${zV(l)}`:Y._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(as,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(ls,{children:[p,(0,Z.jsx)(rs,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let h;t[7]!==n||t[8]!==c?(h=c?(0,Z.jsx)(ss,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(HV)})}):null,t[7]=n,t[8]=c,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=g):g=t[10];let _;t[11]!==r||t[12]!==o?(_=(0,Z.jsx)(qi,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:g}),t[11]=r,t[12]=o,t[13]=_):_=t[13];let v;t[14]===r?v=t[15]:(v=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=v);let y;t[16]!==r||t[17]!==a||t[18]!==v?(y=(0,Z.jsx)(qi,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:v}),t[16]=r,t[17]=a,t[18]=v,t[19]=y):y=t[19];let b;t[20]===r?b=t[21]:(b=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=b);let x;t[22]!==r||t[23]!==i||t[24]!==b?(x=(0,Z.jsx)(qi,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:b}),t[22]=r,t[23]=i,t[24]=b,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==_||t[28]!==y?(S=(0,Z.jsxs)(cs,{children:[_,y,x]}),t[26]=x,t[27]=_,t[28]=y,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h?(C=(0,Z.jsxs)(os,{className:`sm:max-w-md`,children:[m,h,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=C):C=t[33],C}function HV(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:BV(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:zV(e)})]},e.path)}function UV(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=To(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,c;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=Fm(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),c=n;break bb0}let l;t[16]!==i||t[17]!==r?(l=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=l):l=t[18],o=n.map(l)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=c}else o=t[9],c=t[10];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[19]===o?l=t[20]:(l=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=l),l}function WV(e){return e?.isDirectory()?e:null}function GV(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function KV(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=WV(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}GV(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}async function qV(e,t){let n={"not-found":Y._({id:`vY54W_`}),"spawn-error":Y._({id:`ktATCe`}),timeout:Y._({id:`wrzAcD`}),"path-escape":Y._({id:`kDuh1E`}),"ipc-error":Y._({id:`jjmuxV`})},r;try{r=await e.shell.openInTerminal(t)}catch(e){console.warn(`[shell] openInTerminal IPC threw`,{dirAbsPath:t,err:e}),X.error(Y._({id:`DYwdxG`}),{description:n[`ipc-error`]});return}r.ok||(console.warn(`[shell] openInTerminal failed`,{reason:r.reason,dirAbsPath:t}),X.error(Y._({id:`DYwdxG`}),{description:n[r.reason]}))}var JV=`open-knowledge:file-tree-menu-action-delete`,YV=`open-knowledge:file-tree-menu-action-rename`,XV=`open-knowledge:file-tree-menu-action-duplicate`;function ZV(e){window.dispatchEvent(new CustomEvent(JV,{detail:{target:e}}))}function QV(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(JV,t),()=>window.removeEventListener(JV,t)}function $V(e){window.dispatchEvent(new CustomEvent(YV,{detail:{target:e}}))}function eH(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(YV,t),()=>window.removeEventListener(YV,t)}function tH(e){window.dispatchEvent(new CustomEvent(XV,{detail:{target:e}}))}function nH(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(XV,t),()=>window.removeEventListener(XV,t)}function rH(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var iH={Accept:`application/x-ndjson, application/json`};function aH(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var oH=class extends Error{};function sH(e){return typeof e==`object`&&!!e&&`type`in e}async function cH(e){let t=e.body;if(!t)throw new oH(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line`),!1}if(sH(n)){if(n.type===`error`)throw new oH(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return a=n.truncated===!0,!0}let r=Ai.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1};try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
1912
1912
  `);for(;i!==-1;){let t=s(o.slice(0,i));if(o=o.slice(i+1),t){e=!0;break}i=o.indexOf(`
1913
1913
  `)}}o+=r.decode(),o.includes(`
1914
- `)||s(o),c=!0}finally{c?n.releaseLock():await n.cancel().catch(()=>{})}return{entries:i,truncated:a}}function lH(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>mk(e))),a=[];for(let e of t){let t=mk(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function uH(e){return e?Y._({id:`wTcjov`}):null}function dH(e){let t=(0,$.c)(35),{_:n}=i(),r=_h(),{merged:a}=vt(),o=a?.appearance?.preview?.autoOpen??!0;if(r)return null;let{input:c,installStates:l,dispatch:u,webFallbackVisible:d}=e,f=d===void 0?!0:d,p=c===null,m,h,g,_,v,y;if(t[0]!==n||t[1]!==o||t[2]!==u||t[3]!==c||t[4]!==p||t[5]!==l){let e=uH(p),r;t[12]===l?r=t[13]:(r=e=>l[e.id]?.installed===!0,t[12]=l,t[13]=r);let i=bh.filter(r);g=l[`claude-code`]?.installed===!0;let a;t[14]!==o||t[15]!==c?(a=c!==null&&c.docContext!==null?dr(c.docContext.relativePath,o):``,t[14]=o,t[15]=c,t[16]=a):a=t[16];let d=a,f;t[17]!==c||t[18]!==d?(f=()=>{c!==null&&zb(d)},t[17]=c,t[18]=d,t[19]=f):f=t[19],_=f,h=zo,t[20]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(aa,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[20]=y):y=t[20],m=xo,v=i.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(go,{disabled:!r,onSelect:()=>{c&&u(t.id,c)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Nb,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)}),t[0]=n,t[1]=o,t[2]=u,t[3]=c,t[4]=p,t[5]=l,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y}else m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11];let b;t[21]!==n||t[22]!==g||t[23]!==_||t[24]!==p||t[25]!==f?(b=f&&!g?(0,Z.jsxs)(go,{onSelect:_,disabled:p,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(ut,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[21]=n,t[22]=g,t[23]=_,t[24]=p,t[25]=f,t[26]=b):b=t[26];let x;t[27]!==m||t[28]!==v||t[29]!==b?(x=(0,Z.jsxs)(m,{children:[v,b]}),t[27]=m,t[28]=v,t[29]=b,t[30]=x):x=t[30];let S;return t[31]!==h||t[32]!==y||t[33]!==x?(S=(0,Z.jsxs)(h,{children:[y,x]}),t[31]=h,t[32]=y,t[33]=x,t[34]=S):S=t[34],S}var fH=G(`HOVER_INTENT_MS`,80),pH=3,mH=20,hH=new Map,gH=new Set,_H=[],vH=new Map;function yH(e){for(vH.delete(e),vH.set(e,!0);vH.size>mH;){let e=vH.keys().next().value;if(e===void 0)break;vH.delete(e)}}function bH(e){gH.delete(e),SH()}function xH(e,t){let n=Date.now();b(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),I(e,t,n)}function SH(){for(;gH.size<pH&&_H.length>0;){let e=_H.shift();if(!e)break;if(!vH.has(e.docName)){gH.add(e.docName),yH(e.docName);try{let t=e.prewarm(e.docName);t&&xH(e.docName,t)}catch(t){b(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{bH(e.docName)}}}}function CH(e,t){if(Ke(e)||vH.has(e))return;let n=hH.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(hH.delete(e),gH.size>=pH){_H.push({docName:e,prewarm:t});return}yH(e),gH.add(e);try{let n=t(e);n&&xH(e,n)}catch(t){b(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{bH(e)}},fH);hH.set(e,{timer:r,prewarm:t})}function wH(e){let t=hH.get(e);t&&(clearTimeout(t.timer),hH.delete(e))}var TH=/\.(md|mdx)$/i;function EH(e){if(window.location.hash===e)return;let{pathname:t,search:n}=window.location;window.history.replaceState(null,``,`${t}${n}${e}`)}function DH(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function OH(e){let t=e.match(TH);return t?t[0]:null}async function kH(e,t){try{await navigator.clipboard.writeText(e),X.success(t===`full`?Y._({id:`6_ZOw4`}):Y._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),X.error(t===`full`?Y._({id:`vfRlCI`}):Y._({id:`5QGTaA`}))}}var AH=new Set([`agents`,`agent`,`claude`,`skill`]),jH=`ok-file-tree-link-decoration`,MH=`ok-file-tree-agent-decoration`;function NH(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function PH(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${NH(t)}</symbol>`}var FH=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1914
+ `)||s(o)}finally{n.releaseLock()}return{entries:i,truncated:a}}function lH(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>mk(e))),a=[];for(let e of t){let t=mk(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function uH(e){return e?Y._({id:`wTcjov`}):null}function dH(e){let t=(0,$.c)(35),{_:n}=i(),r=_h(),{merged:a}=vt(),o=a?.appearance?.preview?.autoOpen??!0;if(r)return null;let{input:c,installStates:l,dispatch:u,webFallbackVisible:d}=e,f=d===void 0?!0:d,p=c===null,m,h,g,_,v,y;if(t[0]!==n||t[1]!==o||t[2]!==u||t[3]!==c||t[4]!==p||t[5]!==l){let e=uH(p),r;t[12]===l?r=t[13]:(r=e=>l[e.id]?.installed===!0,t[12]=l,t[13]=r);let i=bh.filter(r);g=l[`claude-code`]?.installed===!0;let a;t[14]!==o||t[15]!==c?(a=c!==null&&c.docContext!==null?dr(c.docContext.relativePath,o):``,t[14]=o,t[15]=c,t[16]=a):a=t[16];let d=a,f;t[17]!==c||t[18]!==d?(f=()=>{c!==null&&zb(d)},t[17]=c,t[18]=d,t[19]=f):f=t[19],_=f,h=zo,t[20]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(aa,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[20]=y):y=t[20],m=xo,v=i.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(go,{disabled:!r,onSelect:()=>{c&&u(t.id,c)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Nb,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)}),t[0]=n,t[1]=o,t[2]=u,t[3]=c,t[4]=p,t[5]=l,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=v,t[11]=y}else m=t[6],h=t[7],g=t[8],_=t[9],v=t[10],y=t[11];let b;t[21]!==n||t[22]!==g||t[23]!==_||t[24]!==p||t[25]!==f?(b=f&&!g?(0,Z.jsxs)(go,{onSelect:_,disabled:p,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(ut,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[21]=n,t[22]=g,t[23]=_,t[24]=p,t[25]=f,t[26]=b):b=t[26];let x;t[27]!==m||t[28]!==v||t[29]!==b?(x=(0,Z.jsxs)(m,{children:[v,b]}),t[27]=m,t[28]=v,t[29]=b,t[30]=x):x=t[30];let S;return t[31]!==h||t[32]!==y||t[33]!==x?(S=(0,Z.jsxs)(h,{children:[y,x]}),t[31]=h,t[32]=y,t[33]=x,t[34]=S):S=t[34],S}var fH=G(`HOVER_INTENT_MS`,80),pH=3,mH=20,hH=new Map,gH=new Set,_H=[],vH=new Map;function yH(e){for(vH.delete(e),vH.set(e,!0);vH.size>mH;){let e=vH.keys().next().value;if(e===void 0)break;vH.delete(e)}}function bH(e){gH.delete(e),SH()}function xH(e,t){let n=Date.now();b(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),I(e,t,n)}function SH(){for(;gH.size<pH&&_H.length>0;){let e=_H.shift();if(!e)break;if(!vH.has(e.docName)){gH.add(e.docName),yH(e.docName);try{let t=e.prewarm(e.docName);t&&xH(e.docName,t)}catch(t){b(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{bH(e.docName)}}}}function CH(e,t){if(Ke(e)||vH.has(e))return;let n=hH.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(hH.delete(e),gH.size>=pH){_H.push({docName:e,prewarm:t});return}yH(e),gH.add(e);try{let n=t(e);n&&xH(e,n)}catch(t){b(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{bH(e)}},fH);hH.set(e,{timer:r,prewarm:t})}function wH(e){let t=hH.get(e);t&&(clearTimeout(t.timer),hH.delete(e))}var TH=/\.(md|mdx)$/i;function EH(e){if(window.location.hash===e)return;let{pathname:t,search:n}=window.location;window.history.replaceState(null,``,`${t}${n}${e}`)}function DH(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function OH(e){let t=e.match(TH);return t?t[0]:null}async function kH(e,t){try{await navigator.clipboard.writeText(e),X.success(t===`full`?Y._({id:`6_ZOw4`}):Y._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),X.error(t===`full`?Y._({id:`vfRlCI`}):Y._({id:`5QGTaA`}))}}var AH=new Set([`agents`,`agent`,`claude`,`skill`]),jH=`ok-file-tree-link-decoration`,MH=`ok-file-tree-agent-decoration`;function NH(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function PH(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${NH(t)}</symbol>`}var FH=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1915
1915
  ${PH(jH,Te)}
1916
1916
  ${PH(MH,bc)}
1917
- </svg>`,IH=`${oV}\n${bV}`;function LH(e){return{..._M({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-file-icon-color-image":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`}}function RH(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&AH.has(t)}function zH(e){return e===`darwin`?Y._({id:`LtSYdi`}):e===`win32`?Y._({id:`qi1F96`}):Y._({id:`hz7n6T`})}function BH(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:a}=e,{_:o}=i(),s=typeof window<`u`?window.okDesktop:void 0;if(!s)return null;let c=s.platform,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=zH(c),t[0]=l):l=t[0];let u=l,d,f;t[1]!==o||t[2]!==r?(d=r?null:o({id:`wTcjov`}),f=o(c===`darwin`?d?{id:`FvpFSZ`,values:{hint:d}}:{id:`LtSYdi`}:c===`win32`?d?{id:`o4dcAf`,values:{hint:d}}:{id:`qi1F96`}:d?{id:`ScUTHW`,values:{hint:d}}:{id:`hz7n6T`}),t[1]=o,t[2]=r,t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=f,m=!r,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=()=>{if(!r)return;a();let e=Xh(r.contentDir,Ok(n),r.pathSeparator);s.shell.showItemInFolder(e)},t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(je,{"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{className:`flex-1`,children:u}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===d?v=t[12]:(v=d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null,t[11]=d,t[12]=v);let y;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(go,{disabled:m,onSelect:h,"aria-label":p,children:[g,_,v]}),t[13]=p,t[14]=m,t[15]=h,t[16]=v,t[17]=y):y=t[17],y}function VH(e){let t=(0,$.c)(21),{dirAbsPath:n,onClose:r}=e,{_:a}=i(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let c,l,u,d,f;t[0]!==a||t[1]!==n||t[2]!==r?(l=n===null?a({id:`wTcjov`}):null,c=go,u=n===null,t[8]!==n||t[9]!==r?(d=()=>{n!==null&&(r(),qV(o,n))},t[8]=n,t[9]=r,t[10]=d):d=t[10],f=a(l?{id:`ehLu5O`,values:{hint:l}}:{id:`BJpGCq`}),t[0]=a,t[1]=n,t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d,t[7]=f):(c=t[3],l=t[4],u=t[5],d=t[6],f=t[7]);let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Sl,{"aria-hidden":`true`}),t[11]=p):p=t[11];let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`BJpGCq`})}),t[12]=m):m=t[12];let h;t[13]===l?h=t[14]:(h=l?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null,t[13]=l,t[14]=h);let g;return t[15]!==c||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==h?(g=(0,Z.jsxs)(c,{disabled:u,onSelect:d,"aria-label":f,children:[p,m,h]}),t[15]=c,t[16]=u,t[17]=d,t[18]=f,t[19]=h,t[20]=g):g=t[20],g}function HH(e,t){return Dk({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function UH(e,t){return e!==t&&e.startsWith(t)}function WH(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>UH(e,t))).map(e=>HH(e,t))}function GH(e,t){return e===t||e.startsWith(`${t}/`)}function KH(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function qH(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)mr(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):Bn(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=gk(e);GH(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function JH(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:GH(t.createdPath,e.path)}function YH(e){let t=(0,$.c)(84),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:u,projectLocalBinding:d,mergedConfig:f,onStartCreating:p,onCreateFromTemplate:m,onDuplicate:h,onDelete:g,onExpandSubtree:_,onCollapseSubtree:v,folderTreePaths:y,isAsset:b,documents:x}=e,{_:S}=i(),C,w,T,E,D,O,k,A,j,M;if(t[0]!==S||t[1]!==x||t[2]!==n||t[3]!==f?.appearance?.sidebar?.showAllFiles||t[4]!==f?.appearance?.sidebar?.showHiddenFiles||t[5]!==l||t[6]!==u||t[7]!==d){M=Dk(n,x),D=n.kind===`directory`,O=M.kind===`asset`?null:M,C=O!==null&&u!==null;let e;t[18]!==S||t[19]!==D?(e=S(D?{id:`5D3Ior`}:{id:`dbhUX1`}),t[18]=S,t[19]=D,t[20]=e):e=t[20],E=e,A=f?.appearance?.sidebar?.showHiddenFiles??!1,k=f?.appearance?.sidebar?.showAllFiles??!1,w=d!==null;let r=l.getSelectedPaths(),i=r.includes(M.treePath)?WH(r,x):[];T=i.length>1?i:[M];let a=T.length;j=Y._({id:`44_vJP`,values:{deleteCount:a}}),t[0]=S,t[1]=x,t[2]=n,t[3]=f?.appearance?.sidebar?.showAllFiles,t[4]=f?.appearance?.sidebar?.showHiddenFiles,t[5]=l,t[6]=u,t[7]=d,t[8]=C,t[9]=w,t[10]=T,t[11]=E,t[12]=D,t[13]=O,t[14]=k,t[15]=A,t[16]=j,t[17]=M}else C=t[8],w=t[9],T=t[10],E=t[11],D=t[12],O=t[13],k=t[14],A=t[15],j=t[16],M=t[17];let N=j,P;t[21]!==D||t[22]!==n||t[23]!==o?(P=D&&o?Xh(o.contentDir,Ok(n),o.pathSeparator):null,t[21]=D,t[22]=n,t[23]=o,t[24]=P):P=t[24];let F=P,I;if(t[25]!==D||t[26]!==n||t[27]!==o){bb0:{if(!o||D){I=null;break bb0}let e=Ok(n),t=e.lastIndexOf(`/`);if(t===-1){I=o.contentDir;break bb0}I=Xh(o.contentDir,e.slice(0,t),o.pathSeparator)}t[25]=D,t[26]=n,t[27]=o,t[28]=I}else I=t[28];let L=I,z;t[29]!==b||t[30]!==D||t[31]!==n||t[32]!==o?(z=b?null:D?eg({folderRelativePath:Ok(n),workspace:o}):Qh({docName:pk(n.path),workspace:o}),t[29]=b,t[30]=D,t[31]=n,t[32]=o,t[33]=z):z=t[33];let B=z,V;t[34]===r?V=t[35]:(V=()=>r.close({restoreFocus:!1}),t[34]=r,t[35]=V);let H=V,U;t[36]===r?U=t[37]:(U=()=>r.close(),t[36]=r,t[37]=U);let W=U,G;t[38]!==S||t[39]!==d?(G=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,qr(t.error)),X.error(S({id:`P47EWZ`}),{description:qr(t.error)}))},t[38]=S,t[39]=d,t[40]=G):G=t[40];let ee=G,K;t[41]!==S||t[42]!==d?(K=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,qr(t.error)),X.error(S({id:`P47EWZ`}),{description:qr(t.error)}))},t[41]=S,t[42]=d,t[43]=K):K=t[43];let te=K,ne=0,q=0;if(D){let e=_k(n.path);for(let t of y)(t===e||t.startsWith(e))&&(ne++,WV(l.getItem(t))?.isExpanded()&&q++)}let re=D&&q<ne,ie=D&&q>0,ae;t[44]===W?ae=t[45]:(ae=e=>{e||W()},t[44]=W,t[45]=ae);let oe;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[46]=oe):oe=t[46];let se;t[47]!==S||t[48]!==a||t[49]!==C||t[50]!==w||t[51]!==W||t[52]!==H||t[53]!==N||t[54]!==T||t[55]!==F||t[56]!==te||t[57]!==ee||t[58]!==c||t[59]!==B||t[60]!==E||t[61]!==b||t[62]!==D||t[63]!==n||t[64]!==l||t[65]!==u||t[66]!==O||t[67]!==v||t[68]!==m||t[69]!==g||t[70]!==h||t[71]!==_||t[72]!==p||t[73]!==L||t[74]!==k||t[75]!==A||t[76]!==ie||t[77]!==re||t[78]!==M||t[79]!==o?(se=(0,Z.jsx)(ua,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{H(),p(`file`,gk(n.path))},children:[(0,Z.jsx)(_l,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`MW64zN`})]}),(0,Z.jsxs)(zo,{children:[(0,Z.jsxs)(uo,{disabled:a,children:[(0,Z.jsx)(bo,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(xo,{children:(0,Z.jsx)(UV,{parentDir:gk(n.path),onSelectTemplate:e=>{H(),m(gk(n.path),e)},ItemComponent:go})})]}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{H(),p(`folder`,gk(n.path))},children:[(0,Z.jsx)(Rc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`tX5yOZ`})]}),(0,Z.jsx)(Ao,{}),(0,Z.jsx)(BH,{item:n,workspace:o,onClose:W}),(0,Z.jsx)(dH,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!1}),(0,Z.jsx)(VH,{dirAbsPath:F,onClose:W}),(0,Z.jsxs)(zo,{children:[(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(Vt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(xo,{children:[(0,Z.jsx)(go,{disabled:!o,onSelect:()=>{o&&(W(),kH(Xh(o.contentDir,Ok(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(go,{onSelect:()=>{W(),kH(Ok(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(Ao,{}),(0,Z.jsx)(Ua,{checked:A,onCheckedChange:ee,disabled:!w,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`K_wz1u`})}),(0,Z.jsx)(Ua,{checked:k,onCheckedChange:te,disabled:!w,"data-testid":`file-tree-menu-show-all-files`,children:(0,Z.jsx)(s,{id:`i8dKs-`})}),re||ie?(0,Z.jsx)(Ao,{}):null,re?(0,Z.jsxs)(go,{onSelect:()=>{W(),_(n.path)},children:[(0,Z.jsx)(Tl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}):null,ie?(0,Z.jsxs)(go,{onSelect:()=>{W(),v(n.path)},children:[(0,Z.jsx)(Ic,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]}):null,(0,Z.jsx)(Ao,{}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{M.kind!==`asset`&&(W(),h(M))},children:[(0,Z.jsx)(Ve,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(_e,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)(go,{"data-testid":`file-tree-menu-hide`,disabled:!C,onSelect:()=>{if(!u||!O)return;W();let e=pV(O),t=Wo(u.current()),n=jo(t,e);if(n===t)return;u.patch(Po(n));let r=O.path.split(`/`).pop()||O.path;X.success(S({id:`4xtLTl`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Re,{"aria-hidden":`true`}),E]}),(0,Z.jsxs)(go,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(T)},children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),N]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(BH,{item:n,workspace:o,onClose:W}),!b&&(0,Z.jsx)(dH,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!0}),(0,Z.jsx)(VH,{dirAbsPath:L,onClose:W}),(0,Z.jsxs)(zo,{children:[(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(Vt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(xo,{children:[(0,Z.jsx)(go,{disabled:!o,onSelect:()=>{o&&(W(),kH(Xh(o.contentDir,Ok(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(go,{onSelect:()=>{W(),kH(Ok(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(Ao,{}),b?null:(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{W(),h(M)},children:[(0,Z.jsx)(Ve,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(_e,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),O?(0,Z.jsxs)(go,{"data-testid":`file-tree-menu-hide`,disabled:!C,onSelect:()=>{if(!u)return;W();let e=pV(O),t=Wo(u.current()),n=jo(t,e);if(n===t)return;u.patch(Po(n));let r=O.path.split(`/`).pop()||O.path;X.success(S({id:`OD0FCX`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Re,{"aria-hidden":`true`}),E]}):null,(0,Z.jsxs)(go,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(T)},children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),N]})]})}),t[47]=S,t[48]=a,t[49]=C,t[50]=w,t[51]=W,t[52]=H,t[53]=N,t[54]=T,t[55]=F,t[56]=te,t[57]=ee,t[58]=c,t[59]=B,t[60]=E,t[61]=b,t[62]=D,t[63]=n,t[64]=l,t[65]=u,t[66]=O,t[67]=v,t[68]=m,t[69]=g,t[70]=h,t[71]=_,t[72]=p,t[73]=L,t[74]=k,t[75]=A,t[76]=ie,t[77]=re,t[78]=M,t[79]=o,t[80]=se):se=t[80];let ce;return t[81]!==se||t[82]!==ae?(ce=(0,Z.jsxs)(oo,{open:!0,modal:!1,onOpenChange:ae,children:[oe,se]}),t[81]=se,t[82]=ae,t[83]=ce):ce=t[83],ce}function XH(e){let t=(0,$.c)(280),{ref:n}=e,{_:r}=i(),{activeDocName:a,activeTarget:o,closeTabs:c,closeDocument:l,closeAndClearForRename:u,getPoolActiveDocName:d,poolHas:f,isNewTabActive:p,openTarget:m,prewarm:h,remapTabsForRename:g}=ht(),{notifySidebarFileSelected:_}=OO(),{resolvedTheme:v}=Jn(),{addPage:y,pageMeta:b}=wi(),x;t[0]===b?x=t[1]:(x=function(e,t){return mi(e,t??b.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=b,t[1]=x);let S=x,C;t[2]!==S||t[3]!==_||t[4]!==m?(C=function(e,t){m(S(e,t),{tabBehavior:`replace-active`}),EH(xi(e)),_()},t[2]=S,t[3]=_,t[4]=m,t[5]=C):C=t[5];let w=C,T;t[6]!==_||t[7]!==m?(T=function(e){let t=Hr(e);m({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),EH(t),_()},t[6]=_,t[7]=m,t[8]=T):T=t[8];let E=T,D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[9]=D):D=t[9];let[O,k]=(0,Q.useState)(D),[A,j]=(0,Q.useState)(!0),[M,N]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),{conflicts:U}=qa(),[W,G]=(0,Q.useState)(null),[ee,K]=(0,Q.useState)(null),te=(0,Q.useRef)(O),ne;t[10]!==O||t[11]!==E||t[12]!==w||t[13]!==_||t[14]!==m?(ne=function(e,t){let n=t===void 0?O:t,r=jV(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,vk(e));return}if(r.kind===`asset`){m({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),EH(r.hash),_();return}if(r.kind===`folder`){E(r.path);return}let i=n.find(e=>mr(e)&&e.docName===r.path);w(r.path,i?.size)},t[10]=O,t[11]=E,t[12]=w,t[13]=_,t[14]=m,t[15]=ne):ne=t[15];let q=ne,re;t[16]!==_||t[17]!==m?(re=function(e){m({kind:`asset`,target:e,assetPath:e,mediaKind:te.current.find(t=>Bn(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),EH(pi(e)),_()},t[16]=_,t[17]=m,t[18]=re):re=t[18];let ie=re,ae=(0,Q.useRef)(a),oe;t[19]===O?oe=t[20]:(oe=new Set(O.filter(Bn).map(bU)),t[19]=O,t[20]=oe);let se=oe,ce=(0,Q.useRef)(se),le;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(le=[],t[21]=le):le=t[21];let ue=(0,Q.useRef)(le),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(yU),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=(0,Q.useRef)(!1),ge=(0,Q.useRef)(null),_e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_e=new Map,t[22]=_e):_e=t[22];let ve=(0,Q.useRef)(_e),ye=(0,Q.useRef)(!1),be=(0,Q.useRef)(!1),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(null),Ce=(0,Q.useRef)(vU),we=(0,Q.useRef)(_U),Te=(0,Q.useRef)(gU),Ee=(0,Q.useRef)(hU),De=(0,Q.useRef)(o),{selectedFilePath:Oe,selectedFolderPath:ke,navigationPath:Ae}=AV(o,p?null:a),je=Oe?fk(Oe,O.find(e=>mr(e)&&e.docName===Oe)?.docExt):ke?_k(ke):o?.kind===`asset`?o.assetPath:null,Me=Cg().states,{dispatch:Ne}=fg(),Pe;t[23]!==Ne||t[24]!==Me?(Pe={installStates:Me,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Ne},t[23]=Ne,t[24]=Me,t[25]=Pe):Pe=t[25];let Fe=Pe,{okignoreBinding:Ie,projectLocalBinding:Le,merged:Re}=vt(),ze=Re?.appearance?.sidebar?.showHiddenFiles??!1,Be=Re?.appearance?.sidebar?.showAllFiles??!1,Ve;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=()=>ge.current===null,t[26]=Ve):Ve=t[26];let He=Ve,Ue;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=[],t[27]=Ue):Ue=t[27];let We;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(We={set:`complete`,spriteSheet:FH},t[28]=We):We=t[28];let Ge;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Ge={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[29]=Ge):Ge=t[29];let Ke;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ke={canDrag:He,canDrop:He,onDropComplete:e=>Ee.current(e),onDropError:mU},t[30]=Ke):Ke=t[30];let qe,Je;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(qe={canRename:He,onRename:e=>we.current(e),onError:e=>Te.current(e)},Je=e=>Ce.current(e),t[31]=qe,t[32]=Je):(qe=t[31],Je=t[32]);let Ye;t[33]===r?Ye=t[34]:(Ye={paths:Ue,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:We,unsafeCSS:IH,composition:Ge,dragAndDrop:Ke,renaming:qe,onSelectionChange:Je,renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=te.current.find(e=>mr(e)&&fk(e.docName,e.docExt)===t.path);if(n?.isSymlink){let e=n.targetPath;return{icon:jH,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return RH(t.path)?{icon:MH,title:r({id:`i9toLO`})}:null}},t[33]=r,t[34]=Ye);let{model:J}=eV(Ye),Xe;t[35]===J?Xe=t[36]:(Xe=function(e){let t=J.getItem(e)??J.getItem(_k(e));return t?.isDirectory()?_k(gk(t.getPath())):e},t[35]=J,t[36]=Xe);let Ze=Xe,Qe,$e;t[37]===O?(Qe=t[38],$e=t[39]):($e=yk(O),Qe=bk($e),t[37]=O,t[38]=Qe,t[39]=$e);let et=Qe,tt=(0,Q.useRef)($e),nt;t[40]===O?nt=t[41]:(nt=Sk(O),t[40]=O,t[41]=nt);let rt=nt,it=(0,Q.useRef)(rt),at=ke?Ck(_k(ke)).slice(0,-1):Ck(je??Ae),ot=at.join(`\0`),st;if(t[42]!==J){let e=()=>{let e=new Set;for(let t of it.current)WV(J.getItem(t))?.isExpanded()&&e.add(t);return e};st=t=>{let n=new Set(Sk(t??te.current)),r=e();for(let e of ue.current)r.add(e);return[...r].filter(e=>n.has(e))},t[42]=J,t[43]=st}else st=t[43];let ct=st,lt;t[44]!==ct||t[45]!==J?(lt=e=>{let t=yk(e??te.current);J.resetPaths(t,{initialExpandedPaths:ct(e)})},t[44]=ct,t[45]=J,t[46]=lt):lt=t[46];let ut=lt,dt;t[47]!==J||t[48]!==ut?(dt=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:t,toDocName:r}of n){let n=e.find(e=>mr(e)&&e.docName===t);if(n==null||J.getItem(r)==null)continue;let i=fk(r,n.docExt);J.move(r,i),o=i,a+=1}for(let{toPath:e}of i){let t=tV(e);if(t===``)continue;let n=e.slice(0,-t.length);J.getItem(n)!=null&&(J.getItem(e)??J.move(n,e),o=e,a+=1)}a!==0&&(ut(t),o!=null&&J.focusPath(o))},t[47]=J,t[48]=ut,t[49]=dt):dt=t[49];let ft=dt,pt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(pt=e=>{pe.current=xk(e)},t[50]=pt):pt=t[50];let mt=pt,gt;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(gt=e=>ce.current.has(e),t[51]=gt):gt=t[51];let _t=gt,yt;t[52]!==r||t[53]!==y||t[54]!==E||t[55]!==w||t[56]!==ut?(yt=async function(e){if(e.kind===`asset`||ge.current!==null)return;let t=()=>{R(null),ge.current=null};ge.current=e.path,R(e.path),N(null);try{let n=await Et(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){X.error(n.title),ut(),t();return}let i=P(Wn,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});X.error(e),N(e),Pi([`files`,`backlinks`,`graph`]),ut(),t();return}for(let e of i.duplicatedDocNames)y(e);k(t=>{let n=Vk(t,e,i);return ut(n),mt(n),n}),Pi([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?E(i.path):w(i.path)),X.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),X.error(r({id:`EBVbtP`}),{description:i}),ut(),t()}},t[52]=r,t[53]=y,t[54]=E,t[55]=w,t[56]=ut,t[57]=yt):yt=t[57];let bt=yt,xt=(0,Q.useRef)(bt),St;t[58]===bt?St=t[59]:(St=()=>{xt.current=bt},t[58]=bt,t[59]=St),(0,Q.useEffect)(St);let Ct=function(e){let t=DH(e);if(!t||OH(t))return!1;let n=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||_t(n))return!1;let r=OH(n);if(!r)return!1;let i=_k(t);if(!it.current.includes(i))return!1;let a=`${t}${r}`;return tt.current.includes(a)?!1:(en({sourcePath:n,destinationPath:a,isFolder:!1}),J.move(n,a),!0)},wt;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(wt=e=>{let t=e??de.current;!t||de.current!==t||(t.disposeCommitListener(),de.current=null)},t[60]=wt):wt=t[60];let Tt=wt,Dt;t[61]!==r||t[62]!==Tt||t[63]!==l||t[64]!==c||t[65]!==ut?(Dt=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;Tt(e),i&&R(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await Et(t,r({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=r({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});i?X.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(R(null),ut());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;X.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(R(null),ut());return}i&&(e.kind===`file`?l(e.createdPath):c([Qt(e.createdPath)],{force:!0})),i&&k(t=>{let n=zk(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return mt(n),n}),Pi([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&R(null)},t[61]=r,t[62]=Tt,t[63]=l,t[64]=c,t[65]=ut,t[66]=Dt):Dt=t[66];let Ot=Dt,kt,At;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(kt=()=>()=>{let e=de.current;e&&fe.current(e,{restoreLocation:!1,updateUi:!1}).catch(pU)},At=[],t[67]=kt,t[68]=At):(kt=t[67],At=t[68]),(0,Q.useEffect)(kt,At);let jt,Mt;t[69]===r?(jt=t[70],Mt=t[71]):(jt=()=>{let e=!0,t=null,n=rH(async function(){t?.abort();let n=new AbortController;t=n;try{let t=be.current,i=await fetch(t?`/api/documents?showAll=true`:`/api/documents`,{signal:n.signal,headers:t?iH:void 0});if(t&&aH(i)){let{entries:n,truncated:r}=await cH(i);if(!e)return;k(lH(Un(n,ye.current||t),te.current,ve.current)),N(null),I(r?n.length:null)}else{let n=await Et(i,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)N(n.title),I(null);else{let e=Cr.safeParse(n.body);if(!e.success)N(r({id:`HlmZBk`})),I(null);else{let n=ye.current||t;k(lH(Un(e.data.documents,n),te.current,ve.current)),N(null),I(t&&e.data.truncated===!0?e.data.documents.length:null)}}}}catch(t){let n=t;if(n instanceof DOMException&&n.name===`AbortError`)return;e&&(N(r({id:`34qyH5`})),I(null)),console.warn(`[FileTree] fetch failed:`,n)}e&&j(!1)},()=>t?.abort());xe.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=ji(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,xe.current=null,n.dispose(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},Mt=[r],t[69]=r,t[70]=jt,t[71]=Mt),(0,Q.useEffect)(jt,Mt);let Nt=(0,Q.useRef)(!0),Pt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=()=>{if(Nt.current){Nt.current=!1;return}xe.current?.()},t[72]=Pt):Pt=t[72];let Ft;t[73]===ze?Ft=t[74]:(Ft=[ze],t[73]=ze,t[74]=Ft),(0,Q.useEffect)(Pt,Ft);let It=(0,Q.useRef)(!0),Lt;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=()=>{if(It.current){It.current=!1;return}xe.current?.()},t[75]=Lt):Lt=t[75];let Rt;t[76]===Be?Rt=t[77]:(Rt=[Be],t[76]=Be,t[77]=Rt),(0,Q.useEffect)(Lt,Rt);let zt,Bt;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(zt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=P(Zr,n,`workspace`,null);r&&K({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(fU),()=>{e=!1}},Bt=[],t[78]=zt,t[79]=Bt):(zt=t[78],Bt=t[79]),(0,Q.useEffect)(zt,Bt);let Vt;t[80]!==ct||t[81]!==J||t[82]!==et?(Vt=()=>{if(pe.current===et){pe.current=null;return}J.resetPaths(tt.current,{initialExpandedPaths:ct()})},t[80]=ct,t[81]=J,t[82]=et,t[83]=Vt):Vt=t[83];let Ht;t[84]!==J||t[85]!==et?(Ht=[J,et],t[84]=J,t[85]=et,t[86]=Ht):Ht=t[86],(0,Q.useEffect)(Vt,Ht),KV(J,je,ot,he,et);let Ut;t[87]!==je||t[88]!==A||t[89]!==J?(Ut=()=>{A||!je||OV(Se.current,J)},t[87]=je,t[88]=A,t[89]=J,t[90]=Ut):Ut=t[90];let Wt;t[91]!==ot||t[92]!==je||t[93]!==A||t[94]!==J||t[95]!==et?(Wt=[je,ot,et,A,J],t[91]=ot,t[92]=je,t[93]=A,t[94]=J,t[95]=et,t[96]=Wt):Wt=t[96],(0,Q.useEffect)(Ut,Wt);let Gt,Kt;t[97]===J?(Gt=t[98],Kt=t[99]):(Gt=()=>J.subscribe(()=>{if(!J.isSearchOpen())for(let e of ue.current){let t=WV(J.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Kt=[J],t[97]=J,t[98]=Gt,t[99]=Kt),(0,Q.useEffect)(Gt,Kt);let Jt,Xt;t[100]===J?(Jt=t[101],Xt=t[102]):(Jt=()=>J.onMutation(`remove`,e=>{let t=de.current;!t||e.path!==t.renamePath||fe.current(t)}),Xt=[J],t[100]=J,t[101]=Jt,t[102]=Xt),(0,Q.useEffect)(Jt,Xt);let Zt;t[103]!==y||t[104]!==u||t[105]!==d||t[106]!==ie||t[107]!==E||t[108]!==f||t[109]!==ft||t[110]!==g?(Zt=async(e,t,n,r)=>{let i=t===void 0?[]:t,a=n===void 0?[]:n,o=r?.docName??ae.current,s=Hk(o,e),c=r?.folderPath??(De.current?.kind===`folder`?De.current.folderPath:null),l=c?Yt(c,i):null,p=r?.assetPath??(De.current?.kind===`asset`?De.current.assetPath:null),m=p?a.find(e=>e.fromPath===p)?.toPath??Yt(p,i):null;qt(e);let h=Uk(e,d(),f);await Promise.all(h.map(e=>u(e)));for(let t of e)y(t.toDocName);g(e,i,a),k(t=>{let n=Rk(t,e,i,a);return ft(t,n,e,a),mt(n),n}),c&&l&&l!==c?E(l):s&&s!==o?window.location.hash=xi(s):p&&m&&m!==p&&ie(m),Pi([`files`,`backlinks`,`graph`])},t[103]=y,t[104]=u,t[105]=d,t[106]=ie,t[107]=E,t[108]=f,t[109]=ft,t[110]=g,t[111]=Zt):Zt=t[111];let $t=Zt;async function en(e){let t=!e.isFolder&&_t(e.sourcePath),n=t?e.sourcePath:kk(e.sourcePath,e.isFolder);R(n),N(null);try{let i=rV(e.sourcePath,e.destinationPath,e.isFolder,t);if(i.kind===`block`){X.error(r({id:`FaBZwp`})),queueMicrotask(()=>{ut()}),Tt(),R(null);return}let a=t?i.destinationPath:kk(i.destinationPath,e.isFolder),o=e.isFolder?{kind:`folder`,fromPath:gk(n),toPath:gk(a)}:t?{kind:`asset`,fromPath:n,toPath:a}:{kind:`file`,fromPath:pk(n),toPath:pk(a)},s={docName:ae.current,folderPath:De.current?.kind===`folder`?De.current.folderPath:null,assetPath:De.current?.kind===`asset`?De.current.assetPath:null},c=await Et(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o)}),r({id:`gijbne`}));if(!c.ok){X.error(c.title),ut();let e=de.current;e&&e.renamePath===n?await Ot(e):Tt(),R(null);return}let l=P(Kr,c.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await $t(l.renamed,e.isFolder?[{fromPath:gk(n),toPath:gk(a)}]:[],l.renamedAssets,s)}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:a,renamedCount:l.renamed.length,renamedAssetCount:l.renamedAssets.length}),X.error(r({id:`dDpCOp`}))}Tt(),R(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});X.error(t),N(t),ut();let i=de.current;i&&i.renamePath===n?await Ot(i):Tt(),R(null)}}let tn;t[112]!==r||t[113]!==$t||t[114]!==ut?(tn=async function(e){let t=e.draggedPaths.map(t=>{let n=Mk(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(dU);if(t.length!==0){R(t[0]?.sourcePath??null),N(null);try{let e=[],n=[],i=[],a={docName:ae.current,folderPath:De.current?.kind===`folder`?De.current.folderPath:null,assetPath:De.current?.kind===`asset`?De.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&_t(a.sourcePath),s=t?{kind:`folder`,fromPath:gk(a.sourcePath),toPath:gk(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:pk(a.sourcePath),toPath:pk(a.destinationTreePath)},c=await Et(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){X.error(c.title),ut(),R(null);return}let l=P(Kr,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:gk(a.sourcePath),toPath:gk(a.destinationTreePath)})}try{await $t(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),X.error(r({id:`8OxKZy`}))}R(null)}catch(e){console.warn(`[FileTree] move failed:`,e),X.error(r({id:`HIb0vl`})),ut(),R(null)}}},t[112]=r,t[113]=$t,t[114]=ut,t[115]=tn):tn=t[115];let nn=tn,rn;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(rn=function(e){G({parentDir:e})},t[116]=rn):rn=t[116];let an=rn,on;t[117]!==r||t[118]!==y||t[119]!==Ot||t[120]!==Tt||t[121]!==J||t[122]!==E||t[123]!==w||t[124]!==ut||t[125]!==$e?(on=async function(e,t,n){if(ge.current)return;let i=de.current;i&&Tt(i);try{let i=Ak(e,t,[...$e,...it.current]);R(i.renamePath),ge.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=jk(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await Et(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){X.error(a.title),R(null),ge.current=null;return}let s=pk(e),c=P(Vr,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};y(c),k(e=>{if(e.some(e=>mr(e)&&e.docName===c))return e;let t=[...e,l];return mt(t),ve.current.set(mk(l),Date.now()),t}),Pi([`files`,`backlinks`,`graph`]),w(c)}else{let e=gk(i.addPath),t=await Et(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){X.error(t.title),R(null),ge.current=null;return}o=P(Ii,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};k(e=>{if(e.some(e=>ai(e)&&e.path===o))return e;let t=[...e,n];return mt(t),ve.current.set(mk(n),Date.now()),t}),Pi([`files`]),E(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=de.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>Tt(t))};document.addEventListener(`keydown`,c,!0),de.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},R(null),ge.current=null,J.add(i.addPath),J.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),X.error(r({id:`S6l5dv`}));let t=de.current;t?await Ot(t):Tt(),R(null),ge.current=null,ut()}},t[117]=r,t[118]=y,t[119]=Ot,t[120]=Tt,t[121]=J,t[122]=E,t[123]=w,t[124]=ut,t[125]=$e,t[126]=on):on=t[126];let sn=on,cn;t[127]===J?cn=t[128]:(cn=function(e){let t=_k(e);(0,Q.startTransition)(()=>{for(let e of it.current)if(e===t||e.startsWith(t)){let t=WV(J.getItem(e));t&&t.expand()}})},t[127]=J,t[128]=cn);let ln=cn,un;t[129]===J?un=t[130]:(un=function(e){let t=_k(e),n=new Set(ue.current);(0,Q.startTransition)(()=>{for(let e of[...it.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=WV(J.getItem(e));t&&t.collapse()}})},t[129]=J,t[130]=un);let dn=un,fn;t[131]!==q||t[132]!==at||t[133]!==a||t[134]!==o||t[135]!==se||t[136]!==L||t[137]!==Ot||t[138]!==O||t[139]!==rt||t[140]!==nn||t[141]!==en||t[142]!==Ze||t[143]!==Ct||t[144]!==Be||t[145]!==ze||t[146]!==$e?(fn=()=>{te.current=O,ae.current=a,De.current=o,ce.current=se,ge.current=L,ye.current=ze,be.current=Be,tt.current=$e,it.current=rt,ue.current=at,fe.current=Ot,Ce.current=e=>{if(he.current||e.length!==1)return;let t=e[0];t&&q(Ze(t),O)},Te.current=e=>{Ct(e)||X.error(e)},we.current=en,Ee.current=nn},t[131]=q,t[132]=at,t[133]=a,t[134]=o,t[135]=se,t[136]=L,t[137]=Ot,t[138]=O,t[139]=rt,t[140]=nn,t[141]=en,t[142]=Ze,t[143]=Ct,t[144]=Be,t[145]=ze,t[146]=$e,t[147]=fn):fn=t[147],(0,Q.useLayoutEffect)(fn);let pn,mn;t[148]===J?(pn=t[149],mn=t[150]):(pn=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||KH(e.target))return;let a=Se.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!t)return;let n=J.getItem(t)??J.getItem(_k(t)),r=n?.isDirectory()?_k(gk(n.getPath())):t;if(ce.current.has(r))return;xt.current(HH(r,te.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...it.current,...tt.current]);he.current=!0;for(let e of u)e&&J.getItem(e)?.select();queueMicrotask(()=>{he.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},mn=[J],t[148]=J,t[149]=pn,t[150]=mn),(0,Q.useEffect)(pn,mn);let hn,gn;t[151]!==O.length||t[152]!==A?(hn=()=>{if(A||O.length===0)return;let e=Se.current?.querySelector(Xj)?.shadowRoot;if(!e)return;let t=uU,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},gn=[A,O.length],t[151]=O.length,t[152]=A,t[153]=hn,t[154]=gn):(hn=t[153],gn=t[154]),(0,Q.useEffect)(hn,gn);let _n,vn;t[155]!==O.length||t[156]!==A?(_n=()=>{if(A||O.length===0)return;let e=Se.current?.querySelector(Xj)?.shadowRoot;if(!e)return;let t=()=>sV(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},vn=[A,O.length],t[155]=O.length,t[156]=A,t[157]=_n,t[158]=vn):(_n=t[157],vn=t[158]),(0,Q.useEffect)(_n,vn);let yn,bn;t[159]!==O.length||t[160]!==A?(yn=()=>{if(A||O.length===0)return;let e=Se.current?.querySelector(Xj)?.shadowRoot;if(!e)return;let t=()=>xV(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},bn=[A,O.length],t[159]=O.length,t[160]=A,t[161]=yn,t[162]=bn):(yn=t[161],bn=t[162]),(0,Q.useEffect)(yn,bn);let xn;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(xn={folderCount:0,expandedCount:0},t[163]=xn):xn=t[163];let Sn=(0,Q.useRef)(xn),Cn=(0,Q.useRef)(sn),wn=(0,Q.useRef)(an),Tn;t[164]===sn?Tn=t[165]:(Tn=()=>{Cn.current=sn,wn.current=an},t[164]=sn,t[165]=Tn),(0,Q.useEffect)(Tn);let En,Dn;t[166]===J?(En=t[167],Dn=t[168]):(En=()=>({startCreating(e,t){Cn.current(e,t)},startCreatingFromTemplate(e){wn.current(e)},createFromTemplate(e,t){Cn.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of it.current){let t=WV(J.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(ue.current);(0,Q.startTransition)(()=>{for(let t of[...it.current].reverse()){if(e.has(t))continue;let n=WV(J.getItem(t));n&&n.collapse()}})},getFolderState(){let e=it.current,t=0;for(let n of e)WV(J.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Sn.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Sn.current=i,i},subscribe(e){return J.subscribe(e)}}),Dn=[J],t[166]=J,t[167]=En,t[168]=Dn),(0,Q.useImperativeHandle)(n,En,Dn);let On;t[169]!==Tt||t[170]!==u||t[171]!==c||t[172]!==J?(On=async function(e,t,n){let r=qH(e,te.current,it.current),i=de.current;i&&e.some(e=>JH(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Tt(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(lU).map(cU)]);c([...[...a].map(sU),...[...o].map(oU),...[...s].map(aU)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?_k(t.path):t.kind===`asset`?t.path:fk(t.path,t.docExt);J.getItem(e)&&J.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}k(e=>{let t=zk(e,[...a],void 0,[...s]);for(let e of o)t=zk(t,[],e);return mt(t),t}),Pi([`files`,`backlinks`,`graph`])},t[169]=Tt,t[170]=u,t[171]=c,t[172]=J,t[173]=On):On=t[173];let kn=On,An;t[174]!==r||t[175]!==kn?(An=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;R(a.path);let o=await Et(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!o.ok)return i.length>0&&await kn(i,t,n),X.error(o.title),!1;let s=P(zn,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await kn(i,t,n),!0},t[174]=r,t[175]=kn,t[176]=An):An=t[176];let jn=An,Mn;t[177]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=async function(e,t,n){let r=[],i=[];for(let a of e){R(a.path);let e=Wk(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:LV(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[177]=Mn):Mn=t[177];let Nn=Mn,Pn;t[178]===r?Pn=t[179]:(Pn=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await Et(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),i.push({target:a,reason:o.title});continue}let s=P(Ei,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length;X.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`vEJDlt`})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[178]=r,t[179]=Pn);let Y=Pn,Fn;t[180]!==r||t[181]!==U||t[182]!==kn||t[183]!==jn||t[184]!==Y||t[185]!==ut||t[186]!==ee?(Fn=async function(e){let t=e.map(e=>Bk(e,te.current)),n=t[0];if(!n)return;let i=U.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(iU),t=i.length>e.length?`, +${i.length-e.length} more`:``;X.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}R(n.path),B(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&ee){let{trashed:e,failed:n}=await Nn(t,a,ee);if(e.length>0){let t=await Y(e);t?await kn(e,t.deletedDocNames,t.deletedFolderPaths):await kn(e,e.filter(rU).map(nU),e.filter(tU).map(eU))}n.length>0&&H({failed:n,originalTargets:[...t]}),R(null)}else{let e=await jn(t);R(null),e||ut()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),R(null),ut()}},t[180]=r,t[181]=U,t[182]=kn,t[183]=jn,t[184]=Y,t[185]=ut,t[186]=ee,t[187]=Fn):Fn=t[187];let In=Fn,Ln;t[188]!==r||t[189]!==jn||t[190]!==ut||t[191]!==V?(Ln=async function(){if(!V)return;let e=new Set(V.failed.map($H)),t=V.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(H(null),t.length!==0){R(t[0]?.path??null);try{let e=await jn(t);R(null),e||ut()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),R(null),ut()}}},t[188]=r,t[189]=jn,t[190]=ut,t[191]=V,t[192]=Ln):Ln=t[192];let Rn=Ln,Vn;t[193]!==In||t[194]!==V?(Vn=async function(){if(!V)return;let e=new Set(V.failed.map(QH)),t=V.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));H(null),await In(t)},t[193]=In,t[194]=V,t[195]=Vn):Vn=t[195];let Hn=Vn,Gn=(0,Q.useRef)(In),Kn;t[196]===In?Kn=t[197]:(Kn=()=>{Gn.current=In},t[196]=In,t[197]=Kn),(0,Q.useEffect)(Kn);let qn,Yn;t[198]===Symbol.for(`react.memo_cache_sentinel`)?(qn=()=>QV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=te.current.find(e=>mr(e)&&e.docName===t);Gn.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Gn.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){Gn.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),Yn=[],t[198]=qn,t[199]=Yn):(qn=t[198],Yn=t[199]),(0,Q.useEffect)(qn,Yn);let Xn,Zn;t[200]===Symbol.for(`react.memo_cache_sentinel`)?(Xn=()=>nH(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=te.current.find(e=>mr(e)&&e.docName===t);xt.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){xt.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),Zn=[],t[200]=Xn,t[201]=Zn):(Xn=t[200],Zn=t[201]),(0,Q.useEffect)(Xn,Zn);let Qn,$n;t[202]===J?(Qn=t[203],$n=t[204]):(Qn=()=>eH(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=fk(t,te.current.find(e=>mr(e)&&e.docName===t)?.docExt);J.startRenaming(n);return}if(e.kind===`folder`){J.startRenaming(e.folderPath);return}if(e.kind===`asset`){J.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),$n=[J],t[202]=J,t[203]=Qn,t[204]=$n),(0,Q.useEffect)(Qn,$n);let er;t[205]===Symbol.for(`react.memo_cache_sentinel`)?(er=function(){let e=me.current;e&&wH(e),me.current=null},t[205]=er):er=t[205];let tr=er,nr;t[206]===h?nr=t[207]:(nr=function(e){let t=xU(e.nativeEvent);if(!t||t.endsWith(`/`)){tr();return}let n=pk(t),r=te.current.find(e=>mk(e)===t);if(r&&Bn(r)){tr();return}if(r&&mr(r)&&di(r.size)){tr();return}me.current!==n&&(tr(),me.current=n,CH(n,e=>h(e)))},t[206]=h,t[207]=nr);let rr=nr,ir;t[208]!==q||t[209]!==J||t[210]!==E?(ir=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=SU(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?_k(n):n;if(J.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=gk(r);if(window.location.hash===Hr(e))return;queueMicrotask(()=>E(e));return}let i=pk(r);window.location.hash!==xi(i)&&queueMicrotask(()=>q(r))},t[208]=q,t[209]=J,t[210]=E,t[211]=ir):ir=t[211];let ar=ir;if(A){let e;return t[212]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(wU,{}),t[212]=e):e=t[212],e}if(O.length===0){if(M){let e;return t[213]===M?e=t[214]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/50 text-sm`,children:M})}),t[213]=M,t[214]=e),e}let e;t[215]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(s,{id:`xiv-dW`})}),t[215]=e):e=t[215];let n;t[216]===sn?n=t[217]:(n=()=>sn(`file`,``),t[216]=sn,t[217]=n);let r;t[218]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(s,{id:`6ibbCg`}),t[218]=r):r=t[218];let i;return t[219]===n?i=t[220]:(i=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(qi,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:n,children:r})]}),t[219]=n,t[220]=i),i}let or=L!==null,sr=z?.targets[0]??null,cr;t[221]!==M||t[222]!==F?(cr=(M||F!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[M&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:M}),F!==null&&(0,Z.jsx)(`span`,{role:`status`,className:`px-3 pb-1 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`_HekAK`,values:{truncatedShownCount:F}})})]}),t[221]=M,t[222]=F,t[223]=cr):cr=t[223];let lr;t[224]===v?lr=t[225]:(lr=LH(v),t[224]=v,t[225]=lr);let ur;t[226]!==or||t[227]!==se||t[228]!==dn||t[229]!==O||t[230]!==ln||t[231]!==rt||t[232]!==bt||t[233]!==Fe||t[234]!==Re||t[235]!==J||t[236]!==Ie||t[237]!==Le||t[238]!==sn||t[239]!==ee?(ur=(e,t)=>(0,Z.jsx)(YH,{item:e,context:t,anyActionBusy:or,workspace:ee,handoff:Fe,model:J,okignoreBinding:Ie,projectLocalBinding:Le,mergedConfig:Re,onStartCreating:sn,onCreateFromTemplate:(e,t)=>sn(`file`,e,{template:t}),onDuplicate:bt,onDelete:e=>B({targets:e}),onExpandSubtree:ln,onCollapseSubtree:dn,folderTreePaths:rt,isAsset:se.has(e.path),documents:O}),t[226]=or,t[227]=se,t[228]=dn,t[229]=O,t[230]=ln,t[231]=rt,t[232]=bt,t[233]=Fe,t[234]=Re,t[235]=J,t[236]=Ie,t[237]=Le,t[238]=sn,t[239]=ee,t[240]=ur):ur=t[240];let dr;t[241]!==ar||t[242]!==rr||t[243]!==J||t[244]!==cr||t[245]!==lr||t[246]!==ur?(dr=(0,Z.jsx)(`div`,{ref:Se,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)($B,{header:cr,model:J,style:lr,onClickCapture:ar,onMouseMove:rr,onMouseLeave:tr,renderContextMenu:ur})}),t[241]=ar,t[242]=rr,t[243]=J,t[244]=cr,t[245]=lr,t[246]=ur,t[247]=dr):dr=t[247];let fr=!!z,pr;t[248]===L?pr=t[249]:(pr=e=>{!e&&!L&&B(null)},t[248]=L,t[249]=pr);let hr;t[250]!==r||t[251]!==L||t[252]!==z||t[253]!==In||t[254]!==sr?(hr=z&&sr&&(0,Z.jsx)(va,{...(()=>{let e=PV(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,z.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(ZH)}):null};let t=z.targets.length,n=sr.name;return{itemName:t===1?sr.kind===`folder`?`${sr.name}/`:sr.kind===`file`?`${sr.name}${sr.docExt??`.md`}`:sr.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):sr.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:L!==null,onDelete:()=>In(z.targets)}),t[250]=r,t[251]=L,t[252]=z,t[253]=In,t[254]=sr,t[255]=hr):hr=t[255];let gr;t[256]!==fr||t[257]!==pr||t[258]!==hr?(gr=(0,Z.jsx)(us,{open:fr,onOpenChange:pr,children:hr}),t[256]=fr,t[257]=pr,t[258]=hr,t[259]=gr):gr=t[259];let _r=!!V,vr;t[260]===L?vr=t[261]:(vr=e=>{!e&&!L&&H(null)},t[260]=L,t[261]=vr);let yr;t[262]!==L||t[263]!==Rn||t[264]!==Hn||t[265]!==V?(yr=V&&(0,Z.jsx)(VV,{failedTargets:V.failed,isSubmitting:L!==null,onDeletePermanently:Rn,onRetry:Hn,onCancel:()=>H(null)}),t[262]=L,t[263]=Rn,t[264]=Hn,t[265]=V,t[266]=yr):yr=t[266];let br;t[267]!==_r||t[268]!==vr||t[269]!==yr?(br=(0,Z.jsx)(us,{open:_r,onOpenChange:vr,children:yr}),t[267]=_r,t[268]=vr,t[269]=yr,t[270]=br):br=t[270];let xr=W!==null,Sr;t[271]===Symbol.for(`react.memo_cache_sentinel`)?(Sr=e=>{e||G(null)},t[271]=Sr):Sr=t[271];let wr=W?.parentDir??``,Tr;t[272]!==wr||t[273]!==xr?(Tr=(0,Z.jsx)(Hm,{open:xr,onOpenChange:Sr,kind:`file`,initialDir:wr,defaultToTemplate:!0}),t[272]=wr,t[273]=xr,t[274]=Tr):Tr=t[274];let Er;return t[275]!==Tr||t[276]!==dr||t[277]!==gr||t[278]!==br?(Er=(0,Z.jsxs)(Z.Fragment,{children:[dr,gr,br,Tr]}),t[275]=Tr,t[276]=dr,t[277]=gr,t[278]=br,t[279]=Er):Er=t[279],Er}function ZH(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:FV(e)},`${e.kind}:${e.path}`)}function QH(e){return`${e.kind}:${e.path}`}function $H(e){return`${e.kind}:${e.path}`}function eU(e){return e.path}function tU(e){return e.kind===`folder`}function nU(e){return e.path}function rU(e){return e.kind===`file`}function iU(e){return e.file}function aU(e){return Xe(e)}function oU(e){return Qt(e)}function sU(e){return Oe(e)}function cU(e){return e.path}function lU(e){return e.kind===`asset`}function uU(e){return e.endsWith(`/`)?e.slice(0,-1):e}function dU(e){return!!e}function fU(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function pU(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function mU(e){X.error(e)}function hU(){}function gU(e){return X.error(e)}function _U(){}function vU(){}async function yU(){}function bU(e){return mk(e)}function xU(e){return SU(e)?.dataset.itemPath??null}function SU(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var CU=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function wU(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=CU.map(TU),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function TU(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(pa,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(pa,{className:`h-3 ${e}`})]},t)}function EU(e){return e?Y._({id:`wTcjov`}):null}function DU(e){let t=(0,$.c)(37),{_:n}=i(),r=_h(),{merged:a}=vt(),o=a?.appearance?.preview?.autoOpen??!0;if(r)return null;let{input:c,installStates:l,dispatch:u,webFallbackVisible:d}=e,f=d===void 0?!0:d,p=c===null,m,h,g,_,v,y,b;if(t[0]!==n||t[1]!==o||t[2]!==u||t[3]!==c||t[4]!==p||t[5]!==l||t[6]!==f){b=Symbol.for(`react.early_return_sentinel`);bb0:{let e=EU(p),r;t[14]===l?r=t[15]:(r=e=>l[e.id]?.installed===!0,t[14]=l,t[15]=r);let i=bh.filter(r);g=l[`claude-code`]?.installed===!0;let a;t[16]!==o||t[17]!==c?(a=c!==null&&c.docContext!==null?dr(c.docContext.relativePath,o):``,t[16]=o,t[17]=c,t[18]=a):a=t[18];let d=a,x;t[19]!==c||t[20]!==d?(x=()=>{c!==null&&zb(d)},t[19]=c,t[20]=d,t[21]=x):x=t[21],_=x;let S=f&&!g;if(i.length===0&&!S){b=null;break bb0}h=Qk,t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(tA,{children:[(0,Z.jsx)(aa,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[22]=y):y=t[22],m=nA,v=i.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(eA,{disabled:!r,onSelect:()=>{c&&u(t.id,c)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Nb,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})}t[0]=n,t[1]=o,t[2]=u,t[3]=c,t[4]=p,t[5]=l,t[6]=f,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b}else m=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],b=t[13];if(b!==Symbol.for(`react.early_return_sentinel`))return b;let x;t[23]!==n||t[24]!==g||t[25]!==_||t[26]!==p||t[27]!==f?(x=f&&!g?(0,Z.jsxs)(eA,{onSelect:_,disabled:p,"data-testid":`empty-space-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(ut,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[23]=n,t[24]=g,t[25]=_,t[26]=p,t[27]=f,t[28]=x):x=t[28];let S;t[29]!==m||t[30]!==v||t[31]!==x?(S=(0,Z.jsxs)(m,{children:[v,x]}),t[29]=m,t[30]=v,t[31]=x,t[32]=S):S=t[32];let C;return t[33]!==h||t[34]!==y||t[35]!==S?(C=(0,Z.jsxs)(h,{children:[y,S]}),t[33]=h,t[34]=y,t[35]=S,t[36]=C):C=t[36],C}var OU=(e,t,n)=>Al(e,t,n,`ProjectSwitcher`);function kU(e){let t=(0,$.c)(79),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h;t[1]!==r||t[2]!==n.project||t[3]!==l?(h=()=>{if(!l)return;let e=!1;return OU(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[1]=r,t[2]=n.project,t[3]=l,t[4]=h):h=t[4];let g;t[5]!==r||t[6]!==n||t[7]!==l?(g=[l,n,r],t[5]=r,t[6]=n,t[7]=l,t[8]=g):g=t[8],(0,Q.useEffect)(h,g);let _;t[9]!==r||t[10]!==n.project?(_=e=>{u(!1),OU(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[9]=r,t[10]=n.project,t[11]=_):_=t[11];let v=_,y;t[12]!==r||t[13]!==n.dialog||t[14]!==n.project?(y=()=>{u(!1),OU(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[12]=r,t[13]=n.dialog,t[14]=n.project,t[15]=y):y=t[15];let b=y,x;t[16]!==r||t[17]!==n.navigator?(x=()=>{u(!1),OU(()=>n.navigator.open(),r({id:`jol95m`}))},t[16]=r,t[17]=n.navigator,t[18]=x):x=t[18];let S=x,C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{u(!1),m(!0)},t[19]=C):C=t[19];let w=C,T=n.config.projectPath,E,D,O,k,A,j,M,N,P,F;if(t[20]!==r||t[21]!==n.config.projectName||t[22]!==T||t[23]!==l||t[24]!==v||t[25]!==o||t[26]!==d){let e;t[37]===T?e=t[38]:(e=e=>e.path!==T,t[37]=T,t[38]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;D=oo,j=l,t[39]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{u(e),e||f(``)},t[39]=M):M=t[39];let p;t[40]===r?p=t[41]:(p=r({id:`zZ_I5K`}),t[40]=r,t[41]=p);let m;t[42]===n.config.projectName?m=t[43]:(m=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[42]=n.config.projectName,t[43]=m);let h;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Cc,{"aria-hidden":`true`,className:`opacity-60`}),t[44]=h):h=t[44],t[45]!==p||t[46]!==m?(N=(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsxs)(HO,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:p,children:[m,h]})}),t[45]=p,t[46]=m,t[47]=N):N=t[47],E=ua,P=`start`,F=`top`,O=`min-w-[260px]`,k=`project-switcher-menu`,A=i.length===0?(0,Z.jsx)(Uo,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(TS,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(AS,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:AU,"data-testid":`project-switcher-search`}),(0,Z.jsx)(DS,{children:(0,Z.jsx)(he,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Ao,{}),c.length===0?(0,Z.jsx)(Uo,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(s,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)(go,{disabled:e.missing,onSelect:()=>v(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Z.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[20]=r,t[21]=n.config.projectName,t[22]=T,t[23]=l,t[24]=v,t[25]=o,t[26]=d,t[27]=E,t[28]=D,t[29]=O,t[30]=k,t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P,t[36]=F}else E=t[27],D=t[28],O=t[29],k=t[30],A=t[31],j=t[32],M=t[33],N=t[34],P=t[35],F=t[36];let I;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Ao,{}),t[48]=I):I=t[48];let L,R;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(je,{"aria-hidden":`true`,className:`text-muted-foreground`}),R=(0,Z.jsx)(s,{id:`PVUn_c`}),t[49]=L,t[50]=R):(L=t[49],R=t[50]);let z;t[51]===b?z=t[52]:(z=(0,Z.jsxs)(go,{onSelect:b,"data-testid":`project-switcher-open-folder`,children:[L,R]}),t[51]=b,t[52]=z);let B,V;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(q,{"aria-hidden":`true`,className:`text-muted-foreground`}),V=(0,Z.jsx)(s,{id:`2Xs2jo`}),t[53]=B,t[54]=V):(B=t[53],V=t[54]);let H;t[55]===S?H=t[56]:(H=(0,Z.jsxs)(go,{onSelect:S,"data-testid":`project-switcher-switch-project`,children:[B,V]}),t[55]=S,t[56]=H);let U;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsxs)(go,{onSelect:w,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[57]=U):U=t[57];let W;t[58]!==E||t[59]!==O||t[60]!==k||t[61]!==A||t[62]!==z||t[63]!==H||t[64]!==P||t[65]!==F?(W=(0,Z.jsxs)(E,{align:P,side:F,className:O,"data-testid":k,children:[A,I,z,H,U]}),t[58]=E,t[59]=O,t[60]=k,t[61]=A,t[62]=z,t[63]=H,t[64]=P,t[65]=F,t[66]=W):W=t[66];let G;t[67]!==D||t[68]!==j||t[69]!==M||t[70]!==N||t[71]!==W?(G=(0,Z.jsxs)(D,{open:j,onOpenChange:M,children:[N,W]}),t[67]=D,t[68]=j,t[69]=M,t[70]=N,t[71]=W,t[72]=G):G=t[72];let ee;t[73]!==n||t[74]!==p?(ee=(0,Z.jsx)(xd,{open:p,onOpenChange:m,bridge:n}),t[73]=n,t[74]=p,t[75]=ee):ee=t[75];let K;return t[76]!==G||t[77]!==ee?(K=(0,Z.jsxs)(Z.Fragment,{children:[G,ee]}),t[76]=G,t[77]=ee,t[78]=K):K=t[78],K}function AU(e){return e.stopPropagation()}function jU(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Di(`sidebarSearchPill`)}function MU(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Bi(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(he,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(s,{id:`A1taO8`})}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(D,{className:`text-foreground/70`,children:_a(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(qi,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function NU(e){let t=(0,$.c)(36),{notice:n,onDismiss:r}=e,{_:a}=i(),o=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,s;t[0]===a?s=t[1]:(s=a({id:`GUYwCr`}),t[0]=a,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(is,{"aria-hidden":`true`,className:`size-3`}),t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==s?(l=(0,Z.jsx)(qi,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":s,onClick:r,children:c}),t[3]=r,t[4]=s,t[5]=l):l=t[5];let u=l;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-2 text-xs text-muted-foreground ${o}`,i;t[6]===n.body?i=t[7]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[6]=n.body,t[7]=i);let a;t[8]!==u||t[9]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,u]}),t[8]=u,t[9]=i,t[10]=a):a=t[10];let s;t[11]===n.action?s=t[12]:(s=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[11]=n.action,t[12]=s);let c;t[13]===n.secondaryAction?c=t[14]:(c=()=>{n.secondaryAction?.onClick()},t[13]=n.secondaryAction,t[14]=c);let l;t[15]!==n.secondaryAction.label||t[16]!==c?(l=(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:c,children:n.secondaryAction.label}),t[15]=n.secondaryAction.label,t[16]=c,t[17]=l):l=t[17];let d;t[18]!==l||t[19]!==s?(d=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[s,l]}),t[18]=l,t[19]=s,t[20]=d):d=t[20];let f;return t[21]!==d||t[22]!==e||t[23]!==r||t[24]!==a?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[a,d]}),t[21]=d,t[22]=e,t[23]=r,t[24]=a,t[25]=f):f=t[25],f}let d=`update-notice-${n.id}`,f=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${o}`,p;t[26]===n.body?p=t[27]:(p=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=p);let m;t[28]===n.action?m=t[29]:(m=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=n.action,t[29]=m);let h;return t[30]!==u||t[31]!==d||t[32]!==f||t[33]!==p||t[34]!==m?(h=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":d,className:f,children:[p,m,u]}),t[30]=u,t[31]=d,t[32]=f,t[33]=p,t[34]=m,t[35]=h):h=t[35],h}function PU(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function FU(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(qp,Kp,Kp),n;e[0]===t?n=e[1]:(n=PU(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{Gp(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(NU,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function IU(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Xh(n.contentDir,Zh(t),n.pathSeparator):e?.kind===`folder`?Xh(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?Xh(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function LU(e,t,n){if((e?.kind===`doc`||e?.kind===`folder-index`)&&t){let e=t.lastIndexOf(`/`);return e<0?n.contentDir:Xh(n.contentDir,t.slice(0,e),n.pathSeparator)}if(e?.kind===`folder`)return Xh(n.contentDir,e.folderPath,n.pathSeparator);if(e?.kind===`asset`){let t=e.assetPath.lastIndexOf(`/`);return t<0?n.contentDir:Xh(n.contentDir,e.assetPath.slice(0,t),n.pathSeparator)}return n.contentDir}function RU(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Zh(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function zU(e,t,n){return e===null?$h({workspace:n}):e.kind===`folder`?n?eg({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?Qh({docName:t,workspace:n}):null}var BU={folderCount:0,expandedCount:0},VU=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function HU(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(VU)!==null}function UU(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(x,{name:`file-sidebar`,children:(0,Z.jsx)(GU,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var WU=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(sr,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(ri,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function GU(e){let t=(0,$.c)(200),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=ht(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:xr(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f=typeof window<`u`&&window.okDesktop!=null,{state:p,toggleSidebar:m}=OO(),h=_h(),g=p===`expanded`,_=f&&p===`collapsed`,[v,y]=(0,Q.useState)(BU),b,x;t[3]===a?(b=t[4],x=t[5]):(b=()=>{if(a!==null)return y(a.getFolderState()),a.subscribe(()=>{y(a.getFolderState())})},x=[a],t[3]=a,t[4]=b,t[5]=x),(0,Q.useEffect)(b,x);let S,C;t[6]===a?(S=t[7],C=t[8]):(S=()=>{if(a!==null)return Cx(()=>{a.startCreating(`file`,``)})},C=[a],t[6]=a,t[7]=S,t[8]=C),(0,Q.useEffect)(S,C);let w=v.folderCount>0,T=w&&v.expandedCount===v.folderCount,E=v.expandedCount===0,D=To(``),O=To(d===``?null:d),k=d===``?D:O,A=D.state.status===`ready`?(D.state.data.folder.templates_available?.length??0)>0:!0,j=k.state.status===`ready`?(k.state.data.folder.templates_available?.length??0)>0:!0,M=typeof window<`u`?window.okDesktop:void 0,N=Fo(),P=Cg().states,{dispatch:F}=fg(),I;t[9]===N?I=t[10]:(I=$h({workspace:N}),t[9]=N,t[10]=I);let L=I,{projectLocalBinding:R,merged:z}=vt(),B=z?.appearance?.sidebar?.showHiddenFiles??!1,V=z?.appearance?.sidebar?.showAllFiles??!1,H=w&&!T,U=w&&!E,G=H||U,ee=qU,K;t[11]!==a||t[12]!==N?(K=()=>{N&&a?.startCreating(`file`,``)},t[11]=a,t[12]=N,t[13]=K):K=t[13];let te=K,ne;t[14]!==a||t[15]!==N?(ne=e=>{N&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=N,t[16]=ne):ne=t[16];let q=ne,re;t[17]!==a||t[18]!==N?(re=()=>{N&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=N,t[19]=re):re=t[19];let ie=re,ae;t[20]===N?ae=t[21]:(ae=()=>{!N||!M||M.shell.showItemInFolder(N.contentDir)},t[20]=N,t[21]=ae);let oe=ae,se;t[22]===N?se=t[23]:(se=()=>{!N||!M||qV(M,N.contentDir)},t[22]=N,t[23]=se);let ce=se,le;t[24]!==r||t[25]!==N?(le=async()=>{if(N)try{await navigator.clipboard.writeText(N.contentDir),X.success(r({id:`6_ZOw4`}),{description:N.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))}},t[24]=r,t[25]=N,t[26]=le):le=t[26];let ue=le,de;t[27]!==r||t[28]!==R?(de=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,qr(t.error)),X.error(r({id:`P47EWZ`}),{description:qr(t.error)}))},t[27]=r,t[28]=R,t[29]=de):de=t[29];let fe=de,pe;t[30]!==r||t[31]!==R?(pe=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,qr(t.error)),X.error(r({id:`P47EWZ`}),{description:qr(t.error)}))},t[30]=r,t[31]=R,t[32]=pe):pe=t[32];let me=pe,he;t[33]===a?he=t[34]:(he=()=>{a?.expandAll()},t[33]=a,t[34]=he);let ge=he,_e;t[35]===a?_e=t[36]:(_e=()=>{a?.collapseAll()},t[35]=a,t[36]=_e);let ve=_e,ye,be;t[37]!==V||t[38]!==U||t[39]!==H||t[40]!==B||t[41]!==p?(ye=()=>{M&&M.editor.notifyViewMenuStateChanged({showHiddenFiles:B,showAllFiles:V,canExpandAll:H,canCollapseAll:U,sidebarVisible:p===`expanded`})},be=[M,B,V,H,U,p],t[37]=V,t[38]=U,t[39]=H,t[40]=B,t[41]=p,t[42]=ye,t[43]=be):(ye=t[42],be=t[43]),(0,Q.useEffect)(ye,be);let xe,Se;t[44]!==r||t[45]!==c||t[46]!==l||t[47]!==F||t[48]!==P||t[49]!==d||t[50]!==R||t[51]!==V||t[52]!==B||t[53]!==m||t[54]!==a||t[55]!==N?(xe=()=>{if(M)return M.onMenuAction(e=>{switch(e){case`new-doc`:if(!N||!a)return;a.startCreating(`file`,d);return;case`new-folder`:if(!N||!a)return;a.startCreating(`folder`,d);return;case`new-from-template`:if(!N||!a)return;a.startCreatingFromTemplate(d);return;case`rename`:if(!l)return;$V(l);return;case`duplicate`:if(!l)return;tH(l);return;case`move-to-trash`:if(!l)return;ZV(l);return;case`reveal-in-finder`:{if(!M||!N)return;let e=IU(l,c,N);M.shell.showItemInFolder(e);return}case`open-in-terminal`:if(!M||!N)return;qV(M,LU(l,c,N));return;case`send-to-ai`:{let e=bh.filter(e=>P[e.id]?.installed===!0);if(e.length===0){X.error(r({id:`LKOLNn`}));return}let t=zU(l,c,N);if(!t)return;let[n]=e;if(!n)return;F(n.id,t);return}case`copy-full-path`:{if(!N)return;let e=IU(l,c,N);navigator.clipboard.writeText(e).then(()=>X.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=RU(l,c);if(e===``){X.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>X.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(R===null)return;let e=R.patch({appearance:{sidebar:{showHiddenFiles:!B}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,qr(e.error)),X.error(r({id:`P47EWZ`}),{description:qr(e.error)}));return}case`toggle-show-all-files`:{if(R===null)return;let e=R.patch({appearance:{sidebar:{showAllFiles:!V}}});e.ok||(console.warn(`[FileSidebar] toggle-show-all-files rejected:`,qr(e.error)),X.error(r({id:`P47EWZ`}),{description:qr(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`toggle-sidebar`:m();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`toggle-doc-panel`:return}})},Se=[M,a,N,l,c,d,R,B,V,P,F,m,r],t[44]=r,t[45]=c,t[46]=l,t[47]=F,t[48]=P,t[49]=d,t[50]=R,t[51]=V,t[52]=B,t[53]=m,t[54]=a,t[55]=N,t[56]=xe,t[57]=Se):(xe=t[56],Se=t[57]),(0,Q.useEffect)(xe,Se);let Ce=f&&g&&`motion-safe:delay-100`,we=_&&`opacity-0`,Te;t[58]!==Ce||t[59]!==we?(Te=Bi(`flex-row h-12 items-center py-0 px-3`,f?`justify-end`:`justify-between`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ce,we,f&&`[-webkit-app-region:drag]`),t[58]=Ce,t[59]=we,t[60]=Te):Te=t[60];let Ee;t[61]===g?Ee=t[62]:(Ee=g&&!f?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(s,{id:`sER-bs`})}):null,t[61]=g,t[62]=Ee);let De;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(De=Bi(`flex items-center gap-1`,f&&`[&>*]:[-webkit-app-region:no-drag]`),t[63]=De):De=t[63];let Oe;t[64]!==r||t[65]!==T||t[66]!==w||t[67]!==E||t[68]!==a?(Oe=w?(0,Z.jsxs)(oo,{children:[(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsx)(WU,{icon:Kc,label:r({id:`Lu_dOh`})})}),(0,Z.jsxs)(ua,{align:`end`,children:[T?null:(0,Z.jsxs)(go,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(Tl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}),E?null:(0,Z.jsxs)(go,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(Ic,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]})]})]}):null,t[64]=r,t[65]=T,t[66]=w,t[67]=E,t[68]=a,t[69]=Oe):Oe=t[69];let ke;t[70]===r?ke=t[71]:(ke=r({id:`MW64zN`}),t[70]=r,t[71]=ke);let Ae;t[72]!==d||t[73]!==a?(Ae=()=>a?.startCreating(`file`,d),t[72]=d,t[73]=a,t[74]=Ae):Ae=t[74];let Me;t[75]!==ke||t[76]!==Ae?(Me=(0,Z.jsx)(WU,{icon:_l,label:ke,onClick:Ae}),t[75]=ke,t[76]=Ae,t[77]=Me):Me=t[77];let Ne;t[78]!==r||t[79]!==j||t[80]!==d||t[81]!==a?(Ne=j?(0,Z.jsxs)(oo,{children:[(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsx)(WU,{icon:bo,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(ua,{align:`end`,children:(0,Z.jsx)(UV,{parentDir:d,onSelectTemplate:e=>a?.createFromTemplate(d,e),ItemComponent:go})})]}):null,t[78]=r,t[79]=j,t[80]=d,t[81]=a,t[82]=Ne):Ne=t[82];let Pe;t[83]===r?Pe=t[84]:(Pe=r({id:`tX5yOZ`}),t[83]=r,t[84]=Pe);let Fe;t[85]!==d||t[86]!==a?(Fe=()=>a?.startCreating(`folder`,d),t[85]=d,t[86]=a,t[87]=Fe):Fe=t[87];let Ie;t[88]!==Pe||t[89]!==Fe?(Ie=(0,Z.jsx)(WU,{icon:Rc,label:Pe,onClick:Fe}),t[88]=Pe,t[89]=Fe,t[90]=Ie):Ie=t[90];let Le;t[91]!==Oe||t[92]!==Me||t[93]!==Ne||t[94]!==Ie?(Le=(0,Z.jsxs)(`div`,{className:De,children:[Oe,Me,Ne,Ie]}),t[91]=Oe,t[92]=Me,t[93]=Ne,t[94]=Ie,t[95]=Le):Le=t[95];let Re;t[96]!==Te||t[97]!==Ee||t[98]!==Le?(Re=(0,Z.jsxs)(IO,{"data-electron-drag":f?``:void 0,className:Te,children:[Ee,Le]}),t[96]=Te,t[97]=Ee,t[98]=Le,t[99]=Re):Re=t[99];let ze=f&&g&&`motion-safe:delay-100`,Be=_&&`opacity-0`,Ve;t[100]!==ze||t[101]!==Be?(Ve=Bi(`px-2 pb-2`,f&&`[-webkit-app-region:no-drag]`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,ze,Be),t[100]=ze,t[101]=Be,t[102]=Ve):Ve=t[102];let He;t[103]===p?He=t[104]:(He=[p],t[103]=p,t[104]=He);let Ue;t[105]===n?Ue=t[106]:(Ue=(0,Z.jsx)(MU,{onClick:n}),t[105]=n,t[106]=Ue);let We;t[107]!==He||t[108]!==Ue?(We=(0,Z.jsx)(W,{fallbackRender:KU,onError:jU,resetKeys:He,children:Ue}),t[107]=He,t[108]=Ue,t[109]=We):We=t[109];let Ge;t[110]!==Ve||t[111]!==We?(Ge=(0,Z.jsx)(`div`,{className:Ve,children:We}),t[110]=Ve,t[111]=We,t[112]=Ge):Ge=t[112];let Ke;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Z.jsxs)(RO,{children:[(0,Z.jsx)(LA,{}),(0,Z.jsx)(XH,{ref:o})]}),t[113]=Ke):Ke=t[113];let qe;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsxs)(LO,{className:`px-0`,children:[(0,Z.jsx)(FU,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(zO,{children:(0,Z.jsx)(BO,{children:(0,Z.jsx)(kU,{bridge:window.okDesktop})})}):null]}),t[114]=qe):qe=t[114];let Je=!(h&&p===`collapsed`),Ye;t[115]===Je?Ye=t[116]:(Ye=(0,Z.jsx)(PO,{enableToggle:!1,enableDrag:Je}),t[115]=Je,t[116]=Ye);let J;t[117]!==Re||t[118]!==Ge||t[119]!==Ye?(J=(0,Z.jsx)(Zk,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:ee,children:[Re,Ge,Ke,qe,Ye]})}),t[117]=Re,t[118]=Ge,t[119]=Ye,t[120]=J):J=t[120];let Xe=!N,Ze,Qe;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,Z.jsx)(_l,{"aria-hidden":`true`}),Qe=(0,Z.jsx)(s,{id:`MW64zN`}),t[121]=Ze,t[122]=Qe):(Ze=t[121],Qe=t[122]);let $e;t[123]!==te||t[124]!==Xe?($e=(0,Z.jsxs)(eA,{disabled:Xe,onSelect:te,"data-testid":`empty-space-menu-new-file`,children:[Ze,Qe]}),t[123]=te,t[124]=Xe,t[125]=$e):$e=t[125];let et=!N||!A,tt,nt;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(bo,{"aria-hidden":`true`}),nt=(0,Z.jsx)(s,{id:`Uuj_R4`}),t[126]=tt,t[127]=nt):(tt=t[126],nt=t[127]);let rt;t[128]===et?rt=t[129]:(rt=(0,Z.jsxs)(tA,{disabled:et,"data-testid":`empty-space-menu-new-from-template`,children:[tt,nt]}),t[128]=et,t[129]=rt);let it;t[130]===q?it=t[131]:(it=(0,Z.jsx)(nA,{children:(0,Z.jsx)(UV,{parentDir:``,onSelectTemplate:q,ItemComponent:eA})}),t[130]=q,t[131]=it);let at;t[132]!==rt||t[133]!==it?(at=(0,Z.jsxs)(Qk,{children:[rt,it]}),t[132]=rt,t[133]=it,t[134]=at):at=t[134];let ot=!N,st,ct;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(Rc,{"aria-hidden":`true`}),ct=(0,Z.jsx)(s,{id:`tX5yOZ`}),t[135]=st,t[136]=ct):(st=t[135],ct=t[136]);let lt;t[137]!==ie||t[138]!==ot?(lt=(0,Z.jsxs)(eA,{disabled:ot,onSelect:ie,"data-testid":`empty-space-menu-new-folder`,children:[st,ct]}),t[137]=ie,t[138]=ot,t[139]=lt):lt=t[139];let ut;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,Z.jsx)(iA,{}),t[140]=ut):ut=t[140];let dt;t[141]!==r||t[142]!==oe||t[143]!==N?(dt=M?(0,Z.jsxs)(eA,{disabled:!N,onSelect:oe,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(N?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(je,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[141]=r,t[142]=oe,t[143]=N,t[144]=dt):dt=t[144];let ft;t[145]!==F||t[146]!==L||t[147]!==P?(ft=(0,Z.jsx)(DU,{input:L,installStates:P,dispatch:F,webFallbackVisible:!1}),t[145]=F,t[146]=L,t[147]=P,t[148]=ft):ft=t[148];let pt;t[149]!==r||t[150]!==ce||t[151]!==N?(pt=M?(0,Z.jsxs)(eA,{disabled:!N,onSelect:ce,"data-testid":`empty-space-menu-open-in-terminal`,"aria-label":r(N?{id:`BJpGCq`}:{id:`_6IEmc`}),children:[(0,Z.jsx)(Sl,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`BJpGCq`})}),N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[149]=r,t[150]=ce,t[151]=N,t[152]=pt):pt=t[152];let mt=!N,gt;t[153]!==r||t[154]!==N?(gt=r(N?{id:`Up2_7p`}:{id:`U8CD-l`}),t[153]=r,t[154]=N,t[155]=gt):gt=t[155];let _t;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(Vt,{"aria-hidden":`true`}),t[156]=_t):_t=t[156];let yt;t[157]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[157]=yt):yt=t[157];let bt;t[158]===N?bt=t[159]:(bt=N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[158]=N,t[159]=bt);let xt;t[160]!==ue||t[161]!==mt||t[162]!==gt||t[163]!==bt?(xt=(0,Z.jsxs)(eA,{disabled:mt,onSelect:ue,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":gt,children:[_t,yt,bt]}),t[160]=ue,t[161]=mt,t[162]=gt,t[163]=bt,t[164]=xt):xt=t[164];let St;t[165]===Symbol.for(`react.memo_cache_sentinel`)?(St=(0,Z.jsx)(iA,{}),t[165]=St):St=t[165];let Ct=R===null,wt;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,Z.jsx)(s,{id:`K_wz1u`}),t[166]=wt):wt=t[166];let Tt;t[167]!==fe||t[168]!==B||t[169]!==Ct?(Tt=(0,Z.jsx)(rA,{checked:B,onCheckedChange:fe,disabled:Ct,"data-testid":`empty-space-menu-show-hidden-files`,children:wt}),t[167]=fe,t[168]=B,t[169]=Ct,t[170]=Tt):Tt=t[170];let Et=R===null,Dt;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,Z.jsx)(s,{id:`i8dKs-`}),t[171]=Dt):Dt=t[171];let Ot;t[172]!==me||t[173]!==V||t[174]!==Et?(Ot=(0,Z.jsx)(rA,{checked:V,onCheckedChange:me,disabled:Et,"data-testid":`empty-space-menu-show-all-files`,children:Dt}),t[172]=me,t[173]=V,t[174]=Et,t[175]=Ot):Ot=t[175];let kt;t[176]===G?kt=t[177]:(kt=G?(0,Z.jsx)(iA,{}):null,t[176]=G,t[177]=kt);let At;t[178]!==ge||t[179]!==H?(At=H?(0,Z.jsxs)(eA,{onSelect:ge,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Tl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[178]=ge,t[179]=H,t[180]=At):At=t[180];let jt;t[181]!==ve||t[182]!==U?(jt=U?(0,Z.jsxs)(eA,{onSelect:ve,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Ic,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[181]=ve,t[182]=U,t[183]=jt):jt=t[183];let Mt;t[184]!==$e||t[185]!==at||t[186]!==lt||t[187]!==dt||t[188]!==ft||t[189]!==pt||t[190]!==xt||t[191]!==Tt||t[192]!==Ot||t[193]!==kt||t[194]!==At||t[195]!==jt?(Mt=(0,Z.jsxs)($k,{children:[$e,at,lt,ut,dt,ft,pt,xt,St,Tt,Ot,kt,At,jt]}),t[184]=$e,t[185]=at,t[186]=lt,t[187]=dt,t[188]=ft,t[189]=pt,t[190]=xt,t[191]=Tt,t[192]=Ot,t[193]=kt,t[194]=At,t[195]=jt,t[196]=Mt):Mt=t[196];let Nt;return t[197]!==J||t[198]!==Mt?(Nt=(0,Z.jsx)(MO,{variant:`inset`,children:(0,Z.jsxs)(Xk,{children:[J,Mt]})}),t[197]=J,t[198]=Mt,t[199]=Nt):Nt=t[199],Nt}function KU(){return null}function qU(e){HU(e.target)&&(e.preventDefault(),e.stopPropagation())}function JU(){let e=(0,$.c)(17),t=On(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=ht(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Bt,i=new Qe({url:n,name:bi,document:e,onStateless:e=>{let{payload:t}=e;pe(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:eW,onConfigValidationRejected:$U,onConfigIgnoreNestedError:QU,onUnknown:ZU})},onClose:XU,onDisconnect:YU}),a=ji(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=E(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Pi([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function YU(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function XU(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function ZU(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function QU(e){Ro(e)}function $U(e){Vo(e)}function eW(e){Pi([e.ch])}var tW=`#install-claude-desktop`;function nW(e){return e===`#settings`||e===tW}function rW(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function iW(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=ht(),{openTargetTransition:i}=Dt(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=wi(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=rW(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(nW(window.location.hash))return;let e=yi(window.location.hash);if(e){let t=Vn(e.split(`.`).pop()??``);b(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=ti(window.location.hash);if(!n){b(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){b(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=li(n,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(r.kind===`missing`&&/\/+$/.test(n.trim())){b(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=ei(Yr(r),c);b(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function aW(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(oW,t),null}function oW(){let e=lW;if(!e(window.location.hash))return;let t=new AbortController;return ve(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(cW))}).catch(sW),()=>t.abort()}function sW(){}function cW(){}function lW(e){return!nW(e)&&!yi(e)&&!ti(e)&&(e===``||e===`#`||e===`#/`)}function uW(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(dW,t),null}function dW(){let e=function(e){let t=e.target;Sh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=xh))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function fW(){let e=(0,$.c)(4),{activeTarget:t}=ht(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function pW(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=ht(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:xr(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Bm({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(Hm,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function mW(){let e=(0,$.c)(22),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=t?$l({bridge:t,authQueryTransport:ho(),cloneTransport:eu(),openSignIn:()=>new Promise(e=>{c(()=>e),o(!0)})}):null,e[0]=l):l=e[0];let u=l,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Vg,{}),e[1]=d):d=e[1];let f,p,m,h,g,_,v,y,b;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(JU,{}),m=(0,Z.jsx)(iW,{}),h=(0,Z.jsx)(aW,{}),g=(0,Z.jsx)(fW,{}),_=(0,Z.jsx)(pW,{}),v=(0,Z.jsx)(uW,{}),y=!1,b=(0,Z.jsx)(Nd,{}),f=t&&u?(0,Z.jsx)(Zd,{bridge:t,cloneController:u}):null,e[2]=f,e[3]=p,e[4]=m,e[5]=h,e[6]=g,e[7]=_,e[8]=v,e[9]=y,e[10]=b):(f=e[2],p=e[3],m=e[4],h=e[5],g=e[6],_=e[7],v=e[8],y=e[9],b=e[10]);let S;e[11]!==a||e[12]!==s?(S=t?(0,Z.jsx)(Ra,{open:a,onOpenChange:e=>{e||(o(!1),s?.(null),c(null))},onSuccess:e=>{s?.({authenticated:!0,host:`github.com`,login:e.login}),c(null)}}):null,e[11]=a,e[12]=s,e[13]=S):S=e[13];let C;e[14]===r?C=e[15]:(C=(0,Z.jsx)(Ng,{bridge:t,open:r,onOpenChange:i}),e[14]=r,e[15]=C);let w;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[16]=w):w=e[16];let T;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(UU,{onOpenSearch:()=>i(!0)}),e[17]=T):T=e[17];let E;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsxs)(kO,{className:`h-screen overflow-hidden`,children:[T,(0,Z.jsx)(FO,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(FA,{onOpenSearch:()=>i(!0)})})]}),e[18]=E):E=e[18];let D;return e[19]!==S||e[20]!==C?(D=(0,Z.jsx)(x,{name:`app`,children:(0,Z.jsx)(Ft,{children:(0,Z.jsxs)(Rt,{children:[d,(0,Z.jsxs)(si,{children:[p,m,h,g,_,v,y,b,f,S,C,w,E]})]})})}),e[19]=S,e[20]=C,e[21]=D):D=e[21],D}ec(),Df({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Bf(),mp()&&bp(),Jp(),typeof window<`u`&&Uf({bridge:window.okDesktop}),typeof window<`u`&&tp({bridge:window.okDesktop}),typeof window<`u`&&Es({bridge:window.okDesktop}),typeof window<`u`&&Ss({bridge:window.okDesktop}),typeof window<`u`&&Kf({bridge:window.okDesktop}),typeof window<`u`&&Xd({bridge:window.okDesktop});var hW=new lc({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),gW=document.getElementById(`root`);if(!gW)throw Error(`Root element not found`);var _W=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,yc.createRoot)(gW).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:Y,children:(0,Z.jsx)(bn,{client:hW,children:(0,Z.jsxs)(Nr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(ur,{children:_W&&window.okDesktop?(0,Z.jsx)(xf,{bridge:window.okDesktop}):(0,Z.jsx)(mW,{})}),(0,Z.jsx)(Tf,{richColors:!0,closeButton:!0})]})})})}));
1917
+ </svg>`,IH=`${oV}\n${bV}`;function LH(e){return{..._M({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-file-icon-color-image":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`}}function RH(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&AH.has(t)}function zH(e){return e===`darwin`?Y._({id:`LtSYdi`}):e===`win32`?Y._({id:`qi1F96`}):Y._({id:`hz7n6T`})}function BH(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:a}=e,{_:o}=i(),s=typeof window<`u`?window.okDesktop:void 0;if(!s)return null;let c=s.platform,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=zH(c),t[0]=l):l=t[0];let u=l,d,f;t[1]!==o||t[2]!==r?(d=r?null:o({id:`wTcjov`}),f=o(c===`darwin`?d?{id:`FvpFSZ`,values:{hint:d}}:{id:`LtSYdi`}:c===`win32`?d?{id:`o4dcAf`,values:{hint:d}}:{id:`qi1F96`}:d?{id:`ScUTHW`,values:{hint:d}}:{id:`hz7n6T`}),t[1]=o,t[2]=r,t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=f,m=!r,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=()=>{if(!r)return;a();let e=Xh(r.contentDir,Ok(n),r.pathSeparator);s.shell.showItemInFolder(e)},t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(je,{"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{className:`flex-1`,children:u}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===d?v=t[12]:(v=d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null,t[11]=d,t[12]=v);let y;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(go,{disabled:m,onSelect:h,"aria-label":p,children:[g,_,v]}),t[13]=p,t[14]=m,t[15]=h,t[16]=v,t[17]=y):y=t[17],y}function VH(e){let t=(0,$.c)(21),{dirAbsPath:n,onClose:r}=e,{_:a}=i(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let c,l,u,d,f;t[0]!==a||t[1]!==n||t[2]!==r?(l=n===null?a({id:`wTcjov`}):null,c=go,u=n===null,t[8]!==n||t[9]!==r?(d=()=>{n!==null&&(r(),qV(o,n))},t[8]=n,t[9]=r,t[10]=d):d=t[10],f=a(l?{id:`ehLu5O`,values:{hint:l}}:{id:`BJpGCq`}),t[0]=a,t[1]=n,t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d,t[7]=f):(c=t[3],l=t[4],u=t[5],d=t[6],f=t[7]);let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Sl,{"aria-hidden":`true`}),t[11]=p):p=t[11];let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`BJpGCq`})}),t[12]=m):m=t[12];let h;t[13]===l?h=t[14]:(h=l?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null,t[13]=l,t[14]=h);let g;return t[15]!==c||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==h?(g=(0,Z.jsxs)(c,{disabled:u,onSelect:d,"aria-label":f,children:[p,m,h]}),t[15]=c,t[16]=u,t[17]=d,t[18]=f,t[19]=h,t[20]=g):g=t[20],g}function HH(e,t){return Dk({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function UH(e,t){return e!==t&&e.startsWith(t)}function WH(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>UH(e,t))).map(e=>HH(e,t))}function GH(e,t){return e===t||e.startsWith(`${t}/`)}function KH(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function qH(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)mr(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):Bn(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=gk(e);GH(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function JH(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:GH(t.createdPath,e.path)}function YH(e){let t=(0,$.c)(84),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:u,projectLocalBinding:d,mergedConfig:f,onStartCreating:p,onCreateFromTemplate:m,onDuplicate:h,onDelete:g,onExpandSubtree:_,onCollapseSubtree:v,folderTreePaths:y,isAsset:b,documents:x}=e,{_:S}=i(),C,w,T,E,D,O,k,A,j,M;if(t[0]!==S||t[1]!==x||t[2]!==n||t[3]!==f?.appearance?.sidebar?.showAllFiles||t[4]!==f?.appearance?.sidebar?.showHiddenFiles||t[5]!==l||t[6]!==u||t[7]!==d){M=Dk(n,x),D=n.kind===`directory`,O=M.kind===`asset`?null:M,C=O!==null&&u!==null;let e;t[18]!==S||t[19]!==D?(e=S(D?{id:`5D3Ior`}:{id:`dbhUX1`}),t[18]=S,t[19]=D,t[20]=e):e=t[20],E=e,A=f?.appearance?.sidebar?.showHiddenFiles??!1,k=f?.appearance?.sidebar?.showAllFiles??!1,w=d!==null;let r=l.getSelectedPaths(),i=r.includes(M.treePath)?WH(r,x):[];T=i.length>1?i:[M];let a=T.length;j=Y._({id:`44_vJP`,values:{deleteCount:a}}),t[0]=S,t[1]=x,t[2]=n,t[3]=f?.appearance?.sidebar?.showAllFiles,t[4]=f?.appearance?.sidebar?.showHiddenFiles,t[5]=l,t[6]=u,t[7]=d,t[8]=C,t[9]=w,t[10]=T,t[11]=E,t[12]=D,t[13]=O,t[14]=k,t[15]=A,t[16]=j,t[17]=M}else C=t[8],w=t[9],T=t[10],E=t[11],D=t[12],O=t[13],k=t[14],A=t[15],j=t[16],M=t[17];let N=j,P;t[21]!==D||t[22]!==n||t[23]!==o?(P=D&&o?Xh(o.contentDir,Ok(n),o.pathSeparator):null,t[21]=D,t[22]=n,t[23]=o,t[24]=P):P=t[24];let F=P,I;if(t[25]!==D||t[26]!==n||t[27]!==o){bb0:{if(!o||D){I=null;break bb0}let e=Ok(n),t=e.lastIndexOf(`/`);if(t===-1){I=o.contentDir;break bb0}I=Xh(o.contentDir,e.slice(0,t),o.pathSeparator)}t[25]=D,t[26]=n,t[27]=o,t[28]=I}else I=t[28];let L=I,z;t[29]!==b||t[30]!==D||t[31]!==n||t[32]!==o?(z=b?null:D?eg({folderRelativePath:Ok(n),workspace:o}):Qh({docName:pk(n.path),workspace:o}),t[29]=b,t[30]=D,t[31]=n,t[32]=o,t[33]=z):z=t[33];let B=z,V;t[34]===r?V=t[35]:(V=()=>r.close({restoreFocus:!1}),t[34]=r,t[35]=V);let H=V,U;t[36]===r?U=t[37]:(U=()=>r.close(),t[36]=r,t[37]=U);let W=U,G;t[38]!==S||t[39]!==d?(G=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,qr(t.error)),X.error(S({id:`P47EWZ`}),{description:qr(t.error)}))},t[38]=S,t[39]=d,t[40]=G):G=t[40];let ee=G,K;t[41]!==S||t[42]!==d?(K=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,qr(t.error)),X.error(S({id:`P47EWZ`}),{description:qr(t.error)}))},t[41]=S,t[42]=d,t[43]=K):K=t[43];let te=K,ne=0,q=0;if(D){let e=_k(n.path);for(let t of y)(t===e||t.startsWith(e))&&(ne++,WV(l.getItem(t))?.isExpanded()&&q++)}let re=D&&q<ne,ie=D&&q>0,ae;t[44]===W?ae=t[45]:(ae=e=>{e||W()},t[44]=W,t[45]=ae);let oe;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[46]=oe):oe=t[46];let se;t[47]!==S||t[48]!==a||t[49]!==C||t[50]!==w||t[51]!==W||t[52]!==H||t[53]!==N||t[54]!==T||t[55]!==F||t[56]!==te||t[57]!==ee||t[58]!==c||t[59]!==B||t[60]!==E||t[61]!==b||t[62]!==D||t[63]!==n||t[64]!==l||t[65]!==u||t[66]!==O||t[67]!==v||t[68]!==m||t[69]!==g||t[70]!==h||t[71]!==_||t[72]!==p||t[73]!==L||t[74]!==k||t[75]!==A||t[76]!==ie||t[77]!==re||t[78]!==M||t[79]!==o?(se=(0,Z.jsx)(ua,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{H(),p(`file`,gk(n.path))},children:[(0,Z.jsx)(_l,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`MW64zN`})]}),(0,Z.jsxs)(zo,{children:[(0,Z.jsxs)(uo,{disabled:a,children:[(0,Z.jsx)(bo,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(xo,{children:(0,Z.jsx)(UV,{parentDir:gk(n.path),onSelectTemplate:e=>{H(),m(gk(n.path),e)},ItemComponent:go})})]}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{H(),p(`folder`,gk(n.path))},children:[(0,Z.jsx)(Rc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`tX5yOZ`})]}),(0,Z.jsx)(Ao,{}),(0,Z.jsx)(BH,{item:n,workspace:o,onClose:W}),(0,Z.jsx)(dH,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!1}),(0,Z.jsx)(VH,{dirAbsPath:F,onClose:W}),(0,Z.jsxs)(zo,{children:[(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(Vt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(xo,{children:[(0,Z.jsx)(go,{disabled:!o,onSelect:()=>{o&&(W(),kH(Xh(o.contentDir,Ok(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(go,{onSelect:()=>{W(),kH(Ok(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(Ao,{}),(0,Z.jsx)(Ua,{checked:A,onCheckedChange:ee,disabled:!w,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`K_wz1u`})}),(0,Z.jsx)(Ua,{checked:k,onCheckedChange:te,disabled:!w,"data-testid":`file-tree-menu-show-all-files`,children:(0,Z.jsx)(s,{id:`i8dKs-`})}),re||ie?(0,Z.jsx)(Ao,{}):null,re?(0,Z.jsxs)(go,{onSelect:()=>{W(),_(n.path)},children:[(0,Z.jsx)(Tl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}):null,ie?(0,Z.jsxs)(go,{onSelect:()=>{W(),v(n.path)},children:[(0,Z.jsx)(Ic,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]}):null,(0,Z.jsx)(Ao,{}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{M.kind!==`asset`&&(W(),h(M))},children:[(0,Z.jsx)(Ve,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(_e,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)(go,{"data-testid":`file-tree-menu-hide`,disabled:!C,onSelect:()=>{if(!u||!O)return;W();let e=pV(O),t=Wo(u.current()),n=jo(t,e);if(n===t)return;u.patch(Po(n));let r=O.path.split(`/`).pop()||O.path;X.success(S({id:`4xtLTl`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Re,{"aria-hidden":`true`}),E]}),(0,Z.jsxs)(go,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(T)},children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),N]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(BH,{item:n,workspace:o,onClose:W}),!b&&(0,Z.jsx)(dH,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!0}),(0,Z.jsx)(VH,{dirAbsPath:L,onClose:W}),(0,Z.jsxs)(zo,{children:[(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(Vt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(xo,{children:[(0,Z.jsx)(go,{disabled:!o,onSelect:()=>{o&&(W(),kH(Xh(o.contentDir,Ok(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(go,{onSelect:()=>{W(),kH(Ok(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(Ao,{}),b?null:(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{W(),h(M)},children:[(0,Z.jsx)(Ve,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(go,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(_e,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),O?(0,Z.jsxs)(go,{"data-testid":`file-tree-menu-hide`,disabled:!C,onSelect:()=>{if(!u)return;W();let e=pV(O),t=Wo(u.current()),n=jo(t,e);if(n===t)return;u.patch(Po(n));let r=O.path.split(`/`).pop()||O.path;X.success(S({id:`OD0FCX`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Re,{"aria-hidden":`true`}),E]}):null,(0,Z.jsxs)(go,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(T)},children:[(0,Z.jsx)(R,{"aria-hidden":`true`}),N]})]})}),t[47]=S,t[48]=a,t[49]=C,t[50]=w,t[51]=W,t[52]=H,t[53]=N,t[54]=T,t[55]=F,t[56]=te,t[57]=ee,t[58]=c,t[59]=B,t[60]=E,t[61]=b,t[62]=D,t[63]=n,t[64]=l,t[65]=u,t[66]=O,t[67]=v,t[68]=m,t[69]=g,t[70]=h,t[71]=_,t[72]=p,t[73]=L,t[74]=k,t[75]=A,t[76]=ie,t[77]=re,t[78]=M,t[79]=o,t[80]=se):se=t[80];let ce;return t[81]!==se||t[82]!==ae?(ce=(0,Z.jsxs)(oo,{open:!0,modal:!1,onOpenChange:ae,children:[oe,se]}),t[81]=se,t[82]=ae,t[83]=ce):ce=t[83],ce}function XH(e){let t=(0,$.c)(280),{ref:n}=e,{_:r}=i(),{activeDocName:a,activeTarget:o,closeTabs:c,closeDocument:l,closeAndClearForRename:u,getPoolActiveDocName:d,poolHas:f,isNewTabActive:p,openTarget:m,prewarm:h,remapTabsForRename:g}=ht(),{notifySidebarFileSelected:_}=OO(),{resolvedTheme:v}=Jn(),{addPage:y,pageMeta:b}=wi(),x;t[0]===b?x=t[1]:(x=function(e,t){return mi(e,t??b.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=b,t[1]=x);let S=x,C;t[2]!==S||t[3]!==_||t[4]!==m?(C=function(e,t){m(S(e,t),{tabBehavior:`replace-active`}),EH(xi(e)),_()},t[2]=S,t[3]=_,t[4]=m,t[5]=C):C=t[5];let w=C,T;t[6]!==_||t[7]!==m?(T=function(e){let t=Hr(e);m({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),EH(t),_()},t[6]=_,t[7]=m,t[8]=T):T=t[8];let E=T,D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[9]=D):D=t[9];let[O,k]=(0,Q.useState)(D),[A,j]=(0,Q.useState)(!0),[M,N]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(null),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),{conflicts:U}=qa(),[W,G]=(0,Q.useState)(null),[ee,K]=(0,Q.useState)(null),te=(0,Q.useRef)(O),ne;t[10]!==O||t[11]!==E||t[12]!==w||t[13]!==_||t[14]!==m?(ne=function(e,t){let n=t===void 0?O:t,r=jV(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,vk(e));return}if(r.kind===`asset`){m({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),EH(r.hash),_();return}if(r.kind===`folder`){E(r.path);return}let i=n.find(e=>mr(e)&&e.docName===r.path);w(r.path,i?.size)},t[10]=O,t[11]=E,t[12]=w,t[13]=_,t[14]=m,t[15]=ne):ne=t[15];let q=ne,re;t[16]!==_||t[17]!==m?(re=function(e){m({kind:`asset`,target:e,assetPath:e,mediaKind:te.current.find(t=>Bn(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),EH(pi(e)),_()},t[16]=_,t[17]=m,t[18]=re):re=t[18];let ie=re,ae=(0,Q.useRef)(a),oe;t[19]===O?oe=t[20]:(oe=new Set(O.filter(Bn).map(bU)),t[19]=O,t[20]=oe);let se=oe,ce=(0,Q.useRef)(se),le;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(le=[],t[21]=le):le=t[21];let ue=(0,Q.useRef)(le),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(yU),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),he=(0,Q.useRef)(!1),ge=(0,Q.useRef)(null),_e;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_e=new Map,t[22]=_e):_e=t[22];let ve=(0,Q.useRef)(_e),ye=(0,Q.useRef)(!1),be=(0,Q.useRef)(!1),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(null),Ce=(0,Q.useRef)(vU),we=(0,Q.useRef)(_U),Te=(0,Q.useRef)(gU),Ee=(0,Q.useRef)(hU),De=(0,Q.useRef)(o),{selectedFilePath:Oe,selectedFolderPath:ke,navigationPath:Ae}=AV(o,p?null:a),je=Oe?fk(Oe,O.find(e=>mr(e)&&e.docName===Oe)?.docExt):ke?_k(ke):o?.kind===`asset`?o.assetPath:null,Me=Cg().states,{dispatch:Ne}=fg(),Pe;t[23]!==Ne||t[24]!==Me?(Pe={installStates:Me,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Ne},t[23]=Ne,t[24]=Me,t[25]=Pe):Pe=t[25];let Fe=Pe,{okignoreBinding:Ie,projectLocalBinding:Le,merged:Re}=vt(),ze=Re?.appearance?.sidebar?.showHiddenFiles??!1,Be=Re?.appearance?.sidebar?.showAllFiles??!1,Ve;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=()=>ge.current===null,t[26]=Ve):Ve=t[26];let He=Ve,Ue;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=[],t[27]=Ue):Ue=t[27];let We;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(We={set:`complete`,spriteSheet:FH},t[28]=We):We=t[28];let Ge;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Ge={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[29]=Ge):Ge=t[29];let Ke;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ke={canDrag:He,canDrop:He,onDropComplete:e=>Ee.current(e),onDropError:mU},t[30]=Ke):Ke=t[30];let qe,Je;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(qe={canRename:He,onRename:e=>we.current(e),onError:e=>Te.current(e)},Je=e=>Ce.current(e),t[31]=qe,t[32]=Je):(qe=t[31],Je=t[32]);let Ye;t[33]===r?Ye=t[34]:(Ye={paths:Ue,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:We,unsafeCSS:IH,composition:Ge,dragAndDrop:Ke,renaming:qe,onSelectionChange:Je,renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=te.current.find(e=>mr(e)&&fk(e.docName,e.docExt)===t.path);if(n?.isSymlink){let e=n.targetPath;return{icon:jH,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return RH(t.path)?{icon:MH,title:r({id:`i9toLO`})}:null}},t[33]=r,t[34]=Ye);let{model:J}=eV(Ye),Xe;t[35]===J?Xe=t[36]:(Xe=function(e){let t=J.getItem(e)??J.getItem(_k(e));return t?.isDirectory()?_k(gk(t.getPath())):e},t[35]=J,t[36]=Xe);let Ze=Xe,Qe,$e;t[37]===O?(Qe=t[38],$e=t[39]):($e=yk(O),Qe=bk($e),t[37]=O,t[38]=Qe,t[39]=$e);let et=Qe,tt=(0,Q.useRef)($e),nt;t[40]===O?nt=t[41]:(nt=Sk(O),t[40]=O,t[41]=nt);let rt=nt,it=(0,Q.useRef)(rt),at=ke?Ck(_k(ke)).slice(0,-1):Ck(je??Ae),ot=at.join(`\0`),st;if(t[42]!==J){let e=()=>{let e=new Set;for(let t of it.current)WV(J.getItem(t))?.isExpanded()&&e.add(t);return e};st=t=>{let n=new Set(Sk(t??te.current)),r=e();for(let e of ue.current)r.add(e);return[...r].filter(e=>n.has(e))},t[42]=J,t[43]=st}else st=t[43];let ct=st,lt;t[44]!==ct||t[45]!==J?(lt=e=>{let t=yk(e??te.current);J.resetPaths(t,{initialExpandedPaths:ct(e)})},t[44]=ct,t[45]=J,t[46]=lt):lt=t[46];let ut=lt,dt;t[47]!==J||t[48]!==ut?(dt=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:t,toDocName:r}of n){let n=e.find(e=>mr(e)&&e.docName===t);if(n==null||J.getItem(r)==null)continue;let i=fk(r,n.docExt);J.move(r,i),o=i,a+=1}for(let{toPath:e}of i){let t=tV(e);if(t===``)continue;let n=e.slice(0,-t.length);J.getItem(n)!=null&&(J.getItem(e)??J.move(n,e),o=e,a+=1)}a!==0&&(ut(t),o!=null&&J.focusPath(o))},t[47]=J,t[48]=ut,t[49]=dt):dt=t[49];let ft=dt,pt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(pt=e=>{pe.current=xk(e)},t[50]=pt):pt=t[50];let mt=pt,gt;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(gt=e=>ce.current.has(e),t[51]=gt):gt=t[51];let _t=gt,yt;t[52]!==r||t[53]!==y||t[54]!==E||t[55]!==w||t[56]!==ut?(yt=async function(e){if(e.kind===`asset`||ge.current!==null)return;let t=()=>{R(null),ge.current=null};ge.current=e.path,R(e.path),N(null);try{let n=await Et(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){X.error(n.title),ut(),t();return}let i=P(Wn,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});X.error(e),N(e),Pi([`files`,`backlinks`,`graph`]),ut(),t();return}for(let e of i.duplicatedDocNames)y(e);k(t=>{let n=Vk(t,e,i);return ut(n),mt(n),n}),Pi([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?E(i.path):w(i.path)),X.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),X.error(r({id:`EBVbtP`}),{description:i}),ut(),t()}},t[52]=r,t[53]=y,t[54]=E,t[55]=w,t[56]=ut,t[57]=yt):yt=t[57];let bt=yt,xt=(0,Q.useRef)(bt),St;t[58]===bt?St=t[59]:(St=()=>{xt.current=bt},t[58]=bt,t[59]=St),(0,Q.useEffect)(St);let Ct=function(e){let t=DH(e);if(!t||OH(t))return!1;let n=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||_t(n))return!1;let r=OH(n);if(!r)return!1;let i=_k(t);if(!it.current.includes(i))return!1;let a=`${t}${r}`;return tt.current.includes(a)?!1:(en({sourcePath:n,destinationPath:a,isFolder:!1}),J.move(n,a),!0)},wt;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(wt=e=>{let t=e??de.current;!t||de.current!==t||(t.disposeCommitListener(),de.current=null)},t[60]=wt):wt=t[60];let Tt=wt,Dt;t[61]!==r||t[62]!==Tt||t[63]!==l||t[64]!==c||t[65]!==ut?(Dt=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;Tt(e),i&&R(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await Et(t,r({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=r({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});i?X.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(R(null),ut());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;X.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(R(null),ut());return}i&&(e.kind===`file`?l(e.createdPath):c([Qt(e.createdPath)],{force:!0})),i&&k(t=>{let n=zk(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return mt(n),n}),Pi([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&R(null)},t[61]=r,t[62]=Tt,t[63]=l,t[64]=c,t[65]=ut,t[66]=Dt):Dt=t[66];let Ot=Dt,kt,At;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(kt=()=>()=>{let e=de.current;e&&fe.current(e,{restoreLocation:!1,updateUi:!1}).catch(pU)},At=[],t[67]=kt,t[68]=At):(kt=t[67],At=t[68]),(0,Q.useEffect)(kt,At);let jt,Mt;t[69]===r?(jt=t[70],Mt=t[71]):(jt=()=>{let e=!0,t=null,n=rH(async function(){t?.abort();let n=new AbortController;t=n;try{let t=be.current,i=await fetch(t?`/api/documents?showAll=true`:`/api/documents`,{signal:n.signal,headers:t?iH:void 0});if(t&&aH(i)){let{entries:n,truncated:r}=await cH(i);if(!e)return;k(lH(Un(n,ye.current||t),te.current,ve.current)),N(null),I(r?n.length:null)}else{let n=await Et(i,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)N(n.title),I(null);else{let e=Cr.safeParse(n.body);if(!e.success)N(r({id:`HlmZBk`})),I(null);else{let n=ye.current||t;k(lH(Un(e.data.documents,n),te.current,ve.current)),N(null),I(t&&e.data.truncated===!0?e.data.documents.length:null)}}}}catch(t){let i=t;if(n.signal.aborted)return;e&&N(r({id:`34qyH5`})),console.warn(`[FileTree] fetch failed:`,i)}e&&j(!1)},()=>t?.abort());xe.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=ji(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,xe.current=null,n.dispose(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},Mt=[r],t[69]=r,t[70]=jt,t[71]=Mt),(0,Q.useEffect)(jt,Mt);let Nt=(0,Q.useRef)(!0),Pt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=()=>{if(Nt.current){Nt.current=!1;return}xe.current?.()},t[72]=Pt):Pt=t[72];let Ft;t[73]===ze?Ft=t[74]:(Ft=[ze],t[73]=ze,t[74]=Ft),(0,Q.useEffect)(Pt,Ft);let It=(0,Q.useRef)(!0),Lt;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=()=>{if(It.current){It.current=!1;return}xe.current?.()},t[75]=Lt):Lt=t[75];let Rt;t[76]===Be?Rt=t[77]:(Rt=[Be],t[76]=Be,t[77]=Rt),(0,Q.useEffect)(Lt,Rt);let zt,Bt;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(zt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=P(Zr,n,`workspace`,null);r&&K({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(fU),()=>{e=!1}},Bt=[],t[78]=zt,t[79]=Bt):(zt=t[78],Bt=t[79]),(0,Q.useEffect)(zt,Bt);let Vt;t[80]!==ct||t[81]!==J||t[82]!==et?(Vt=()=>{if(pe.current===et){pe.current=null;return}J.resetPaths(tt.current,{initialExpandedPaths:ct()})},t[80]=ct,t[81]=J,t[82]=et,t[83]=Vt):Vt=t[83];let Ht;t[84]!==J||t[85]!==et?(Ht=[J,et],t[84]=J,t[85]=et,t[86]=Ht):Ht=t[86],(0,Q.useEffect)(Vt,Ht),KV(J,je,ot,he,et);let Ut;t[87]!==je||t[88]!==A||t[89]!==J?(Ut=()=>{A||!je||OV(Se.current,J)},t[87]=je,t[88]=A,t[89]=J,t[90]=Ut):Ut=t[90];let Wt;t[91]!==ot||t[92]!==je||t[93]!==A||t[94]!==J||t[95]!==et?(Wt=[je,ot,et,A,J],t[91]=ot,t[92]=je,t[93]=A,t[94]=J,t[95]=et,t[96]=Wt):Wt=t[96],(0,Q.useEffect)(Ut,Wt);let Gt,Kt;t[97]===J?(Gt=t[98],Kt=t[99]):(Gt=()=>J.subscribe(()=>{if(!J.isSearchOpen())for(let e of ue.current){let t=WV(J.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Kt=[J],t[97]=J,t[98]=Gt,t[99]=Kt),(0,Q.useEffect)(Gt,Kt);let Jt,Xt;t[100]===J?(Jt=t[101],Xt=t[102]):(Jt=()=>J.onMutation(`remove`,e=>{let t=de.current;!t||e.path!==t.renamePath||fe.current(t)}),Xt=[J],t[100]=J,t[101]=Jt,t[102]=Xt),(0,Q.useEffect)(Jt,Xt);let Zt;t[103]!==y||t[104]!==u||t[105]!==d||t[106]!==ie||t[107]!==E||t[108]!==f||t[109]!==ft||t[110]!==g?(Zt=async(e,t,n,r)=>{let i=t===void 0?[]:t,a=n===void 0?[]:n,o=r?.docName??ae.current,s=Hk(o,e),c=r?.folderPath??(De.current?.kind===`folder`?De.current.folderPath:null),l=c?Yt(c,i):null,p=r?.assetPath??(De.current?.kind===`asset`?De.current.assetPath:null),m=p?a.find(e=>e.fromPath===p)?.toPath??Yt(p,i):null;qt(e);let h=Uk(e,d(),f);await Promise.all(h.map(e=>u(e)));for(let t of e)y(t.toDocName);g(e,i,a),k(t=>{let n=Rk(t,e,i,a);return ft(t,n,e,a),mt(n),n}),c&&l&&l!==c?E(l):s&&s!==o?window.location.hash=xi(s):p&&m&&m!==p&&ie(m),Pi([`files`,`backlinks`,`graph`])},t[103]=y,t[104]=u,t[105]=d,t[106]=ie,t[107]=E,t[108]=f,t[109]=ft,t[110]=g,t[111]=Zt):Zt=t[111];let $t=Zt;async function en(e){let t=!e.isFolder&&_t(e.sourcePath),n=t?e.sourcePath:kk(e.sourcePath,e.isFolder);R(n),N(null);try{let i=rV(e.sourcePath,e.destinationPath,e.isFolder,t);if(i.kind===`block`){X.error(r({id:`FaBZwp`})),queueMicrotask(()=>{ut()}),Tt(),R(null);return}let a=t?i.destinationPath:kk(i.destinationPath,e.isFolder),o=e.isFolder?{kind:`folder`,fromPath:gk(n),toPath:gk(a)}:t?{kind:`asset`,fromPath:n,toPath:a}:{kind:`file`,fromPath:pk(n),toPath:pk(a)},s={docName:ae.current,folderPath:De.current?.kind===`folder`?De.current.folderPath:null,assetPath:De.current?.kind===`asset`?De.current.assetPath:null},c=await Et(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o)}),r({id:`gijbne`}));if(!c.ok){X.error(c.title),ut();let e=de.current;e&&e.renamePath===n?await Ot(e):Tt(),R(null);return}let l=P(Kr,c.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await $t(l.renamed,e.isFolder?[{fromPath:gk(n),toPath:gk(a)}]:[],l.renamedAssets,s)}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:a,renamedCount:l.renamed.length,renamedAssetCount:l.renamedAssets.length}),X.error(r({id:`dDpCOp`}))}Tt(),R(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});X.error(t),N(t),ut();let i=de.current;i&&i.renamePath===n?await Ot(i):Tt(),R(null)}}let tn;t[112]!==r||t[113]!==$t||t[114]!==ut?(tn=async function(e){let t=e.draggedPaths.map(t=>{let n=Mk(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(dU);if(t.length!==0){R(t[0]?.sourcePath??null),N(null);try{let e=[],n=[],i=[],a={docName:ae.current,folderPath:De.current?.kind===`folder`?De.current.folderPath:null,assetPath:De.current?.kind===`asset`?De.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&_t(a.sourcePath),s=t?{kind:`folder`,fromPath:gk(a.sourcePath),toPath:gk(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:pk(a.sourcePath),toPath:pk(a.destinationTreePath)},c=await Et(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){X.error(c.title),ut(),R(null);return}let l=P(Kr,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:gk(a.sourcePath),toPath:gk(a.destinationTreePath)})}try{await $t(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),X.error(r({id:`8OxKZy`}))}R(null)}catch(e){console.warn(`[FileTree] move failed:`,e),X.error(r({id:`HIb0vl`})),ut(),R(null)}}},t[112]=r,t[113]=$t,t[114]=ut,t[115]=tn):tn=t[115];let nn=tn,rn;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(rn=function(e){G({parentDir:e})},t[116]=rn):rn=t[116];let an=rn,on;t[117]!==r||t[118]!==y||t[119]!==Ot||t[120]!==Tt||t[121]!==J||t[122]!==E||t[123]!==w||t[124]!==ut||t[125]!==$e?(on=async function(e,t,n){if(ge.current)return;let i=de.current;i&&Tt(i);try{let i=Ak(e,t,[...$e,...it.current]);R(i.renamePath),ge.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=jk(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await Et(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){X.error(a.title),R(null),ge.current=null;return}let s=pk(e),c=P(Vr,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};y(c),k(e=>{if(e.some(e=>mr(e)&&e.docName===c))return e;let t=[...e,l];return mt(t),ve.current.set(mk(l),Date.now()),t}),Pi([`files`,`backlinks`,`graph`]),w(c)}else{let e=gk(i.addPath),t=await Et(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){X.error(t.title),R(null),ge.current=null;return}o=P(Ii,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};k(e=>{if(e.some(e=>ai(e)&&e.path===o))return e;let t=[...e,n];return mt(t),ve.current.set(mk(n),Date.now()),t}),Pi([`files`]),E(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=de.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>Tt(t))};document.addEventListener(`keydown`,c,!0),de.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},R(null),ge.current=null,J.add(i.addPath),J.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),X.error(r({id:`S6l5dv`}));let t=de.current;t?await Ot(t):Tt(),R(null),ge.current=null,ut()}},t[117]=r,t[118]=y,t[119]=Ot,t[120]=Tt,t[121]=J,t[122]=E,t[123]=w,t[124]=ut,t[125]=$e,t[126]=on):on=t[126];let sn=on,cn;t[127]===J?cn=t[128]:(cn=function(e){let t=_k(e);(0,Q.startTransition)(()=>{for(let e of it.current)if(e===t||e.startsWith(t)){let t=WV(J.getItem(e));t&&t.expand()}})},t[127]=J,t[128]=cn);let ln=cn,un;t[129]===J?un=t[130]:(un=function(e){let t=_k(e),n=new Set(ue.current);(0,Q.startTransition)(()=>{for(let e of[...it.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=WV(J.getItem(e));t&&t.collapse()}})},t[129]=J,t[130]=un);let dn=un,fn;t[131]!==q||t[132]!==at||t[133]!==a||t[134]!==o||t[135]!==se||t[136]!==L||t[137]!==Ot||t[138]!==O||t[139]!==rt||t[140]!==nn||t[141]!==en||t[142]!==Ze||t[143]!==Ct||t[144]!==Be||t[145]!==ze||t[146]!==$e?(fn=()=>{te.current=O,ae.current=a,De.current=o,ce.current=se,ge.current=L,ye.current=ze,be.current=Be,tt.current=$e,it.current=rt,ue.current=at,fe.current=Ot,Ce.current=e=>{if(he.current||e.length!==1)return;let t=e[0];t&&q(Ze(t),O)},Te.current=e=>{Ct(e)||X.error(e)},we.current=en,Ee.current=nn},t[131]=q,t[132]=at,t[133]=a,t[134]=o,t[135]=se,t[136]=L,t[137]=Ot,t[138]=O,t[139]=rt,t[140]=nn,t[141]=en,t[142]=Ze,t[143]=Ct,t[144]=Be,t[145]=ze,t[146]=$e,t[147]=fn):fn=t[147],(0,Q.useLayoutEffect)(fn);let pn,mn;t[148]===J?(pn=t[149],mn=t[150]):(pn=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||KH(e.target))return;let a=Se.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!t)return;let n=J.getItem(t)??J.getItem(_k(t)),r=n?.isDirectory()?_k(gk(n.getPath())):t;if(ce.current.has(r))return;xt.current(HH(r,te.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...it.current,...tt.current]);he.current=!0;for(let e of u)e&&J.getItem(e)?.select();queueMicrotask(()=>{he.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},mn=[J],t[148]=J,t[149]=pn,t[150]=mn),(0,Q.useEffect)(pn,mn);let hn,gn;t[151]!==O.length||t[152]!==A?(hn=()=>{if(A||O.length===0)return;let e=Se.current?.querySelector(Xj)?.shadowRoot;if(!e)return;let t=uU,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},gn=[A,O.length],t[151]=O.length,t[152]=A,t[153]=hn,t[154]=gn):(hn=t[153],gn=t[154]),(0,Q.useEffect)(hn,gn);let _n,vn;t[155]!==O.length||t[156]!==A?(_n=()=>{if(A||O.length===0)return;let e=Se.current?.querySelector(Xj)?.shadowRoot;if(!e)return;let t=()=>sV(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},vn=[A,O.length],t[155]=O.length,t[156]=A,t[157]=_n,t[158]=vn):(_n=t[157],vn=t[158]),(0,Q.useEffect)(_n,vn);let yn,bn;t[159]!==O.length||t[160]!==A?(yn=()=>{if(A||O.length===0)return;let e=Se.current?.querySelector(Xj)?.shadowRoot;if(!e)return;let t=()=>xV(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},bn=[A,O.length],t[159]=O.length,t[160]=A,t[161]=yn,t[162]=bn):(yn=t[161],bn=t[162]),(0,Q.useEffect)(yn,bn);let xn;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(xn={folderCount:0,expandedCount:0},t[163]=xn):xn=t[163];let Sn=(0,Q.useRef)(xn),Cn=(0,Q.useRef)(sn),wn=(0,Q.useRef)(an),Tn;t[164]===sn?Tn=t[165]:(Tn=()=>{Cn.current=sn,wn.current=an},t[164]=sn,t[165]=Tn),(0,Q.useEffect)(Tn);let En,Dn;t[166]===J?(En=t[167],Dn=t[168]):(En=()=>({startCreating(e,t){Cn.current(e,t)},startCreatingFromTemplate(e){wn.current(e)},createFromTemplate(e,t){Cn.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of it.current){let t=WV(J.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(ue.current);(0,Q.startTransition)(()=>{for(let t of[...it.current].reverse()){if(e.has(t))continue;let n=WV(J.getItem(t));n&&n.collapse()}})},getFolderState(){let e=it.current,t=0;for(let n of e)WV(J.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Sn.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Sn.current=i,i},subscribe(e){return J.subscribe(e)}}),Dn=[J],t[166]=J,t[167]=En,t[168]=Dn),(0,Q.useImperativeHandle)(n,En,Dn);let On;t[169]!==Tt||t[170]!==u||t[171]!==c||t[172]!==J?(On=async function(e,t,n){let r=qH(e,te.current,it.current),i=de.current;i&&e.some(e=>JH(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Tt(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(lU).map(cU)]);c([...[...a].map(sU),...[...o].map(oU),...[...s].map(aU)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?_k(t.path):t.kind===`asset`?t.path:fk(t.path,t.docExt);J.getItem(e)&&J.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}k(e=>{let t=zk(e,[...a],void 0,[...s]);for(let e of o)t=zk(t,[],e);return mt(t),t}),Pi([`files`,`backlinks`,`graph`])},t[169]=Tt,t[170]=u,t[171]=c,t[172]=J,t[173]=On):On=t[173];let kn=On,An;t[174]!==r||t[175]!==kn?(An=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;R(a.path);let o=await Et(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!o.ok)return i.length>0&&await kn(i,t,n),X.error(o.title),!1;let s=P(zn,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await kn(i,t,n),!0},t[174]=r,t[175]=kn,t[176]=An):An=t[176];let jn=An,Mn;t[177]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=async function(e,t,n){let r=[],i=[];for(let a of e){R(a.path);let e=Wk(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:LV(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[177]=Mn):Mn=t[177];let Nn=Mn,Pn;t[178]===r?Pn=t[179]:(Pn=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await Et(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),i.push({target:a,reason:o.title});continue}let s=P(Ei,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length;X.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`vEJDlt`})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[178]=r,t[179]=Pn);let Y=Pn,Fn;t[180]!==r||t[181]!==U||t[182]!==kn||t[183]!==jn||t[184]!==Y||t[185]!==ut||t[186]!==ee?(Fn=async function(e){let t=e.map(e=>Bk(e,te.current)),n=t[0];if(!n)return;let i=U.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(iU),t=i.length>e.length?`, +${i.length-e.length} more`:``;X.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}R(n.path),B(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&ee){let{trashed:e,failed:n}=await Nn(t,a,ee);if(e.length>0){let t=await Y(e);t?await kn(e,t.deletedDocNames,t.deletedFolderPaths):await kn(e,e.filter(rU).map(nU),e.filter(tU).map(eU))}n.length>0&&H({failed:n,originalTargets:[...t]}),R(null)}else{let e=await jn(t);R(null),e||ut()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),R(null),ut()}},t[180]=r,t[181]=U,t[182]=kn,t[183]=jn,t[184]=Y,t[185]=ut,t[186]=ee,t[187]=Fn):Fn=t[187];let In=Fn,Ln;t[188]!==r||t[189]!==jn||t[190]!==ut||t[191]!==V?(Ln=async function(){if(!V)return;let e=new Set(V.failed.map($H)),t=V.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(H(null),t.length!==0){R(t[0]?.path??null);try{let e=await jn(t);R(null),e||ut()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),R(null),ut()}}},t[188]=r,t[189]=jn,t[190]=ut,t[191]=V,t[192]=Ln):Ln=t[192];let Rn=Ln,Vn;t[193]!==In||t[194]!==V?(Vn=async function(){if(!V)return;let e=new Set(V.failed.map(QH)),t=V.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));H(null),await In(t)},t[193]=In,t[194]=V,t[195]=Vn):Vn=t[195];let Hn=Vn,Gn=(0,Q.useRef)(In),Kn;t[196]===In?Kn=t[197]:(Kn=()=>{Gn.current=In},t[196]=In,t[197]=Kn),(0,Q.useEffect)(Kn);let qn,Yn;t[198]===Symbol.for(`react.memo_cache_sentinel`)?(qn=()=>QV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=te.current.find(e=>mr(e)&&e.docName===t);Gn.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Gn.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){Gn.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),Yn=[],t[198]=qn,t[199]=Yn):(qn=t[198],Yn=t[199]),(0,Q.useEffect)(qn,Yn);let Xn,Zn;t[200]===Symbol.for(`react.memo_cache_sentinel`)?(Xn=()=>nH(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=te.current.find(e=>mr(e)&&e.docName===t);xt.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){xt.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),Zn=[],t[200]=Xn,t[201]=Zn):(Xn=t[200],Zn=t[201]),(0,Q.useEffect)(Xn,Zn);let Qn,$n;t[202]===J?(Qn=t[203],$n=t[204]):(Qn=()=>eH(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=fk(t,te.current.find(e=>mr(e)&&e.docName===t)?.docExt);J.startRenaming(n);return}if(e.kind===`folder`){J.startRenaming(e.folderPath);return}if(e.kind===`asset`){J.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),$n=[J],t[202]=J,t[203]=Qn,t[204]=$n),(0,Q.useEffect)(Qn,$n);let er;t[205]===Symbol.for(`react.memo_cache_sentinel`)?(er=function(){let e=me.current;e&&wH(e),me.current=null},t[205]=er):er=t[205];let tr=er,nr;t[206]===h?nr=t[207]:(nr=function(e){let t=xU(e.nativeEvent);if(!t||t.endsWith(`/`)){tr();return}let n=pk(t),r=te.current.find(e=>mk(e)===t);if(r&&Bn(r)){tr();return}if(r&&mr(r)&&di(r.size)){tr();return}me.current!==n&&(tr(),me.current=n,CH(n,e=>h(e)))},t[206]=h,t[207]=nr);let rr=nr,ir;t[208]!==q||t[209]!==J||t[210]!==E?(ir=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=SU(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?_k(n):n;if(J.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=gk(r);if(window.location.hash===Hr(e))return;queueMicrotask(()=>E(e));return}let i=pk(r);window.location.hash!==xi(i)&&queueMicrotask(()=>q(r))},t[208]=q,t[209]=J,t[210]=E,t[211]=ir):ir=t[211];let ar=ir;if(A){let e;return t[212]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(wU,{}),t[212]=e):e=t[212],e}if(O.length===0){if(M){let e;return t[213]===M?e=t[214]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/50 text-sm`,children:M})}),t[213]=M,t[214]=e),e}let e;t[215]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(s,{id:`xiv-dW`})}),t[215]=e):e=t[215];let n;t[216]===sn?n=t[217]:(n=()=>sn(`file`,``),t[216]=sn,t[217]=n);let r;t[218]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(s,{id:`6ibbCg`}),t[218]=r):r=t[218];let i;return t[219]===n?i=t[220]:(i=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(qi,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:n,children:r})]}),t[219]=n,t[220]=i),i}let or=L!==null,sr=z?.targets[0]??null,cr;t[221]!==M||t[222]!==F?(cr=(M||F!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[M&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:M}),F!==null&&(0,Z.jsx)(`span`,{role:`status`,className:`px-3 pb-1 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`_HekAK`,values:{truncatedShownCount:F}})})]}),t[221]=M,t[222]=F,t[223]=cr):cr=t[223];let lr;t[224]===v?lr=t[225]:(lr=LH(v),t[224]=v,t[225]=lr);let ur;t[226]!==or||t[227]!==se||t[228]!==dn||t[229]!==O||t[230]!==ln||t[231]!==rt||t[232]!==bt||t[233]!==Fe||t[234]!==Re||t[235]!==J||t[236]!==Ie||t[237]!==Le||t[238]!==sn||t[239]!==ee?(ur=(e,t)=>(0,Z.jsx)(YH,{item:e,context:t,anyActionBusy:or,workspace:ee,handoff:Fe,model:J,okignoreBinding:Ie,projectLocalBinding:Le,mergedConfig:Re,onStartCreating:sn,onCreateFromTemplate:(e,t)=>sn(`file`,e,{template:t}),onDuplicate:bt,onDelete:e=>B({targets:e}),onExpandSubtree:ln,onCollapseSubtree:dn,folderTreePaths:rt,isAsset:se.has(e.path),documents:O}),t[226]=or,t[227]=se,t[228]=dn,t[229]=O,t[230]=ln,t[231]=rt,t[232]=bt,t[233]=Fe,t[234]=Re,t[235]=J,t[236]=Ie,t[237]=Le,t[238]=sn,t[239]=ee,t[240]=ur):ur=t[240];let dr;t[241]!==ar||t[242]!==rr||t[243]!==J||t[244]!==cr||t[245]!==lr||t[246]!==ur?(dr=(0,Z.jsx)(`div`,{ref:Se,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)($B,{header:cr,model:J,style:lr,onClickCapture:ar,onMouseMove:rr,onMouseLeave:tr,renderContextMenu:ur})}),t[241]=ar,t[242]=rr,t[243]=J,t[244]=cr,t[245]=lr,t[246]=ur,t[247]=dr):dr=t[247];let fr=!!z,pr;t[248]===L?pr=t[249]:(pr=e=>{!e&&!L&&B(null)},t[248]=L,t[249]=pr);let hr;t[250]!==r||t[251]!==L||t[252]!==z||t[253]!==In||t[254]!==sr?(hr=z&&sr&&(0,Z.jsx)(va,{...(()=>{let e=PV(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,z.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(ZH)}):null};let t=z.targets.length,n=sr.name;return{itemName:t===1?sr.kind===`folder`?`${sr.name}/`:sr.kind===`file`?`${sr.name}${sr.docExt??`.md`}`:sr.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):sr.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:L!==null,onDelete:()=>In(z.targets)}),t[250]=r,t[251]=L,t[252]=z,t[253]=In,t[254]=sr,t[255]=hr):hr=t[255];let gr;t[256]!==fr||t[257]!==pr||t[258]!==hr?(gr=(0,Z.jsx)(us,{open:fr,onOpenChange:pr,children:hr}),t[256]=fr,t[257]=pr,t[258]=hr,t[259]=gr):gr=t[259];let _r=!!V,vr;t[260]===L?vr=t[261]:(vr=e=>{!e&&!L&&H(null)},t[260]=L,t[261]=vr);let yr;t[262]!==L||t[263]!==Rn||t[264]!==Hn||t[265]!==V?(yr=V&&(0,Z.jsx)(VV,{failedTargets:V.failed,isSubmitting:L!==null,onDeletePermanently:Rn,onRetry:Hn,onCancel:()=>H(null)}),t[262]=L,t[263]=Rn,t[264]=Hn,t[265]=V,t[266]=yr):yr=t[266];let br;t[267]!==_r||t[268]!==vr||t[269]!==yr?(br=(0,Z.jsx)(us,{open:_r,onOpenChange:vr,children:yr}),t[267]=_r,t[268]=vr,t[269]=yr,t[270]=br):br=t[270];let xr=W!==null,Sr;t[271]===Symbol.for(`react.memo_cache_sentinel`)?(Sr=e=>{e||G(null)},t[271]=Sr):Sr=t[271];let wr=W?.parentDir??``,Tr;t[272]!==wr||t[273]!==xr?(Tr=(0,Z.jsx)(Hm,{open:xr,onOpenChange:Sr,kind:`file`,initialDir:wr,defaultToTemplate:!0}),t[272]=wr,t[273]=xr,t[274]=Tr):Tr=t[274];let Er;return t[275]!==Tr||t[276]!==dr||t[277]!==gr||t[278]!==br?(Er=(0,Z.jsxs)(Z.Fragment,{children:[dr,gr,br,Tr]}),t[275]=Tr,t[276]=dr,t[277]=gr,t[278]=br,t[279]=Er):Er=t[279],Er}function ZH(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:FV(e)},`${e.kind}:${e.path}`)}function QH(e){return`${e.kind}:${e.path}`}function $H(e){return`${e.kind}:${e.path}`}function eU(e){return e.path}function tU(e){return e.kind===`folder`}function nU(e){return e.path}function rU(e){return e.kind===`file`}function iU(e){return e.file}function aU(e){return Xe(e)}function oU(e){return Qt(e)}function sU(e){return Oe(e)}function cU(e){return e.path}function lU(e){return e.kind===`asset`}function uU(e){return e.endsWith(`/`)?e.slice(0,-1):e}function dU(e){return!!e}function fU(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function pU(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function mU(e){X.error(e)}function hU(){}function gU(e){return X.error(e)}function _U(){}function vU(){}async function yU(){}function bU(e){return mk(e)}function xU(e){return SU(e)?.dataset.itemPath??null}function SU(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var CU=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function wU(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=CU.map(TU),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function TU(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(pa,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(pa,{className:`h-3 ${e}`})]},t)}function EU(e){return e?Y._({id:`wTcjov`}):null}function DU(e){let t=(0,$.c)(37),{_:n}=i(),r=_h(),{merged:a}=vt(),o=a?.appearance?.preview?.autoOpen??!0;if(r)return null;let{input:c,installStates:l,dispatch:u,webFallbackVisible:d}=e,f=d===void 0?!0:d,p=c===null,m,h,g,_,v,y,b;if(t[0]!==n||t[1]!==o||t[2]!==u||t[3]!==c||t[4]!==p||t[5]!==l||t[6]!==f){b=Symbol.for(`react.early_return_sentinel`);bb0:{let e=EU(p),r;t[14]===l?r=t[15]:(r=e=>l[e.id]?.installed===!0,t[14]=l,t[15]=r);let i=bh.filter(r);g=l[`claude-code`]?.installed===!0;let a;t[16]!==o||t[17]!==c?(a=c!==null&&c.docContext!==null?dr(c.docContext.relativePath,o):``,t[16]=o,t[17]=c,t[18]=a):a=t[18];let d=a,x;t[19]!==c||t[20]!==d?(x=()=>{c!==null&&zb(d)},t[19]=c,t[20]=d,t[21]=x):x=t[21],_=x;let S=f&&!g;if(i.length===0&&!S){b=null;break bb0}h=Qk,t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(tA,{children:[(0,Z.jsx)(aa,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[22]=y):y=t[22],m=nA,v=i.map(t=>{let r=!p,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(eA,{disabled:!r,onSelect:()=>{c&&u(t.id,c)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Nb,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})}t[0]=n,t[1]=o,t[2]=u,t[3]=c,t[4]=p,t[5]=l,t[6]=f,t[7]=m,t[8]=h,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b}else m=t[7],h=t[8],g=t[9],_=t[10],v=t[11],y=t[12],b=t[13];if(b!==Symbol.for(`react.early_return_sentinel`))return b;let x;t[23]!==n||t[24]!==g||t[25]!==_||t[26]!==p||t[27]!==f?(x=f&&!g?(0,Z.jsxs)(eA,{onSelect:_,disabled:p,"data-testid":`empty-space-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(ut,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[23]=n,t[24]=g,t[25]=_,t[26]=p,t[27]=f,t[28]=x):x=t[28];let S;t[29]!==m||t[30]!==v||t[31]!==x?(S=(0,Z.jsxs)(m,{children:[v,x]}),t[29]=m,t[30]=v,t[31]=x,t[32]=S):S=t[32];let C;return t[33]!==h||t[34]!==y||t[35]!==S?(C=(0,Z.jsxs)(h,{children:[y,S]}),t[33]=h,t[34]=y,t[35]=S,t[36]=C):C=t[36],C}var OU=(e,t,n)=>Al(e,t,n,`ProjectSwitcher`);function kU(e){let t=(0,$.c)(79),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h;t[1]!==r||t[2]!==n.project||t[3]!==l?(h=()=>{if(!l)return;let e=!1;return OU(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[1]=r,t[2]=n.project,t[3]=l,t[4]=h):h=t[4];let g;t[5]!==r||t[6]!==n||t[7]!==l?(g=[l,n,r],t[5]=r,t[6]=n,t[7]=l,t[8]=g):g=t[8],(0,Q.useEffect)(h,g);let _;t[9]!==r||t[10]!==n.project?(_=e=>{u(!1),OU(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[9]=r,t[10]=n.project,t[11]=_):_=t[11];let v=_,y;t[12]!==r||t[13]!==n.dialog||t[14]!==n.project?(y=()=>{u(!1),OU(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[12]=r,t[13]=n.dialog,t[14]=n.project,t[15]=y):y=t[15];let b=y,x;t[16]!==r||t[17]!==n.navigator?(x=()=>{u(!1),OU(()=>n.navigator.open(),r({id:`jol95m`}))},t[16]=r,t[17]=n.navigator,t[18]=x):x=t[18];let S=x,C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{u(!1),m(!0)},t[19]=C):C=t[19];let w=C,T=n.config.projectPath,E,D,O,k,A,j,M,N,P,F;if(t[20]!==r||t[21]!==n.config.projectName||t[22]!==T||t[23]!==l||t[24]!==v||t[25]!==o||t[26]!==d){let e;t[37]===T?e=t[38]:(e=e=>e.path!==T,t[37]=T,t[38]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;D=oo,j=l,t[39]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{u(e),e||f(``)},t[39]=M):M=t[39];let p;t[40]===r?p=t[41]:(p=r({id:`zZ_I5K`}),t[40]=r,t[41]=p);let m;t[42]===n.config.projectName?m=t[43]:(m=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[42]=n.config.projectName,t[43]=m);let h;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Cc,{"aria-hidden":`true`,className:`opacity-60`}),t[44]=h):h=t[44],t[45]!==p||t[46]!==m?(N=(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsxs)(HO,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:p,children:[m,h]})}),t[45]=p,t[46]=m,t[47]=N):N=t[47],E=ua,P=`start`,F=`top`,O=`min-w-[260px]`,k=`project-switcher-menu`,A=i.length===0?(0,Z.jsx)(Uo,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(TS,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(AS,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:AU,"data-testid":`project-switcher-search`}),(0,Z.jsx)(DS,{children:(0,Z.jsx)(he,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Ao,{}),c.length===0?(0,Z.jsx)(Uo,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(s,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)(go,{disabled:e.missing,onSelect:()=>v(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Z.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[20]=r,t[21]=n.config.projectName,t[22]=T,t[23]=l,t[24]=v,t[25]=o,t[26]=d,t[27]=E,t[28]=D,t[29]=O,t[30]=k,t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P,t[36]=F}else E=t[27],D=t[28],O=t[29],k=t[30],A=t[31],j=t[32],M=t[33],N=t[34],P=t[35],F=t[36];let I;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Ao,{}),t[48]=I):I=t[48];let L,R;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(je,{"aria-hidden":`true`,className:`text-muted-foreground`}),R=(0,Z.jsx)(s,{id:`PVUn_c`}),t[49]=L,t[50]=R):(L=t[49],R=t[50]);let z;t[51]===b?z=t[52]:(z=(0,Z.jsxs)(go,{onSelect:b,"data-testid":`project-switcher-open-folder`,children:[L,R]}),t[51]=b,t[52]=z);let B,V;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(q,{"aria-hidden":`true`,className:`text-muted-foreground`}),V=(0,Z.jsx)(s,{id:`2Xs2jo`}),t[53]=B,t[54]=V):(B=t[53],V=t[54]);let H;t[55]===S?H=t[56]:(H=(0,Z.jsxs)(go,{onSelect:S,"data-testid":`project-switcher-switch-project`,children:[B,V]}),t[55]=S,t[56]=H);let U;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsxs)(go,{onSelect:w,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[57]=U):U=t[57];let W;t[58]!==E||t[59]!==O||t[60]!==k||t[61]!==A||t[62]!==z||t[63]!==H||t[64]!==P||t[65]!==F?(W=(0,Z.jsxs)(E,{align:P,side:F,className:O,"data-testid":k,children:[A,I,z,H,U]}),t[58]=E,t[59]=O,t[60]=k,t[61]=A,t[62]=z,t[63]=H,t[64]=P,t[65]=F,t[66]=W):W=t[66];let G;t[67]!==D||t[68]!==j||t[69]!==M||t[70]!==N||t[71]!==W?(G=(0,Z.jsxs)(D,{open:j,onOpenChange:M,children:[N,W]}),t[67]=D,t[68]=j,t[69]=M,t[70]=N,t[71]=W,t[72]=G):G=t[72];let ee;t[73]!==n||t[74]!==p?(ee=(0,Z.jsx)(xd,{open:p,onOpenChange:m,bridge:n}),t[73]=n,t[74]=p,t[75]=ee):ee=t[75];let K;return t[76]!==G||t[77]!==ee?(K=(0,Z.jsxs)(Z.Fragment,{children:[G,ee]}),t[76]=G,t[77]=ee,t[78]=K):K=t[78],K}function AU(e){return e.stopPropagation()}function jU(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Di(`sidebarSearchPill`)}function MU(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Bi(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(he,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(s,{id:`A1taO8`})}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(D,{className:`text-foreground/70`,children:_a(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(qi,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function NU(e){let t=(0,$.c)(36),{notice:n,onDismiss:r}=e,{_:a}=i(),o=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,s;t[0]===a?s=t[1]:(s=a({id:`GUYwCr`}),t[0]=a,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(is,{"aria-hidden":`true`,className:`size-3`}),t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==s?(l=(0,Z.jsx)(qi,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":s,onClick:r,children:c}),t[3]=r,t[4]=s,t[5]=l):l=t[5];let u=l;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-2 text-xs text-muted-foreground ${o}`,i;t[6]===n.body?i=t[7]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[6]=n.body,t[7]=i);let a;t[8]!==u||t[9]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,u]}),t[8]=u,t[9]=i,t[10]=a):a=t[10];let s;t[11]===n.action?s=t[12]:(s=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[11]=n.action,t[12]=s);let c;t[13]===n.secondaryAction?c=t[14]:(c=()=>{n.secondaryAction?.onClick()},t[13]=n.secondaryAction,t[14]=c);let l;t[15]!==n.secondaryAction.label||t[16]!==c?(l=(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:c,children:n.secondaryAction.label}),t[15]=n.secondaryAction.label,t[16]=c,t[17]=l):l=t[17];let d;t[18]!==l||t[19]!==s?(d=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[s,l]}),t[18]=l,t[19]=s,t[20]=d):d=t[20];let f;return t[21]!==d||t[22]!==e||t[23]!==r||t[24]!==a?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[a,d]}),t[21]=d,t[22]=e,t[23]=r,t[24]=a,t[25]=f):f=t[25],f}let d=`update-notice-${n.id}`,f=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${o}`,p;t[26]===n.body?p=t[27]:(p=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=p);let m;t[28]===n.action?m=t[29]:(m=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=n.action,t[29]=m);let h;return t[30]!==u||t[31]!==d||t[32]!==f||t[33]!==p||t[34]!==m?(h=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":d,className:f,children:[p,m,u]}),t[30]=u,t[31]=d,t[32]=f,t[33]=p,t[34]=m,t[35]=h):h=t[35],h}function PU(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function FU(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(qp,Kp,Kp),n;e[0]===t?n=e[1]:(n=PU(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{Gp(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(NU,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function IU(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Xh(n.contentDir,Zh(t),n.pathSeparator):e?.kind===`folder`?Xh(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?Xh(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function LU(e,t,n){if((e?.kind===`doc`||e?.kind===`folder-index`)&&t){let e=t.lastIndexOf(`/`);return e<0?n.contentDir:Xh(n.contentDir,t.slice(0,e),n.pathSeparator)}if(e?.kind===`folder`)return Xh(n.contentDir,e.folderPath,n.pathSeparator);if(e?.kind===`asset`){let t=e.assetPath.lastIndexOf(`/`);return t<0?n.contentDir:Xh(n.contentDir,e.assetPath.slice(0,t),n.pathSeparator)}return n.contentDir}function RU(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Zh(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function zU(e,t,n){return e===null?$h({workspace:n}):e.kind===`folder`?n?eg({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?Qh({docName:t,workspace:n}):null}var BU={folderCount:0,expandedCount:0},VU=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function HU(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(VU)!==null}function UU(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(x,{name:`file-sidebar`,children:(0,Z.jsx)(GU,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var WU=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(hr,{asChild:!0,children:(0,Z.jsx)(qi,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(sr,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(ri,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function GU(e){let t=(0,$.c)(200),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=ht(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:xr(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f=typeof window<`u`&&window.okDesktop!=null,{state:p,toggleSidebar:m}=OO(),h=_h(),g=p===`expanded`,_=f&&p===`collapsed`,[v,y]=(0,Q.useState)(BU),b,x;t[3]===a?(b=t[4],x=t[5]):(b=()=>{if(a!==null)return y(a.getFolderState()),a.subscribe(()=>{y(a.getFolderState())})},x=[a],t[3]=a,t[4]=b,t[5]=x),(0,Q.useEffect)(b,x);let S,C;t[6]===a?(S=t[7],C=t[8]):(S=()=>{if(a!==null)return Cx(()=>{a.startCreating(`file`,``)})},C=[a],t[6]=a,t[7]=S,t[8]=C),(0,Q.useEffect)(S,C);let w=v.folderCount>0,T=w&&v.expandedCount===v.folderCount,E=v.expandedCount===0,D=To(``),O=To(d===``?null:d),k=d===``?D:O,A=D.state.status===`ready`?(D.state.data.folder.templates_available?.length??0)>0:!0,j=k.state.status===`ready`?(k.state.data.folder.templates_available?.length??0)>0:!0,M=typeof window<`u`?window.okDesktop:void 0,N=Fo(),P=Cg().states,{dispatch:F}=fg(),I;t[9]===N?I=t[10]:(I=$h({workspace:N}),t[9]=N,t[10]=I);let L=I,{projectLocalBinding:R,merged:z}=vt(),B=z?.appearance?.sidebar?.showHiddenFiles??!1,V=z?.appearance?.sidebar?.showAllFiles??!1,H=w&&!T,U=w&&!E,G=H||U,ee=qU,K;t[11]!==a||t[12]!==N?(K=()=>{N&&a?.startCreating(`file`,``)},t[11]=a,t[12]=N,t[13]=K):K=t[13];let te=K,ne;t[14]!==a||t[15]!==N?(ne=e=>{N&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=N,t[16]=ne):ne=t[16];let q=ne,re;t[17]!==a||t[18]!==N?(re=()=>{N&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=N,t[19]=re):re=t[19];let ie=re,ae;t[20]===N?ae=t[21]:(ae=()=>{!N||!M||M.shell.showItemInFolder(N.contentDir)},t[20]=N,t[21]=ae);let oe=ae,se;t[22]===N?se=t[23]:(se=()=>{!N||!M||qV(M,N.contentDir)},t[22]=N,t[23]=se);let ce=se,le;t[24]!==r||t[25]!==N?(le=async()=>{if(N)try{await navigator.clipboard.writeText(N.contentDir),X.success(r({id:`6_ZOw4`}),{description:N.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))}},t[24]=r,t[25]=N,t[26]=le):le=t[26];let ue=le,de;t[27]!==r||t[28]!==R?(de=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,qr(t.error)),X.error(r({id:`P47EWZ`}),{description:qr(t.error)}))},t[27]=r,t[28]=R,t[29]=de):de=t[29];let fe=de,pe;t[30]!==r||t[31]!==R?(pe=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,qr(t.error)),X.error(r({id:`P47EWZ`}),{description:qr(t.error)}))},t[30]=r,t[31]=R,t[32]=pe):pe=t[32];let me=pe,he;t[33]===a?he=t[34]:(he=()=>{a?.expandAll()},t[33]=a,t[34]=he);let ge=he,_e;t[35]===a?_e=t[36]:(_e=()=>{a?.collapseAll()},t[35]=a,t[36]=_e);let ve=_e,ye,be;t[37]!==V||t[38]!==U||t[39]!==H||t[40]!==B||t[41]!==p?(ye=()=>{M&&M.editor.notifyViewMenuStateChanged({showHiddenFiles:B,showAllFiles:V,canExpandAll:H,canCollapseAll:U,sidebarVisible:p===`expanded`})},be=[M,B,V,H,U,p],t[37]=V,t[38]=U,t[39]=H,t[40]=B,t[41]=p,t[42]=ye,t[43]=be):(ye=t[42],be=t[43]),(0,Q.useEffect)(ye,be);let xe,Se;t[44]!==r||t[45]!==c||t[46]!==l||t[47]!==F||t[48]!==P||t[49]!==d||t[50]!==R||t[51]!==V||t[52]!==B||t[53]!==m||t[54]!==a||t[55]!==N?(xe=()=>{if(M)return M.onMenuAction(e=>{switch(e){case`new-doc`:if(!N||!a)return;a.startCreating(`file`,d);return;case`new-folder`:if(!N||!a)return;a.startCreating(`folder`,d);return;case`new-from-template`:if(!N||!a)return;a.startCreatingFromTemplate(d);return;case`rename`:if(!l)return;$V(l);return;case`duplicate`:if(!l)return;tH(l);return;case`move-to-trash`:if(!l)return;ZV(l);return;case`reveal-in-finder`:{if(!M||!N)return;let e=IU(l,c,N);M.shell.showItemInFolder(e);return}case`open-in-terminal`:if(!M||!N)return;qV(M,LU(l,c,N));return;case`send-to-ai`:{let e=bh.filter(e=>P[e.id]?.installed===!0);if(e.length===0){X.error(r({id:`LKOLNn`}));return}let t=zU(l,c,N);if(!t)return;let[n]=e;if(!n)return;F(n.id,t);return}case`copy-full-path`:{if(!N)return;let e=IU(l,c,N);navigator.clipboard.writeText(e).then(()=>X.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=RU(l,c);if(e===``){X.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>X.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(R===null)return;let e=R.patch({appearance:{sidebar:{showHiddenFiles:!B}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,qr(e.error)),X.error(r({id:`P47EWZ`}),{description:qr(e.error)}));return}case`toggle-show-all-files`:{if(R===null)return;let e=R.patch({appearance:{sidebar:{showAllFiles:!V}}});e.ok||(console.warn(`[FileSidebar] toggle-show-all-files rejected:`,qr(e.error)),X.error(r({id:`P47EWZ`}),{description:qr(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`toggle-sidebar`:m();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`toggle-doc-panel`:return}})},Se=[M,a,N,l,c,d,R,B,V,P,F,m,r],t[44]=r,t[45]=c,t[46]=l,t[47]=F,t[48]=P,t[49]=d,t[50]=R,t[51]=V,t[52]=B,t[53]=m,t[54]=a,t[55]=N,t[56]=xe,t[57]=Se):(xe=t[56],Se=t[57]),(0,Q.useEffect)(xe,Se);let Ce=f&&g&&`motion-safe:delay-100`,we=_&&`opacity-0`,Te;t[58]!==Ce||t[59]!==we?(Te=Bi(`flex-row h-12 items-center py-0 px-3`,f?`justify-end`:`justify-between`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ce,we,f&&`[-webkit-app-region:drag]`),t[58]=Ce,t[59]=we,t[60]=Te):Te=t[60];let Ee;t[61]===g?Ee=t[62]:(Ee=g&&!f?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(s,{id:`sER-bs`})}):null,t[61]=g,t[62]=Ee);let De;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(De=Bi(`flex items-center gap-1`,f&&`[&>*]:[-webkit-app-region:no-drag]`),t[63]=De):De=t[63];let Oe;t[64]!==r||t[65]!==T||t[66]!==w||t[67]!==E||t[68]!==a?(Oe=w?(0,Z.jsxs)(oo,{children:[(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsx)(WU,{icon:Kc,label:r({id:`Lu_dOh`})})}),(0,Z.jsxs)(ua,{align:`end`,children:[T?null:(0,Z.jsxs)(go,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(Tl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}),E?null:(0,Z.jsxs)(go,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(Ic,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]})]})]}):null,t[64]=r,t[65]=T,t[66]=w,t[67]=E,t[68]=a,t[69]=Oe):Oe=t[69];let ke;t[70]===r?ke=t[71]:(ke=r({id:`MW64zN`}),t[70]=r,t[71]=ke);let Ae;t[72]!==d||t[73]!==a?(Ae=()=>a?.startCreating(`file`,d),t[72]=d,t[73]=a,t[74]=Ae):Ae=t[74];let Me;t[75]!==ke||t[76]!==Ae?(Me=(0,Z.jsx)(WU,{icon:_l,label:ke,onClick:Ae}),t[75]=ke,t[76]=Ae,t[77]=Me):Me=t[77];let Ne;t[78]!==r||t[79]!==j||t[80]!==d||t[81]!==a?(Ne=j?(0,Z.jsxs)(oo,{children:[(0,Z.jsx)(No,{asChild:!0,children:(0,Z.jsx)(WU,{icon:bo,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(ua,{align:`end`,children:(0,Z.jsx)(UV,{parentDir:d,onSelectTemplate:e=>a?.createFromTemplate(d,e),ItemComponent:go})})]}):null,t[78]=r,t[79]=j,t[80]=d,t[81]=a,t[82]=Ne):Ne=t[82];let Pe;t[83]===r?Pe=t[84]:(Pe=r({id:`tX5yOZ`}),t[83]=r,t[84]=Pe);let Fe;t[85]!==d||t[86]!==a?(Fe=()=>a?.startCreating(`folder`,d),t[85]=d,t[86]=a,t[87]=Fe):Fe=t[87];let Ie;t[88]!==Pe||t[89]!==Fe?(Ie=(0,Z.jsx)(WU,{icon:Rc,label:Pe,onClick:Fe}),t[88]=Pe,t[89]=Fe,t[90]=Ie):Ie=t[90];let Le;t[91]!==Oe||t[92]!==Me||t[93]!==Ne||t[94]!==Ie?(Le=(0,Z.jsxs)(`div`,{className:De,children:[Oe,Me,Ne,Ie]}),t[91]=Oe,t[92]=Me,t[93]=Ne,t[94]=Ie,t[95]=Le):Le=t[95];let Re;t[96]!==Te||t[97]!==Ee||t[98]!==Le?(Re=(0,Z.jsxs)(IO,{"data-electron-drag":f?``:void 0,className:Te,children:[Ee,Le]}),t[96]=Te,t[97]=Ee,t[98]=Le,t[99]=Re):Re=t[99];let ze=f&&g&&`motion-safe:delay-100`,Be=_&&`opacity-0`,Ve;t[100]!==ze||t[101]!==Be?(Ve=Bi(`px-2 pb-2`,f&&`[-webkit-app-region:no-drag]`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,ze,Be),t[100]=ze,t[101]=Be,t[102]=Ve):Ve=t[102];let He;t[103]===p?He=t[104]:(He=[p],t[103]=p,t[104]=He);let Ue;t[105]===n?Ue=t[106]:(Ue=(0,Z.jsx)(MU,{onClick:n}),t[105]=n,t[106]=Ue);let We;t[107]!==He||t[108]!==Ue?(We=(0,Z.jsx)(W,{fallbackRender:KU,onError:jU,resetKeys:He,children:Ue}),t[107]=He,t[108]=Ue,t[109]=We):We=t[109];let Ge;t[110]!==Ve||t[111]!==We?(Ge=(0,Z.jsx)(`div`,{className:Ve,children:We}),t[110]=Ve,t[111]=We,t[112]=Ge):Ge=t[112];let Ke;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Z.jsxs)(RO,{children:[(0,Z.jsx)(LA,{}),(0,Z.jsx)(XH,{ref:o})]}),t[113]=Ke):Ke=t[113];let qe;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsxs)(LO,{className:`px-0`,children:[(0,Z.jsx)(FU,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(zO,{children:(0,Z.jsx)(BO,{children:(0,Z.jsx)(kU,{bridge:window.okDesktop})})}):null]}),t[114]=qe):qe=t[114];let Je=!(h&&p===`collapsed`),Ye;t[115]===Je?Ye=t[116]:(Ye=(0,Z.jsx)(PO,{enableToggle:!1,enableDrag:Je}),t[115]=Je,t[116]=Ye);let J;t[117]!==Re||t[118]!==Ge||t[119]!==Ye?(J=(0,Z.jsx)(Zk,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:ee,children:[Re,Ge,Ke,qe,Ye]})}),t[117]=Re,t[118]=Ge,t[119]=Ye,t[120]=J):J=t[120];let Xe=!N,Ze,Qe;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,Z.jsx)(_l,{"aria-hidden":`true`}),Qe=(0,Z.jsx)(s,{id:`MW64zN`}),t[121]=Ze,t[122]=Qe):(Ze=t[121],Qe=t[122]);let $e;t[123]!==te||t[124]!==Xe?($e=(0,Z.jsxs)(eA,{disabled:Xe,onSelect:te,"data-testid":`empty-space-menu-new-file`,children:[Ze,Qe]}),t[123]=te,t[124]=Xe,t[125]=$e):$e=t[125];let et=!N||!A,tt,nt;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(bo,{"aria-hidden":`true`}),nt=(0,Z.jsx)(s,{id:`Uuj_R4`}),t[126]=tt,t[127]=nt):(tt=t[126],nt=t[127]);let rt;t[128]===et?rt=t[129]:(rt=(0,Z.jsxs)(tA,{disabled:et,"data-testid":`empty-space-menu-new-from-template`,children:[tt,nt]}),t[128]=et,t[129]=rt);let it;t[130]===q?it=t[131]:(it=(0,Z.jsx)(nA,{children:(0,Z.jsx)(UV,{parentDir:``,onSelectTemplate:q,ItemComponent:eA})}),t[130]=q,t[131]=it);let at;t[132]!==rt||t[133]!==it?(at=(0,Z.jsxs)(Qk,{children:[rt,it]}),t[132]=rt,t[133]=it,t[134]=at):at=t[134];let ot=!N,st,ct;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(Rc,{"aria-hidden":`true`}),ct=(0,Z.jsx)(s,{id:`tX5yOZ`}),t[135]=st,t[136]=ct):(st=t[135],ct=t[136]);let lt;t[137]!==ie||t[138]!==ot?(lt=(0,Z.jsxs)(eA,{disabled:ot,onSelect:ie,"data-testid":`empty-space-menu-new-folder`,children:[st,ct]}),t[137]=ie,t[138]=ot,t[139]=lt):lt=t[139];let ut;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,Z.jsx)(iA,{}),t[140]=ut):ut=t[140];let dt;t[141]!==r||t[142]!==oe||t[143]!==N?(dt=M?(0,Z.jsxs)(eA,{disabled:!N,onSelect:oe,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(N?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(je,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[141]=r,t[142]=oe,t[143]=N,t[144]=dt):dt=t[144];let ft;t[145]!==F||t[146]!==L||t[147]!==P?(ft=(0,Z.jsx)(DU,{input:L,installStates:P,dispatch:F,webFallbackVisible:!1}),t[145]=F,t[146]=L,t[147]=P,t[148]=ft):ft=t[148];let pt;t[149]!==r||t[150]!==ce||t[151]!==N?(pt=M?(0,Z.jsxs)(eA,{disabled:!N,onSelect:ce,"data-testid":`empty-space-menu-open-in-terminal`,"aria-label":r(N?{id:`BJpGCq`}:{id:`_6IEmc`}),children:[(0,Z.jsx)(Sl,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`BJpGCq`})}),N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[149]=r,t[150]=ce,t[151]=N,t[152]=pt):pt=t[152];let mt=!N,gt;t[153]!==r||t[154]!==N?(gt=r(N?{id:`Up2_7p`}:{id:`U8CD-l`}),t[153]=r,t[154]=N,t[155]=gt):gt=t[155];let _t;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(Vt,{"aria-hidden":`true`}),t[156]=_t):_t=t[156];let yt;t[157]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[157]=yt):yt=t[157];let bt;t[158]===N?bt=t[159]:(bt=N?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[158]=N,t[159]=bt);let xt;t[160]!==ue||t[161]!==mt||t[162]!==gt||t[163]!==bt?(xt=(0,Z.jsxs)(eA,{disabled:mt,onSelect:ue,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":gt,children:[_t,yt,bt]}),t[160]=ue,t[161]=mt,t[162]=gt,t[163]=bt,t[164]=xt):xt=t[164];let St;t[165]===Symbol.for(`react.memo_cache_sentinel`)?(St=(0,Z.jsx)(iA,{}),t[165]=St):St=t[165];let Ct=R===null,wt;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,Z.jsx)(s,{id:`K_wz1u`}),t[166]=wt):wt=t[166];let Tt;t[167]!==fe||t[168]!==B||t[169]!==Ct?(Tt=(0,Z.jsx)(rA,{checked:B,onCheckedChange:fe,disabled:Ct,"data-testid":`empty-space-menu-show-hidden-files`,children:wt}),t[167]=fe,t[168]=B,t[169]=Ct,t[170]=Tt):Tt=t[170];let Et=R===null,Dt;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,Z.jsx)(s,{id:`i8dKs-`}),t[171]=Dt):Dt=t[171];let Ot;t[172]!==me||t[173]!==V||t[174]!==Et?(Ot=(0,Z.jsx)(rA,{checked:V,onCheckedChange:me,disabled:Et,"data-testid":`empty-space-menu-show-all-files`,children:Dt}),t[172]=me,t[173]=V,t[174]=Et,t[175]=Ot):Ot=t[175];let kt;t[176]===G?kt=t[177]:(kt=G?(0,Z.jsx)(iA,{}):null,t[176]=G,t[177]=kt);let At;t[178]!==ge||t[179]!==H?(At=H?(0,Z.jsxs)(eA,{onSelect:ge,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Tl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[178]=ge,t[179]=H,t[180]=At):At=t[180];let jt;t[181]!==ve||t[182]!==U?(jt=U?(0,Z.jsxs)(eA,{onSelect:ve,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Ic,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[181]=ve,t[182]=U,t[183]=jt):jt=t[183];let Mt;t[184]!==$e||t[185]!==at||t[186]!==lt||t[187]!==dt||t[188]!==ft||t[189]!==pt||t[190]!==xt||t[191]!==Tt||t[192]!==Ot||t[193]!==kt||t[194]!==At||t[195]!==jt?(Mt=(0,Z.jsxs)($k,{children:[$e,at,lt,ut,dt,ft,pt,xt,St,Tt,Ot,kt,At,jt]}),t[184]=$e,t[185]=at,t[186]=lt,t[187]=dt,t[188]=ft,t[189]=pt,t[190]=xt,t[191]=Tt,t[192]=Ot,t[193]=kt,t[194]=At,t[195]=jt,t[196]=Mt):Mt=t[196];let Nt;return t[197]!==J||t[198]!==Mt?(Nt=(0,Z.jsx)(MO,{variant:`inset`,children:(0,Z.jsxs)(Xk,{children:[J,Mt]})}),t[197]=J,t[198]=Mt,t[199]=Nt):Nt=t[199],Nt}function KU(){return null}function qU(e){HU(e.target)&&(e.preventDefault(),e.stopPropagation())}function JU(){let e=(0,$.c)(17),t=On(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=ht(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Bt,i=new Qe({url:n,name:bi,document:e,onStateless:e=>{let{payload:t}=e;pe(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:eW,onConfigValidationRejected:$U,onConfigIgnoreNestedError:QU,onUnknown:ZU})},onClose:XU,onDisconnect:YU}),a=ji(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=E(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Pi([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function YU(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function XU(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function ZU(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function QU(e){Ro(e)}function $U(e){Vo(e)}function eW(e){Pi([e.ch])}var tW=`#install-claude-desktop`;function nW(e){return e===`#settings`||e===tW}function rW(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function iW(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=ht(),{openTargetTransition:i}=Dt(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=wi(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=rW(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(nW(window.location.hash))return;let e=yi(window.location.hash);if(e){let t=Vn(e.split(`.`).pop()??``);b(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=ti(window.location.hash);if(!n){b(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){b(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=li(n,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(r.kind===`missing`&&/\/+$/.test(n.trim())){b(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=ei(Yr(r),c);b(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function aW(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(oW,t),null}function oW(){let e=lW;if(!e(window.location.hash))return;let t=new AbortController;return ve(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(cW))}).catch(sW),()=>t.abort()}function sW(){}function cW(){}function lW(e){return!nW(e)&&!yi(e)&&!ti(e)&&(e===``||e===`#`||e===`#/`)}function uW(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(dW,t),null}function dW(){let e=function(e){let t=e.target;Sh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=xh))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function fW(){let e=(0,$.c)(4),{activeTarget:t}=ht(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function pW(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=ht(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:xr(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Bm({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(Hm,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function mW(){let e=(0,$.c)(22),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=t?$l({bridge:t,authQueryTransport:ho(),cloneTransport:eu(),openSignIn:()=>new Promise(e=>{c(()=>e),o(!0)})}):null,e[0]=l):l=e[0];let u=l,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Vg,{}),e[1]=d):d=e[1];let f,p,m,h,g,_,v,y,b;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(JU,{}),m=(0,Z.jsx)(iW,{}),h=(0,Z.jsx)(aW,{}),g=(0,Z.jsx)(fW,{}),_=(0,Z.jsx)(pW,{}),v=(0,Z.jsx)(uW,{}),y=!1,b=(0,Z.jsx)(Nd,{}),f=t&&u?(0,Z.jsx)(Zd,{bridge:t,cloneController:u}):null,e[2]=f,e[3]=p,e[4]=m,e[5]=h,e[6]=g,e[7]=_,e[8]=v,e[9]=y,e[10]=b):(f=e[2],p=e[3],m=e[4],h=e[5],g=e[6],_=e[7],v=e[8],y=e[9],b=e[10]);let S;e[11]!==a||e[12]!==s?(S=t?(0,Z.jsx)(Ra,{open:a,onOpenChange:e=>{e||(o(!1),s?.(null),c(null))},onSuccess:e=>{s?.({authenticated:!0,host:`github.com`,login:e.login}),c(null)}}):null,e[11]=a,e[12]=s,e[13]=S):S=e[13];let C;e[14]===r?C=e[15]:(C=(0,Z.jsx)(Ng,{bridge:t,open:r,onOpenChange:i}),e[14]=r,e[15]=C);let w;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[16]=w):w=e[16];let T;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(UU,{onOpenSearch:()=>i(!0)}),e[17]=T):T=e[17];let E;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsxs)(kO,{className:`h-screen overflow-hidden`,children:[T,(0,Z.jsx)(FO,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(FA,{onOpenSearch:()=>i(!0)})})]}),e[18]=E):E=e[18];let D;return e[19]!==S||e[20]!==C?(D=(0,Z.jsx)(x,{name:`app`,children:(0,Z.jsx)(Ft,{children:(0,Z.jsxs)(Rt,{children:[d,(0,Z.jsxs)(si,{children:[p,m,h,g,_,v,y,b,f,S,C,w,E]})]})})}),e[19]=S,e[20]=C,e[21]=D):D=e[21],D}ec(),Df({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Bf(),mp()&&bp(),Jp(),typeof window<`u`&&Uf({bridge:window.okDesktop}),typeof window<`u`&&tp({bridge:window.okDesktop}),typeof window<`u`&&Es({bridge:window.okDesktop}),typeof window<`u`&&Ss({bridge:window.okDesktop}),typeof window<`u`&&Kf({bridge:window.okDesktop}),typeof window<`u`&&Xd({bridge:window.okDesktop});var hW=new lc({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),gW=document.getElementById(`root`);if(!gW)throw Error(`Root element not found`);var _W=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,yc.createRoot)(gW).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:Y,children:(0,Z.jsx)(bn,{client:hW,children:(0,Z.jsxs)(Nr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(ur,{children:_W&&window.okDesktop?(0,Z.jsx)(xf,{bridge:window.okDesktop}):(0,Z.jsx)(mW,{})}),(0,Z.jsx)(Tf,{richColors:!0,closeButton:!0})]})})})}));