@inkeep/open-knowledge 0.9.2-beta.9 → 0.10.0-beta.1

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 (45) hide show
  1. package/dist/LICENSE +674 -0
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +1 -1
  4. package/dist/cli.mjs +14 -13
  5. package/dist/constants-DBo6X59s.mjs +2 -0
  6. package/dist/{dist-Bj_IaFF5.mjs → dist-B_gH0hwY.mjs} +1 -1
  7. package/dist/{dist-sld-_d9T.mjs → dist-dFbVRgjP.mjs} +73 -70
  8. package/dist/{gh-detect-BveVRAue.mjs → gh-detect-DH0jeaqh.mjs} +2 -2
  9. package/dist/index.mjs +1 -1
  10. package/dist/init-5ScaZzxw.mjs +1 -0
  11. package/dist/{init-Ctu92Awt.mjs → init-DzrbCl9i.mjs} +6 -6
  12. package/dist/{loader-DLF6I7F7.mjs → loader-BMUcj0Gb.mjs} +2 -2
  13. package/dist/loader-RJOf6d25.mjs +1 -0
  14. package/dist/{preview-BiAC5DG4.mjs → preview-CBkcN3yq.mjs} +2 -2
  15. package/dist/preview-CNLDsQLX.mjs +1 -0
  16. package/dist/public/assets/{ActivityModeContent-ryZpdhrg.js → ActivityModeContent-DqtdV56a.js} +1 -1
  17. package/dist/public/assets/{DocumentContext-B0qDv4j7.js → DocumentContext-Cf0J0V-D.js} +2 -2
  18. package/dist/public/assets/{GraphPanel-DUQL1b5J.js → GraphPanel-DyvuLzi4.js} +1 -1
  19. package/dist/public/assets/{SettingsDialogBody-D3PLgmQr.js → SettingsDialogBody-DfwLWUB4.js} +1 -1
  20. package/dist/public/assets/{SourceEditor-DOh6wSxy.js → SourceEditor-CWDD_0Ko.js} +1 -1
  21. package/dist/public/assets/{config-validation-events-S5hCYFuT.js → config-validation-events-CTMArlH_.js} +1 -1
  22. package/dist/public/assets/{index-BfBcR9P5.js → index-BWU-OT-w.js} +5 -5
  23. package/dist/public/assets/{keyboard-shortcuts-xl_TcQeg.js → keyboard-shortcuts-CwjLkUXk.js} +1 -1
  24. package/dist/public/assets/{prop-types-DgfF561f.js → prop-types-1LtPV_jm.js} +110 -110
  25. package/dist/public/assets/{target-navigation-intent-D3XZeIgO.js → target-navigation-intent-C3fRj6CU.js} +1 -1
  26. package/dist/public/assets/{typing-burst-detector-D53pUunD.js → typing-burst-detector-B8t-SuQv.js} +1 -1
  27. package/dist/public/index.html +7 -7
  28. package/dist/{repair-launch-json-dWYTCWls.mjs → repair-launch-json-Dnz3TtnV.mjs} +2 -2
  29. package/dist/{repair-mcp-configs-zqCKhtNX.mjs → repair-mcp-configs-Cmow_T2G.mjs} +2 -2
  30. package/dist/repair-skills-D5TVXlpu.mjs +1 -0
  31. package/dist/{repair-skills-BP58ginR.mjs → repair-skills-DrBahEE9.mjs} +2 -2
  32. package/dist/{server-lock-BpjJj3OD-2pOoEhSP.mjs → server-lock-BpjJj3OD-uzESbCl1.mjs} +6 -6
  33. package/dist/server-lock-CyhBidkz-BnpZYxAZ.mjs +1 -0
  34. package/dist/{src-jN1tBoyd.mjs → src-DzdHVeuo.mjs} +2 -2
  35. package/dist/start-C1yS6bXD.mjs +1 -0
  36. package/dist/{start-D474Z7JL.mjs → start-CEPHRdwU.mjs} +2 -2
  37. package/dist/{write-project-skill-ppRYJ9T2.mjs → write-project-skill-BgBD0HrT.mjs} +2 -2
  38. package/package.json +4 -2
  39. package/dist/constants-DU4TbLA_.mjs +0 -2
  40. package/dist/init-BjabhwWj.mjs +0 -1
  41. package/dist/loader-Bytb4s2w.mjs +0 -1
  42. package/dist/preview-xUWmx13Q.mjs +0 -1
  43. package/dist/repair-skills-B9lFVB-G.mjs +0 -1
  44. package/dist/server-lock-CyhBidkz-Blwoi-6-.mjs +0 -1
  45. package/dist/start-BQLkhCCa.mjs +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BCjHJnNa.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-CM1Lm4n9.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-sOEyFULC.js","./label-DwEePOBC.js","./mcp-consent-store-CijO54Jd.js","./ActivityPanelDiffView-DgtknSgX.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-DUQL1b5J.js","./prop-types-DgfF561f.js","./w3c-keyname-B5t0fahT.js","./toggle-group-Cs-1L92l.js","./panel-BNBODYwB.js","./min-BiwsSkbB.js","./src-L3wpjxBL.js","./colors-D6LRuSY-.js","./ordinal-BLFwWMHf.js","./init-8GNx5phc.js","./isObjectLike-DFnkciUU.js","./now-D_m-3Vjm.js","./isSymbol-D0ur5y-p.js","./target-navigation-intent-D3XZeIgO.js","./ActivityModeContent-ryZpdhrg.js","./DocumentContext-B0qDv4j7.js","./dist-BrsSsfiw.js","./dist-Du-s1q8P.js","./dist-DsbVHLNy.js","./dist-BYGzJeLM.js","./dist-Cq1LYbUj.js","./stex-CzCFWeB9.js","./DocumentContext-B0sQn39F.css","./agent-presence-DxGcS3q2.js","./SettingsDialogBody-D3PLgmQr.js","./config-validation-events-S5hCYFuT.js","./keyboard-shortcuts-xl_TcQeg.js","./SourceEditor-DOh6wSxy.js","./typing-burst-detector-D53pUunD.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,In as j,It as M,J as N,Jn as P,Jt as F,Kn as I,Kt as L,L 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 K,Pn as q,Pt as J,Q as Y,Qn as ee,Qt as te,R as ne,Rn as re,Rt as ie,Sn as ae,Sr as oe,St as se,Tn as ce,Tt as le,U as ue,Un as de,Ut as fe,V as pe,Vn as me,Vt as he,Wn as ge,Wt as _e,X as ve,Xn as ye,Xt as be,Yn as xe,Yt as Se,Z as Ce,Zn as we,Zt as Te,_r as Ee,_t as De,a as Oe,an as ke,ar as Ae,at as je,b as Me,br as Ne,bt as Pe,c as Fe,cn as Ie,cr as Le,ct as Re,d as ze,dr as Be,dt as Ve,en as He,er as Ue,et as We,f as Ge,fr as Ke,ft as qe,g as X,gt as Je,h as Ye,hr as Xe,ht as Ze,i as Qe,in as $e,ir as et,it as tt,j as nt,jn as rt,jt as it,k as at,kn as ot,kt as st,l as ct,lr as lt,lt as ut,m as dt,mt as ft,n as pt,nn as mt,nr as ht,nt as gt,o as _t,on as vt,or as yt,ot as bt,p as xt,pr as St,pt as Ct,qn as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sn as jt,sr as Mt,st as Nt,t as Pt,tn as Ft,tr as It,tt as Lt,u as Rt,un as zt,ur as Bt,ut as Vt,v as Ht,vr as Ut,vt as Wt,wn as Gt,wt as Kt,xr as qt,xt as Jt,y as Yt,yr as Xt,yt as Zt,z as Qt,zn as $t,zt as en}from"./DocumentContext-B0qDv4j7.js";import{A as tn,C as nn,D as rn,E as an,O as on,S as sn,T as cn,_ as ln,a as un,b as dn,c as fn,d as pn,f as mn,g as hn,h as gn,i as _n,k as vn,l as yn,m as bn,n as xn,o as Sn,p as Cn,r as wn,s as Tn,t as En,u as Dn,v as On,w as kn,x as An,y as jn}from"./panel-BNBODYwB.js";import{$ as Mn,$n as Nn,A as Pn,At as Fn,Bi as In,Bn as Ln,Br as Rn,C as zn,Ci as Bn,Ct as Vn,D as Hn,Di as Un,Dn as Wn,Dt as Gn,E as Kn,Ei as qn,En as Jn,F as Yn,Fr as Xn,G as Zn,Gn as Qn,Gt as $n,Hn as er,Hr as tr,I as nr,It as rr,J as ir,Ji as ar,Jn as or,Jr as sr,K as cr,Ki as lr,Kn as ur,Kr as dr,L as fr,Ln as pr,Lr as mr,Lt as hr,M as gr,N as _r,Nt as vr,O as yr,On as br,Ot as xr,P as Sr,Q as Cr,Qn as wr,R as Tr,Ri as Er,Rn as Dr,Rr as Or,S as kr,T as Ar,Ti as jr,Ur as Mr,Vn as Nr,Vr as Pr,W as Fr,Wr as Ir,X as Lr,Xi as Rr,Xr as zr,Y as Br,Yi as Vr,Yn as Hr,Z as Ur,Zi as Wr,Zr as Gr,a as Kr,b as qr,bt as Jr,c as Yr,cn as Xr,ct as Zr,di as Qr,en as $r,er as ei,fi as ti,g as ni,gi as ri,h as ii,hi as ai,hn as oi,hr as si,i as ci,in as li,ir as ui,it as di,j as fi,jn as pi,jt as mi,k as hi,kn as gi,kr as _i,kt as vi,n as yi,ni as bi,nr as xi,nt as Si,o as Ci,or as wi,p as Ti,q as Ei,qi as Di,qn as Oi,r as ki,ri as Ai,s as ji,sn as Mi,tt as Ni,ui as Pi,vi as Fi,vr as Ii,w as Li,wn as Ri,wt as zi,x as Bi,xn as Vi,zi as Hi,zn as Ui}from"./prop-types-DgfF561f.js";import{C as Wi,S as Gi,d as Ki,g as qi,l as Ji,m as Yi,o as Xi,p as Zi,t as Qi,w as $i,x as ea}from"./button-DenIdY-r.js";import{a as ta,c as na,d as ra,f as ia,i as aa,l as oa,m as sa,n as ca,o as la,p as ua,r as da,s as fa,t as pa,u as ma}from"./agent-presence-DxGcS3q2.js";import{$ as ha,$t as ga,A as _a,At as va,B as ya,Bt as ba,C as xa,Ct as Sa,D as Ca,Dt as wa,E as Ta,Et as Ea,F as Da,Ft as Oa,G as ka,Gt as Aa,H as ja,Ht as Ma,I as Na,It as Pa,J as Fa,Jt as Ia,K as La,Kt as Ra,L as za,Lt as Ba,M as Va,Mt as Ha,N as Ua,Nt as Wa,O as Ga,Ot as Ka,P as qa,Pt as Ja,Q as Ya,Qt as Xa,R as Za,Rt as Qa,S as $a,St as eo,T as to,Tt as no,U as ro,Ut as io,V as ao,Vt as oo,W as so,Wt as co,X as lo,Y as uo,Yt as fo,Z as po,Zt as mo,_t as ho,at as go,b as _o,bt as vo,dt as yo,en as bo,et as xo,ft as So,gt as Co,ht as wo,it as To,j as Eo,jt as Do,k as Oo,kt as ko,lt as Ao,m as jo,mt as Mo,nt as No,o as Po,ot as Fo,p as Io,pt as Lo,q as Ro,qt as zo,r as Bo,rt as Vo,st as Ho,t as Uo,tt as Wo,u as Go,ut as Ko,vt as qo,w as Jo,wt as Yo,x as Xo,xt as Zo,y as Qo,yt as $o,z as es,zt as ts}from"./config-validation-events-S5hCYFuT.js";import{i as ns,n as rs,r as is,t as as}from"./toggle-group-Cs-1L92l.js";import{a as os,b as ss,c as cs,i as ls,n as us,o as ds,s as fs,t as ps,v as ms,x as hs,y as gs}from"./dialog-B1es0EvU.js";import{a as _s,i as vs,n as ys,r as bs,t as xs}from"./collapsible-BhpeB6tu.js";import{t as Ss}from"./checkbox-Co7Tjlri.js";import{t as Cs}from"./label-DwEePOBC.js";import{n as ws,r as Ts}from"./textarea-luaT-nOK.js";import{i as Es,n as Ds,r as Os}from"./project-paths-CsGHlmFh.js";import{n as ks,t as As}from"./mcp-consent-store-CijO54Jd.js";import{c as js,i as Ms,l as Ns,o as Ps}from"./keyboard-shortcuts-xl_TcQeg.js";import{$ as Fs,At as Is,Ct as Ls,Dt as Rs,Ft as zs,I as Bs,It as Vs,J as Hs,Mt as Us,Ot as Ws,Pt as Gs,Q as Ks,Tt as qs,X as Js,Z as Ys,at as Xs,bt as Zs,c as Qs,jt as $s,k as ec,w as tc}from"./dist-Du-s1q8P.js";import{n as nc}from"./dist-DsbVHLNy.js";import{c as rc,d as ic,f as ac,h as oc,i as sc,l as cc,n as lc,o as uc,r as dc,s as fc,t as pc,u as mc}from"./typing-burst-detector-D53pUunD.js";import{t as hc}from"./target-navigation-intent-D3XZeIgO.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 gc(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.9.1`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BCjHJnNa.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function _c(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=>{hn(e,()=>t.signal,()=>n=!0)},u=jn(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?On:ln;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?yc:vc,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:vc(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 vc(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 yc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var bc=class extends mn{#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||xc(),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=Cn({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),gn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function xc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Sc=class extends tn{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 bc({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=Cc(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=Cc(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=Cc(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=Cc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){gn.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=>nn(t,e))}findAll(e={}){return this.getAll().filter(t=>nn(e,t))}notify(e){gn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return gn.batch(()=>Promise.all(e.map(e=>e.continue().catch(cn))))}};function Cc(e){return e.options.scope?.id}var wc=class extends tn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??sn(r,t),a=this.get(i);return a||(a=new pn({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(){gn.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=>kn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>kn(e,t)):t}notify(e){gn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){gn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){gn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Tc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new wc,this.#t=e.mutationCache||new Sc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=vn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=bn.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(rn(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=dn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return gn.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;gn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return gn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=gn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(cn).catch(cn)}invalidateQueries(e,t={}){return gn.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=gn.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(cn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(cn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(rn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(cn).catch(cn)}fetchInfiniteQuery(e){return e.behavior=_c(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(cn).catch(cn)}ensureInfiniteQueryData(e){return e.behavior=_c(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return bn.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(An(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{an(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(An(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{an(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||=sn(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===on&&(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()}},Ec=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=Ec()})),Oc=t((e=>{var t=Dc(),n=r(),i=$i();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function J(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function Y(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ee,te;function ne(e){if(ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ee=t&&t[1]||``,te=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BCjHJnNa.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-CM1Lm4n9.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-sOEyFULC.js","./label-DwEePOBC.js","./mcp-consent-store-CijO54Jd.js","./ActivityPanelDiffView-DgtknSgX.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-DyvuLzi4.js","./prop-types-1LtPV_jm.js","./w3c-keyname-B5t0fahT.js","./toggle-group-Cs-1L92l.js","./panel-BNBODYwB.js","./min-BiwsSkbB.js","./src-L3wpjxBL.js","./colors-D6LRuSY-.js","./ordinal-BLFwWMHf.js","./init-8GNx5phc.js","./isObjectLike-DFnkciUU.js","./now-D_m-3Vjm.js","./isSymbol-D0ur5y-p.js","./target-navigation-intent-C3fRj6CU.js","./ActivityModeContent-DqtdV56a.js","./DocumentContext-Cf0J0V-D.js","./dist-BrsSsfiw.js","./dist-Du-s1q8P.js","./dist-DsbVHLNy.js","./dist-BYGzJeLM.js","./dist-Cq1LYbUj.js","./stex-CzCFWeB9.js","./DocumentContext-B0sQn39F.css","./agent-presence-DxGcS3q2.js","./SettingsDialogBody-DfwLWUB4.js","./config-validation-events-CTMArlH_.js","./keyboard-shortcuts-CwjLkUXk.js","./SourceEditor-CWDD_0Ko.js","./typing-burst-detector-B8t-SuQv.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,In as j,It as M,J as N,Jn as P,Jt as F,Kn as I,Kt as L,L 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 K,Pn as q,Pt as J,Q as Y,Qn as ee,Qt as te,R as ne,Rn as re,Rt as ie,Sn as ae,Sr as oe,St as se,Tn as ce,Tt as le,U as ue,Un as de,Ut as fe,V as pe,Vn as me,Vt as he,Wn as ge,Wt as _e,X as ve,Xn as ye,Xt as be,Yn as xe,Yt as Se,Z as Ce,Zn as we,Zt as Te,_r as Ee,_t as De,a as Oe,an as ke,ar as Ae,at as je,b as Me,br as Ne,bt as Pe,c as Fe,cn as Ie,cr as Le,ct as Re,d as ze,dr as Be,dt as Ve,en as He,er as Ue,et as We,f as Ge,fr as Ke,ft as qe,g as X,gt as Je,h as Ye,hr as Xe,ht as Ze,i as Qe,in as $e,ir as et,it as tt,j as nt,jn as rt,jt as it,k as at,kn as ot,kt as st,l as ct,lr as lt,lt as ut,m as dt,mt as ft,n as pt,nn as mt,nr as ht,nt as gt,o as _t,on as vt,or as yt,ot as bt,p as xt,pr as St,pt as Ct,qn as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sn as jt,sr as Mt,st as Nt,t as Pt,tn as Ft,tr as It,tt as Lt,u as Rt,un as zt,ur as Bt,ut as Vt,v as Ht,vr as Ut,vt as Wt,wn as Gt,wt as Kt,xr as qt,xt as Jt,y as Yt,yr as Xt,yt as Zt,z as Qt,zn as $t,zt as en}from"./DocumentContext-Cf0J0V-D.js";import{A as tn,C as nn,D as rn,E as an,O as on,S as sn,T as cn,_ as ln,a as un,b as dn,c as fn,d as pn,f as mn,g as hn,h as gn,i as _n,k as vn,l as yn,m as bn,n as xn,o as Sn,p as Cn,r as wn,s as Tn,t as En,u as Dn,v as On,w as kn,x as An,y as jn}from"./panel-BNBODYwB.js";import{$ as Mn,$n as Nn,A as Pn,At as Fn,Bi as In,Bn as Ln,Br as Rn,C as zn,Ci as Bn,Ct as Vn,D as Hn,Di as Un,Dn as Wn,Dt as Gn,E as Kn,Ei as qn,En as Jn,F as Yn,Fr as Xn,G as Zn,Gn as Qn,Gt as $n,Hn as er,Hr as tr,I as nr,It as rr,J as ir,Ji as ar,Jn as or,Jr as sr,K as cr,Ki as lr,Kn as ur,Kr as dr,L as fr,Ln as pr,Lr as mr,Lt as hr,M as gr,N as _r,Nt as vr,O as yr,On as br,Ot as xr,P as Sr,Q as Cr,Qn as wr,R as Tr,Ri as Er,Rn as Dr,Rr as Or,S as kr,T as Ar,Ti as jr,Ur as Mr,Vn as Nr,Vr as Pr,W as Fr,Wr as Ir,X as Lr,Xi as Rr,Xr as zr,Y as Br,Yi as Vr,Yn as Hr,Z as Ur,Zi as Wr,Zr as Gr,a as Kr,b as qr,bt as Jr,c as Yr,cn as Xr,ct as Zr,di as Qr,en as $r,er as ei,fi as ti,g as ni,gi as ri,h as ii,hi as ai,hn as oi,hr as si,i as ci,in as li,ir as ui,it as di,j as fi,jn as pi,jt as mi,k as hi,kn as gi,kr as _i,kt as vi,n as yi,ni as bi,nr as xi,nt as Si,o as Ci,or as wi,p as Ti,q as Ei,qi as Di,qn as Oi,r as ki,ri as Ai,s as ji,sn as Mi,tt as Ni,ui as Pi,vi as Fi,vr as Ii,w as Li,wn as Ri,wt as zi,x as Bi,xn as Vi,zi as Hi,zn as Ui}from"./prop-types-1LtPV_jm.js";import{C as Wi,S as Gi,d as Ki,g as qi,l as Ji,m as Yi,o as Xi,p as Zi,t as Qi,w as $i,x as ea}from"./button-DenIdY-r.js";import{a as ta,c as na,d as ra,f as ia,i as aa,l as oa,m as sa,n as ca,o as la,p as ua,r as da,s as fa,t as pa,u as ma}from"./agent-presence-DxGcS3q2.js";import{$ as ha,$t as ga,A as _a,At as va,B as ya,Bt as ba,C as xa,Ct as Sa,D as Ca,Dt as wa,E as Ta,Et as Ea,F as Da,Ft as Oa,G as ka,Gt as Aa,H as ja,Ht as Ma,I as Na,It as Pa,J as Fa,Jt as Ia,K as La,Kt as Ra,L as za,Lt as Ba,M as Va,Mt as Ha,N as Ua,Nt as Wa,O as Ga,Ot as Ka,P as qa,Pt as Ja,Q as Ya,Qt as Xa,R as Za,Rt as Qa,S as $a,St as eo,T as to,Tt as no,U as ro,Ut as io,V as ao,Vt as oo,W as so,Wt as co,X as lo,Y as uo,Yt as fo,Z as po,Zt as mo,_t as ho,at as go,b as _o,bt as vo,dt as yo,en as bo,et as xo,ft as So,gt as Co,ht as wo,it as To,j as Eo,jt as Do,k as Oo,kt as ko,lt as Ao,m as jo,mt as Mo,nt as No,o as Po,ot as Fo,p as Io,pt as Lo,q as Ro,qt as zo,r as Bo,rt as Vo,st as Ho,t as Uo,tt as Wo,u as Go,ut as Ko,vt as qo,w as Jo,wt as Yo,x as Xo,xt as Zo,y as Qo,yt as $o,z as es,zt as ts}from"./config-validation-events-CTMArlH_.js";import{i as ns,n as rs,r as is,t as as}from"./toggle-group-Cs-1L92l.js";import{a as os,b as ss,c as cs,i as ls,n as us,o as ds,s as fs,t as ps,v as ms,x as hs,y as gs}from"./dialog-B1es0EvU.js";import{a as _s,i as vs,n as ys,r as bs,t as xs}from"./collapsible-BhpeB6tu.js";import{t as Ss}from"./checkbox-Co7Tjlri.js";import{t as Cs}from"./label-DwEePOBC.js";import{n as ws,r as Ts}from"./textarea-luaT-nOK.js";import{i as Es,n as Ds,r as Os}from"./project-paths-CsGHlmFh.js";import{n as ks,t as As}from"./mcp-consent-store-CijO54Jd.js";import{c as js,i as Ms,l as Ns,o as Ps}from"./keyboard-shortcuts-CwjLkUXk.js";import{$ as Fs,At as Is,Ct as Ls,Dt as Rs,Ft as zs,I as Bs,It as Vs,J as Hs,Mt as Us,Ot as Ws,Pt as Gs,Q as Ks,Tt as qs,X as Js,Z as Ys,at as Xs,bt as Zs,c as Qs,jt as $s,k as ec,w as tc}from"./dist-Du-s1q8P.js";import{n as nc}from"./dist-DsbVHLNy.js";import{c as rc,d as ic,f as ac,h as oc,i as sc,l as cc,n as lc,o as uc,r as dc,s as fc,t as pc,u as mc}from"./typing-burst-detector-B8t-SuQv.js";import{t as hc}from"./target-navigation-intent-C3fRj6CU.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 gc(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.9.1`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BCjHJnNa.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function _c(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=>{hn(e,()=>t.signal,()=>n=!0)},u=jn(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?On:ln;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?yc:vc,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:vc(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 vc(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 yc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var bc=class extends mn{#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||xc(),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=Cn({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),gn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function xc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Sc=class extends tn{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 bc({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=Cc(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=Cc(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=Cc(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=Cc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){gn.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=>nn(t,e))}findAll(e={}){return this.getAll().filter(t=>nn(e,t))}notify(e){gn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return gn.batch(()=>Promise.all(e.map(e=>e.continue().catch(cn))))}};function Cc(e){return e.options.scope?.id}var wc=class extends tn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??sn(r,t),a=this.get(i);return a||(a=new pn({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(){gn.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=>kn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>kn(e,t)):t}notify(e){gn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){gn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){gn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Tc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new wc,this.#t=e.mutationCache||new Sc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=vn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=bn.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(rn(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=dn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return gn.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;gn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return gn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=gn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(cn).catch(cn)}invalidateQueries(e,t={}){return gn.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=gn.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(cn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(cn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(rn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(cn).catch(cn)}fetchInfiniteQuery(e){return e.behavior=_c(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(cn).catch(cn)}ensureInfiniteQueryData(e){return e.behavior=_c(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return bn.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(An(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{an(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(An(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{an(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||=sn(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===on&&(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()}},Ec=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=Ec()})),Oc=t((e=>{var t=Dc(),n=r(),i=$i();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function J(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function Y(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ee,te;function ne(e){if(ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ee=t&&t[1]||``,te=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ee+e+te}var re=!1;function ie(e,t){if(!e||re)return``;re=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -20,12 +20,12 @@ Error generating stack: `+e.message+`
20
20
  `}function A_(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;O_(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?k_(e,o.headerOptions):void 0)}}))}else{let s=O_(e,t,n,r,i,a,o);return s?k_(s,o?.headerOptions):void 0}}function j_(e,t,n,r,i,a){return A_(e,e,t,n,r,i,a)}function M_(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 N_(e,t){return`${e}\u0000${t}`}function P_(e,t,n){let r=Mr(e).body,i=Mr(t).body;return r===i?``:j_(n,r,i,``,``,{context:3})}function F_(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=pt(),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=N_(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=P_(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 I_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-DgtknSgX.js`),__vite__mapDeps([18,1,6,19]),import.meta.url)).ActivityPanelDiffView}));function L_(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return lr._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return lr._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return lr._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return lr._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?lr._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function R_(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 B_(e){return e.type===`upstream`?lr._({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`?lr._({id:`B2DrPb`}):e.author}function V_(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)(ra,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(la,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ta,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(oa,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(ma,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(fa,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(ua,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function H_(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)(Ae,{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=wi(i),t[1]=i,t[2]=a);let o=a,s=r?Si[o]??Ni[o]:Ni[o],c;t[3]!==s||t[4]!==i?(c=s??pr(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)(V_,{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)(rl,{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)(Ac,{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)(Hl,{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)(ua,{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)(Ac,{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)(Hl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function U_(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(W_),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(Ut,{className:`size-3`}):(0,Z.jsx)(_s,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?lr._({id:`OKQe56`,values:{entryCount:p}}):lr._({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)(nv,{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 W_(e){return!e}function G_(e){return e.checkpoint?e.checkpoint.kind:`save`}function K_(e){let t=G_(e);if(t===`save`)return lr._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${q_(n)})`:``;return t===`bridge-merge-loss`?lr._({id:`uZAG7T`,values:{sizeSuffix:r}}):lr._({id:`_4rAQI`,values:{sizeSuffix:r}})}function q_(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function J_(e){return e.type===`checkpoint`?G_(e)===`save`?`version`:`auto-save`:`wip`}function Y_(e){let t=J_(e);return t===`version`?lr._({id:`RFQ1Yx`}):t===`auto-save`?lr._({id:`9Uv1CD`}):lr._({id:`Yea-K5`})}function X_(e){let t=J_(e);return t===`version`?lr._({id:`gg3Rpy`}):t===`auto-save`?lr._({id:`PXXeW8`}):lr._({id:`Pyp1NA`})}function Z_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Q_(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(ev),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($_)},children:[r?(0,Z.jsx)(Ut,{className:`size-3`}):(0,Z.jsx)(_s,{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 $_(e){return!e}function ev(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 tv(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=F_(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)(wt,{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)(wt,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(I_,{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 nv(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=L_(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=B_(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=R_(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(rv),w;t[8]===n?w=t[9]:(w=Z_(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 F=P,I;t[15]===D?I=t[16]:(I=function(){A.current?.abort(),A.current=null,k(!1),D(!1)},t[15]=D,t[16]=I);let L=I,R;t[17]!==m||t[18]!==l||t[19]!==n.sha||t[20]!==f||t[21]!==D?(R=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}),gs.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=$r.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}),gs.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]=R):R=t[22];let z=R,B;t[23]!==n||t[24]!==a||t[25]!==p?(B=p?(()=>{let e=G_(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Di,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(Jc,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(Gc,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(H_,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=B):B=t[26];let V=B,H=u?j:void 0,U=u?`bg-muted`:`hover:bg-muted/80`,W;t[27]===U?W=t[28]:(W=[`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`,U],t[27]=U,t[28]=W);let G=W.join(` `),K;t[29]===F?K=t[30]:(K=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),F())},t[29]=F,t[30]=K);let q;t[31]===V?q=t[32]:(q=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:V}),t[31]=V,t[32]=q);let J;t[33]!==v||t[34]!==n||t[35]!==p?(J=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:K_(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]=J):J=t[36];let Y;t[37]!==n.timestamp||t[38]!==g?(Y=(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]=Y):Y=t[39];let ee;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=ee):ee=t[40];let te;t[41]===n?te=t[42]:(te=Y_(n),t[41]=n,t[42]=te);let ne;t[43]===D?ne=t[44]:(ne=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=ne);let re;t[45]===O?re=t[46]:(re=O?(0,Z.jsx)(wt,{className:`size-3 animate-spin`}):(0,Z.jsx)(ia,{className:`size-3`}),t[45]=O,t[46]=re);let ie;t[47]!==O||t[48]!==te||t[49]!==ne||t[50]!==re?(ie=(0,Z.jsx)(Tr,{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":te,disabled:O,onClick:ne,children:re})}),t[47]=O,t[48]=te,t[49]=ne,t[50]=re,t[51]=ie):ie=t[51];let ae;t[52]===n?ae=t[53]:(ae=Y_(n),t[52]=n,t[53]=ae);let oe;t[54]===ae?oe=t[55]:(oe=(0,Z.jsx)(nr,{side:`top`,children:ae}),t[54]=ae,t[55]=oe);let se;t[56]!==ie||t[57]!==oe?(se=(0,Z.jsxs)(Yn,{children:[ie,oe]}),t[56]=ie,t[57]=oe,t[58]=se):se=t[58];let ce;t[59]!==J||t[60]!==Y||t[61]!==se?(ce=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[J,Y,ee,se]}),t[59]=J,t[60]=Y,t[61]=se,t[62]=ce):ce=t[62];let le;t[63]===T?le=t[64]:(le=T.length>0&&(0,Z.jsx)(Q_,{summaries:T}),t[63]=T,t[64]=le);let ue=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}),de;t[65]!==ce||t[66]!==le||t[67]!==ue?(de=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ce,le,ue]}),t[65]=ce,t[66]=le,t[67]=ue,t[68]=de):de=t[68];let fe;t[69]!==u||t[70]!==F||t[71]!==H||t[72]!==G||t[73]!==K||t[74]!==q||t[75]!==de?(fe=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":H,"data-testid":`timeline-entry-expand`,className:G,onClick:F,onKeyDown:K,children:[q,de]}),t[69]=u,t[70]=F,t[71]=H,t[72]=G,t[73]=K,t[74]=q,t[75]=de,t[76]=fe):fe=t[76];let pe;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(pe=u&&(0,Z.jsx)(tv,{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]=pe):pe=t[83];let me;t[84]!==fe||t[85]!==pe?(me=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[fe,pe]}),t[84]=fe,t[85]=pe,t[86]=me):me=t[86];let he;t[87]!==L||t[88]!==D?(he=e=>{e?D(!0):L()},t[87]=L,t[88]=D,t[89]=he):he=t[89];let ge;t[90]===n?ge=t[91]:(ge=X_(n),t[90]=n,t[91]=ge);let _e;t[92]===ge?_e=t[93]:(_e=(0,Z.jsx)(cs,{children:ge}),t[92]=ge,t[93]=_e);let ve;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(ve={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=ve):ve=t[98];let ye;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(ye={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=ye):ye=t[99];let be;t[100]===ve?be=t[101]:(be=(0,Z.jsx)(os,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:ve,components:ye})}),t[100]=ve,t[101]=be);let xe;t[102]!==_e||t[103]!==be?(xe=(0,Z.jsxs)(fs,{children:[_e,be]}),t[102]=_e,t[103]=be,t[104]=xe):xe=t[104];let Se;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=Se):Se=t[105];let Ce;t[106]===L?Ce=t[107]:(Ce=(0,Z.jsx)(Qi,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:L,children:Se}),t[106]=L,t[107]=Ce);let we;t[108]===z?we=t[109]:(we=()=>z(),t[108]=z,t[109]=we);let Te;t[110]===O?Te=t[111]:(Te=O?(0,Z.jsx)(wt,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=Te);let Ee;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=Ee):Ee=t[112];let De;t[113]!==O||t[114]!==we||t[115]!==Te?(De=(0,Z.jsxs)(Qi,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:we,children:[Te,Ee]}),t[113]=O,t[114]=we,t[115]=Te,t[116]=De):De=t[116];let Oe;t[117]!==Ce||t[118]!==De?(Oe=(0,Z.jsxs)(ds,{children:[Ce,De]}),t[117]=Ce,t[118]=De,t[119]=Oe):Oe=t[119];let ke;t[120]!==xe||t[121]!==Oe?(ke=(0,Z.jsxs)(ls,{children:[xe,Oe]}),t[120]=xe,t[121]=Oe,t[122]=ke):ke=t[122];let Ae;t[123]!==E||t[124]!==he||t[125]!==ke?(Ae=(0,Z.jsx)(ps,{open:E,onOpenChange:he,children:ke}),t[123]=E,t[124]=he,t[125]=ke,t[126]=Ae):Ae=t[126];let je;return t[127]!==me||t[128]!==Ae?(je=(0,Z.jsxs)(Z.Fragment,{children:[me,Ae]}),t[127]=me,t[128]=Ae,t[129]=je):je=t[129],je}function rv(e){return e.docs}function iv(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=Wr(),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)(cv),[x,S]=(0,Q.useState)(sv),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,F,I,L,R;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(ov),t[31]=p,t[32]=f);let m=!f,g=!h&&!_&&p.length>0;F=`flex h-full flex-col`;let v;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Tn,{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)(Yn,{children:[(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsxs)(as,{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)(rs,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(El,{className:`size-3.5`})}),(0,Z.jsx)(rs,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(Vc,{className:`size-3.5`})})]})}),(0,Z.jsx)(nr,{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)(wt,{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)(Tr,{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)(nr,{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)(Yn,{children:[w,T]}),t[50]=w,t[51]=T,t[52]=D):D=t[52],t[53]!==y||t[54]!==D?(I=(0,Z.jsxs)(Sn,{children:[v,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,D]})]}),t[53]=y,t[54]=D,t[55]=I):I=t[55],L=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[56]!==l||t[57]!==h?(R=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(av)}),t[56]=l,t[57]=h,t[58]=R):R=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)(nv,{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)(nv,{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)(U_,{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]=F,t[28]=I,t[29]=L,t[30]=R}else j=t[23],M=t[24],N=t[25],P=t[26],F=t[27],I=t[28],L=t[29],R=t[30];let z;t[76]!==j||t[77]!==M||t[78]!==N||t[79]!==P||t[80]!==L||t[81]!==R?(z=(0,Z.jsxs)(`div`,{className:L,children:[R,j,M,N,P]}),t[76]=j,t[77]=M,t[78]=N,t[79]=P,t[80]=L,t[81]=R,t[82]=z):z=t[82];let B;return t[83]!==F||t[84]!==I||t[85]!==z?(B=(0,Z.jsxs)(`div`,{className:F,children:[I,z]}),t[83]=F,t[84]=I,t[85]=z,t[86]=B):B=t[86],B}function av(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Sa,{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)(Sa,{className:`h-3 w-28`}),(0,Z.jsx)(Sa,{className:`h-3 w-40`})]})]},e)}function ov(e){return e.type===`checkpoint`}function sv(){return new Set}function cv(){return new aa(32)}var lv=[{id:`outline`,icon:ul},{id:`links`,icon:we},{id:`graph`,icon:pl},{id:`timeline`,icon:Bc}];function uv(e){return e===`outline`?lr._({id:`dD7NPy`}):e===`links`?lr._({id:`Rj01Fz`}):e===`graph`?lr._({id:`x2fr_j`}):lr._({id:`cklVjM`})}function dv(){return n(()=>import(`./GraphPanel-DUQL1b5J.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 fv=(0,Q.lazy)(async()=>({default:(await dv()).GraphPanel})),pv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-ryZpdhrg.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 mv(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)(as,{type:`single`,variant:`outline`,value:a,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:lv.map(hv)})}):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)(ac,{docName:n,isSourceMode:r}),a===`links`&&(0,Z.jsx)(a_,{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)(fv,{activeDocName:n})}),a===`timeline`&&(0,Z.jsx)(iv,{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)(pv,{})})}),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 hv(e){let{id:t,icon:n}=e,r=uv(t);return(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(rs,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(Tr,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(nr,{side:`bottom`,children:r})]},t)}function gv(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function _v(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function vv(e){return e/100*window.innerHeight}function yv(e){return e/100*window.innerWidth}function bv(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 xv({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=bv(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=_v(t,i);break;case`em`:r=gv(t,i);break;case`vh`:r=vv(i);break;case`vw`:r=yv(i);break}return r}function Sv(e){return parseFloat(e.toFixed(3))}function Cv({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 wv(e){let{panels:t}=e,n=Cv({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=Sv(xv({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Sv(xv({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Sv(xv({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Sv(xv({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 Tv(e,t=`Assertion error`){if(!e)throw Error(t)}function Ev(e,t){return Array.from(t).sort(e===`horizontal`?Dv:Ov)}function Dv(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Ov(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function kv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Av(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 jv({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}=Av(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Tv(i,`No rect found`),i}var Mv;function Nv(){return Mv===void 0&&(Mv=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Mv}function Pv(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Ev(n,Array.from(t.children).filter(kv).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,jv({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=Nv()?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:Cv({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 Fv=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)}}},Iv=new Map,Lv=new Fv;function Rv(e){Iv=new Map(Iv),Iv.delete(e)}function zv(e,t){for(let[t]of Iv)if(t.id===e)return t}function Bv(e,t){for(let[t,n]of Iv)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Vv(){return Iv}function Hv(e,t){return Lv.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Uv(e,t){let n=Iv.get(e);Iv=new Map(Iv),Iv.set(e,t),Lv.emit(`groupChange`,{group:e,prev:n,next:t})}function Wv(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Av(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 Gv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Kv(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Qv(e),b:Qv(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Tv(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Zv(Xv(n.a)),b:Zv(Xv(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 qv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Jv(e){let t=getComputedStyle($v(e)??e).display;return t===`flex`||t===`inline-flex`}function Yv(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Jv(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`||qv.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Xv(e){let t=e.length;for(;t--;){let n=e[t];if(Tv(n,`Missing node`),Yv(n))return n}return null}function Zv(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Qv(e){let t=[];for(;e;)t.push(e),e=$v(e);return t}function $v(e){let{parentNode:t}=e;return Gv(t)?t.host:t}function ey(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 ty({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!kv(n)||n.contains(e)||e.contains(n))return!0;if(Kv(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ey(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function ny(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Pv(r),a=Wv(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&ty({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function ry(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 iy(e,t,n=0){return Math.abs(Sv(e)-Sv(t))<=n}function ay(e,t){return iy(e,t)?0:e>t?1:-1}function oy({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(ay(r,c)<0)if(a){let e=(i+c)/2;r=ay(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Sv(r),r}function sy({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(iy(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Tv(u!=null,`Invalid first pivot index`),Tv(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Tv(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(Tv(n!=null,`Previous layout not found for panel index ${t}`),iy(n,i)){let t=o-n;ay(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Tv(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(Tv(n!=null,`Previous layout not found for panel index ${t}`),iy(n,o)){let t=n-i;ay(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Tv(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&ay(i,c)<0)if(e>0){let t=c-o,n=t/2;ay(i+e,c)<0&&(e=ay(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;ay(i-e,c)<0&&(e=ay(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];Tv(e!=null,`Previous layout not found for panel index ${r}`);let a=oy({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];Tv(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=oy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!iy(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(ry(c,l))return i;{let t=e<0?d:u,r=s[t];Tv(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=oy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!iy(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Tv(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=oy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(iy(i,s)||(t-=s-i,l[r]=s),iy(t,0))break;e>0?r--:r++}}}if(!iy(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 cy(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||ay(e[n],t[n])!==0)return!1;return!0}function ly({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(!iy(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Tv(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];Tv(i!=null,`No layout data found for index ${e}`);let o=r[e];Tv(o!=null,`No layout data found for index ${e}`);let s=oy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!iy(a,0))for(let e=0;e<t.length;e++){let n=r[e];Tv(n!=null,`No layout data found for index ${e}`);let i=n+a,o=oy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,iy(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function uy({groupId:e,panelId:t}){let n=()=>{let t=Vv();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=ly({layout:sy({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});cy(l,p)||Uv(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&&iy(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Cv({group:t});o(Sv(xv({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function dy(e){e.defaultPrevented||ny(e,Vv()).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=uy({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function fy(e){let t=Vv();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 py({groupId:e}){let t=()=>{let t=Vv();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=ly({layout:e,panelConstraints:r});return n?o:(cy(o,c)||Uv(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function my(e,t){let n=fy(e),r=Bv(n.id,!0),i=n.separators.find(t=>t.element===e);Tv(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Tv(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=py({groupId:n.id}).getLayout(),c=ly({layout:sy({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});cy(s,c)||Uv(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function hy(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=fy(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&my(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&my(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&my(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&my(t,-5);break;case`End`:e.preventDefault(),my(t,100);break;case`Enter`:{e.preventDefault();let n=fy(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Bv(n.id,!0),o=n.separators.find(e=>e.element===t);Tv(o,`Matching separator not found`);let s=a.get(o);Tv(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Tv(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];my(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=fy(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Tv(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(),my(t,-100);break}}var gy={cursorFlags:0,state:`inactive`},_y=new Fv;function vy(){return gy}function yy(e){return _y.addListener(`change`,e)}function by(e){let t=gy,n={...gy};n.cursorFlags=e,gy=n,_y.emit(`change`,{prev:t,next:n})}function xy(e){let t=gy;gy=e,_y.emit(`change`,{prev:t,next:e})}function Sy(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Vv(),n=ny(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)}),xy({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Cy=e=>e,wy=()=>{},Ty=1,Ey=2,Dy=4,Oy=8,ky=3,Ay=12,jy;function My(){return jy===void 0&&(jy=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(jy=!0)),jy}function Ny({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&&My()){let t=(e&Ty)!==0,n=(e&Ey)!==0,r=(e&Dy)!==0,i=(e&Oy)!==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 My()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Py=new WeakMap;function Fy(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Py.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=vy();switch(r.state){case`active`:case`hover`:{let e=Ny({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}Py.set(e,{prevStyle:t,styleSheet:n})}function Iy({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=sy({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(cy(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ty:Ey;break;case`vertical`:s|=d<0?Dy:Oy;break}}else Uv(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&ky:c|=s&ky,t.movementY===0?c|=o&Ay:c|=s&Ay,by(c),Fy(e)}function Ly(e){let t=Vv(),n=vy();switch(n.state){case`active`:Iy({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Ry(e){if(e.defaultPrevented)return;let t=vy(),n=Vv();switch(t.state){case`active`:if(e.buttons===0){xy({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Bv(e.group.id,!0);Uv(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)}Iy({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=ny(e,n);r.length===0?t.state!==`inactive`&&xy({cursorFlags:0,state:`inactive`}):xy({cursorFlags:0,hitRegions:r,state:`hover`}),Fy(e.currentTarget);break}}}function zy(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(vy().state){case`hover`:xy({cursorFlags:0,state:`inactive`})}}function By(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=vy();switch(t.state){case`active`:xy({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Fy(e.currentTarget),t.hitRegions.forEach(e=>{let t=Bv(e.group.id,!0);Uv(e.group,t)}),e.preventDefault())}}function Vy(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Sv(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Sv((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Hy(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Cv({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Sv(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Uy(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 Wy({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=Sv(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]=Sv((r[e]??0)/a*l);else{let e=Sv(l/c.length);for(let t of c)u[t]=e}return u}function Gy(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 Ky=new Map;function qy(e){let t=!0;Tv(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=Cv({group:e});if(t===0)return;let n=Bv(e.id);if(!n)return;let r=wv(e),i=n.defaultLayoutDeferred?Vy(r):n.layout,a=ly({layout:Wy({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&cy(n.layout,a)&&Uy(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Uv(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Hy(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Tv(!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=Cv({group:e}),s=wv(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Gy(e.panels,l)||(l=void 0));let u=ly({layout:e.mutableState.layouts[c]??l??Vy(s),panelConstraints:s}),d=e.element.ownerDocument;Ky.set(d,(Ky.get(d)??0)+1);let f=new Map;return Pv(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Uv(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Tv(!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`,hy)}),Ky.get(d)===1&&(d.addEventListener(`dblclick`,dy,!0),d.addEventListener(`pointerdown`,Sy,!0),d.addEventListener(`pointerleave`,Ly),d.addEventListener(`pointermove`,Ry),d.addEventListener(`pointerout`,zy),d.addEventListener(`pointerup`,By,!0)),function(){t=!1,Ky.set(d,Math.max(0,(Ky.get(d)??0)-1)),Rv(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,hy)}),Ky.get(d)||(d.removeEventListener(`dblclick`,dy,!0),d.removeEventListener(`pointerdown`,Sy,!0),d.removeEventListener(`pointerleave`,Ly),d.removeEventListener(`pointermove`,Ry),d.removeEventListener(`pointerout`,zy),d.removeEventListener(`pointerup`,By,!0)),a.disconnect()}}function Jy(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Yy(e){let t=(0,Q.useId)();return`${e??t}`}var Xy=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Zy(e){let t=(0,Q.useRef)(e);return Xy(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Qy(...e){return Zy(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function $y(e){let t=(0,Q.useRef)({...e});return Xy(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var eb=(0,Q.createContext)(null);function tb(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Cy});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Xy(()=>{Object.assign(n.current,py({groupId:e}))})}function nb({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=Zy(e=>{cy(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Zy(e=>{cy(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Yy(s),v=(0,Q.useRef)(null),[y,b]=Jy(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Qy(v,a);tb(_,o);let C=Zy((e,t)=>{let r=vy(),i=zv(e),a=Bv(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=$y({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=Ev(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Ev(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=Bv(_);r&&i&&Uv(r,{...i,derivedPanelConstraints:wv(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 Xy(()=>{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=qy(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Bv(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Hv(_,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=iy(t.collapsedSize,i[t.panelId]),a=iy(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=vy().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)(eb.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})})}nb.displayName=`Group`;function rb(){let e=(0,Q.useContext)(eb);return Tv(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function ib(e,t){let{id:n}=rb(),r=(0,Q.useRef)({collapse:wy,expand:wy,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:wy});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Xy(()=>{Object.assign(r.current,uy({groupId:n,panelId:e}))})}function ab({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=Yy(c),_=$y({disabled:a}),v=(0,Q.useRef)(null),y=Qy(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=rb(),T=d!==null,E=Zy((e,t,n)=>{d?.(e,c,n)});Xy(()=>{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]),ib(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Hv(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:{...ob,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})})}ab.displayName=`Panel`;var ob={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function sb(){return(0,Q.useRef)(null)}function cb({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=ly({layout:sy({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=ly({layout:sy({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function lb({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Yy(a),l=$y({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Qy(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=rb(),x=v===`horizontal`?`vertical`:`horizontal`;Xy(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=yy(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Hv(_,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(cb({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})}lb.displayName=`Separator`;var ub={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:`#`}}},db=Qt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),fb=ne({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function pb(e){switch(e.toLowerCase()){case`json`:return nc().language;case`toml`:return Qs.define(ub);default:return null}}function mb(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 hb(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}=Wr(),l=mb(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=pb(i),t=c===`dark`?db:fb,n=[mc,...e?[e]:[],Js.editable.of(!0),Rs.readOnly.of(!0),Js.lineWrapping,t],r=new Js({state:Rs.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 gb(e){return Ir(`/api/asset?path=${encodeURIComponent(e)}`)}function _b(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function vb(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=gb(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)(tt,{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=_b(n),t[18]=n,t[19]=r),p=(0,Z.jsx)(hb,{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)(bt,{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 yb(){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)(Sa,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Sa,{className:`h-4 w-full`}),(0,Z.jsx)(Sa,{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 bb={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function xb(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}=Wr(),s=bb[r],c=s?(o===`dark`?Si[s]:void 0)??Ni[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=Gi(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)(ra,{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)(na,{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)(la,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function Sb(e){let{installState:t}=e;return t.installed===null?lr._({id:`IA6JW2`}):t.installed===!1?lr._({id:`5SwVv1`}):null}function Cb(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:lr._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:lr._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:lr._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function wb(e){return Jn(e)}function Tb(e){return lr._({id:`h_HYHD`,values:{displayName:e}})}var Eb=`claude.ai`;async function Db(e,t=Ph){(await t(Jn(e))).ok?gs.success(Tb(Eb)):gs.error(lr._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:Eb}}))}function Ob(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??Ph,u=e.onWebFallbackSuccess??Ab,d=e.onWebFallbackError??kb,{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=Cb({target:r,installState:a,isElectronHost:o}),i=Sb({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(wb(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)(xb,{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)(Wo,{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)(xb,{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)(Wo,{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=To;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(xb,{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)(Fo,{"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=go,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(No,{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)(Vo,{}),t[55]=v):v=t[55],y=(0,Z.jsx)(Wo,{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)(Wo,{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 kb(){}function Ab(){}function jb(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=ug(),{dispatch:a}=$h(),o=Mo(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=Bh({workspace:o});t[7]===n?s=t[8]:(s=Gi(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=sh.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(Mb,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{Uh(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 Mb(e){let t=(0,$.c)(17),{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)(xb,{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]===r?f=t[8]:(f=r===`missing`?(0,Z.jsx)(ns,{"aria-hidden":`true`,className:`size-3`}):null,t[7]=r,t[8]=f);let p;t[9]!==c||t[10]!==f?(p=(0,Z.jsxs)(`p`,{className:`inline-flex items-center gap-1 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,f]}),t[9]=c,t[10]=f,t[11]=p):p=t[11];let m;return t[12]!==s||t[13]!==o||t[14]!==d||t[15]!==p?(m=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-row items-center justify-between gap-4 rounded-xl border border-border/60 bg-card p-4 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:[d,p]}),t[12]=s,t[13]=o,t[14]=d,t[15]=p,t[16]=m):m=t[16],m}var Nb=3100,Pb=3;function Fb(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Pb;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var Ib={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}},Lb=[`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 Rb(e,t={}){let n=t.rng??Math.random,r=t.colors??Lb,i=Ib[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,Bb=90,Vb=16,Hb=380,Ub=.025,Wb=.1,Gb=.18,Kb=400,qb=9.2736,Jb=18.1799,Yb=14.5244,Xb={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Zb(e,t){let{halfWidth:n,apexLift:r}=Xb[t];return`M${e-n} ${Yb+.3} Q${e} ${Yb-r}, ${e+n} ${Yb+.3}`}function Qb(e){let t=1.5,n=.3;return`M${e-t} ${Yb-n} Q${e} ${Yb+1.4}, ${e+t} ${Yb-n}`}var $b=15,ex=15;function tx(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 nx(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=Fb(g,t);_(n),y(ox),S(Rb(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Nb)},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(ax),S(Rb(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Nb))},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/Hb)),C=Math.max(-1,Math.min(1,b/Hb)),w=S*Vb,T=-C*Vb,E=0,D=0;if(x>=1){let e=Math.min(x/Bb,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)*Wb,i+=(w-i)*Wb,u.style.transform=`perspective(${Kb}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*Gb,o+=(D-o)*Gb;let k=i*Ub,A=-r*Ub,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=Gi(`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=Gi(`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=Gi(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:qb,cy:Yb,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let q=(F||T)&&`ok-blob-eye-hidden`,J;t[26]===q?J=t[27]:(J=Gi(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=J);let Y;t[28]===J?Y=t[29]:(Y=(0,Z.jsx)(`ellipse`,{cx:Jb,cy:Yb,rx:1.2722,ry:1.9083,className:J}),t[28]=J,t[29]=Y);let ee;t[30]===I?ee=t[31]:(ee=Zb(qb,I),t[30]=I,t[31]=ee);let te=(!F||T)&&`ok-blob-eye-hidden`,ne;t[32]===te?ne=t[33]:(ne=Gi(`ok-blob-happy-eye`,te),t[32]=te,t[33]=ne);let re;t[34]!==ee||t[35]!==ne?(re=(0,Z.jsx)(`path`,{d:ee,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ne}),t[34]=ee,t[35]=ne,t[36]=re):re=t[36];let ie;t[37]===I?ie=t[38]:(ie=Zb(Jb,I),t[37]=I,t[38]=ie);let ae=(!F||T)&&`ok-blob-eye-hidden`,oe;t[39]===ae?oe=t[40]:(oe=Gi(`ok-blob-happy-eye`,ae),t[39]=ae,t[40]=oe);let se;t[41]!==ie||t[42]!==oe?(se=(0,Z.jsx)(`path`,{d:ie,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:oe}),t[41]=ie,t[42]=oe,t[43]=se):se=t[43];let ce;t[44]===T?ce=t[45]:(ce=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:Qb(qb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:Qb(Jb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ce);let le;t[46]!==K||t[47]!==Y||t[48]!==re||t[49]!==se||t[50]!==ce?(le=(0,Z.jsxs)(`g`,{ref:p,children:[K,Y,re,se,ce]}),t[46]=K,t[47]=Y,t[48]=re,t[49]=se,t[50]=ce,t[51]=le):le=t[51];let ue;t[52]!==B||t[53]!==H||t[54]!==le?(ue=(0,Z.jsxs)(`g`,{className:H,children:[U,le]},B),t[52]=B,t[53]=H,t[54]=le,t[55]=ue):ue=t[55];let de;t[56]===T?de=t[57]:(de=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]=de);let fe;t[58]!==v||t[59]!==x?(fe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(rx)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=fe):fe=t[60];let pe;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==ue||t[65]!==de||t[66]!==fe?(pe=(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:ix,children:[ue,de,fe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=ue,t[65]=de,t[66]=fe,t[67]=pe):pe=t[67];let me;return t[68]!==R||t[69]!==pe?(me=(0,Z.jsx)(`span`,{ref:d,className:R,children:pe}),t[68]=R,t[69]=pe,t[70]=me):me=t[70],me}function rx(e){return(0,Z.jsx)(`circle`,{cx:$b+e.originDx,cy:ex+e.originDy,r:e.size,className:`ok-blob-firework`,style:tx(e)},e.id)}function ix(e){return e.preventDefault()}function ax(e){return e+1}function ox(e){return e+1}function sx(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(nx,{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 cx(){let e=(0,$.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Ms(`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 lx=`open-knowledge:create-top-level-file`;function ux(e={}){window.dispatchEvent(new CustomEvent(lx,{detail:e}))}function dx(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(lx,t),()=>window.removeEventListener(lx,t)}function fx(e){let t=(0,$.c)(33),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=ih(),c=Zo(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ms(`new-item`),t[3]=p):p=t[3];let m=p,h;t[4]===a?h=t[5]:(h=a({id:`FOGD7m`}),t[4]=a,t[5]=h);let g;t[6]===a?g=t[7]:(g=a({id:`LMbgDK`}),t[6]=a,t[7]=g);let _;t[8]!==n||t[9]!==h||t[10]!==g?(_=(0,Z.jsx)(sx,{title:h,subtitle:g,celebrateSignal:n}),t[8]=n,t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(hx,{shortcutLabel:m,onClick:mx}),t[12]=v):v=t[12];let y;t[13]!==u||t[14]!==f||t[15]!==d?(y=d||f||u.length>0?(0,Z.jsx)(gx,{templates:u,loading:d,error:f,onSelect:px}):null,t[13]=u,t[14]=f,t[15]=d,t[16]=y):y=t[16];let b;t[17]===o?b=t[18]:(b=o?null:(0,Z.jsx)(vx,{}),t[17]=o,t[18]=b);let x,S;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(ge,{"aria-hidden":`true`,className:`size-3`}),x=(0,Z.jsx)(s,{id:`IajAbS`}),t[19]=x,t[20]=S):(x=t[19],S=t[20]);let C;t[21]===r?C=t[22]:(C=(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:[S,x]}),t[21]=r,t[22]=C);let w;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(cx,{}),t[23]=w):w=t[23];let T;t[24]===C?T=t[25]:(T=(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[C,w]}),t[24]=C,t[25]=T);let E;t[26]!==T||t[27]!==y||t[28]!==b?(E=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,y,b,T]}),t[26]=T,t[27]=y,t[28]=b,t[29]=E):E=t[29];let D;return t[30]!==E||t[31]!==_?(D=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[_,E]}),t[30]=E,t[31]=_,t[32]=D):D=t[32],D}function px(e,t){return ux({template:{folder:e,name:t}})}function mx(){return ux({initialDir:``})}function hx(e){let t=(0,$.c)(7),{shortcutLabel:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Xc,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i,(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:(0,Z.jsx)(s,{id:`HdkSiO`})})]}),t[1]=a):a=t[1];let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(D,{children:n}),t[2]=n,t[3]=o);let c;return t[4]!==r||t[5]!==o?(c=(0,Z.jsxs)(Qi,{type:`button`,variant:`ghost`,onClick:r,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-xl border border-border/60 bg-card p-4 text-left transition-colors hover:bg-muted/50 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,children:[a,o]}),t[4]=r,t[5]=o,t[6]=c):c=t[6],c}function gx(e){let t=(0,$.c)(25),{templates:n,loading:r,error:a,onSelect:o}=e,{_:c}=i(),l;t[0]===c?l=t[1]:(l=c({id:`_8quCH`}),t[0]=c,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`_8quCH`})}),t[2]=u):u=t[2];let d;t[3]!==c||t[4]!==a||t[5]!==r||t[6]!==n?(d=r||a?null:(0,Z.jsx)(q,{className:`text-2xs`,variant:`gray`,"aria-label":c({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=c,t[4]=a,t[5]=r,t[6]=n,t[7]=d):d=t[7];let f;t[8]===d?f=t[9]:(f=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[u,d]}),t[8]=d,t[9]=f);let p;t[10]===c?p=t[11]:(p=c({id:`irFGwu`}),t[10]=c,t[11]=p);let m;t[12]!==a||t[13]!==r||t[14]!==o||t[15]!==n?(m=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Hl89Qd`})}):a?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(s,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(_x,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>o(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=a,t[13]=r,t[14]=o,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==r||t[18]!==p||t[19]!==m?(h=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":p,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:m})}),t[17]=r,t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==l||t[22]!==f||t[23]!==h?(g=(0,Z.jsxs)(`section`,{"aria-label":l,className:`flex w-full flex-col gap-3`,children:[f,h]}),t[21]=l,t[22]=f,t[23]=h,t[24]=g):g=t[24],g}function _x(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:a}=e,{_:o}=i(),s;t[0]!==n.name||t[1]!==n.title?(s=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=s):s=t[2];let c=s,l=`${n.name}.md`,u=n.source_folder===``,d;t[3]!==o||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==r?(d=o(u?{id:`89TtiD`,values:{displayTitle:c,fileName:l}}:{id:`0_J12R`,values:{displayTitle:c,fileName:l,targetLabel:r}}),t[3]=o,t[4]=c,t[5]=l,t[6]=u,t[7]=r,t[8]=d):d=t[8];let f=d,p;t[9]===c?p=t[10]:(p=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:c}),t[9]=c,t[10]=p);let m;t[11]===l?m=t[12]:(m=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g=`shrink-0 font-mono text-1sm ${u?`text-muted-foreground/70`:`text-muted-foreground`}`,_;t[16]!==g||t[17]!==r?(_=(0,Z.jsx)(`span`,{className:g,children:r}),t[16]=g,t[17]=r,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==a||t[21]!==h||t[22]!==_?(v=(0,Z.jsxs)(Qi,{type:`button`,variant:`ghost`,onClick:a,"aria-label":f,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[h,_]}),t[19]=f,t[20]=a,t[21]=h,t[22]=_,t[23]=v):v=t[23],v}function vx(){let e=(0,$.c)(6),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`27ANM6`}),e[0]=t,e[1]=n);let r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`header`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`27ANM6`})}),a=(0,Z.jsx)(jb,{}),e[2]=r,e[3]=a):(r=e[2],a=e[3]);let o;return e[4]===n?o=e[5]:(o=(0,Z.jsxs)(`section`,{"aria-label":n,className:`flex w-full flex-col gap-3`,children:[r,a]}),e[4]=n,e[5]=o),o}function yx(){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(Cx);if(e)return;let r=t.ok?vi.safeParse(n):null;r?.success?(o(wx(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=ni(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(Sx),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(xx);if(!e.ok)return;let n=vi.safeParse(t);n.success&&o(wx(n.data.documents))}).catch(bx)},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)(Tx,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(fx,{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)($m,{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 bx(){}function xx(){return null}function Sx(e){return e+1}function Cx(){return null}function wx(e){return Bi(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function Tx(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)(sx,{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)(Km,{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:Ex,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 Ex(){return ux()}function Dx(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function Ox(e){let t=(0,$.c)(70),{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)(Ax,{}),(0,Z.jsx)(Sa,{className:`h-7 w-full`}),(0,Z.jsx)(Sa,{className:`h-7 w-full`}),(0,Z.jsx)(Sa,{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.frontmatterLocal?m=t[4]:(m=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=m);let h=m,g;t[5]===r.data.folder.path?g=t[6]:(g=Dx(r.data.folder.path),t[5]=r.data.folder.path,t[6]=g);let _=g,v;t[7]===h?v=t[8]:(v=Object.keys(h),t[7]=h,t[8]=v);let y=v,b;t[9]!==o||t[10]!==n||t[11]!==a?(b=async function(e,t){let r=await Va(n,{[e]:t});if(!r.ok){let{error:e}=r;gs.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},t[9]=o,t[10]=n,t[11]=a,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==n||t[15]!==a?(S=async function(e){let t=await Va(n,{[e]:null});if(!t.ok){let{error:e}=t;gs.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},t[13]=o,t[14]=n,t[15]=a,t[16]=S):S=t[16];let C=S,w;t[17]!==x||t[18]!==h?(w=function(e,t){let n=h[e];x(e,za(n,t))},t[17]=x,t[18]=h,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[20]=E):E=t[20];let D=E,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Na[e];return{...t,type:e,value:n,error:null}})},t[21]=O):O=t[21];let k=O,A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){d(t=>t&&{...t,value:e})},t[22]=A):A=t[22];let j=A,M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){d(t=>t&&{...t,name:e,error:null})},t[23]=M):M=t[23];let N=M,P;t[24]!==o||t[25]!==u||t[26]!==n||t[27]!==a||t[28]!==h?(P=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(In(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 Va(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[24]=o,t[25]=u,t[26]=n,t[27]=a,t[28]=h,t[29]=P):P=t[29];let F=P,I;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){p({key:e,draft:e,error:null})},t[30]=I):I=t[30];let L=I,R;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(t=>t&&{...t,draft:e,error:null})},t[31]=R):R=t[31];let z=R,B;t[32]!==o||t[33]!==n||t[34]!==a||t[35]!==h||t[36]!==f?(B=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}let t=h[f.key],r=await Va(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},t[32]=o,t[33]=n,t[34]=a,t[35]=h,t[36]=f,t[37]=B):B=t[37];let V=B,H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(){p(null)},t[38]=H):H=t[38];let U=H,W=!c,G;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>l(!e),t[39]=G):G=t[39];let K=`size-3 transition-transform ${c?``:`rotate-90`}`,q;t[40]===K?q=t[41]:(q=(0,Z.jsx)(_s,{className:K,"aria-hidden":!0}),t[40]=K,t[41]=q);let J;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=J):J=t[42];let Y;t[43]===q?Y=t[44]:(Y=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[q,J]}),t[43]=q,t[44]=Y);let ee;t[45]===_?ee=t[46]:(ee=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:kx,children:_}),t[45]=_,t[46]=ee);let te;t[47]!==Y||t[48]!==ee?(te=(0,Z.jsxs)(bs,{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:[Y,ee]}),t[47]=Y,t[48]=ee,t[49]=te):te=t[49];let ne;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`e6pmcJ`})}),t[50]=ne):ne=t[50];let re;t[51]!==u||t[52]!==x||t[53]!==V||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(re=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`})}):y.map(e=>{let t=h[e];return(0,Z.jsx)(qa,{keyName:e,value:t,declared:Za(t,Hi(t)),rename:{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:z,onCommit:V,onCancel:U},badge:null,onCommit:t=>void x(e,t),onChangeType:t=>T(e,t),onRemove:()=>void C(e)},e)}),t[51]=u,t[52]=x,t[53]=V,t[54]=y,t[55]=h,t[56]=C,t[57]=f,t[58]=T,t[59]=re):re=t[59];let ie;t[60]!==u||t[61]!==F?(ie=u?(0,Z.jsx)(Ua,{draft:u,onChangeName:N,onChangeType:k,onChangeValue:j,onCommit:()=>void F(),onCancel:()=>d(null)}):(0,Z.jsx)(`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:()=>D(),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)(ge,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=F,t[62]=ie):ie=t[62];let ae;t[63]!==re||t[64]!==ie?(ae=(0,Z.jsx)(ys,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[ne,re,ie]})}),t[63]=re,t[64]=ie,t[65]=ae):ae=t[65];let oe;return t[66]!==W||t[67]!==te||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(xs,{open:W,onOpenChange:G,children:[te,ae]})}),t[66]=W,t[67]=te,t[68]=ae,t[69]=oe):oe=t[69],oe}function kx(e){return e.stopPropagation()}function Ax(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)($c,{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 jx(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function Mx(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=jx(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function Nx(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Px(e,t){let n=e===``?``:`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:Mx(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:Nx(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:Mx(e,t.pageTitles),children:a}}function Fx(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)(Sa,{className:`h-12 w-full`}),(0,Z.jsx)(Sa,{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)(q,{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)(ge,{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)(Ca,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Da,{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)(Ga,{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)(Oo,{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(Ix)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Eo,{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)(km,{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 Ix(e){return e.name}function Lx(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=Gi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Gi(`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 Rx(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=Gi(`[&_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 zx(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=Gi(`[&_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 Bx(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=Gi(`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 Vx(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=Gi(`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 Hx(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=Gi(`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 Ux(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return lr._({id:`xOTzt5`});if(r<60)return lr._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return lr._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?lr._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Wx(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 Gx(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)(qt,{className:`ml-1 size-3`}):(0,Z.jsx)(oe,{className:`ml-1 size-3`}):(0,Z.jsx)(jc,{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 Kx(e){let t=(0,$.c)(92),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=ki(),d=eo(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)(Sa,{className:`size-5 rounded`}),(0,Z.jsx)(Sa,{className:`h-7 w-48`})]}),(0,Z.jsx)(Sa,{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)(Sa,{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)(Sa,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Yx)]})]}),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=Px(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=Wx(e.children,g,v),o=e.title||(n===``?r({id:`3aeN7X`}):e.title),m;t[28]===g?m=t[29]:(m=function(e){e===g?y(Jx):(_(e),y(`asc`))},t[28]=g,t[29]=m);let A=m;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 j;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(yt,{className:`size-5 text-muted-foreground`}),t[30]=j):j=t[30];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:o})]}),N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(Qi,{onClick:()=>h(!0),children:[(0,Z.jsx)(ge,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[31]=N):N=t[31],t[32]===M?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:[M,N]})}),t[32]=M,t[33]=E),t[34]!==f||t[35]!==n||t[36]!==p?(D=(0,Z.jsx)(Ox,{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)(Fx,{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=Lx;let P=g===`name`?v===`asc`?`ascending`:`descending`:`none`,F;t[43]===r?F=t[44]:(F=r({id:`6YtxFj`}),t[43]=r,t[44]=F);let I;t[45]!==A||t[46]!==v||t[47]!==g||t[48]!==F?(I=(0,Z.jsx)(Gx,{label:F,sortKey:`name`,activeKey:g,activeDir:v,onSort:A}),t[45]=A,t[46]=v,t[47]=g,t[48]=F,t[49]=I):I=t[49];let L;t[50]!==P||t[51]!==I?(L=(0,Z.jsx)(Vx,{"aria-sort":P,children:I}),t[50]=P,t[51]=I,t[52]=L):L=t[52];let R=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,z;t[53]===r?z=t[54]:(z=r({id:`tgWuMB`}),t[53]=r,t[54]=z);let B;t[55]!==A||t[56]!==v||t[57]!==g||t[58]!==z?(B=(0,Z.jsx)(Gx,{label:z,sortKey:`modified`,activeKey:g,activeDir:v,onSort:A}),t[55]=A,t[56]=v,t[57]=g,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==R||t[61]!==B?(V=(0,Z.jsx)(Vx,{className:`w-32`,"aria-sort":R,children:B}),t[60]=R,t[61]=B,t[62]=V):V=t[62],t[63]!==L||t[64]!==V?(C=(0,Z.jsx)(Rx,{children:(0,Z.jsxs)(Bx,{children:[L,V]})}),t[63]=L,t[64]=V,t[65]=C):C=t[65],b=zx,S=i.length?i.map(qx):(0,Z.jsx)(Bx,{children:(0,Z.jsx)(Hx,{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)(km,{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 qx(e){return(0,Z.jsxs)(Bx,{children:[(0,Z.jsx)(Hx,{children:(0,Z.jsxs)(`a`,{href:gr(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)(tl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Mt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(Hx,{className:`text-muted-foreground`,children:e.kind===`file`?Ux(e.modified):`—`})]},e.path)}function Jx(e){return e===`asc`?`desc`:`asc`}function Yx(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)(Sa,{className:`size-4 rounded`}),(0,Z.jsx)(Sa,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Sa,{className:`h-4 w-16`})})]},e)}function Xx(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)(Yc,{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=Nn(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Nn(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)(sa,{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 Zx(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(Qx),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 Qx(){return new Set}var $x=(0,Q.createContext)(null);function eS(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(tS),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)($x,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function tS(){return new Map}function nS(){let e=(0,Q.use)($x);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function rS(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var iS=rS(()=>n(()=>import(`./SettingsDialogBody-D3PLgmQr.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,46]),import.meta.url));function aS(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:oS,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 oS(){return window.location.reload()}function sS(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(W,{fallbackRender:lS,onError:cS,children:n}),t[0]=n,t[1]=r),r}function cS(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function lS(e){return(0,Z.jsx)(aS,{...e})}function uS(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function dS(e){let t=(0,$.c)(81),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=pt(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=gt(),{desktopPresent:f}=Ta(),[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)(cs,{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)(os,{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)(fS,{groups:H,activeId:p,onSelect:m}),t[65]=p,t[66]=H,t[67]=G):G=t[67];let K;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(hS,{}),t[68]=K):K=t[68];let q=l?c:null,J;t[69]!==p||t[70]!==u||t[71]!==d||t[72]!==q?(J=(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)(sS,{children:(0,Z.jsx)(Q.Suspense,{fallback:K,children:(0,Z.jsx)(iS,{activeId:p,userBinding:q,okignoreBinding:u,okignoreSynced:d})})})}),t[69]=p,t[70]=u,t[71]=d,t[72]=q,t[73]=J):J=t[73];let Y;t[74]!==G||t[75]!==J?(Y=(0,Z.jsxs)(ls,{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,J]}),t[74]=G,t[75]=J,t[76]=Y):Y=t[76];let ee;return t[77]!==r||t[78]!==n||t[79]!==Y?(ee=(0,Z.jsx)(ps,{open:n,onOpenChange:r,children:Y}),t[77]=r,t[78]=n,t[79]=Y,t[80]=ee):ee=t[80],ee}function fS(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)(mS,{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)(pS,{}),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 pS(){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=uS(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:Gi(`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)(ns,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function mS(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=Gi(`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:Gi(`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 hS(){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)(Sa,{className:`h-5 w-32`}),r=(0,Z.jsx)(Sa,{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)(Sa,{className:`h-9 w-full`}),(0,Z.jsx)(Sa,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function gS(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=Gi(`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)(nb,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _S(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)(ab,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function vS(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=Gi(`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)(lb,{"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 yS(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=Gi(`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 bS=ea(`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 xS(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=Gi(bS({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:SS,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function SS(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ea(`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 CS(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=Gi(`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 wS(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=Gi(`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)(vs,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TS(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)(wS,{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)(Lc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(is,{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)(nr,{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)(Yn,{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)(Ul,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(is,{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)(nr,{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)(Yn,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(xS,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=K):K=t[48];let q;t[49]!==K||t[50]!==F?(q=(0,Z.jsxs)(yS,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,K]}),t[49]=K,t[50]=F,t[51]=q):q=t[51];let J;t[52]===E?J=t[53]:(J=(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]=J);let Y;t[54]===S?Y=t[55]:(Y=S({id:`oqB2ez`}),t[54]=S,t[55]=Y);let ee=!w,te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ee,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=te):te=t[56];let ne;t[57]!==v||t[58]!==Y||t[59]!==ee?(ne=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Y,disabled:ee,onClick:v,children:te})}),t[57]=v,t[58]=Y,t[59]=ee,t[60]=ne):ne=t[60];let re;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(nr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=re):re=t[61];let ie;t[62]===ne?ie=t[63]:(ie=(0,Z.jsxs)(Yn,{children:[ne,re]}),t[62]=ne,t[63]=ie);let ae;t[64]===S?ae=t[65]:(ae=S({id:`SiUUCS`}),t[64]=S,t[65]=ae);let oe=!w,se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Ut,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=se):se=t[66];let ce;t[67]!==_||t[68]!==ae||t[69]!==oe?(ce=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ae,disabled:oe,onClick:_,children:se})}),t[67]=_,t[68]=ae,t[69]=oe,t[70]=ce):ce=t[70];let le;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(nr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=le):le=t[71];let ue;t[72]===ce?ue=t[73]:(ue=(0,Z.jsxs)(Yn,{children:[ce,le]}),t[72]=ce,t[73]=ue);let de=o?`secondary`:`ghost`,fe;t[74]!==S||t[75]!==o?(fe=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=fe):fe=t[76];let pe=o?`ok-replace-input`:void 0,me;t[77]!==m||t[78]!==o?(me=()=>m(!o),t[77]=m,t[78]=o,t[79]=me):me=t[79];let he;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(Tl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=he):he=t[80];let ge;t[81]!==o||t[82]!==de||t[83]!==fe||t[84]!==pe||t[85]!==me?(ge=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{type:`button`,variant:de,size:`icon-sm`,"aria-label":fe,"aria-expanded":o,"aria-controls":pe,onClick:me,children:he})}),t[81]=o,t[82]=de,t[83]=fe,t[84]=pe,t[85]=me,t[86]=ge):ge=t[86];let _e;t[87]===o?_e=t[88]:(_e=(0,Z.jsx)(nr,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=_e);let ve;t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsxs)(Yn,{children:[ge,_e]}),t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(ye=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)(vs,{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)(Yn,{children:[(0,Z.jsx)(Tr,{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)(Tl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(nr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Tr,{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)(wl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(nr,{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]=ye):ye=t[100];let be;t[101]===S?be=t[102]:(be=S({id:`wJo9oS`}),t[101]=S,t[102]=be);let xe;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(ss,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=xe):xe=t[103];let Se;t[104]!==x||t[105]!==be?(Se=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":be,onClick:x,children:xe})}),t[104]=x,t[105]=be,t[106]=Se):Se=t[106];let Ce;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(nr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Ce):Ce=t[107];let we;t[108]===Se?we=t[109]:(we=(0,Z.jsxs)(Yn,{children:[Se,Ce]}),t[108]=Se,t[109]=we);let Te;return t[110]!==q||t[111]!==J||t[112]!==ie||t[113]!==ue||t[114]!==j||t[115]!==ve||t[116]!==ye||t[117]!==we?(Te=(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,q,J,ie,ue,ve,ye,we]}),t[110]=q,t[111]=J,t[112]=ie,t[113]=ue,t[114]=j,t[115]=ve,t[116]=ye,t[117]=we,t[118]=Te):Te=t[118],Te}var ES={current:0,total:0},DS=120,OS=100;function kS(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?en(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(he,n,AS)}function AS(){return null}function jS(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 N_(e,t){return`${e}\u0000${t}`}function P_(e,t,n){let r=Mr(e).body,i=Mr(t).body;return r===i?``:j_(n,r,i,``,``,{context:3})}function F_(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=pt(),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=N_(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=P_(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 I_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-DgtknSgX.js`),__vite__mapDeps([18,1,6,19]),import.meta.url)).ActivityPanelDiffView}));function L_(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return lr._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return lr._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return lr._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return lr._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?lr._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function R_(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 B_(e){return e.type===`upstream`?lr._({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`?lr._({id:`B2DrPb`}):e.author}function V_(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)(ra,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(la,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ta,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(oa,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(ma,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(fa,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(ua,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function H_(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)(Ae,{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=wi(i),t[1]=i,t[2]=a);let o=a,s=r?Si[o]??Ni[o]:Ni[o],c;t[3]!==s||t[4]!==i?(c=s??pr(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)(V_,{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)(rl,{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)(Ac,{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)(Hl,{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)(ua,{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)(Ac,{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)(Hl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function U_(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(W_),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(Ut,{className:`size-3`}):(0,Z.jsx)(_s,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?lr._({id:`OKQe56`,values:{entryCount:p}}):lr._({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)(nv,{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 W_(e){return!e}function G_(e){return e.checkpoint?e.checkpoint.kind:`save`}function K_(e){let t=G_(e);if(t===`save`)return lr._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${q_(n)})`:``;return t===`bridge-merge-loss`?lr._({id:`uZAG7T`,values:{sizeSuffix:r}}):lr._({id:`_4rAQI`,values:{sizeSuffix:r}})}function q_(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function J_(e){return e.type===`checkpoint`?G_(e)===`save`?`version`:`auto-save`:`wip`}function Y_(e){let t=J_(e);return t===`version`?lr._({id:`RFQ1Yx`}):t===`auto-save`?lr._({id:`9Uv1CD`}):lr._({id:`Yea-K5`})}function X_(e){let t=J_(e);return t===`version`?lr._({id:`gg3Rpy`}):t===`auto-save`?lr._({id:`PXXeW8`}):lr._({id:`Pyp1NA`})}function Z_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Q_(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(ev),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($_)},children:[r?(0,Z.jsx)(Ut,{className:`size-3`}):(0,Z.jsx)(_s,{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 $_(e){return!e}function ev(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 tv(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=F_(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)(wt,{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)(wt,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(I_,{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 nv(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=L_(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=B_(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=R_(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(rv),w;t[8]===n?w=t[9]:(w=Z_(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 F=P,I;t[15]===D?I=t[16]:(I=function(){A.current?.abort(),A.current=null,k(!1),D(!1)},t[15]=D,t[16]=I);let L=I,R;t[17]!==m||t[18]!==l||t[19]!==n.sha||t[20]!==f||t[21]!==D?(R=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}),gs.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=$r.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}),gs.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]=R):R=t[22];let z=R,B;t[23]!==n||t[24]!==a||t[25]!==p?(B=p?(()=>{let e=G_(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Di,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(Jc,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(Gc,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(H_,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=B):B=t[26];let V=B,H=u?j:void 0,U=u?`bg-muted`:`hover:bg-muted/80`,W;t[27]===U?W=t[28]:(W=[`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`,U],t[27]=U,t[28]=W);let G=W.join(` `),K;t[29]===F?K=t[30]:(K=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),F())},t[29]=F,t[30]=K);let q;t[31]===V?q=t[32]:(q=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:V}),t[31]=V,t[32]=q);let J;t[33]!==v||t[34]!==n||t[35]!==p?(J=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:K_(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]=J):J=t[36];let Y;t[37]!==n.timestamp||t[38]!==g?(Y=(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]=Y):Y=t[39];let ee;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=ee):ee=t[40];let te;t[41]===n?te=t[42]:(te=Y_(n),t[41]=n,t[42]=te);let ne;t[43]===D?ne=t[44]:(ne=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=ne);let re;t[45]===O?re=t[46]:(re=O?(0,Z.jsx)(wt,{className:`size-3 animate-spin`}):(0,Z.jsx)(ia,{className:`size-3`}),t[45]=O,t[46]=re);let ie;t[47]!==O||t[48]!==te||t[49]!==ne||t[50]!==re?(ie=(0,Z.jsx)(Tr,{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":te,disabled:O,onClick:ne,children:re})}),t[47]=O,t[48]=te,t[49]=ne,t[50]=re,t[51]=ie):ie=t[51];let ae;t[52]===n?ae=t[53]:(ae=Y_(n),t[52]=n,t[53]=ae);let oe;t[54]===ae?oe=t[55]:(oe=(0,Z.jsx)(nr,{side:`top`,children:ae}),t[54]=ae,t[55]=oe);let se;t[56]!==ie||t[57]!==oe?(se=(0,Z.jsxs)(Yn,{children:[ie,oe]}),t[56]=ie,t[57]=oe,t[58]=se):se=t[58];let ce;t[59]!==J||t[60]!==Y||t[61]!==se?(ce=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[J,Y,ee,se]}),t[59]=J,t[60]=Y,t[61]=se,t[62]=ce):ce=t[62];let le;t[63]===T?le=t[64]:(le=T.length>0&&(0,Z.jsx)(Q_,{summaries:T}),t[63]=T,t[64]=le);let ue=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}),de;t[65]!==ce||t[66]!==le||t[67]!==ue?(de=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ce,le,ue]}),t[65]=ce,t[66]=le,t[67]=ue,t[68]=de):de=t[68];let fe;t[69]!==u||t[70]!==F||t[71]!==H||t[72]!==G||t[73]!==K||t[74]!==q||t[75]!==de?(fe=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":H,"data-testid":`timeline-entry-expand`,className:G,onClick:F,onKeyDown:K,children:[q,de]}),t[69]=u,t[70]=F,t[71]=H,t[72]=G,t[73]=K,t[74]=q,t[75]=de,t[76]=fe):fe=t[76];let pe;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(pe=u&&(0,Z.jsx)(tv,{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]=pe):pe=t[83];let me;t[84]!==fe||t[85]!==pe?(me=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[fe,pe]}),t[84]=fe,t[85]=pe,t[86]=me):me=t[86];let he;t[87]!==L||t[88]!==D?(he=e=>{e?D(!0):L()},t[87]=L,t[88]=D,t[89]=he):he=t[89];let ge;t[90]===n?ge=t[91]:(ge=X_(n),t[90]=n,t[91]=ge);let _e;t[92]===ge?_e=t[93]:(_e=(0,Z.jsx)(cs,{children:ge}),t[92]=ge,t[93]=_e);let ve;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(ve={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=ve):ve=t[98];let ye;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(ye={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=ye):ye=t[99];let be;t[100]===ve?be=t[101]:(be=(0,Z.jsx)(os,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:ve,components:ye})}),t[100]=ve,t[101]=be);let xe;t[102]!==_e||t[103]!==be?(xe=(0,Z.jsxs)(fs,{children:[_e,be]}),t[102]=_e,t[103]=be,t[104]=xe):xe=t[104];let Se;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=Se):Se=t[105];let Ce;t[106]===L?Ce=t[107]:(Ce=(0,Z.jsx)(Qi,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:L,children:Se}),t[106]=L,t[107]=Ce);let we;t[108]===z?we=t[109]:(we=()=>z(),t[108]=z,t[109]=we);let Te;t[110]===O?Te=t[111]:(Te=O?(0,Z.jsx)(wt,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=Te);let Ee;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=Ee):Ee=t[112];let De;t[113]!==O||t[114]!==we||t[115]!==Te?(De=(0,Z.jsxs)(Qi,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:we,children:[Te,Ee]}),t[113]=O,t[114]=we,t[115]=Te,t[116]=De):De=t[116];let Oe;t[117]!==Ce||t[118]!==De?(Oe=(0,Z.jsxs)(ds,{children:[Ce,De]}),t[117]=Ce,t[118]=De,t[119]=Oe):Oe=t[119];let ke;t[120]!==xe||t[121]!==Oe?(ke=(0,Z.jsxs)(ls,{children:[xe,Oe]}),t[120]=xe,t[121]=Oe,t[122]=ke):ke=t[122];let Ae;t[123]!==E||t[124]!==he||t[125]!==ke?(Ae=(0,Z.jsx)(ps,{open:E,onOpenChange:he,children:ke}),t[123]=E,t[124]=he,t[125]=ke,t[126]=Ae):Ae=t[126];let je;return t[127]!==me||t[128]!==Ae?(je=(0,Z.jsxs)(Z.Fragment,{children:[me,Ae]}),t[127]=me,t[128]=Ae,t[129]=je):je=t[129],je}function rv(e){return e.docs}function iv(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=Wr(),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)(cv),[x,S]=(0,Q.useState)(sv),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,F,I,L,R;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(ov),t[31]=p,t[32]=f);let m=!f,g=!h&&!_&&p.length>0;F=`flex h-full flex-col`;let v;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Tn,{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)(Yn,{children:[(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsxs)(as,{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)(rs,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(El,{className:`size-3.5`})}),(0,Z.jsx)(rs,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(Vc,{className:`size-3.5`})})]})}),(0,Z.jsx)(nr,{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)(wt,{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)(Tr,{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)(nr,{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)(Yn,{children:[w,T]}),t[50]=w,t[51]=T,t[52]=D):D=t[52],t[53]!==y||t[54]!==D?(I=(0,Z.jsxs)(Sn,{children:[v,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,D]})]}),t[53]=y,t[54]=D,t[55]=I):I=t[55],L=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[56]!==l||t[57]!==h?(R=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(av)}),t[56]=l,t[57]=h,t[58]=R):R=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)(nv,{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)(nv,{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)(U_,{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]=F,t[28]=I,t[29]=L,t[30]=R}else j=t[23],M=t[24],N=t[25],P=t[26],F=t[27],I=t[28],L=t[29],R=t[30];let z;t[76]!==j||t[77]!==M||t[78]!==N||t[79]!==P||t[80]!==L||t[81]!==R?(z=(0,Z.jsxs)(`div`,{className:L,children:[R,j,M,N,P]}),t[76]=j,t[77]=M,t[78]=N,t[79]=P,t[80]=L,t[81]=R,t[82]=z):z=t[82];let B;return t[83]!==F||t[84]!==I||t[85]!==z?(B=(0,Z.jsxs)(`div`,{className:F,children:[I,z]}),t[83]=F,t[84]=I,t[85]=z,t[86]=B):B=t[86],B}function av(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Sa,{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)(Sa,{className:`h-3 w-28`}),(0,Z.jsx)(Sa,{className:`h-3 w-40`})]})]},e)}function ov(e){return e.type===`checkpoint`}function sv(){return new Set}function cv(){return new aa(32)}var lv=[{id:`outline`,icon:ul},{id:`links`,icon:we},{id:`graph`,icon:pl},{id:`timeline`,icon:Bc}];function uv(e){return e===`outline`?lr._({id:`dD7NPy`}):e===`links`?lr._({id:`Rj01Fz`}):e===`graph`?lr._({id:`x2fr_j`}):lr._({id:`cklVjM`})}function dv(){return n(()=>import(`./GraphPanel-DyvuLzi4.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 fv=(0,Q.lazy)(async()=>({default:(await dv()).GraphPanel})),pv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DqtdV56a.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 mv(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)(as,{type:`single`,variant:`outline`,value:a,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:lv.map(hv)})}):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)(ac,{docName:n,isSourceMode:r}),a===`links`&&(0,Z.jsx)(a_,{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)(fv,{activeDocName:n})}),a===`timeline`&&(0,Z.jsx)(iv,{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)(pv,{})})}),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 hv(e){let{id:t,icon:n}=e,r=uv(t);return(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(rs,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(Tr,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(nr,{side:`bottom`,children:r})]},t)}function gv(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function _v(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function vv(e){return e/100*window.innerHeight}function yv(e){return e/100*window.innerWidth}function bv(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 xv({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=bv(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=_v(t,i);break;case`em`:r=gv(t,i);break;case`vh`:r=vv(i);break;case`vw`:r=yv(i);break}return r}function Sv(e){return parseFloat(e.toFixed(3))}function Cv({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 wv(e){let{panels:t}=e,n=Cv({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=Sv(xv({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Sv(xv({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Sv(xv({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Sv(xv({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 Tv(e,t=`Assertion error`){if(!e)throw Error(t)}function Ev(e,t){return Array.from(t).sort(e===`horizontal`?Dv:Ov)}function Dv(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Ov(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function kv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Av(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 jv({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}=Av(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Tv(i,`No rect found`),i}var Mv;function Nv(){return Mv===void 0&&(Mv=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Mv}function Pv(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Ev(n,Array.from(t.children).filter(kv).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,jv({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=Nv()?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:Cv({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 Fv=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)}}},Iv=new Map,Lv=new Fv;function Rv(e){Iv=new Map(Iv),Iv.delete(e)}function zv(e,t){for(let[t]of Iv)if(t.id===e)return t}function Bv(e,t){for(let[t,n]of Iv)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Vv(){return Iv}function Hv(e,t){return Lv.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Uv(e,t){let n=Iv.get(e);Iv=new Map(Iv),Iv.set(e,t),Lv.emit(`groupChange`,{group:e,prev:n,next:t})}function Wv(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Av(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 Gv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Kv(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Qv(e),b:Qv(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Tv(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Zv(Xv(n.a)),b:Zv(Xv(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 qv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Jv(e){let t=getComputedStyle($v(e)??e).display;return t===`flex`||t===`inline-flex`}function Yv(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Jv(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`||qv.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Xv(e){let t=e.length;for(;t--;){let n=e[t];if(Tv(n,`Missing node`),Yv(n))return n}return null}function Zv(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Qv(e){let t=[];for(;e;)t.push(e),e=$v(e);return t}function $v(e){let{parentNode:t}=e;return Gv(t)?t.host:t}function ey(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 ty({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!kv(n)||n.contains(e)||e.contains(n))return!0;if(Kv(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ey(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function ny(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Pv(r),a=Wv(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&ty({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function ry(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 iy(e,t,n=0){return Math.abs(Sv(e)-Sv(t))<=n}function ay(e,t){return iy(e,t)?0:e>t?1:-1}function oy({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(ay(r,c)<0)if(a){let e=(i+c)/2;r=ay(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Sv(r),r}function sy({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(iy(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Tv(u!=null,`Invalid first pivot index`),Tv(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Tv(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(Tv(n!=null,`Previous layout not found for panel index ${t}`),iy(n,i)){let t=o-n;ay(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Tv(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(Tv(n!=null,`Previous layout not found for panel index ${t}`),iy(n,o)){let t=n-i;ay(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Tv(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&ay(i,c)<0)if(e>0){let t=c-o,n=t/2;ay(i+e,c)<0&&(e=ay(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;ay(i-e,c)<0&&(e=ay(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];Tv(e!=null,`Previous layout not found for panel index ${r}`);let a=oy({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];Tv(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=oy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!iy(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(ry(c,l))return i;{let t=e<0?d:u,r=s[t];Tv(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=oy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!iy(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Tv(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=oy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(iy(i,s)||(t-=s-i,l[r]=s),iy(t,0))break;e>0?r--:r++}}}if(!iy(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 cy(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||ay(e[n],t[n])!==0)return!1;return!0}function ly({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(!iy(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Tv(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];Tv(i!=null,`No layout data found for index ${e}`);let o=r[e];Tv(o!=null,`No layout data found for index ${e}`);let s=oy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!iy(a,0))for(let e=0;e<t.length;e++){let n=r[e];Tv(n!=null,`No layout data found for index ${e}`);let i=n+a,o=oy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,iy(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function uy({groupId:e,panelId:t}){let n=()=>{let t=Vv();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=ly({layout:sy({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});cy(l,p)||Uv(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&&iy(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Cv({group:t});o(Sv(xv({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function dy(e){e.defaultPrevented||ny(e,Vv()).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=uy({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function fy(e){let t=Vv();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 py({groupId:e}){let t=()=>{let t=Vv();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=ly({layout:e,panelConstraints:r});return n?o:(cy(o,c)||Uv(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function my(e,t){let n=fy(e),r=Bv(n.id,!0),i=n.separators.find(t=>t.element===e);Tv(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Tv(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=py({groupId:n.id}).getLayout(),c=ly({layout:sy({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});cy(s,c)||Uv(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function hy(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=fy(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&my(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&my(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&my(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&my(t,-5);break;case`End`:e.preventDefault(),my(t,100);break;case`Enter`:{e.preventDefault();let n=fy(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Bv(n.id,!0),o=n.separators.find(e=>e.element===t);Tv(o,`Matching separator not found`);let s=a.get(o);Tv(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Tv(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];my(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=fy(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Tv(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(),my(t,-100);break}}var gy={cursorFlags:0,state:`inactive`},_y=new Fv;function vy(){return gy}function yy(e){return _y.addListener(`change`,e)}function by(e){let t=gy,n={...gy};n.cursorFlags=e,gy=n,_y.emit(`change`,{prev:t,next:n})}function xy(e){let t=gy;gy=e,_y.emit(`change`,{prev:t,next:e})}function Sy(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Vv(),n=ny(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)}),xy({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Cy=e=>e,wy=()=>{},Ty=1,Ey=2,Dy=4,Oy=8,ky=3,Ay=12,jy;function My(){return jy===void 0&&(jy=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(jy=!0)),jy}function Ny({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&&My()){let t=(e&Ty)!==0,n=(e&Ey)!==0,r=(e&Dy)!==0,i=(e&Oy)!==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 My()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Py=new WeakMap;function Fy(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Py.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=vy();switch(r.state){case`active`:case`hover`:{let e=Ny({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}Py.set(e,{prevStyle:t,styleSheet:n})}function Iy({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=sy({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(cy(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ty:Ey;break;case`vertical`:s|=d<0?Dy:Oy;break}}else Uv(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&ky:c|=s&ky,t.movementY===0?c|=o&Ay:c|=s&Ay,by(c),Fy(e)}function Ly(e){let t=Vv(),n=vy();switch(n.state){case`active`:Iy({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Ry(e){if(e.defaultPrevented)return;let t=vy(),n=Vv();switch(t.state){case`active`:if(e.buttons===0){xy({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Bv(e.group.id,!0);Uv(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)}Iy({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=ny(e,n);r.length===0?t.state!==`inactive`&&xy({cursorFlags:0,state:`inactive`}):xy({cursorFlags:0,hitRegions:r,state:`hover`}),Fy(e.currentTarget);break}}}function zy(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(vy().state){case`hover`:xy({cursorFlags:0,state:`inactive`})}}function By(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=vy();switch(t.state){case`active`:xy({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Fy(e.currentTarget),t.hitRegions.forEach(e=>{let t=Bv(e.group.id,!0);Uv(e.group,t)}),e.preventDefault())}}function Vy(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Sv(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Sv((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Hy(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Cv({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Sv(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Uy(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 Wy({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=Sv(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]=Sv((r[e]??0)/a*l);else{let e=Sv(l/c.length);for(let t of c)u[t]=e}return u}function Gy(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 Ky=new Map;function qy(e){let t=!0;Tv(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=Cv({group:e});if(t===0)return;let n=Bv(e.id);if(!n)return;let r=wv(e),i=n.defaultLayoutDeferred?Vy(r):n.layout,a=ly({layout:Wy({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&cy(n.layout,a)&&Uy(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Uv(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Hy(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Tv(!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=Cv({group:e}),s=wv(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Gy(e.panels,l)||(l=void 0));let u=ly({layout:e.mutableState.layouts[c]??l??Vy(s),panelConstraints:s}),d=e.element.ownerDocument;Ky.set(d,(Ky.get(d)??0)+1);let f=new Map;return Pv(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Uv(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Tv(!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`,hy)}),Ky.get(d)===1&&(d.addEventListener(`dblclick`,dy,!0),d.addEventListener(`pointerdown`,Sy,!0),d.addEventListener(`pointerleave`,Ly),d.addEventListener(`pointermove`,Ry),d.addEventListener(`pointerout`,zy),d.addEventListener(`pointerup`,By,!0)),function(){t=!1,Ky.set(d,Math.max(0,(Ky.get(d)??0)-1)),Rv(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,hy)}),Ky.get(d)||(d.removeEventListener(`dblclick`,dy,!0),d.removeEventListener(`pointerdown`,Sy,!0),d.removeEventListener(`pointerleave`,Ly),d.removeEventListener(`pointermove`,Ry),d.removeEventListener(`pointerout`,zy),d.removeEventListener(`pointerup`,By,!0)),a.disconnect()}}function Jy(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Yy(e){let t=(0,Q.useId)();return`${e??t}`}var Xy=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Zy(e){let t=(0,Q.useRef)(e);return Xy(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Qy(...e){return Zy(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function $y(e){let t=(0,Q.useRef)({...e});return Xy(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var eb=(0,Q.createContext)(null);function tb(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Cy});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Xy(()=>{Object.assign(n.current,py({groupId:e}))})}function nb({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=Zy(e=>{cy(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Zy(e=>{cy(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Yy(s),v=(0,Q.useRef)(null),[y,b]=Jy(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Qy(v,a);tb(_,o);let C=Zy((e,t)=>{let r=vy(),i=zv(e),a=Bv(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=$y({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=Ev(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Ev(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=Bv(_);r&&i&&Uv(r,{...i,derivedPanelConstraints:wv(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 Xy(()=>{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=qy(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Bv(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Hv(_,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=iy(t.collapsedSize,i[t.panelId]),a=iy(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=vy().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)(eb.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})})}nb.displayName=`Group`;function rb(){let e=(0,Q.useContext)(eb);return Tv(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function ib(e,t){let{id:n}=rb(),r=(0,Q.useRef)({collapse:wy,expand:wy,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:wy});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Xy(()=>{Object.assign(r.current,uy({groupId:n,panelId:e}))})}function ab({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=Yy(c),_=$y({disabled:a}),v=(0,Q.useRef)(null),y=Qy(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=rb(),T=d!==null,E=Zy((e,t,n)=>{d?.(e,c,n)});Xy(()=>{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]),ib(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Hv(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:{...ob,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})})}ab.displayName=`Panel`;var ob={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function sb(){return(0,Q.useRef)(null)}function cb({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=ly({layout:sy({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=ly({layout:sy({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function lb({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Yy(a),l=$y({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Qy(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=rb(),x=v===`horizontal`?`vertical`:`horizontal`;Xy(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=yy(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Hv(_,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(cb({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})}lb.displayName=`Separator`;var ub={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:`#`}}},db=Qt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),fb=ne({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function pb(e){switch(e.toLowerCase()){case`json`:return nc().language;case`toml`:return Qs.define(ub);default:return null}}function mb(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 hb(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}=Wr(),l=mb(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=pb(i),t=c===`dark`?db:fb,n=[mc,...e?[e]:[],Js.editable.of(!0),Rs.readOnly.of(!0),Js.lineWrapping,t],r=new Js({state:Rs.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 gb(e){return Ir(`/api/asset?path=${encodeURIComponent(e)}`)}function _b(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function vb(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=gb(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)(tt,{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=_b(n),t[18]=n,t[19]=r),p=(0,Z.jsx)(hb,{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)(bt,{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 yb(){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)(Sa,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Sa,{className:`h-4 w-full`}),(0,Z.jsx)(Sa,{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 bb={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function xb(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}=Wr(),s=bb[r],c=s?(o===`dark`?Si[s]:void 0)??Ni[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=Gi(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)(ra,{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)(na,{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)(la,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function Sb(e){let{installState:t}=e;return t.installed===null?lr._({id:`IA6JW2`}):t.installed===!1?lr._({id:`5SwVv1`}):null}function Cb(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:lr._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:lr._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:lr._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function wb(e){return Jn(e)}function Tb(e){return lr._({id:`h_HYHD`,values:{displayName:e}})}var Eb=`claude.ai`;async function Db(e,t=Ph){(await t(Jn(e))).ok?gs.success(Tb(Eb)):gs.error(lr._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:Eb}}))}function Ob(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??Ph,u=e.onWebFallbackSuccess??Ab,d=e.onWebFallbackError??kb,{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=Cb({target:r,installState:a,isElectronHost:o}),i=Sb({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(wb(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)(xb,{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)(Wo,{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)(xb,{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)(Wo,{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=To;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(xb,{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)(Fo,{"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=go,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(No,{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)(Vo,{}),t[55]=v):v=t[55],y=(0,Z.jsx)(Wo,{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)(Wo,{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 kb(){}function Ab(){}function jb(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=ug(),{dispatch:a}=$h(),o=Mo(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=Bh({workspace:o});t[7]===n?s=t[8]:(s=Gi(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=sh.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(Mb,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{Uh(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 Mb(e){let t=(0,$.c)(17),{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)(xb,{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]===r?f=t[8]:(f=r===`missing`?(0,Z.jsx)(ns,{"aria-hidden":`true`,className:`size-3`}):null,t[7]=r,t[8]=f);let p;t[9]!==c||t[10]!==f?(p=(0,Z.jsxs)(`p`,{className:`inline-flex items-center gap-1 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,f]}),t[9]=c,t[10]=f,t[11]=p):p=t[11];let m;return t[12]!==s||t[13]!==o||t[14]!==d||t[15]!==p?(m=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-row items-center justify-between gap-4 rounded-xl border border-border/60 bg-card p-4 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:[d,p]}),t[12]=s,t[13]=o,t[14]=d,t[15]=p,t[16]=m):m=t[16],m}var Nb=3100,Pb=3;function Fb(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Pb;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var Ib={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}},Lb=[`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 Rb(e,t={}){let n=t.rng??Math.random,r=t.colors??Lb,i=Ib[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,Bb=90,Vb=16,Hb=380,Ub=.025,Wb=.1,Gb=.18,Kb=400,qb=9.2736,Jb=18.1799,Yb=14.5244,Xb={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Zb(e,t){let{halfWidth:n,apexLift:r}=Xb[t];return`M${e-n} ${Yb+.3} Q${e} ${Yb-r}, ${e+n} ${Yb+.3}`}function Qb(e){let t=1.5,n=.3;return`M${e-t} ${Yb-n} Q${e} ${Yb+1.4}, ${e+t} ${Yb-n}`}var $b=15,ex=15;function tx(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 nx(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=Fb(g,t);_(n),y(ox),S(Rb(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Nb)},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(ax),S(Rb(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Nb))},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/Hb)),C=Math.max(-1,Math.min(1,b/Hb)),w=S*Vb,T=-C*Vb,E=0,D=0;if(x>=1){let e=Math.min(x/Bb,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)*Wb,i+=(w-i)*Wb,u.style.transform=`perspective(${Kb}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*Gb,o+=(D-o)*Gb;let k=i*Ub,A=-r*Ub,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=Gi(`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=Gi(`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=Gi(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:qb,cy:Yb,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let q=(F||T)&&`ok-blob-eye-hidden`,J;t[26]===q?J=t[27]:(J=Gi(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=J);let Y;t[28]===J?Y=t[29]:(Y=(0,Z.jsx)(`ellipse`,{cx:Jb,cy:Yb,rx:1.2722,ry:1.9083,className:J}),t[28]=J,t[29]=Y);let ee;t[30]===I?ee=t[31]:(ee=Zb(qb,I),t[30]=I,t[31]=ee);let te=(!F||T)&&`ok-blob-eye-hidden`,ne;t[32]===te?ne=t[33]:(ne=Gi(`ok-blob-happy-eye`,te),t[32]=te,t[33]=ne);let re;t[34]!==ee||t[35]!==ne?(re=(0,Z.jsx)(`path`,{d:ee,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ne}),t[34]=ee,t[35]=ne,t[36]=re):re=t[36];let ie;t[37]===I?ie=t[38]:(ie=Zb(Jb,I),t[37]=I,t[38]=ie);let ae=(!F||T)&&`ok-blob-eye-hidden`,oe;t[39]===ae?oe=t[40]:(oe=Gi(`ok-blob-happy-eye`,ae),t[39]=ae,t[40]=oe);let se;t[41]!==ie||t[42]!==oe?(se=(0,Z.jsx)(`path`,{d:ie,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:oe}),t[41]=ie,t[42]=oe,t[43]=se):se=t[43];let ce;t[44]===T?ce=t[45]:(ce=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:Qb(qb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:Qb(Jb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ce);let le;t[46]!==K||t[47]!==Y||t[48]!==re||t[49]!==se||t[50]!==ce?(le=(0,Z.jsxs)(`g`,{ref:p,children:[K,Y,re,se,ce]}),t[46]=K,t[47]=Y,t[48]=re,t[49]=se,t[50]=ce,t[51]=le):le=t[51];let ue;t[52]!==B||t[53]!==H||t[54]!==le?(ue=(0,Z.jsxs)(`g`,{className:H,children:[U,le]},B),t[52]=B,t[53]=H,t[54]=le,t[55]=ue):ue=t[55];let de;t[56]===T?de=t[57]:(de=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]=de);let fe;t[58]!==v||t[59]!==x?(fe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(rx)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=fe):fe=t[60];let pe;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==ue||t[65]!==de||t[66]!==fe?(pe=(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:ix,children:[ue,de,fe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=ue,t[65]=de,t[66]=fe,t[67]=pe):pe=t[67];let me;return t[68]!==R||t[69]!==pe?(me=(0,Z.jsx)(`span`,{ref:d,className:R,children:pe}),t[68]=R,t[69]=pe,t[70]=me):me=t[70],me}function rx(e){return(0,Z.jsx)(`circle`,{cx:$b+e.originDx,cy:ex+e.originDy,r:e.size,className:`ok-blob-firework`,style:tx(e)},e.id)}function ix(e){return e.preventDefault()}function ax(e){return e+1}function ox(e){return e+1}function sx(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(nx,{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 cx(){let e=(0,$.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Ms(`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 lx=`open-knowledge:create-top-level-file`;function ux(e={}){window.dispatchEvent(new CustomEvent(lx,{detail:e}))}function dx(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(lx,t),()=>window.removeEventListener(lx,t)}function fx(e){let t=(0,$.c)(33),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=ih(),c=Zo(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=Ms(`new-item`),t[3]=p):p=t[3];let m=p,h;t[4]===a?h=t[5]:(h=a({id:`FOGD7m`}),t[4]=a,t[5]=h);let g;t[6]===a?g=t[7]:(g=a({id:`LMbgDK`}),t[6]=a,t[7]=g);let _;t[8]!==n||t[9]!==h||t[10]!==g?(_=(0,Z.jsx)(sx,{title:h,subtitle:g,celebrateSignal:n}),t[8]=n,t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(hx,{shortcutLabel:m,onClick:mx}),t[12]=v):v=t[12];let y;t[13]!==u||t[14]!==f||t[15]!==d?(y=d||f||u.length>0?(0,Z.jsx)(gx,{templates:u,loading:d,error:f,onSelect:px}):null,t[13]=u,t[14]=f,t[15]=d,t[16]=y):y=t[16];let b;t[17]===o?b=t[18]:(b=o?null:(0,Z.jsx)(vx,{}),t[17]=o,t[18]=b);let x,S;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(ge,{"aria-hidden":`true`,className:`size-3`}),x=(0,Z.jsx)(s,{id:`IajAbS`}),t[19]=x,t[20]=S):(x=t[19],S=t[20]);let C;t[21]===r?C=t[22]:(C=(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:[S,x]}),t[21]=r,t[22]=C);let w;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(cx,{}),t[23]=w):w=t[23];let T;t[24]===C?T=t[25]:(T=(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[C,w]}),t[24]=C,t[25]=T);let E;t[26]!==T||t[27]!==y||t[28]!==b?(E=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,y,b,T]}),t[26]=T,t[27]=y,t[28]=b,t[29]=E):E=t[29];let D;return t[30]!==E||t[31]!==_?(D=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[_,E]}),t[30]=E,t[31]=_,t[32]=D):D=t[32],D}function px(e,t){return ux({template:{folder:e,name:t}})}function mx(){return ux({initialDir:``})}function hx(e){let t=(0,$.c)(7),{shortcutLabel:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Xc,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i,(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:(0,Z.jsx)(s,{id:`HdkSiO`})})]}),t[1]=a):a=t[1];let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(D,{children:n}),t[2]=n,t[3]=o);let c;return t[4]!==r||t[5]!==o?(c=(0,Z.jsxs)(Qi,{type:`button`,variant:`ghost`,onClick:r,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-xl border border-border/60 bg-card p-4 text-left transition-colors hover:bg-muted/50 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,children:[a,o]}),t[4]=r,t[5]=o,t[6]=c):c=t[6],c}function gx(e){let t=(0,$.c)(25),{templates:n,loading:r,error:a,onSelect:o}=e,{_:c}=i(),l;t[0]===c?l=t[1]:(l=c({id:`_8quCH`}),t[0]=c,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`_8quCH`})}),t[2]=u):u=t[2];let d;t[3]!==c||t[4]!==a||t[5]!==r||t[6]!==n?(d=r||a?null:(0,Z.jsx)(q,{className:`text-2xs`,variant:`gray`,"aria-label":c({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=c,t[4]=a,t[5]=r,t[6]=n,t[7]=d):d=t[7];let f;t[8]===d?f=t[9]:(f=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[u,d]}),t[8]=d,t[9]=f);let p;t[10]===c?p=t[11]:(p=c({id:`irFGwu`}),t[10]=c,t[11]=p);let m;t[12]!==a||t[13]!==r||t[14]!==o||t[15]!==n?(m=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Hl89Qd`})}):a?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(s,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(_x,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>o(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=a,t[13]=r,t[14]=o,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==r||t[18]!==p||t[19]!==m?(h=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":p,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:m})}),t[17]=r,t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==l||t[22]!==f||t[23]!==h?(g=(0,Z.jsxs)(`section`,{"aria-label":l,className:`flex w-full flex-col gap-3`,children:[f,h]}),t[21]=l,t[22]=f,t[23]=h,t[24]=g):g=t[24],g}function _x(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:a}=e,{_:o}=i(),s;t[0]!==n.name||t[1]!==n.title?(s=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=s):s=t[2];let c=s,l=`${n.name}.md`,u=n.source_folder===``,d;t[3]!==o||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==r?(d=o(u?{id:`89TtiD`,values:{displayTitle:c,fileName:l}}:{id:`0_J12R`,values:{displayTitle:c,fileName:l,targetLabel:r}}),t[3]=o,t[4]=c,t[5]=l,t[6]=u,t[7]=r,t[8]=d):d=t[8];let f=d,p;t[9]===c?p=t[10]:(p=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:c}),t[9]=c,t[10]=p);let m;t[11]===l?m=t[12]:(m=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g=`shrink-0 font-mono text-1sm ${u?`text-muted-foreground/70`:`text-muted-foreground`}`,_;t[16]!==g||t[17]!==r?(_=(0,Z.jsx)(`span`,{className:g,children:r}),t[16]=g,t[17]=r,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==a||t[21]!==h||t[22]!==_?(v=(0,Z.jsxs)(Qi,{type:`button`,variant:`ghost`,onClick:a,"aria-label":f,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[h,_]}),t[19]=f,t[20]=a,t[21]=h,t[22]=_,t[23]=v):v=t[23],v}function vx(){let e=(0,$.c)(6),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`27ANM6`}),e[0]=t,e[1]=n);let r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`header`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`27ANM6`})}),a=(0,Z.jsx)(jb,{}),e[2]=r,e[3]=a):(r=e[2],a=e[3]);let o;return e[4]===n?o=e[5]:(o=(0,Z.jsxs)(`section`,{"aria-label":n,className:`flex w-full flex-col gap-3`,children:[r,a]}),e[4]=n,e[5]=o),o}function yx(){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(Cx);if(e)return;let r=t.ok?vi.safeParse(n):null;r?.success?(o(wx(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=ni(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(Sx),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(xx);if(!e.ok)return;let n=vi.safeParse(t);n.success&&o(wx(n.data.documents))}).catch(bx)},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)(Tx,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(fx,{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)($m,{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 bx(){}function xx(){return null}function Sx(e){return e+1}function Cx(){return null}function wx(e){return Bi(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function Tx(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)(sx,{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)(Km,{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:Ex,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 Ex(){return ux()}function Dx(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function Ox(e){let t=(0,$.c)(70),{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)(Ax,{}),(0,Z.jsx)(Sa,{className:`h-7 w-full`}),(0,Z.jsx)(Sa,{className:`h-7 w-full`}),(0,Z.jsx)(Sa,{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.frontmatterLocal?m=t[4]:(m=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=m);let h=m,g;t[5]===r.data.folder.path?g=t[6]:(g=Dx(r.data.folder.path),t[5]=r.data.folder.path,t[6]=g);let _=g,v;t[7]===h?v=t[8]:(v=Object.keys(h),t[7]=h,t[8]=v);let y=v,b;t[9]!==o||t[10]!==n||t[11]!==a?(b=async function(e,t){let r=await Va(n,{[e]:t});if(!r.ok){let{error:e}=r;gs.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},t[9]=o,t[10]=n,t[11]=a,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==n||t[15]!==a?(S=async function(e){let t=await Va(n,{[e]:null});if(!t.ok){let{error:e}=t;gs.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},t[13]=o,t[14]=n,t[15]=a,t[16]=S):S=t[16];let C=S,w;t[17]!==x||t[18]!==h?(w=function(e,t){let n=h[e];x(e,za(n,t))},t[17]=x,t[18]=h,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[20]=E):E=t[20];let D=E,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Na[e];return{...t,type:e,value:n,error:null}})},t[21]=O):O=t[21];let k=O,A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){d(t=>t&&{...t,value:e})},t[22]=A):A=t[22];let j=A,M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){d(t=>t&&{...t,name:e,error:null})},t[23]=M):M=t[23];let N=M,P;t[24]!==o||t[25]!==u||t[26]!==n||t[27]!==a||t[28]!==h?(P=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(In(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 Va(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[24]=o,t[25]=u,t[26]=n,t[27]=a,t[28]=h,t[29]=P):P=t[29];let F=P,I;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){p({key:e,draft:e,error:null})},t[30]=I):I=t[30];let L=I,R;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(t=>t&&{...t,draft:e,error:null})},t[31]=R):R=t[31];let z=R,B;t[32]!==o||t[33]!==n||t[34]!==a||t[35]!==h||t[36]!==f?(B=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}let t=h[f.key],r=await Va(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},t[32]=o,t[33]=n,t[34]=a,t[35]=h,t[36]=f,t[37]=B):B=t[37];let V=B,H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(){p(null)},t[38]=H):H=t[38];let U=H,W=!c,G;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>l(!e),t[39]=G):G=t[39];let K=`size-3 transition-transform ${c?``:`rotate-90`}`,q;t[40]===K?q=t[41]:(q=(0,Z.jsx)(_s,{className:K,"aria-hidden":!0}),t[40]=K,t[41]=q);let J;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=J):J=t[42];let Y;t[43]===q?Y=t[44]:(Y=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[q,J]}),t[43]=q,t[44]=Y);let ee;t[45]===_?ee=t[46]:(ee=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:kx,children:_}),t[45]=_,t[46]=ee);let te;t[47]!==Y||t[48]!==ee?(te=(0,Z.jsxs)(bs,{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:[Y,ee]}),t[47]=Y,t[48]=ee,t[49]=te):te=t[49];let ne;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`e6pmcJ`})}),t[50]=ne):ne=t[50];let re;t[51]!==u||t[52]!==x||t[53]!==V||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(re=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`})}):y.map(e=>{let t=h[e];return(0,Z.jsx)(qa,{keyName:e,value:t,declared:Za(t,Hi(t)),rename:{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:z,onCommit:V,onCancel:U},badge:null,onCommit:t=>void x(e,t),onChangeType:t=>T(e,t),onRemove:()=>void C(e)},e)}),t[51]=u,t[52]=x,t[53]=V,t[54]=y,t[55]=h,t[56]=C,t[57]=f,t[58]=T,t[59]=re):re=t[59];let ie;t[60]!==u||t[61]!==F?(ie=u?(0,Z.jsx)(Ua,{draft:u,onChangeName:N,onChangeType:k,onChangeValue:j,onCommit:()=>void F(),onCancel:()=>d(null)}):(0,Z.jsx)(`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:()=>D(),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)(ge,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=F,t[62]=ie):ie=t[62];let ae;t[63]!==re||t[64]!==ie?(ae=(0,Z.jsx)(ys,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[ne,re,ie]})}),t[63]=re,t[64]=ie,t[65]=ae):ae=t[65];let oe;return t[66]!==W||t[67]!==te||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(xs,{open:W,onOpenChange:G,children:[te,ae]})}),t[66]=W,t[67]=te,t[68]=ae,t[69]=oe):oe=t[69],oe}function kx(e){return e.stopPropagation()}function Ax(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)($c,{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 jx(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function Mx(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=jx(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function Nx(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Px(e,t){let n=e===``?``:`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:Mx(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:Nx(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:Mx(e,t.pageTitles),children:a}}function Fx(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)(Sa,{className:`h-12 w-full`}),(0,Z.jsx)(Sa,{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)(q,{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)(ge,{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)(Ca,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Da,{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)(Ga,{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)(Oo,{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(Ix)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Eo,{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)(km,{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 Ix(e){return e.name}function Lx(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=Gi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Gi(`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 Rx(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=Gi(`[&_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 zx(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=Gi(`[&_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 Bx(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=Gi(`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 Vx(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=Gi(`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 Hx(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=Gi(`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 Ux(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return lr._({id:`xOTzt5`});if(r<60)return lr._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return lr._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?lr._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Wx(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 Gx(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)(qt,{className:`ml-1 size-3`}):(0,Z.jsx)(oe,{className:`ml-1 size-3`}):(0,Z.jsx)(jc,{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 Kx(e){let t=(0,$.c)(92),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=ki(),d=eo(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)(Sa,{className:`size-5 rounded`}),(0,Z.jsx)(Sa,{className:`h-7 w-48`})]}),(0,Z.jsx)(Sa,{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)(Sa,{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)(Sa,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Yx)]})]}),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=Px(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=Wx(e.children,g,v),o=e.title||(n===``?r({id:`3aeN7X`}):e.title),m;t[28]===g?m=t[29]:(m=function(e){e===g?y(Jx):(_(e),y(`asc`))},t[28]=g,t[29]=m);let A=m;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 j;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(yt,{className:`size-5 text-muted-foreground`}),t[30]=j):j=t[30];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:o})]}),N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(Qi,{onClick:()=>h(!0),children:[(0,Z.jsx)(ge,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[31]=N):N=t[31],t[32]===M?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:[M,N]})}),t[32]=M,t[33]=E),t[34]!==f||t[35]!==n||t[36]!==p?(D=(0,Z.jsx)(Ox,{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)(Fx,{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=Lx;let P=g===`name`?v===`asc`?`ascending`:`descending`:`none`,F;t[43]===r?F=t[44]:(F=r({id:`6YtxFj`}),t[43]=r,t[44]=F);let I;t[45]!==A||t[46]!==v||t[47]!==g||t[48]!==F?(I=(0,Z.jsx)(Gx,{label:F,sortKey:`name`,activeKey:g,activeDir:v,onSort:A}),t[45]=A,t[46]=v,t[47]=g,t[48]=F,t[49]=I):I=t[49];let L;t[50]!==P||t[51]!==I?(L=(0,Z.jsx)(Vx,{"aria-sort":P,children:I}),t[50]=P,t[51]=I,t[52]=L):L=t[52];let R=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,z;t[53]===r?z=t[54]:(z=r({id:`tgWuMB`}),t[53]=r,t[54]=z);let B;t[55]!==A||t[56]!==v||t[57]!==g||t[58]!==z?(B=(0,Z.jsx)(Gx,{label:z,sortKey:`modified`,activeKey:g,activeDir:v,onSort:A}),t[55]=A,t[56]=v,t[57]=g,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==R||t[61]!==B?(V=(0,Z.jsx)(Vx,{className:`w-32`,"aria-sort":R,children:B}),t[60]=R,t[61]=B,t[62]=V):V=t[62],t[63]!==L||t[64]!==V?(C=(0,Z.jsx)(Rx,{children:(0,Z.jsxs)(Bx,{children:[L,V]})}),t[63]=L,t[64]=V,t[65]=C):C=t[65],b=zx,S=i.length?i.map(qx):(0,Z.jsx)(Bx,{children:(0,Z.jsx)(Hx,{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)(km,{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 qx(e){return(0,Z.jsxs)(Bx,{children:[(0,Z.jsx)(Hx,{children:(0,Z.jsxs)(`a`,{href:gr(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)(tl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Mt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(Hx,{className:`text-muted-foreground`,children:e.kind===`file`?Ux(e.modified):`—`})]},e.path)}function Jx(e){return e===`asc`?`desc`:`asc`}function Yx(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)(Sa,{className:`size-4 rounded`}),(0,Z.jsx)(Sa,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Sa,{className:`h-4 w-16`})})]},e)}function Xx(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)(Yc,{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=Nn(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Nn(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)(sa,{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 Zx(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(Qx),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 Qx(){return new Set}var $x=(0,Q.createContext)(null);function eS(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(tS),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)($x,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function tS(){return new Map}function nS(){let e=(0,Q.use)($x);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function rS(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var iS=rS(()=>n(()=>import(`./SettingsDialogBody-DfwLWUB4.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,46]),import.meta.url));function aS(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:oS,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 oS(){return window.location.reload()}function sS(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(W,{fallbackRender:lS,onError:cS,children:n}),t[0]=n,t[1]=r),r}function cS(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function lS(e){return(0,Z.jsx)(aS,{...e})}function uS(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function dS(e){let t=(0,$.c)(81),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=pt(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=gt(),{desktopPresent:f}=Ta(),[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)(cs,{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)(os,{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)(fS,{groups:H,activeId:p,onSelect:m}),t[65]=p,t[66]=H,t[67]=G):G=t[67];let K;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(hS,{}),t[68]=K):K=t[68];let q=l?c:null,J;t[69]!==p||t[70]!==u||t[71]!==d||t[72]!==q?(J=(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)(sS,{children:(0,Z.jsx)(Q.Suspense,{fallback:K,children:(0,Z.jsx)(iS,{activeId:p,userBinding:q,okignoreBinding:u,okignoreSynced:d})})})}),t[69]=p,t[70]=u,t[71]=d,t[72]=q,t[73]=J):J=t[73];let Y;t[74]!==G||t[75]!==J?(Y=(0,Z.jsxs)(ls,{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,J]}),t[74]=G,t[75]=J,t[76]=Y):Y=t[76];let ee;return t[77]!==r||t[78]!==n||t[79]!==Y?(ee=(0,Z.jsx)(ps,{open:n,onOpenChange:r,children:Y}),t[77]=r,t[78]=n,t[79]=Y,t[80]=ee):ee=t[80],ee}function fS(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)(mS,{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)(pS,{}),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 pS(){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=uS(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:Gi(`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)(ns,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function mS(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=Gi(`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:Gi(`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 hS(){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)(Sa,{className:`h-5 w-32`}),r=(0,Z.jsx)(Sa,{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)(Sa,{className:`h-9 w-full`}),(0,Z.jsx)(Sa,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function gS(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=Gi(`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)(nb,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _S(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)(ab,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function vS(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=Gi(`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)(lb,{"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 yS(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=Gi(`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 bS=ea(`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 xS(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=Gi(bS({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:SS,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function SS(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ea(`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 CS(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=Gi(`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 wS(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=Gi(`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)(vs,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TS(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)(wS,{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)(Lc,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(is,{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)(nr,{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)(Yn,{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)(Ul,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(is,{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)(nr,{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)(Yn,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(xS,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=K):K=t[48];let q;t[49]!==K||t[50]!==F?(q=(0,Z.jsxs)(yS,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,K]}),t[49]=K,t[50]=F,t[51]=q):q=t[51];let J;t[52]===E?J=t[53]:(J=(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]=J);let Y;t[54]===S?Y=t[55]:(Y=S({id:`oqB2ez`}),t[54]=S,t[55]=Y);let ee=!w,te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Ee,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=te):te=t[56];let ne;t[57]!==v||t[58]!==Y||t[59]!==ee?(ne=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Y,disabled:ee,onClick:v,children:te})}),t[57]=v,t[58]=Y,t[59]=ee,t[60]=ne):ne=t[60];let re;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(nr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=re):re=t[61];let ie;t[62]===ne?ie=t[63]:(ie=(0,Z.jsxs)(Yn,{children:[ne,re]}),t[62]=ne,t[63]=ie);let ae;t[64]===S?ae=t[65]:(ae=S({id:`SiUUCS`}),t[64]=S,t[65]=ae);let oe=!w,se;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Ut,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=se):se=t[66];let ce;t[67]!==_||t[68]!==ae||t[69]!==oe?(ce=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ae,disabled:oe,onClick:_,children:se})}),t[67]=_,t[68]=ae,t[69]=oe,t[70]=ce):ce=t[70];let le;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(nr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=le):le=t[71];let ue;t[72]===ce?ue=t[73]:(ue=(0,Z.jsxs)(Yn,{children:[ce,le]}),t[72]=ce,t[73]=ue);let de=o?`secondary`:`ghost`,fe;t[74]!==S||t[75]!==o?(fe=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=fe):fe=t[76];let pe=o?`ok-replace-input`:void 0,me;t[77]!==m||t[78]!==o?(me=()=>m(!o),t[77]=m,t[78]=o,t[79]=me):me=t[79];let he;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(Tl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=he):he=t[80];let ge;t[81]!==o||t[82]!==de||t[83]!==fe||t[84]!==pe||t[85]!==me?(ge=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{type:`button`,variant:de,size:`icon-sm`,"aria-label":fe,"aria-expanded":o,"aria-controls":pe,onClick:me,children:he})}),t[81]=o,t[82]=de,t[83]=fe,t[84]=pe,t[85]=me,t[86]=ge):ge=t[86];let _e;t[87]===o?_e=t[88]:(_e=(0,Z.jsx)(nr,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=_e);let ve;t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsxs)(Yn,{children:[ge,_e]}),t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(ye=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)(vs,{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)(Yn,{children:[(0,Z.jsx)(Tr,{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)(Tl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(nr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Tr,{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)(wl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(nr,{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]=ye):ye=t[100];let be;t[101]===S?be=t[102]:(be=S({id:`wJo9oS`}),t[101]=S,t[102]=be);let xe;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(ss,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=xe):xe=t[103];let Se;t[104]!==x||t[105]!==be?(Se=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":be,onClick:x,children:xe})}),t[104]=x,t[105]=be,t[106]=Se):Se=t[106];let Ce;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(nr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Ce):Ce=t[107];let we;t[108]===Se?we=t[109]:(we=(0,Z.jsxs)(Yn,{children:[Se,Ce]}),t[108]=Se,t[109]=we);let Te;return t[110]!==q||t[111]!==J||t[112]!==ie||t[113]!==ue||t[114]!==j||t[115]!==ve||t[116]!==ye||t[117]!==we?(Te=(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,q,J,ie,ue,ve,ye,we]}),t[110]=q,t[111]=J,t[112]=ie,t[113]=ue,t[114]=j,t[115]=ve,t[116]=ye,t[117]=we,t[118]=Te):Te=t[118],Te}var ES={current:0,total:0},DS=120,OS=100;function kS(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?en(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(he,n,AS)}function AS(){return null}function jS(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>DS||i.includes(`
26
26
  `)?null:i}function MS(e){let t=ft(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function NS(e,t){return e.current===t.current&&e.total===t.total}function PS(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(ES)}function FS(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 IS(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=kS(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)(ES),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(RS))},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(LS)},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(ES);return}if(!u.open||r){i.commands.clearFindMatches(),p(ES);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=MS(i);p(t=>NS(t,e)?t:e)},OS);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=ft(i.state),t=MS(i);p(e=>NS(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=jS(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(Ns(t,`find`)){t.preventDefault(),u.open?PS(i,d,p):e(!1);return}if(Ns(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=Ns(t,`find-next`),n=Ns(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&FS(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),PS(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=ft(i.state),t=MS(i);p(e=>NS(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(){PS(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()&&FS(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()&&FS(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)&&FS(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)&&FS(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,q,J;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),q=e=>d(t=>({...t,caseSensitive:e})),J=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=J):(W=t[63],G=t[64],K=t[65],q=t[66],J=t[67]);let Y;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(Y=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(TS,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:q,onWholeWordChange:J,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=Y):Y=t[80],Y}function LS(e){return{...e,open:!1,activeIndex:0}}function RS(e){return{...e,activeIndex:0}}var zS=300;function BS(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(rc),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(rc);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(cc(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,zS)};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 VS(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function HS(e){let t=(0,$.c)(8),{poolEntries:n}=pt(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>VS(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(VS(i));let t=()=>s(VS(i));return e.observe(t),()=>{e.unobserve(t)}},l=[i],t[5]=i,t[6]=c,t[7]=l),(0,Q.useEffect)(c,l),o}function US(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>dc(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(fc,r)}var WS=`ok-doc-panel-width-v1`;function GS(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function KS(e){try{let t=(e??localStorage).getItem(WS);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?GS(n):320}catch{return 320}}function qS(e,t){try{(t??localStorage).setItem(WS,String(GS(e)))}catch{}}function JS(){try{return typeof localStorage>`u`?320:KS()}catch{return 320}}var YS=1024,XS=1280,ZS={left:YS,right:XS};function QS(e,t,n){return e==null?t>=ZS[n]?`above`:`below`:`embedded`}function $S(e){return e===`above`?`open`:`collapsed`}var eC=`ok-sidebar-pins-v2`;function tC(e){return e===`open`||e===`collapsed`}function nC(e){return e===`above`||e===`below`||e===`embedded`}function rC(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!nC(e)||!tC(t[e]))return!1;return!0}function iC(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return rC(n.left)&&(r.left=n.left),rC(n.right)&&(r.right=n.right),r}function aC(e){try{let t=(e??localStorage).getItem(eC);return t==null?{}:iC(t)}catch{return{}}}function oC(e,t){try{t.setItem(eC,JSON.stringify(e))}catch{}}function sC(e,t,n){return n[e]?.[t]??$S(t)}function cC(e,t,n,r){let i=r??localStorage,a=aC(i);return a[e]={...a[e],[t]:n},oC(a,i),a}function lC(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`?uC: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 uC(e){return e===`synced`?`synced`:`connected`}var dC=zr;function fC(e,t={}){let n=kt(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var pC=200,mC=`Outside any block`;function hC(e){let t=(0,$.c)(5),{editor:n}=e,r=Me(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?gC(n,r):o.current?mC:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},pC),()=>{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 gC(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=fC(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=fC(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 _C(){let[e]=(0,Q.useState)(xi);return e}function vC({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:ei(e.display_name),color:pr(e.id,hr),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:pr(e.id,hr),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function yC(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 bC=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&&ri(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(ir(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Cr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ur(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Fr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Mn(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Zn(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Br(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Lr(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=Fi(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof jr){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 Gr){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():yC(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Ei(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()}},xC=e=>new qn({key:typeof e.pluginKey==`string`?new Un(e.pluginKey):e.pluginKey,view:t=>new bC({view:t,...e})});Ai.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[xC({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 SC=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 Qr(e,{textSerializers:ti(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(ir(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Cr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ur(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Fr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Mn(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Zn(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Br(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Lr(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=Fi(this.view,e.from,e.to);Ei({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()}},CC=e=>new qn({key:typeof e.pluginKey==`string`?new Un(e.pluginKey):e.pluginKey,view:t=>new SC({view:t,...e})});Ai.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?[CC({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 wC(e,t){return e??new Un(t)}var TC=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,EC=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),DC=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(`.`)),OC=new Set([`children`,`className`,`style`]),kC=new Set([`tabIndex`]),AC=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 MC(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function NC(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function PC(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||AC.has(e)}function FC(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function IC(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 LC(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 RC(e){return kC.has(e)}function zC(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function BC(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 VC(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||DC.has(e)?String(t):`${t}px`}function HC(e,t){EC.has(t)||e.style.removeProperty(FC(t))}function UC(e,t,n){EC.has(t)||e.style.setProperty(FC(t),VC(t,n))}function WC(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(OC.has(r)||!PC(r)||MC(r,t[r])||MC(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=NC(r);if(a==null||a===!1){RC(r)&&BC(e,r),e.removeAttribute(o);return}if(a===!0){RC(r)&&zC(e,r,!0),e.setAttribute(o,``);return}if(RC(r)){zC(e,r,a);return}e.setAttribute(o,String(a))})}function GC(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function KC(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){HC(e,t);return}UC(e,t,a)}})}function qC(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(!MC(t,n))return;let{eventName:i,options:a}=IC(t),o=t=>{n(LC(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function JC(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);TC(()=>{let i=n.current;return GC(e,i.className,t.className),KC(e,i.style,t.style),WC(e,i,t),r.current=qC(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 YC=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)(wC(e,`bubbleMenu`)).current;JC(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Gt(),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=xC({...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,Pc.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)(wC(e,`floatingMenu`)).current;JC(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Gt(),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=CC({...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,Pc.createPortal)(s,u.current)});var XC=[{name:`paragraph`,label:`Text`,icon:bl,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Ot,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:ht,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:It,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:P,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:ye,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:xe,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:de,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:Ml,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function ZC(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:QC},t[0]=n,t[1]=r);let{current:i,activeStates:a}=ce(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)(Ut,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Ho,{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=XC.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Wo,{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)(xo,{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)(Ya,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function QC(e){let t=Object.fromEntries(XC.map(t=>[t.name,t.isActive(e.editor)]));return{current:XC.find(e=>t[e.name])??XC[0],activeStates:t}}function $C(e){let t=Y(e.state.selection.content(),e.state.schema);return je().serialize(t).trim()}function ew(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function tw(e){let t=(0,$.c)(14),{editor:n,shortcutEnabled:r}=e,a=r===void 0?!1:r,{_:o}=i(),{openSelection:c}=lc(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=ai(),t[0]=l):l=t[0];let u=l,d;t[1]!==o||t[2]!==n||t[3]!==c?(d=()=>{let e;try{e=$C(n)}catch(e){console.error(`Edit with AI: could not read the selection`,e),gs.error(o({id:`-RXIMO`}));return}c({docName:qe(n),instruction:``,selectionMarkdown:e})},t[1]=o,t[2]=n,t[3]=c,t[4]=d):d=t[4];let f=d,p,m;if(t[5]!==f||t[6]!==a?(p=()=>{if(!u)return;let e=e=>{a&&Ns(e,`edit-with-ai`)&&(ew(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),f()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},m=[u,a,f],t[5]=f,t[6]=a,t[7]=p,t[8]=m):(p=t[7],m=t[8]),(0,Q.useEffect)(p,m),!u)return null;let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(vo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[9]=h):h=t[9];let g,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(ua,{className:`size-3.5`,"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`EVnzPs`})}),t[10]=g,t[11]=_):(g=t[10],_=t[11]);let v;return t[12]===f?v=t[13]:(v=(0,Z.jsxs)(Z.Fragment,{children:[h,(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`,onClick:f,children:[g,_]})]}),t[12]=f,t[13]=v),v}function nw(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 rw(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:Nt(typeof n.src==`string`?n.src:``)}function iw(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 aw(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:ow},t[0]=n,t[1]=a),ce(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=nw(n);t&&iw(t,rw(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(ga,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(Tr,{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)(nr,{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)(Yn,{children:[u,d]})}),t[11]=u,t[12]=f),f}function ow(e){return nw(e.editor)}function sw(e){return nw(e)!==null}var cw=[{value:`left`,label:`Align left`,icon:$t},{value:`center`,label:`Align center`,icon:me},{value:`right`,label:`Align right`,icon:g}];function lw(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Yt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function uw(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:dw},t[0]=n,t[1]=r);let i=ce(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=cw.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Tr,{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(!Yt.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(jr.create(u.doc,s)),Ht(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(nr,{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 dw(e){return lw(e.editor)}function fw(e){return lw(e)!==null}var pw=[{name:`bold`,icon:Nc,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:al,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Bl,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:Il,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:St,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:il,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:hw},t[0]=n,t[1]=r);let i=ce(r),a;t[2]!==i||t[3]!==n?(a=pw.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Tr,{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)(nr,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(D,{"aria-label":Ps(e.shortcutId),children:Ms(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 hw(e){return Object.fromEntries(pw.map(t=>[t.name,t.isActive(e.editor)]))}function gw(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}=ki(),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)(at,{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)(Wc,{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)(Yn,{children:[(0,Z.jsx)(Tr,{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)(ns,{className:`size-3.5`})})}),(0,Z.jsx)(nr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Tr,{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)(re,{className:`size-3.5`})})}),(0,Z.jsx)(nr,{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)(sl,{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)(Tr,{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 R;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(s,{id:`yzF66j`}),t[59]=R):R=t[59];let z;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsxs)(nr,{side:`bottom`,sideOffset:8,children:[R,(0,Z.jsx)(D,{children:Ms(`command-palette`)})]}),t[60]=z):z=t[60];let B;return t[61]===L?B=t[62]:(B=(0,Z.jsxs)(Yn,{children:[L,z]}),t[61]=L,t[62]=B),B}function _w({editor:e}){if(ft(e.state).query||e.isActive(`codeBlock`))return!1;if(fw(e)||sw(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 vw(e){let t=(0,$.c)(23),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:Cw},t[0]=n,t[1]=l);let u=ce(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:Sw},t[2]=n,t[3]=d);let f=ce(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Fi(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;if(t[7]!==n.view.dom||t[8]!==p){let e={getBoundingClientRect:p,contextElement:n.view.dom};m=()=>{let t=a.current;t&&(c.current?.(),c.current=cr(e,t,()=>{Ei(e,t,{placement:`top`,strategy:`fixed`,middleware:[Ur(8),ir(),Cr({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(xw)}))},t[7]=n.view.dom,t[8]=p,t[9]=m}else m=t[9];let h=m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{c.current?.(),c.current=null,s(bw)},t[10]=g):g=t[10];let _=g,v;t[11]===h?v=t[12]:(v={onShow:h,onHide:_,strategy:`fixed`},t[11]=h,t[12]=v);let y;t[13]!==n||t[14]!==f||t[15]!==u||t[16]!==i||t[17]!==o?(y=u?(0,Z.jsx)(uw,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(aw,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ZC,{editor:n}),(0,Z.jsx)(vo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(mw,{editor:n},o),(0,Z.jsx)(vo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(gw,{editor:n},`${o}-link`),(0,Z.jsx)(tw,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[13]=n,t[14]=f,t[15]=u,t[16]=i,t[17]=o,t[18]=y):y=t[18];let b;return t[19]!==n||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(YC,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:yw,shouldShow:_w,updateDelay:250,options:v,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:y}),t[19]=n,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function yw(){return document.body}function bw(e){return e+1}function xw(){}function Sw(e){return sw(e.editor)}function Cw(e){return fw(e.editor)}function ww(e){return[...e?[{label:`Toggle header column`,icon:Hc,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:sa,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:bo,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:re,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:nl,run:e=>e.chain().focus().deleteTable().run()}]}function Tw(e){return[...e?[{label:`Toggle header row`,icon:Ll,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:qt,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:oe,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:re,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:nl,run:e=>e.chain().focus().deleteTable().run()}]}function Ew(e){if(!e.isEditable||ft(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 Dw(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 cr(r,e,()=>{Ei(r,e,{strategy:`absolute`,placement:t,middleware:[Ur(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(Ow)})},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`?qc:Xa,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)(Ho,{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)(Vo,{}),(0,Z.jsxs)(Wo,{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)(xo,{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)(Ya,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function Ow(){}function kw(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=Ew(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=ww(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)(Dw,{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=Tw(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)(Dw,{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 Aw=new WeakMap;function jw(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=Oi(e.color),n.textContent=e.name,t.append(n),t}var Mw={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},Nw=100,Pw=100,Fw=3,Iw=250;function Lw(){let e=new $n({extensions:tr});return{mdManager:e,text:Ce({mdManager:e}),html:ve({mdManager:e}),paste:We({mdManager:e}),drop:l({mdManager:e})}}function Rw(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...xt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),dC.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),nt.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),Ai.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[Vt]}}),Ai.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[Ie(e,{cursorBuilder:jw})]}})]}function zw(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{Aw.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=Aw.get(e);if(Aw.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:ap(Rw(e))}}function Bw(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=Pi(Rw({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=jt(t.document.getXmlFragment(`default`),a);return{...zw({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var Vw=e=>{let t=(0,$.c)(21),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(Mw),c=_C(),{principal:l,activeDocName:u}=pt(),d=n.configuration.name??``,[f]=(0,Q.useState)(Lw),p;t[0]!==f||t[1]!==r||t[2]!==n?(p=()=>()=>({editor:new bi(Bw({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=J({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=()=>()=>{K(_)},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)(Hw,{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},Hw=e=>{let t=(0,$.c)(93),{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=()=>(Ct(c,n.configuration.name??null),()=>{Ct(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=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,sc(e,`wysiwyg`,uc(c))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),sc(e,`wysiwyg`,null)}},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[21]!==c||t[22]!==n.configuration.name?(w=()=>{},t[21]=c,t[22]=n.configuration.name,t[23]=w):w=t[23];let T;t[24]!==c||t[25]!==n?(T=[c,n],t[24]=c,t[25]=n,t[26]=T):T=t[26],(0,Q.useEffect)(w,T);let E,D;t[27]===c?(E=t[28],D=t[29]):(E=()=>{let e=Uw,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()}},D=[c],t[27]=c,t[28]=E,t[29]=D),(0,Q.useEffect)(E,D);let O,A;t[30]!==i||t[31]!==c?(O=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!h(c))return;e=!0;let t=st(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})}le(i)};if(h(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},A=[c,i],t[30]=i,t[31]=c,t[32]=O,t[33]=A):(O=t[32],A=t[33]),(0,Q.useEffect)(O,A);let j,M;t[34]!==u||t[35]!==n.document||t[36]!==l?(j=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},vr)};c(Mw);let f=()=>{if(Hr(e),!ui(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`?ui(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},M=[n.document,u,l],t[34]=u,t[35]=n.document,t[36]=l,t[37]=j,t[38]=M):(j=t[37],M=t[38]),(0,Q.useEffect)(j,M);let N,P;t[39]!==a||t[40]!==i||t[41]!==c||t[42]!==n?(N=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<Nw){e+=1,t=window.setTimeout(p,Pw);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=Fw,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,Iw)))};t=window.setTimeout(o,Iw)};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=Kn(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)}},P=[n,c,i,a],t[39]=a,t[40]=i,t[41]=c,t[42]=n,t[43]=N,t[44]=P):(N=t[43],P=t[44]),(0,Q.useEffect)(N,P);let F,I;t[45]===c?(F=t[46],I=t[47]):(F=()=>{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(ic,e),()=>window.removeEventListener(ic,e)},I=[c],t[45]=c,t[46]=F,t[47]=I),(0,Q.useEffect)(F,I);let L;t[48]!==a||t[49]!==i||t[50]!==o||t[51]!==r||t[52]!==s||t[53]!==n.awareness?(L=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:vC({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[48]=a,t[49]=i,t[50]=o,t[51]=r,t[52]=s,t[53]=n.awareness,t[54]=L):L=t[54];let R;t[55]!==a||t[56]!==i||t[57]!==o||t[58]!==r||t[59]!==s||t[60]!==n?(R=[n,i,a,o,s,r],t[55]=a,t[56]=i,t[57]=o,t[58]=r,t[59]=s,t[60]=n,t[61]=R):R=t[61],(0,Q.useEffect)(L,R);let z,B;t[62]!==c||t[63]!==r?(z=()=>(ke(c,r),()=>{ke(c,!1)}),B=[c,r],t[62]=c,t[63]=r,t[64]=z,t[65]=B):(z=t[64],B=t[65]),(0,Q.useEffect)(z,B);let V;t[66]!==a||t[67]!==i||t[68]!==c||t[69]!==r?(V=!r&&(0,Z.jsx)(vw,{editor:c,shortcutEnabled:i===a}),t[66]=a,t[67]=i,t[68]=c,t[69]=r,t[70]=V):V=t[70];let H;t[71]!==c||t[72]!==r?(H=!r&&(0,Z.jsx)(kw,{editor:c}),t[71]=c,t[72]=r,t[73]=H):H=t[73];let U;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[74]=U):U=t[74];let W;t[75]===c?W=t[76]:(W=(0,Z.jsx)(ae,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[75]=c,t[76]=W);let G;t[77]!==d||t[78]!==W?(G=(0,Pc.createPortal)(W,d),t[77]=d,t[78]=W,t[79]=G):G=t[79];let K;t[80]===c?K=t[81]:(K=(0,Z.jsx)(hC,{editor:c}),t[80]=c,t[81]=K);let q;t[82]===c?q=t[83]:(q=Re(c),t[82]=c,t[83]=q);let J;t[84]===q.store?J=t[85]:(J=(0,Z.jsx)(ut,{store:q.store}),t[84]=q.store,t[85]=J);let Y;return t[86]!==V||t[87]!==H||t[88]!==G||t[89]!==K||t[90]!==J||t[91]!==l?(Y=(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:[V,H,U,G,K,J]}),t[86]=V,t[87]=H,t[88]=G,t[89]=K,t[90]=J,t[91]=l,t[92]=Y):Y=t[92],Y};function Uw(){return pe()}var Ww=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 Gw(e,t,n,r,i,a){if(e==r)return[];let o=tT(e,t,n,r,i,a),s=nT(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 Ww(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new Ww(t,t+o,i,i),new Ww(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 Ww(t,t,i,i+o),new Ww(n,n,i+o+c,a)]}if(c==1||l==1)return[new Ww(t,n,i,a)];let u=iT(e,t,n,r,i,a);if(u){let[o,s,c]=u;return Gw(e,t,o,r,i,s).concat(Gw(e,o+c,n,r,s+c,a))}return Yw(e,t,n,r,i,a)}var Kw=1e9,qw=0,Jw=!1;function Yw(e,t,n,r,i,a){let o=n-t,s=a-i;if(Kw<1e9&&Math.min(o,s)>Kw*16||qw>0&&Date.now()>qw)return Math.min(o,s)>Kw*64?[new Ww(t,n,i,a)]:aT(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);Zw.reset(c),Qw.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:Qw,f=d?null:Zw;for(let p=0;p<c;p++){if(p>Kw||qw>0&&!(p&63)&&Date.now()>qw)return aT(e,t,n,r,i,a);let m=Zw.advance(p,o,s,c,d,!1,l)||Qw.advance(p,o,s,c,f,!0,u);if(m)return $w(e,t,n,t+m[0],r,i,a,i+m[1])}return[new Ww(t,n,i,a)]}var Xw=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}},Zw=new Xw,Qw=new Xw;function $w(e,t,n,r,i,a,o,s){let c=!1;return!bT(e,r)&&++r==n&&(c=!0),!bT(i,s)&&++s==o&&(c=!0),c?[new Ww(t,n,a,o)]:Gw(e,t,r,i,a,s).concat(Gw(e,r,n,i,s,o))}function eT(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function tT(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=eT(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-+!bT(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function nT(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=eT(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-+!bT(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function rT(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;;){bT(e,s)||s++;let u=s+o;if(bT(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=tT(e,u,n,r,i+f+d.length,a),c=nT(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 iT(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=iT(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:rT(e,t,n,r,i,a,Math.floor(o/4),-1)}function aT(e,t,n,r,i,a){Jw=!0;let o=n-t,s=a-i,c;if(o<s){let s=rT(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=rT(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new Ww(t,n,i,a)];let[l,u,d]=c;return Gw(e,t,l,r,i,u).concat(Gw(e,l+d,n,r,u+d,a))}function oT(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 Ww(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function sT(e,t,n){for(;;){oT(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=tT(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Ww(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=nT(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Ww(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 Ww(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 Ww(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function cT(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=hT(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 Ww(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 Ww(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=hT(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new Ww(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=_T(n,a.fromB,a.toB),r,o=t<0?-1:gT(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=_T(t,a.fromA,a.toA),r,o=n<0?-1:gT(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 oT(e,3),e}var lT;try{lT=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function uT(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function dT(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!uT(n):lT?!vT(n)||t==e.length-1?+!!lT.test(String.fromCharCode(n)):lT.test(e.slice(t,t+2))?2:0:0}function fT(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!uT(n):lT?!yT(n)||t==1?+!!lT.test(String.fromCharCode(n)):lT.test(e.slice(t-2,t))?2:0:0}var pT=8;function mT(e,t,n){if(t==e.length||!fT(e,t))return t;for(let r=t,i=t+n,a=0;a<pT;a++){let t=dT(e,r);if(!t||r+t>i)return r;r+=t}return t}function hT(e,t,n){if(!t||!dT(e,t))return t;for(let r=t,i=t-n,a=0;a<pT;a++){let t=fT(e,r);if(!t||r-t<i)return r;r-=t}return t}function gT(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function _T(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var vT=e=>e>=55296&&e<=56319,yT=e=>e>=56320&&e<=57343;function bT(e,t){return!t||t==e.length||!vT(e.charCodeAt(t-1))||!yT(e.charCodeAt(t))}function xT(e,t,n){let r=n?.override;return r?r(e,t):(Kw=(n?.scanLimit??1e9)>>1,qw=n?.timeout?Date.now()+n.timeout:0,Jw=!1,sT(e,t,Gw(e,0,e.length,t,0,t.length)))}function ST(){return!Jw}function CT(e,t,n){return cT(xT(e,t,n),e,t)}var wT=Ws.define({combine:e=>e[0]}),TT=Gs.define(),ET=Ws.define(),DT=zs.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(TT)&&(e=n.value);for(let n of t.state.facet(ET))e=n(e,t);return e}});function OT(e){let t=e.field(DT,!1);if(!t)return null;let n=e.facet(wT);return{chunks:t,side:n?n.side:null}}var kT=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 MT(CT(e.toString(),t.toString(),n),e,t,0,0,ST())}static updateA(e,t,n,r,i){return IT(FT(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return IT(FT(e,r,!1,t.length),e,t,n,i)}};function AT(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 jT(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 MT(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=AT(c.fromA+r,c.fromB+i,t,n),[d,f]=jT(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]=AT(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]=jT(a.toA+r,a.toB+i,t,n),s++}o.push(new kT(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var NT=1e3;function PT(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 FT(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>NT&&([l,d]=PT(e,a-NT,n,!0)),o<t.length-NT&&([u,f]=PT(e,o+NT,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 IT(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=CT(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of MT(h,n,r,d,f,ST()))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 LT={scanLimit:500},RT=Ks.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=JT(e))}update(e){(e.docChanged||e.viewportChanged||BT(e.startState,e.state)||VT(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=JT(e.view))}},{decorations:e=>e.deco}),zT=Is.low(Xs({class:`cm-changeGutter`,markers:e=>e.plugin(RT)?.gutter||$s.empty}));function BT(e,t){return e.field(DT,!1)!=t.field(DT,!1)}function VT(e,t){return e.facet(wT)!=t.facet(wT)}var HT=Hs.line({class:`cm-changedLine`}),UT=Hs.mark({class:`cm-changedText`}),WT=Hs.mark({tagName:`ins`,class:`cm-insertedLine`}),GT=Hs.mark({tagName:`del`,class:`cm-deletedLine`}),KT=new class extends Ys{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function qT(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,HT),i.add(o,s,n?GT:WT),a&&a.add(o,o,KT);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,HT),a&&a.add(u,u,KT);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,UT),s<t)c++;else break}u=t}}}function JT(e){let t=e.state.field(DT),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(wT),o=n==`a`,s=new Us,c=i?new Us: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))&&qT(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var YT=class extends Fs{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}},XT=Gs.define({map:(e,t)=>e.map(t)}),ZT=zs.define({create:()=>Hs.none,update:(e,t)=>{for(let e of t.effects)if(e.is(XT))return e.value;return e.map(t.changes)},provide:e=>Js.decorations.from(e)}),QT=.01;function $T(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 eE(e,t,n){let r=new Us,i=new Us,a=e.state.field(ZT).iter(),o=t.state.field(ZT).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<-QT?(l-=n,r.add(s,s,Hs.widget({widget:new YT(-n),block:!0,side:-1}))):n>QT&&(u+=n,i.add(c,c,Hs.widget({widget:new YT(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<QT?r.add(e.state.doc.length,e.state.doc.length,Hs.widget({widget:new YT(-p),block:!0,side:1})):p>QT&&i.add(t.state.doc.length,t.state.doc.length,Hs.widget({widget:new YT(p),block:!0,side:1}));let m=r.finish(),h=i.finish();$T(m,e.state.field(ZT))||e.dispatch({effects:XT.of(m)}),$T(h,t.state.field(ZT))||t.dispatch({effects:XT.of(h)})}var tE=Gs.define({map:(e,t)=>t.mapPos(e)}),nE=class extends Fs{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:tE.of(n)});let{side:r,sibling:i}=e.state.facet(wT);i&&i().dispatch({effects:tE.of(rE(n,e.state.field(DT),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function rE(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 iE=zs.define({create(e){return Hs.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(tE)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Js.decorations.from(e)});function aE({margin:e=3,minSize:t=4}){return iE.init(n=>oE(n,e,t))}function oE(e,t,n){let r=new Us,i=e.facet(wT).side==`a`,a=e.field(DT),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,Hs.replace({widget:new nE(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var sE=Js.styleModule.of(new Zs({".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`}})),cE=Js.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`}}),lE=new qs,uE=new qs,dE=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||LT;let t=[Is.low(RT),cE,sE,ZT,Js.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(XT)))&&this.measure()})],n=[wT.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(zT);let r=Rs.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Js.editorAttributes.of({class:`cm-merge-a`}),uE.of(n),t]}),i=[wT.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(zT);let a=Rs.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Js.editorAttributes.of({class:`cm-merge-b`}),uE.of(i),t]});this.chunks=kT.build(r.doc,a.doc,this.diffConf);let o=[DT.init(()=>this.chunks),lE.of(e.collapseUnchanged?aE(e.collapseUnchanged):[])];r=r.update({effects:Gs.appendConfig.of(o)}).state,a=a.update({effects:Gs.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 Js({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Js({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),Ls.empty(e[0].startState.doc.length));this.chunks=t==this.a?kT.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):kT.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:TT.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:TT.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(wT),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(uE.reconfigure([wT.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?zT:[]])),a.push(uE.reconfigure([wT.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?zT:[]]))}if(r){let t=lE.reconfigure(e.collapseUnchanged?aE(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(){eE(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=fE(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=fE(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 fE(e){let t=e.nextSibling;return e.remove(),t}var pE=new class extends Ys{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},mE=Is.low(Xs({class:`cm-changeGutter`,markers:e=>e.plugin(RT)?.gutter||$s.empty,widgetMarker:(e,t)=>t instanceof yE?pE:null}));function hE(e){let t=typeof e.original==`string`?Vs.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||LT;return[Is.low(RT),wE,cE,Js.editorAttributes.of({class:`cm-merge-b`}),ET.of((e,t)=>{let r=t.effects.find(e=>e.is(gE));return r&&(e=kT.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=kT.updateB(e,t.state.field(_E),t.newDoc,t.changes,n)),e}),wT.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?AE:void 0,side:`b`}),_E.init(()=>t),e.gutter===!1?[]:mE,e.collapseUnchanged?aE(e.collapseUnchanged):[],DT.init(e=>kT.build(t,e.doc,n))]}var gE=Gs.define(),_E=zs.define({create:()=>Vs.empty,update(e,t){for(let n of t.effects)n.is(gE)&&(e=n.value.doc);return e}}),vE=new WeakMap,yE=class extends Fs{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 bE(e,t,n){let r=vE.get(t.changes);if(r)return r;let i=Hs.widget({block:!0,side:-1,widget:new yE(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(wT),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(),xE(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),SE(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(_E).sliceString(t.fromA,t.endA),u=a&&e.facet(ec),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)==`
27
27
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
28
- `,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;Bs(t,{style:t=>tc(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 vE.set(t.changes,i),i}function xE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(DT).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(_E);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Ls.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:gE.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function SE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(DT).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(_E).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 CE(e){let t=new Us;for(let n of e.field(DT)){let r=e.facet(wT).overrideChunk&&EE(e,n);t.add(n.fromB,n.fromB,bE(e,n,!!r))}return t.finish()}var wE=zs.define({create:e=>CE(e),update(e,t){return t.state.field(DT,!1)==t.startState.field(DT,!1)?e:CE(t.state)},provide:e=>Js.decorations.from(e)}),TE=new WeakMap;function EE(e,t){let n=TE.get(t);if(n!==void 0)return n;n=null;let r=e.field(_E),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(Hs.widget({widget:new DE(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(UT.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return TE.set(t,n),n}var DE=class extends Fs{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}},OE=new class extends Ys{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},kE=Hs.line({class:`cm-inlineChangedLine`});function AE(e,t,n,r){let i=EE(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,OE),n.add(o.from,o.from,kE);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 jE=Qt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),ME=ne({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),NE=Js.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 PE({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 FE(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:_}=Wr(),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`?jE:ME,u=[Js.editable.of(!1),Rs.readOnly.of(!0)],d=[mc,ue(),...u,l,Js.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new Js({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=PE({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 Js({doc:p,extensions:[mc,ue(),Js.editable.of(!1),l,NE,Js.lineWrapping,hE({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),Js.updateListener.of(e=>{let t=OT(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=OT(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new dE({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new Js({doc:p,extensions:[...d,hE({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 Js)||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 Js)||N(e)},t[13]=A):A=t[13];let j=A,M=b===0,P;t[14]!==f||t[15]!==b?(P=b===null?``:b===0?f({id:`lPzyrU`}):lr._({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,Pc.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]!==M||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 ${M?`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:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,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 IE(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 LE(e,t){return IE(e,`content`,t)}async function RE(e){return IE(e,`mine`)}async function zE(e){return IE(e,`theirs`)}async function BE(e){return IE(e,`delete`)}async function VE(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 HE(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=to(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Pn(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),VE(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 LE(u,e);t.ok||gs.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),gs.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)(FE,{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(BE),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(zE),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)(FE,{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(RE),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(BE),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)(FE,{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 UE(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Rt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var WE=`__back-nav__`;function GE(e){return e instanceof Fe||e instanceof _t||e instanceof Oe||e instanceof Qe||e instanceof At||e instanceof it?e.docName:null}function KE(e){if(e instanceof Fe){let t=e.docName;return{title:lr._({id:`Jejur6`}),summary:lr._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof _t){let t=e.docName;return{title:lr._({id:`V7QxyT`}),summary:lr._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Oe){let t=e.docName;return{title:lr._({id:`1di5fu`}),summary:lr._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Qe){let t=e.docName;return{title:lr._({id:`wvbc1r`}),summary:lr._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof At)return{title:lr._({id:`Gfr4fu`}),summary:lr._({id:`j6LB7S`})};if(e instanceof it){let t=e.docName;return{title:lr._({id:`vv7kpg`}),summary:lr._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:lr._({id:`W5A0Ly`});return{title:lr._({id:`29VNqC`}),summary:t}}function qE(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=KE(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)(nx,{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||(ct(GE(n)??i),o(a),r(WE))},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 JE(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)(qE,{...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]===WE){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}: ${KE(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 YE(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Or(t);return{map:n,keys:mr(t),parseError:r}}function XE(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>YE(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=Ri(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=Ye(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=dt(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(ZE,{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)(QE,{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 ZE(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 QE(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 $E(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Or(t);return{map:n,keys:mr(t),parseError:r}}function eD(e){let t=(0,$.c)(124),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>$E(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=Ri(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]!==r||t[9]!==a?(M=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=wr(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=M):M=t[10];let N=M,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=P):P=t[11];let F=P,I;t[12]===r?I=t[13]:(I=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=I);let L=I,R;t[14]!==N||t[15]!==L?(R=function(e,t){F(e),L(N({[e]:t}),[e])},t[14]=N,t[15]=L,t[16]=R):R=t[16];let z=R,B;t[17]!==N||t[18]!==L?(B=function(e){F(e),L(N({[e]:null}),[e])},t[17]=N,t[18]=L,t[19]=B):B=t[19];let V=B,H;t[20]!==r||t[21]!==a?(H=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=wr(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=H):H=t[22];let U=H,W;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(W=function(e,t){return`${e} ${t}`},t[23]=W):W=t[23];let G=W,K;t[24]!==a||t[25]!==m?(K=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)=>G(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=K):K=t[26];let q=K,J;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(J={activationConstraint:{distance:4}},t[27]=J):J=t[27];let Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y={coordinateGetter:ja},t[28]=Y):Y=t[28];let ee=lo(uo(Ro,J),uo(La,Y)),te;t[29]!==z||t[30]!==p?(te=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=za(n,t);(!Object.hasOwn(p,e)||!nD(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=te):te=t[31];let ne=te,re;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=re):re=t[32];let ie=re,{addPropertySignal:ae,clearAddProperty:oe}=nS(),se;t[33]!==ae||t[34]!==j?(se=ae.get(j)??0,t[33]=ae,t[34]=j,t[35]=se):se=t[35];let ce=se,le,ue;t[36]===ce?(le=t[37],ue=t[38]):(le=()=>{ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},ue=[ce],t[36]=ce,t[37]=le,t[38]=ue),(0,Q.useEffect)(le,ue);let de,fe;t[39]!==oe||t[40]!==j?(de=()=>()=>oe(j),fe=[j,oe],t[39]=oe,t[40]=j,t[41]=de,t[42]=fe):(de=t[41],fe=t[42]),(0,Q.useEffect)(de,fe);let pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Na[e];return{...t,type:e,value:n,error:null}})},t[43]=pe):pe=t[43];let me=pe,he;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){S(t=>t&&{...t,value:e})},t[44]=he):he=t[44];let _e=he,ve;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=ve):ve=t[45];let ye=ve,be;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(be=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=N({[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[46]=r,t[47]=x,t[48]=N,t[49]=p,t[50]=be):be=t[50];let xe=be,Se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){S(null)},t[51]=Se):Se=t[51];let Ce=Se,we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){w({key:e,draft:e,error:null})},t[52]=we):we=t[52];let Te=we,Ee;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Ee):Ee=t[53];let De=Ee,Oe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){w(null)},t[54]=Oe):Oe=t[54];let ke=Oe,Ae;t[55]!==r||t[56]!==p||t[57]!==U||t[58]!==C?(Ae=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=U(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}),F(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=U,t[58]=C,t[59]=Ae):Ae=t[59];let je=Ae,Me;t[60]!==p||t[61]!==m?(Me=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=Me):Me=t[62];let Ne=Me,Pe;if(t[63]!==Ne){Pe=new Map;for(let e of Ne)Pe.set(e,(Pe.get(e)??0)+1);t[63]=Ne,t[64]=Pe}else Pe=t[64];if(Ne.length===0&&!x&&!h)return null;let Fe=!g,Ie;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>_(!e),t[65]=Ie):Ie=t[65];let Le=!g,Re;t[66]===Le?Re=t[67]:(Re=(0,Z.jsx)(_s,{"data-expanded":Le,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Le,t[67]=Re);let ze;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=ze):ze=t[68];let Be;t[69]===Re?Be=t[70]:(Be=(0,Z.jsx)(bs,{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:[Re,ze]})}),t[69]=Re,t[70]=Be);let Ve;t[71]===h?Ve=t[72]:(Ve=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)(Di,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=Ve);let He;if(t[73]!==Ne){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>G(e,t),t[75]=e):e=t[75],He=Ne.map(e),t[73]=Ne,t[74]=He}else He=t[74];let Ue;if(t[76]!==z||t[77]!==je||t[78]!==Pe||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==V||t[83]!==C||t[84]!==Ne||t[85]!==k||t[86]!==ne){let e;t[88]!==z||t[89]!==je||t[90]!==Pe||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==V||t[95]!==C||t[96]!==k||t[97]!==ne?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??Hi(n),i=C?.key===e?C:null,a=(Pe.get(e)??0)>1;return(0,Z.jsx)(qa,{sortableId:G(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Te(e),onChangeDraft:De,onCommit:je,onCancel:ke},onCommit:t=>z(e,t),onChangeType:t=>ne(e,t),onRemove:()=>V(e)},`${e}-${t}`)},t[88]=z,t[89]=je,t[90]=Pe,t[91]=E,t[92]=p,t[93]=y,t[94]=V,t[95]=C,t[96]=k,t[97]=ne,t[98]=e):e=t[98],Ue=Ne.map(e),t[76]=z,t[77]=je,t[78]=Pe,t[79]=E,t[80]=p,t[81]=y,t[82]=V,t[83]=C,t[84]=Ne,t[85]=k,t[86]=ne,t[87]=Ue}else Ue=t[87];let We;t[99]!==He||t[100]!==Ue?(We=(0,Z.jsx)(es,{items:He,strategy:so,children:Ue}),t[99]=He,t[100]=Ue,t[101]=We):We=t[101];let Ge;t[102]!==q||t[103]!==ee||t[104]!==We?(Ge=(0,Z.jsx)(ka,{sensors:ee,collisionDetection:Fa,onDragEnd:q,children:We}),t[102]=q,t[103]=ee,t[104]=We,t[105]=Ge):Ge=t[105];let Ke;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(Ke=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(qa,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:tD},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=Ke):Ke=t[110];let qe;t[111]!==r||t[112]!==x||t[113]!==xe?(qe=x?(0,Z.jsx)(Ua,{draft:x,onChangeName:ye,onChangeType:me,onChangeValue:_e,onCommit:xe,onCancel:Ce}):(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:ie,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(ge,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=xe,t[114]=qe):qe=t[114];let X;t[115]!==Ve||t[116]!==Ge||t[117]!==Ke||t[118]!==qe?(X=(0,Z.jsxs)(ys,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Ve,Ge,Ke,qe]}),t[115]=Ve,t[116]=Ge,t[117]=Ke,t[118]=qe,t[119]=X):X=t[119];let Je;return t[120]!==Fe||t[121]!==Be||t[122]!==X?(Je=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(xs,{open:Fe,onOpenChange:Ie,children:[Be,X]})}),t[120]=Fe,t[121]=Be,t[122]=X,t[123]=Je):Je=t[123],Je}function tD(){}function nD(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}var rD=G(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function iD(e){let t=e.threshold??rD;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function aD(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var oD=G(`ACTIVITY_MOUNT_LIMIT`,3);function sD(){return n(()=>import(`./SourceEditor-DOh6wSxy.js`),__vite__mapDeps([47,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,48,24,46]),import.meta.url)}var cD=(0,Q.lazy)(async()=>({default:(await sD()).SourceEditor}));function lD(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ge(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 uD(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:lr._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?lr._({id:`Sc1bKE`,values:{docName:e}}):lr._({id:`ovIGrT`,values:{docName:e}}),actionLabel:lr._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:lr._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?lr._({id:`bmC18N`,values:{docName:e}}):lr._({id:`pAgkuZ`,values:{docName:e}})}:null}function dD(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}=pt(),{pages:u,loading:d}=ki(),f=lD(c,n,oD),p=(0,Q.useRef)(``),h=f.map(pD).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)M(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;ie(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)(yD,{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 pD(e){return e.docName}function mD(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 hD(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)(yb,{}),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)(cD,{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 gD(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)(fo,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(wt,{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:_D,children:[(0,Z.jsx)(fo,{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 _D(){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 yD(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=uD(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=HS(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=iD({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=()=>st(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=()=>{aD({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)(gD,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(JE,{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)(yb,{}),children:(0,Z.jsx)(UE,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(HE,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(XE,{provider:n.provider}),!i&&(0,Z.jsx)(eD,{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)(hD,{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)(Vw,{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)(mD,{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 bD(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function xD(e){let{value:t,unit:n}=bD(e);return n===`rem`?t*16:t}function SD(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var CD=3600*24*7;function wD(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?TD:m,O=g===void 0?CD:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=xD(b),J;t[6]===x?J=t[7]:(J=xD(x),t[6]=x,t[7]=J);let Y=J,ee;t[8]!==E||t[9]!==k?(ee=function(e){E&&(P.current=!0,j.current=H.current?0:xD(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=ee):ee=t[10];let te=ee,ne,re;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==Y||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ne=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=bD(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(Y,t)),u=SD(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(Y,u)),f=SD(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},re=[i,a,D,q,Y,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=Y,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=re):(ne=t[24],re=t[25]),(0,Q.useEffect)(ne,re);let ie;return t[26]===te?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=ie),ie}function TD(){}var ED=3600*24*7,DD=`18rem`,OD=`3rem`,kD=`app-file-sidebar`,AD=`14.625rem`,jD=`32rem`,MD=`sidebar_width`,ND=/^\d+(?:\.\d+)?(?:rem|px)$/,PD=Q.createContext(null);function FD(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${MD}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return ND.test(n)?n:e}function ID(){let e=Q.use(PD);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function LD(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?DD:c,[u]=Q.useState(zD),d;t[8]===u?d=t[9]:(d=()=>QS(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>FD(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=aC();return sC(`left`,QS(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),cC(`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(RD)},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: ${YS}px)`),t=()=>{let e=QS(u,window.innerWidth,`left`);p(e),C(sC(`left`,e,aC())===`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(kD)?.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=>{Ns(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":OD,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Gi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(PD.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function RD(e){return!e}function zD(){return or()}function BD(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}=ID();if(d===`none`){let e;t[7]===r?e=t[8]:(e=Gi(`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]:(_=Gi(`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=Gi(`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:kD,"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 VD(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}=ID(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=Ps(`toggle-files-sidebar`);l=Qi,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=kD,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]:(_=Gi(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)(I,{}):(0,Z.jsx)(gl,{}),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 HD(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}=ID(),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:AD,maxResizeWidth:jD,setIsDraggingRail:h,widthCookieName:MD,widthCookieMaxAge:ED},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}=wD(_),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=Gi(`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 UD(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}=ID(),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=Gi(`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 WD(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=Gi(`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 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=Gi(`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 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=Gi(`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 qD(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=Gi(`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 JD(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=Gi(`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 YD=ea(`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 XD(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?qi:`button`,{state:m}=ID(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Gi(YD({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)(Tr,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(nr,{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)(Yn,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function ZD(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function QD(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Xr.safeParse(t);return n.success?n.data.currentBranch??null:null}var $D=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:ZD({fetchBranch:QD,subscribeToEvent:ii}),eO=$D.subscribe,tO=$D.getSnapshot;function nO(){return(0,Q.useSyncExternalStore)(eO,tO,tO)}function rO(){let e=(0,$.c)(6),t=nO(),n=Mo(),{state:r}=ID(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&Jo(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function iO(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=rO();if(!o&&l===null)return null;let u=r??n,d=r!=null,{words:f,chars:p,tokens:m}=u,h;t[0]!==c||t[1]!==d||t[2]!==o?(h=c(o?d?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=c,t[1]=d,t[2]=o,t[3]=h):h=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=g):g=t[4];let _;t[5]===l?_=t[6]:(_=l===null?null:(0,Z.jsx)(aO,{identity:l}),t[5]=l,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[7]=_,t[8]=v);let y;t[9]!==c||t[10]!==u.chars||t[11]!==u.tokens||t[12]!==u.words||t[13]!==p||t[14]!==d||t[15]!==o||t[16]!==m||t[17]!==f?(y=o?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[d?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:c({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:f}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:p}})]}),(0,Z.jsxs)(`span`,{children:[u.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:m}})]})]}):null,t[9]=c,t[10]=u.chars,t[11]=u.tokens,t[12]=u.words,t[13]=p,t[14]=d,t[15]=o,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==h||t[20]!==v||t[21]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":h,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[g,v,y]}),t[19]=h,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function aO(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(nr,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(Ae,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function oO(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=Gi(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 sO(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=Gi(`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 cO(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=Gi(`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 lO(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=Gi(`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 uO(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=Gi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(_s,{}),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 dO=1,fO=2,pO=4;function mO(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>pO?[...u.slice(0,dO).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(dO,-fO)},...u.slice(-fO).map((e,t)=>d(e,u.length-fO+t))]:u.map((e,t)=>d(e,t));a=oO,t[8]===r?c=t[9]:(c=Gi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=sO,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(hO)}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 hO(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(uO,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(cO,{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)(qc,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(cO,{className:`min-w-0`,children:(0,Z.jsx)(lO,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var gO={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`},_O=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`,...gO,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},vO=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)(_O,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},yO=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)(_O,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function bO(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=Ms(`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=Ps(`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)(mO,{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)(Tr,{children:(0,Z.jsx)(yO,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(rs,{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)(nr,{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)(Yn,{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)(vO,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(rs,{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)(nr,{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)(Yn,{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)(as,{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)(Yn,{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)(Tr,{children:(0,Z.jsx)(ll,{})})}),(0,Z.jsx)(nr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=Yn,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)(Tr,{children:u?(0,Z.jsx)(vl,{}):(0,Z.jsx)(_l,{})}),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)(nr,{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 xO(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var SO=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-ryZpdhrg.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 CO(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(TO,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(wO,{}),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)(eS,{children:[n,r]})}),t[3]=n,t[4]=i),i}function wO(){let e=(0,$.c)(5),t=fh(),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)(dS,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function TO(e){let t=(0,$.c)(144),{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:_}=pt(),{openDocumentTransition:v}=Et(),{requestAddProperty:y}=nS(),b=BS(f,d),x=US(d,n===`source`?`source`:`wysiwyg`),S=lC(f),C=S===`connected`||S===`synced`,w=HS(d)===`conflict`,T=(0,Q.useDeferredValue)(d),E=p?.kind===`missing`,D=!!d&&p?.kind!==`folder`,O;t[0]!==u||t[1]!==E?(O=E?u({id:`K-a33w`}):void 0,t[0]=u,t[1]=E,t[2]=O):O=t[2];let k=O,[A]=(0,Q.useState)(DO),j=A!==null,M;t[3]===A?M=t[4]:(M=()=>QS(A,window.innerWidth,`right`),t[3]=A,t[4]=M);let[N,P]=(0,Q.useState)(M),F=(0,Q.useRef)(N),I,L;t[5]===N?(I=t[6],L=t[7]):(I=()=>{F.current=N},L=[N],t[5]=N,t[6]=I,t[7]=L),(0,Q.useEffect)(I,L);let R=sb(),z;t[8]===N?z=t[9]:(z=()=>sC(`right`,N,aC())===`collapsed`,t[8]=N,t[9]=z);let[B]=(0,Q.useState)(z),[V,H]=(0,Q.useState)(B),W=(0,Q.useRef)(V),G,K;t[10]===V?(G=t[11],K=t[12]):(G=()=>{W.current=V},K=[V],t[10]=V,t[11]=G,t[12]=K),(0,Q.useEffect)(G,K);let[q,J]=(0,Q.useState)(!1),Y=(0,Q.useRef)(!1),[ee]=(0,Q.useState)(EO),te=(0,Q.useRef)(ee),ne=(0,Q.useRef)(null),re;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(e){ne.current!=null&&clearTimeout(ne.current),ne.current=setTimeout(()=>{qS(e),ne.current=null},100)},t[13]=re):re=t[13];let ie=re,ae,oe;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>()=>{ne.current!=null&&clearTimeout(ne.current)},ae=[],t[14]=ae,t[15]=oe):(ae=t[14],oe=t[15]),(0,Q.useEffect)(oe,ae);let[se,ce]=(0,Q.useState)(null),le;t[16]!==V||t[17]!==R?(le=function(){if(R.current==null)return;let e=F.current;V?(cC(`right`,e,`open`),R.current?.expand()):(cC(`right`,e,`collapsed`),R.current?.collapse())},t[16]=V,t[17]=R,t[18]=le):le=t[18];let ue=le,de,fe;t[19]!==A||t[20]!==R?(de=()=>{let e=window.matchMedia(`(min-width: ${XS}px)`),t=()=>{let e=QS(A,window.innerWidth,`right`);P(e);let t=sC(`right`,e,aC())===`collapsed`;H(t),t?R.current?.collapse():R.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},fe=[A,R],t[19]=A,t[20]=R,t[21]=de,t[22]=fe):(de=t[21],fe=t[22]),(0,Q.useEffect)(de,fe);let pe,me;t[23]!==se||t[24]!==j||t[25]!==R?(pe=()=>{if(se==null||j)return;let e=new ResizeObserver(()=>{W.current||Y.current||R.current?.resize(`${te.current}px`)});return e.observe(se),()=>e.disconnect()},me=[se,j,R],t[23]=se,t[24]=j,t[25]=R,t[26]=pe,t[27]=me):(pe=t[26],me=t[27]),(0,Q.useEffect)(pe,me);let he,ge;t[28]!==o||t[29]!==R?(he=()=>{let e=e=>{o(e),R.current?.expand()},t=gm();return t&&e(t),vm(t=>{gm(),e(t)})},ge=[o,R],t[28]=o,t[29]=R,t[30]=he,t[31]=ge):(he=t[30],ge=t[31]),(0,Q.useEffect)(he,ge);let _e,ve;t[32]!==_||t[33]!==R?(_e=()=>{_!==0&&R.current?.expand()},ve=[_,R],t[32]=_,t[33]=R,t[34]=_e,t[35]=ve):(_e=t[34],ve=t[35]),(0,Q.useEffect)(_e,ve);let ye,be;t[36]===V?(ye=t[37],be=t[38]):(ye=()=>{if(!V||!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()},be=[V],t[36]=V,t[37]=ye,t[38]=be),(0,Q.useLayoutEffect)(ye,be);let xe,Se;t[39]===V?(xe=t[40],Se=t[41]):(xe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!V})},Se=[V],t[39]=V,t[40]=xe,t[41]=Se),(0,Q.useEffect)(xe,Se);let Ce,we;t[42]===ue?(Ce=t[43],we=t[44]):(Ce=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&ue()})},we=[ue],t[42]=ue,t[43]=Ce,t[44]=we),(0,Q.useEffect)(Ce,we);let Te,Ee;t[45]===ue?(Te=t[46],Ee=t[47]):(Te=()=>{if(window.okDesktop!=null)return;let e=e=>{Ns(e,`toggle-document-panel`)&&(e.preventDefault(),ue())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ee=[ue],t[45]=ue,t[46]=Te,t[47]=Ee),(0,Q.useEffect)(Te,Ee);let De=(0,Q.useRef)(null),[Oe,ke]=(0,Q.useState)(null),Ae=p?.kind===`large-file`?p.docName:d,je,Me;t[48]===Ae?(je=t[49],Me=t[50]):(je=()=>{if(Ae&&Ae!==De.current){let e=De.current;De.current=Ae,ke(e)}},Me=[Ae],t[48]=Ae,t[49]=je,t[50]=Me),(0,Q.useEffect)(je,Me);let Ne;t[51]===v?Ne=t[52]:(Ne=function(e){let t=gr(e);window.location.hash===t?v(e):window.location.hash=t},t[51]=v,t[52]=Ne);let Pe=Ne;if(p?.kind===`large-file`){let e;t[53]!==Pe||t[54]!==Oe?(e=Oe?{previousDocName:Oe,onNavigateBack:Pe}:void 0,t[53]=Pe,t[54]=Oe,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)(Xx,{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)(Kx,{folderPath:p.folderPath}),t[61]=p.folderPath,t[62]=e),e}let e;t[63]===p.folderPath?e=t[64]:(e=(0,Z.jsx)(_S,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(Kx,{folderPath:p.folderPath})}),t[63]=p.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(vS,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(_S,{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)(SO,{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)(gS,{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)(vb,{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`?yr(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yb,{}),t[72]=e):e=t[72],e}let e;return t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yx,{}),t[73]=e):e=t[73],e}let Fe=n===`source`,Ie=!C,Le=V,Re;t[74]!==d||t[75]!==y?(Re=function(){d&&y(d)},t[74]=d,t[75]=y,t[76]=Re):Re=t[76];let Be=Re,Ve=T??d,He=Oe??void 0,Ue;t[77]!==k||t[78]!==Fe||t[79]!==Pe||t[80]!==m||t[81]!==Ve||t[82]!==He?(Ue=(0,Z.jsx)(dD,{activeDocName:Ve,isSourceMode:Fe,editorPlaceholder:k,previousDocName:He,onNavigateBack:Pe,onRecycle:m}),t[77]=k,t[78]=Fe,t[79]=Pe,t[80]=m,t[81]=Ve,t[82]=He,t[83]=Ue):Ue=t[83];let We;t[84]!==d||t[85]!==Fe?(We=(0,Z.jsx)(IS,{activeDocName:d,isSourceMode:Fe}),t[84]=d,t[85]=Fe,t[86]=We):We=t[86];let Ge;t[87]!==d||t[88]!==T?(Ge=xO({activeDocName:d,deferredActiveDocName:T,mountResolved:d!==null&&U(d),syncResolved:d!==null&&ze(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(yb,{}),d===null?null:(0,Z.jsx)(Zx,{docName:d})]}):null,t[87]=d,t[88]=T,t[89]=Ge):Ge=t[89];let Ke;t[90]!==Ue||t[91]!==We||t[92]!==Ge?(Ke=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[Ue,We,Ge]}),t[90]=Ue,t[91]=We,t[92]=Ge,t[93]=Ke):Ke=t[93];let qe;t[94]!==d||t[95]!==w||t[96]!==Le||t[97]!==Fe||t[98]!==r||t[99]!==Be||t[100]!==Ie||t[101]!==ue?(qe=!w&&(0,Z.jsx)(bO,{activeDocName:d,isSourceMode:Fe,sourceDisabled:Ie,onModeChange:r,showAddPropertyButton:!Fe,onAddProperty:Be,isPanelCollapsed:Le,onTogglePanel:ue}),t[94]=d,t[95]=w,t[96]=Le,t[97]=Fe,t[98]=r,t[99]=Be,t[100]=Ie,t[101]=ue,t[102]=qe):qe=t[102];let X;t[103]!==Ke||t[104]!==qe?(X=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[Ke,qe]}),t[103]=Ke,t[104]=qe,t[105]=X):X=t[105];let Je;t[106]!==x||t[107]!==D||t[108]!==b?(Je=(0,Z.jsx)(iO,{stats:b,selectionStats:x,showStats:D}),t[106]=x,t[107]=D,t[108]=b,t[109]=Je):Je=t[109];let Ye;t[110]!==X||t[111]!==Je?(Ye=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[X,Je]}),t[110]=X,t[111]=Je,t[112]=Ye):Ye=t[112];let Xe=Ye,Ze=q||void 0,Qe;t[113]===B?Qe=t[114]:(Qe=B?{defaultSize:`100%`}:{},t[113]=B,t[114]=Qe);let $e=q?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,et;t[115]!==Xe||t[116]!==Qe||t[117]!==$e?(et=(0,Z.jsx)(_S,{minSize:`30%`,...Qe,className:$e,children:Xe}),t[115]=Xe,t[116]=Qe,t[117]=$e,t[118]=et):et=t[118];let tt=j&&V,nt;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(nt=()=>{J(!0),Y.current=!0;let e=()=>{J(!1),Y.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[119]=nt):nt=t[119];let rt;t[120]===tt?rt=t[121]:(rt=(0,Z.jsx)(vS,{withHandle:!0,disabled:tt,onPointerDown:nt}),t[120]=tt,t[121]=rt);let it=B?0:`${ee}px`,at;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(at=e=>{H(e.asPercentage===0),e.inPixels>0&&Y.current&&(te.current=e.inPixels,ie(e.inPixels))},t[122]=at):at=t[122];let ot=!q&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,st;t[123]===ot?st=t[124]:(st=Gi(`flex flex-col bg-muted/20`,ot),t[123]=ot,t[124]=st);let ct;t[125]!==d||t[126]!==a||t[127]!==h||t[128]!==Fe||t[129]!==o||t[130]!==c||t[131]!==l?(ct=(0,Z.jsx)(mv,{docName:d,isSourceMode:Fe,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l}),t[125]=d,t[126]=a,t[127]=h,t[128]=Fe,t[129]=o,t[130]=c,t[131]=l,t[132]=ct):ct=t[132];let lt;t[133]!==V||t[134]!==R||t[135]!==it||t[136]!==st||t[137]!==ct?(lt=(0,Z.jsx)(_S,{id:`doc-panel`,panelRef:R,defaultSize:it,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:at,inert:V,className:st,children:ct}),t[133]=V,t[134]=R,t[135]=it,t[136]=st,t[137]=ct,t[138]=lt):lt=t[138];let ut;return t[139]!==Ze||t[140]!==et||t[141]!==rt||t[142]!==lt?(ut=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:ce,children:(0,Z.jsxs)(gS,{orientation:`horizontal`,"data-dragging":Ze,children:[et,rt,lt]})}),t[139]=Ze,t[140]=et,t[141]=rt,t[142]=lt,t[143]=ut):ut=t[143],ut}function EO(){return JS()}function DO(){return or()}function OO(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 kO(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 AO=1e3,jO=!1;function MO(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function NO(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:pa(i)?a=i:(a=void 0,jO||(jO=!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`&&(MO({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=kO(i),{current:c,crossDoc:l}=a?ca(a,n,Date.now()):{current:[],crossDoc:[]},u=PO,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>OO(e.current,p)&&OO(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,AO);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 PO(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var FO=`sync-status`;function IO(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,gs.warning(r({id:`HGNCsl`}),{id:FO,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,gs.success(r({id:`GhjUB_`}),{id:FO,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 LO=4,RO=3,zO={Bird:Mc,Cat:Rc,Dog:Kc,Fish:Zc,Mouse:Cl,Rabbit:Sl,Shrimp:Al,Snail:jl,Squirrel:Pl,Turtle:zl};Object.freeze(Object.keys(zO));function BO(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(zO,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var VO={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function HO(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=BO(n),c=s.kind===`animal`?zO[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=er(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Oi(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)(Tr,{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)(nr,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Yn,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function UO(e){let t=VO[e.icon];return e.displayName||t||lr._({id:`iEQQyu`})}function WO(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 GO(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=pt(),{presence:u,agentId:d}=n,f=UO(u),p=WO(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)(da,{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)(da,{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)(Tr,{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)(nr,{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)(Yn,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function KO(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?lr._({id:`9euN0m`,values:{count:n}}):lr._({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)(HO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(GO,{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 qO(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(HO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(GO,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function JO(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=pt(),{current:s,crossDoc:c}=NO(t,r,n);if(IO(lC(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,LO),n;e[6]===s?n=e[7]:(n=s.slice(LO),e[6]=s,e[7]=n);let r=n,u=c.slice(0,RO),d;e[8]===c?d=e[9]:(d=c.slice(RO),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=>qO(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)(KO,{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=>qO(e,p,!0,m)),f.length>0?(0,Z.jsx)(KO,{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 YO=`.md`,XO=/\.(md|mdx)$/i;function ZO(e,t=YO){return`${e}${t}`}function QO(e){return yk(e).replace(XO,``)}function $O(e){return Li(e)?nk(e.path):kr(e)?e.path:ZO(e.docName,e.docExt)}function ek(e){let t=yk(e).match(XO);return t?`.${t[1].toLowerCase()}`:void 0}function tk(e){return yk(e)}function nk(e){let t=yk(e.trim());return t?`${t}/`:``}function rk(e){return e.endsWith(`/`)?tk(e):QO(e)}function ik(e){return e.map($O)}function ak(e){return[...e].sort().join(`\0`)}function ok(e){return ak(ik(e))}function sk(e){let t=new Set;for(let n of e){if(Li(n)){let e=nk(n.path);e&&t.add(e)}let e=(Li(n)||kr(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Li(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=yk(e.replace(XO,``)).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 lk(e,t,n){let r=ek(e);if(r)return r;let i=n.find(e=>zn(e)&&e.docName===t);return i?i.docExt??YO:vk(e).includes(`.`)?void 0:YO}function uk(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(!kr(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 dk(e,t,n){if(ek(e))return null;let r=n.find(e=>kr(e)&&e.path===t);return r?r.path:vk(e).includes(`.`)?t:uk(t,n)}function fk(e,t){let n=e.kind===`directory`,r=n?tk(e.path):QO(e.path);if(n)return{kind:`folder`,name:yk(vk(e.path)).replace(XO,``),path:r,treePath:mk(e.path,!0)};let i=dk(e.path,r,t);if(i)return{kind:`asset`,name:yk(vk(i)),path:i,treePath:i};let a=lk(e.path,r,t);return{kind:`file`,name:yk(vk(e.path)).replace(XO,``),path:r,treePath:mk(e.path,!1),docExt:a}}function pk(e){return e.kind===`directory`?tk(e.path):e.path}function mk(e,t){return t?nk(e):XO.test(e)?e:`${e}${YO}`}function hk(e,t,n){let r=nk(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}${YO}`;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 gk(e,t){return e===`file`?mk(t,!1):`${tk(t)}/index${YO}`}function _k(e,t){return t.kind===`root`||t.directoryPath==null?vk(e):`${t.directoryPath}${vk(e)}`}function vk(e){let t=yk(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function yk(e){return e.endsWith(`/`)?e.slice(0,-1):e}function bk(e,t){return t.trim()}function xk(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function Sk(e,t){let n=bk(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function Ck(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=>zn(e)?{...e,docName:i.get(e.docName)??e.docName}:Li(e)?{...e,path:Ak(e.path,n)}:kr(e)?{...e,path:a.get(e.path)??Ak(e.path,n)}:e)}function wk(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=>zn(e)?!i.has(e.docName)&&!Pk(e.docName,n):Li(e)?!Pk(e.path,n):kr(e)?!a.has(e.path)&&!Pk(e.path,n):!0)}function Tk(e,t){if(e.kind!==`asset`||t.some(t=>kr(t)&&t.path===e.path))return e;let n=uk(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function Ek(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>jk(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>zn(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=>Li(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(zn(i)){let e=Nk(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Li(i)){let e=Mk(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function Dk(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function Ok(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function kk(e,t){let n=e.kind===`file`?ZO(e.path,e.docExt):e.path;return Lh(t.contentDir,n,t.pathSeparator)}function Ak(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 jk(e,t){return zn(e)&&zn(t)?e.docName===t.docName:Li(e)&&Li(t)||kr(e)&&kr(t)?e.path===t.path:!1}function Mk(e,t,n){return e===t?n:Nk(e,t,n)}function Nk(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function Pk(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function Fk(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)(zu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function Ik(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=Gi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Bu,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lk(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)(qu,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Rk(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=Gi(`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)(Vu,{children:(0,Z.jsx)(Hu,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zk(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=Gi(`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)(Uu,{"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 Bk(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=Gi(`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)(_s,{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)(Ju,{"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 Vk(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=Gi(`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)(Yu,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Hk(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=Gi(`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)(Gu,{children:(0,Z.jsx)(hs,{})})}),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)(Wu,{"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 Uk(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=Gi(`-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)(Ku,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Wk=[`.md`,`.mdx`],Gk=`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`,Kk=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,qk=Gi(Kk,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),Jk=`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`,Yk=`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 Xk(e){return Gi(Yk,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 Zk(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function Qk(e){let t=gr(e);window.location.hash!==t&&(window.location.hash=t)}function $k(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function eA(e,t){let n=[t,...Wk].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 tA(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}=ro(s),m;t[9]===d?m=t[10]:(m=po.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 nA(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=Wt(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=Wt(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)(Ik,{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)(zk,{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)(zk,{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)(zk,{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)(Uk,{}),(0,Z.jsx)(zk,{"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)(Rk,{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)(Fk,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function rA(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)(xl,{"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)(ss,{"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 iA(e){let t=(0,$.c)(1),{docName:n}=e;if(HS(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Di,{"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 aA(){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}=pt(),{_:E}=i(),{pageMeta:D}=ki(),O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,P]=(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?se(a):t?De(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 K=G,q,J;e[10]===t?(q=e[11],J=e[12]):(q=()=>{H.current=t},J=[t],e[10]=t,e[11]=q,e[12]=J),(0,Q.useEffect)(q,J);let Y,ee;e[13]===K?(Y=e[14],ee=e[15]):(Y=()=>{K&&(O.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ee=[K],e[13]=K,e[14]=Y,e[15]=ee),(0,Q.useEffect)(Y,ee);let te,ne;e[16]===k?(te=e[17],ne=e[18]):(te=()=>{k&&(R.current?.focus(),R.current?.select())},ne=[k],e[16]=k,e[17]=te,e[18]=ne),(0,Q.useEffect)(te,ne);let re,ie;e[19]!==v||e[20]!==k?(re=()=>{!k||v.includes(k.tabId)||(B.current=!0,V.current=null,A(null),M(``),P(null),L(!1))},ie=[v,k],e[19]=v,e[20]=k,e[21]=re,e[22]=ie):(re=e[21],ie=e[22]),(0,Q.useEffect)(re,ie);let ae=function(e,t){let n=t.split(`/`);B.current=!1,V.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),P(null)},oe=function(){B.current=!0,V.current=null,A(null),M(``),P(null),L(!1)},ce=async function(){if(B.current){B.current=!1;return}if(z.current)return;let e=k?.docName;if(!e){oe();return}let t=bk(`file`,eA(j,D.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){oe();return}if(t===V.current){R.current?.focus();return}if(!xk(t)){P(E({id:`P8yDjG`})),R.current?.focus();return}let i=Sk({kind:`file`,path:e,name:r},t);z.current=!0,L(!0),P(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(B.current){L(!1),z.current=!1;return}let r=await Tt(n,`Server error (HTTP ${n.status})`);if(!r.ok){P(r.title),L(!1),z.current=!1,V.current=t,R.current?.focus();return}let a=F(li,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=H.current,s=Dk(o,a);Kt(a);let c=!0;try{let e=Ok(a,p(),m);await Promise.all(e.map(e=>l(e))),S(a),Ti([`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}),gs.error(E({id:`MUBR8r`}))}B.current=!0,A(null),M(``),P(null),L(!1),z.current=!1,V.current=null,c&&s&&s!==o&&Qk(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),P(E({id:`HIb0vl`})),L(!1),z.current=!1,V.current=t,R.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===g?ue=e[24]:(ue=new Set(g),e[23]=g,e[24]=ue);let de=ue,fe;e[25]!==u||e[26]!==f||e[27]!==de?(fe=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[25]=u,e[26]=f,e[27]=de,e[28]=fe):fe=e[28];let pe=fe,me;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(me={activationConstraint:{distance:8}},e[29]=me):me=e[29];let he;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(he={coordinateGetter:ja},e[30]=he):he=e[30];let _e=lo(uo(Ro,me),uo(La,he)),ve;e[31]!==C||e[32]!==T?(ve=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(ya([...T],r,i),t)},e[31]=C,e[32]=T,e[33]=ve):ve=e[33];let ye=ve,be=le?``:void 0,xe;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(xe=Gi(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,le&&`[-webkit-app-region:drag]`),e[34]=xe):xe=e[34];let Se=$k,Ce;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=Gi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[35]=Ce):Ce=e[35];let we=ka,Te=Fa,Ee;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ee={container:typeof document<`u`?document.body:void 0},e[36]=Ee):Ee=e[36];let Oe=es,ke;e[37]===T?ke=e[38]:(ke=[...T],e[37]=T,e[38]=ke);let Ae=ao,je=T.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(nA,{tabId:e,canPin:!1,openTabs:T,closeTab:u,closeTabs:pe,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(tA,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Gi(Gk,t?Kk:qk),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:Jk,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:Xk(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(ss,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=Pe(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)(nA,{tabId:e,openTabs:T,closeTab:d,closeTabs:pe,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(tA,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(Gk,n?Kk:qk),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:Jk,onClick:()=>{o(e)},children:[s&&(0,Z.jsx)(`span`,{className:Gi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Gi(`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)(rA,{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)(nA,{tabId:e,openTabs:T,closeTab:d,closeTabs:pe,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(tA,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(Gk,n?Kk:qk),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:Jk,onClick:()=>{o(e)},children:[s?(0,Z.jsx)(`span`,{className:Gi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Gi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(rA,{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-${Zk(a)}`;return(0,Z.jsx)(nA,{disabled:v,tabId:e,openTabs:T,closeTab:d,closeTabs:pe,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsx)(tA,{tabId:e,disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(Gk,n?Kk:qk,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)(yS,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(wS,{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(eA(e.target.value,l)),P(null),V.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),oe())},onBlur:ce}),(0,Z.jsx)(xS,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(CS,{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:Jk,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),ae(e,a)},children:[(0,Z.jsx)(iA,{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)(rA,{accessibleLabel:g,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})})},e)}),Me;e[39]!==Oe||e[40]!==ke||e[41]!==Ae||e[42]!==je?(Me=(0,Z.jsx)(Oe,{items:ke,strategy:Ae,children:je}),e[39]=Oe,e[40]=ke,e[41]=Ae,e[42]=je,e[43]=Me):Me=e[43];let Ne;e[44]!==we||e[45]!==ye||e[46]!==_e||e[47]!==Te||e[48]!==Ee||e[49]!==Me?(Ne=(0,Z.jsx)(we,{sensors:_e,collisionDetection:Te,onDragEnd:ye,accessibility:Ee,children:Me}),e[44]=we,e[45]=ye,e[46]=_e,e[47]=Te,e[48]=Ee,e[49]=Me,e[50]=Ne):Ne=e[50];let Fe;e[51]===E?Fe=e[52]:(Fe=E({id:`3YvS-c`}),e[51]=E,e[52]=Fe);let Ie;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(ge,{"aria-hidden":`true`}),e[53]=Ie):Ie=e[53];let Le;e[54]!==_||e[55]!==Fe?(Le=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Fe,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ie})}),e[54]=_,e[55]=Fe,e[56]=Le):Le=e[56];let Re;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(nr,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[57]=Re):Re=e[57];let ze;e[58]===Le?ze=e[59]:(ze=(0,Z.jsxs)(Yn,{children:[Le,Re]}),e[58]=Le,e[59]=ze);let Be;e[60]!==Ce||e[61]!==Ne||e[62]!==ze?(Be=(0,Z.jsxs)(`div`,{className:Ce,children:[Ne,ze]}),e[60]=Ce,e[61]=Ne,e[62]=ze,e[63]=Be):Be=e[63];let Ve;return e[64]!==be||e[65]!==xe||e[66]!==Se||e[67]!==Be?(Ve=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":be,className:xe,onWheel:Se,children:Be}),e[64]=be,e[65]=xe,e[66]=Se,e[67]=Be,e[68]=Ve):Ve=e[68],Ve}function oA(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:Ne},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:kd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:ar},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:oA},{label:`Twitter`,href:`https://x.com/inkeep`,icon:sA}],lA=()=>{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)(Xe,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Tr,{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)(Yn,{children:[o,(0,Z.jsx)(nr,{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=>co(e,r),onAuxClick:e=>co(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 uA(e){let t=(0,$.c)(75),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=ug(),{dispatch:u}=$h(),{merged:d}=gt(),f=d?.appearance?.preview?.autoOpen??!0,[p,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(!1);if(ih())return null;let g=typeof window<`u`&&window.okDesktop!=null,_=r??p,v;t[0]!==a||t[1]!==r||t[2]!==l?(v=e=>{r===void 0&&m(e),a?.(e),e&&l()},t[0]=a,t[1]=r,t[2]=l,t[3]=v):v=t[3];let y=v,b=n===null,x=!!n?.selection,S;t[4]!==f||t[5]!==n?(S=n!==null&&n.docContext!==null?Ui(n.docContext.relativePath,f):``,t[4]=f,t[5]=n,t[6]=S):S=t[6];let C=S,w;t[7]!==u||t[8]!==n?(w=e=>{n!==null&&u(e.id,n)},t[7]=u,t[8]=n,t[9]=w):w=t[9];let T=w,E,D,O,k,A,j,M,N,P,F,I,L,R,z;if(t[10]!==y||t[11]!==T||t[12]!==n||t[13]!==_||t[14]!==C||t[15]!==c||t[16]!==b){let e;t[31]===c?e=t[32]:(e=e=>c[e.id]?.installed===!0,t[31]=c,t[32]=e),A=sh.filter(e);let r;t[33]===c?r=t[34]:(r=sh.some(e=>c[e.id]?.installed==null),t[33]=c,t[34]=r),j=r,O=c[`claude-code`]?.installed===!0;let i;t[35]!==n||t[36]!==C?(i=()=>{n!==null&&Db(C)},t[35]=n,t[36]=C,t[37]=i):i=t[37],k=i,D=Ya,R=_,z=y,M=!1;let a;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(a=g?()=>{h.current=!0}:void 0,t[38]=a):a=t[38];let o;t[39]===y?o=t[40]:(o=g?()=>{if(h.current){h.current=!1;return}y(!0)}:void 0,t[39]=y,t[40]=o);let l,u;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(ua,{className:`size-3.5`,"aria-hidden":`true`}),u=(0,Z.jsx)(s,{id:`O7_W_a`}),t[41]=l,t[42]=u):(l=t[41],u=t[42]),t[43]!==o||t[44]!==b?(N=(0,Z.jsx)(Ho,{asChild:!0,children:(0,Z.jsxs)(Qi,{variant:`ghost`,size:`sm`,disabled:b,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:a,onClick:o,children:[l,u]})}),t[43]=o,t[44]=b,t[45]=N):N=t[45],E=xo,P=`end`,F=`min-w-[220px]`,I=`open-in-agent-menu`;let d;t[46]!==T||t[47]!==C||t[48]!==c?(d=e=>{let t=c[e.id];return(0,Z.jsx)(Ob,{target:e,installState:t,isElectronHost:g,prompt:C,onSelect:()=>T(e)},e.id)},t[46]=T,t[47]=C,t[48]=c,t[49]=d):d=t[49],L=A.map(d),t[10]=y,t[11]=T,t[12]=n,t[13]=_,t[14]=C,t[15]=c,t[16]=b,t[17]=E,t[18]=D,t[19]=O,t[20]=k,t[21]=A,t[22]=j,t[23]=M,t[24]=N,t[25]=P,t[26]=F,t[27]=I,t[28]=L,t[29]=R,t[30]=z}else E=t[17],D=t[18],O=t[19],k=t[20],A=t[21],j=t[22],M=t[23],N=t[24],P=t[25],F=t[26],I=t[27],L=t[28],R=t[29],z=t[30];let B;t[50]!==A||t[51]!==x||t[52]!==j?(B=x&&A.length===0?(0,Z.jsx)(Wo,{disabled:!0,"data-testid":`open-in-agent-selection-empty`,children:j?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}):null,t[50]=A,t[51]=x,t[52]=j,t[53]=B):B=t[53];let V;t[54]!==o||t[55]!==O||t[56]!==k||t[57]!==n||t[58]!==x?(V=!O&&!x?(0,Z.jsxs)(Wo,{onSelect:k,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":o({id:`aA51jP`}),children:[(0,Z.jsx)(Bt,{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[54]=o,t[55]=O,t[56]=k,t[57]=n,t[58]=x,t[59]=V):V=t[59];let H;t[60]!==E||t[61]!==B||t[62]!==V||t[63]!==P||t[64]!==F||t[65]!==I||t[66]!==L?(H=(0,Z.jsxs)(E,{align:P,className:F,"data-testid":I,children:[L,B,V]}),t[60]=E,t[61]=B,t[62]=V,t[63]=P,t[64]=F,t[65]=I,t[66]=L,t[67]=H):H=t[67];let U;return t[68]!==D||t[69]!==M||t[70]!==N||t[71]!==H||t[72]!==R||t[73]!==z?(U=(0,Z.jsxs)(D,{open:R,onOpenChange:z,modal:M,children:[N,H]}),t[68]=D,t[69]=M,t[70]=N,t[71]=H,t[72]=R,t[73]=z,t[74]=U):U=t[74],U}var dA=50,fA=()=>{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,iS.preload()},dA))},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=ch)},u=(0,Z.jsx)(Ol,{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)(Tr,{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)(Yn,{children:[d,(0,Z.jsx)(nr,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function pA(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=Lo(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),m,h;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);let g=o?.hasRemote===!0,_=n===null,v;t[3]!==a||t[4]!==c||t[5]!==g||t[6]!==n||t[7]!==r?(v=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await xa({...n,hasRemote:g,onClickWhenNoRemote:r},{clipboardWrite:_o,toastSuccess:vA,toastError:_A,logEvent:gA});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{gs.error(a({id:`u3YnKw`}))}l(!1)}},t[3]=a,t[4]=c,t[5]=g,t[6]=n,t[7]=r,t[8]=v):v=t[8];let y=v,b=u!==null,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[9]=x):x=t[9];let S;t[10]!==a||t[11]!==n?.kind?(S=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=S):S=t[12];let C=c||_,w,T;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(kl,{className:`size-3.5`,"aria-hidden":!0}),T=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=w,t[14]=T):(w=t[13],T=t[14]);let E;t[15]!==y||t[16]!==S||t[17]!==C?(E=(0,Z.jsx)(rt,{asChild:!0,children:(0,Z.jsxs)(Qi,{variant:`ghost`,size:`sm`,"aria-label":S,onClick:y,disabled:C,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[w,T]})}),t[15]=y,t[16]=S,t[17]=C,t[18]=E):E=t[18];let D;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=D):D=t[19];let O;t[20]===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[20]=O):O=t[20];let k=u??``,A;t[21]===a?A=t[22]:(A=a({id:`5-FeN2`}),t[21]=a,t[22]=A);let j;t[23]!==k||t[24]!==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)(vs,{ref:f,readOnly:!0,value:k,onFocus:hA,onClick:mA,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":A})]}),t[23]=k,t[24]=A,t[25]=j):j=t[25];let M;return t[26]!==E||t[27]!==j||t[28]!==b?(M=(0,Z.jsxs)(p,{open:b,onOpenChange:x,children:[E,j]}),t[26]=E,t[27]=j,t[28]=b,t[29]=M):M=t[29],M}function mA(e){return e.currentTarget.select()}function hA(e){return e.currentTarget.select()}function gA(e){return console.log(e)}function _A(e){e!==`Link ready but could not copy to clipboard.`&&gs.error(e)}function vA(e){return gs.success(e)}function yA(e){let t=(0,$.c)(54),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=pt(),{state:p}=ID(),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=Ms(`toggle-files-sidebar`),t[0]=m):m=t[0];let h=m,g=Ms(`command-palette`),_=Mo(),[v,y]=(0,Q.useState)(!1),b;bb0:{if(f===null){let e;t[1]===_?e=t[2]:(e=Bh({workspace:_}),t[1]=_,t[2]=e),b=e;break bb0}if(f.kind===`folder`){if(!_){b=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==_?(e=Vh({folderRelativePath:f.folderPath,workspace:_}),t[3]=f.folderPath,t[4]=_,t[5]=e):e=t[5],b=e;break bb0}let e;t[6]!==d||t[7]!==_?(e=zh({docName:d,workspace:_}),t[6]=d,t[7]=_,t[8]=e):e=t[8],b=e}let x=c??b,S;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=$a(f.folderPath),t[9]=f.folderPath,t[10]=e),S=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Xo(d),t[11]=d,t[12]=e),S=e;break bb1}S=null}let C=S,w=typeof window<`u`&&window.okDesktop!=null,T=p===`collapsed`,E=w?``:void 0,D=w&&T&&`pl-[78px]`,k;t[13]===D?k=t[14]:(k=Gi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,w&&`[-webkit-app-region:drag]`,D,w&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[13]=D,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(VD,{className:Gi(`-ml-1 shrink-0 text-muted-foreground`,w&&`[-webkit-app-region:no-drag]`)})}),t[15]=A):A=t[15];let j;t[16]===p?j=t[17]:(j=(0,Z.jsxs)(Yn,{children:[A,(0,Z.jsx)(nr,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:h}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:h}})})]}),t[16]=p,t[17]=j);let M=T&&a&&(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:g}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Gi(`shrink-0 text-muted-foreground`,w&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(O,{"aria-hidden":`true`})})}),(0,Z.jsx)(nr,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:g}})})]}),N,P;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(vo,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),P=(0,Z.jsx)(aA,{}),t[18]=N,t[19]=P):(N=t[18],P=t[19]);let F;t[20]!==M||t[21]!==j?(F=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[j,M,N,P]}),t[20]=M,t[21]=j,t[22]=F):F=t[22];let I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=Gi(`flex shrink-0 items-center justify-end gap-2 px-3`,w&&`[&>*]:[-webkit-app-region:no-drag]`),t[23]=I):I=t[23];let L;t[24]!==x||t[25]!==l||t[26]!==o?(L=(0,Z.jsx)(uA,{input:x,open:o,onOpenChange:l}),t[24]=x,t[25]=l,t[26]=o,t[27]=L):L=t[27];let R;t[28]===y?R=t[29]:(R=()=>y(!0),t[28]=y,t[29]=R);let z;t[30]!==C||t[31]!==R?(z=(0,Z.jsx)(pA,{input:C,onClickWhenNoRemote:R}),t[30]=C,t[31]=R,t[32]=z):z=t[32];let B;t[33]!==v||t[34]!==y?(B=(0,Z.jsx)(Qo,{open:v,onOpenChange:y}),t[33]=v,t[34]=y,t[35]=B):B=t[35];let V;t[36]!==r||t[37]!==n?(V=(0,Z.jsx)(jo,{onSignIn:n,onSetIdentity:r}),t[36]=r,t[37]=n,t[38]=V):V=t[38];let H,U,W,G,K;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(JO,{}),U=(0,Z.jsx)(vo,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),W=(0,Z.jsx)(Qu,{}),G=(0,Z.jsx)(fA,{}),K=(0,Z.jsx)(lA,{}),t[39]=H,t[40]=U,t[41]=W,t[42]=G,t[43]=K):(H=t[39],U=t[40],W=t[41],G=t[42],K=t[43]);let q;t[44]!==L||t[45]!==z||t[46]!==B||t[47]!==V?(q=(0,Z.jsxs)(`div`,{className:I,children:[L,z,B,V,H,U,W,G,K]}),t[44]=L,t[45]=z,t[46]=B,t[47]=V,t[48]=q):q=t[48];let J;return t[49]!==F||t[50]!==q||t[51]!==E||t[52]!==k?(J=(0,Z.jsxs)(`header`,{"data-electron-drag":E,className:k,children:[F,q]}),t[49]=F,t[50]=q,t[51]=E,t[52]=k,t[53]=J):J=t[53],J}function bA(e){let t=(0,$.c)(48),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]=Hg(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(lv[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),w=So(),{projectLocalConfig:T,projectLocalSynced:E}=gt(),D=Mo(),{activeDocName:O}=pt(),k=w?.hasRemote,A=w?.pushPermission?.checkStatus,j;t[2]!==v||t[3]!==T||t[4]!==E||t[5]!==k||t[6]!==A?(j=Kg({autoSyncOnboardingDismissed:v,hasRemote:k,projectLocalSynced:E,projectLocalConfig:T,pushPermissionCheckStatus:A}),t[2]=v,t[3]=T,t[4]=E,t[5]=k,t[6]=A,t[7]=j):j=t[7];let M=j,N,P;t[8]===O?(N=t[9],P=t[10]):(N=()=>{let e=function(e){let t=e.detail;t&&O&&oc(O,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(Pg,e),()=>window.removeEventListener(Pg,e)},P=[O],t[8]=O,t[9]=N,t[10]=P),(0,Q.useEffect)(N,P),Ug(w?.pausedReason);let F;t[11]===s?F=t[12]:(F=function(e){l(e),s(e)},t[11]=s,t[12]=F);let I=F,L;t[13]===a?L=t[14]:(L=async function(){_(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?gs.success(a({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),gs.error(a({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),gs.error(a({id:`q7zsRM`}))}_(!1)},t[13]=a,t[14]=L);let R=L,z;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){x(e),e||C(null)},t[15]=z):z=t[15];let B=z,V;t[16]!==a||t[17]!==O||t[18]!==D?(V={openSelection(e){let t=Hh({docName:e.docName,workspace:D,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown})??zh({docName:O,workspace:D});return t===null?(gs.error(a({id:`_VRtd7`})),!1):(C(t),x(!0),!0)}},t[16]=a,t[17]=O,t[18]=D,t[19]=V):V=t[19];let H,U;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{p(`auth`),d(!0)},U=()=>{p(`identity`),d(!0)},t[20]=H,t[21]=U):(H=t[20],U=t[21]);let W;t[22]!==r||t[23]!==S||t[24]!==b?(W=(0,Z.jsx)(yA,{onSignIn:H,onSetIdentity:U,onOpenSearch:r,openInAgentMenuOpen:b,openInAgentMenuInput:S,onOpenInAgentMenuOpenChange:B}),t[22]=r,t[23]=S,t[24]=b,t[25]=W):W=t[25];let G;t[26]!==m||t[27]!==c||t[28]!==I||t[29]!==R||t[30]!==g?(G=(0,Z.jsx)(CO,{editorMode:c,onModeChange:I,activeTab:m,onActiveTabChange:h,onSaveVersion:R,saving:g}),t[26]=m,t[27]=c,t[28]=I,t[29]=R,t[30]=g,t[31]=G):G=t[31];let K;t[32]!==V||t[33]!==W||t[34]!==G?(K=(0,Z.jsxs)(pc,{value:V,children:[W,G]}),t[32]=V,t[33]=W,t[34]=G,t[35]=K):K=t[35];let q=f===`identity`,J;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{d(!1)},t[36]=J):J=t[36];let Y;t[37]!==u||t[38]!==q?(Y=(0,Z.jsx)(Ea,{open:u,onOpenChange:d,identityPrompt:q,onSuccess:J}),t[37]=u,t[38]=q,t[39]=Y):Y=t[39];let ee;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>y(!0),t[40]=ee):ee=t[40];let te;t[41]===M?te=t[42]:(te=(0,Z.jsx)(Wg,{open:M,onResolved:ee}),t[41]=M,t[42]=te);let ne;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(jg,{}),t[43]=ne):ne=t[43];let re;return t[44]!==K||t[45]!==Y||t[46]!==te?(re=(0,Z.jsxs)(Z.Fragment,{children:[K,Y,te,ne]}),t[44]=K,t[45]=Y,t[46]=te,t[47]=re):re=t[47],re}function xA(e){let t=gr(Pn(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function SA(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=to();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Di,{"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)(Di,{"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(CA),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 CA(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:()=>xA(e.file),children:[(0,Z.jsx)(Di,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var wA=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
28
+ `,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;Bs(t,{style:t=>tc(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 vE.set(t.changes,i),i}function xE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(DT).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(_E);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Ls.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:gE.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function SE(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(DT).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(_E).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 CE(e){let t=new Us;for(let n of e.field(DT)){let r=e.facet(wT).overrideChunk&&EE(e,n);t.add(n.fromB,n.fromB,bE(e,n,!!r))}return t.finish()}var wE=zs.define({create:e=>CE(e),update(e,t){return t.state.field(DT,!1)==t.startState.field(DT,!1)?e:CE(t.state)},provide:e=>Js.decorations.from(e)}),TE=new WeakMap;function EE(e,t){let n=TE.get(t);if(n!==void 0)return n;n=null;let r=e.field(_E),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(Hs.widget({widget:new DE(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(UT.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return TE.set(t,n),n}var DE=class extends Fs{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}},OE=new class extends Ys{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},kE=Hs.line({class:`cm-inlineChangedLine`});function AE(e,t,n,r){let i=EE(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,OE),n.add(o.from,o.from,kE);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 jE=Qt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),ME=ne({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),NE=Js.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 PE({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 FE(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:_}=Wr(),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`?jE:ME,u=[Js.editable.of(!1),Rs.readOnly.of(!0)],d=[mc,ue(),...u,l,Js.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new Js({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=PE({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 Js({doc:p,extensions:[mc,ue(),Js.editable.of(!1),l,NE,Js.lineWrapping,hE({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),Js.updateListener.of(e=>{let t=OT(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=OT(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new dE({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new Js({doc:p,extensions:[...d,hE({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 Js)||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 Js)||N(e)},t[13]=A):A=t[13];let j=A,M=b===0,P;t[14]!==f||t[15]!==b?(P=b===null?``:b===0?f({id:`lPzyrU`}):lr._({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,Pc.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]!==M||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 ${M?`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:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,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 IE(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 LE(e,t){return IE(e,`content`,t)}async function RE(e){return IE(e,`mine`)}async function zE(e){return IE(e,`theirs`)}async function BE(e){return IE(e,`delete`)}async function VE(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 HE(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=to(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Pn(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),VE(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 LE(u,e);t.ok||gs.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),gs.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)(FE,{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(BE),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(zE),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)(FE,{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(RE),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(BE),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)(FE,{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 UE(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Rt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var WE=`__back-nav__`;function GE(e){return e instanceof Fe||e instanceof _t||e instanceof Oe||e instanceof Qe||e instanceof At||e instanceof it?e.docName:null}function KE(e){if(e instanceof Fe){let t=e.docName;return{title:lr._({id:`Jejur6`}),summary:lr._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof _t){let t=e.docName;return{title:lr._({id:`V7QxyT`}),summary:lr._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Oe){let t=e.docName;return{title:lr._({id:`1di5fu`}),summary:lr._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Qe){let t=e.docName;return{title:lr._({id:`wvbc1r`}),summary:lr._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof At)return{title:lr._({id:`Gfr4fu`}),summary:lr._({id:`j6LB7S`})};if(e instanceof it){let t=e.docName;return{title:lr._({id:`vv7kpg`}),summary:lr._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:lr._({id:`W5A0Ly`});return{title:lr._({id:`29VNqC`}),summary:t}}function qE(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=KE(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)(nx,{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||(ct(GE(n)??i),o(a),r(WE))},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 JE(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)(qE,{...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]===WE){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}: ${KE(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 YE(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Or(t);return{map:n,keys:mr(t),parseError:r}}function XE(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>YE(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=Ri(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=Ye(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=dt(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(ZE,{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)(QE,{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 ZE(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 QE(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 $E(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Or(t);return{map:n,keys:mr(t),parseError:r}}function eD(e){let t=(0,$.c)(124),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>$E(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=Ri(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]!==r||t[9]!==a?(M=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=wr(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=M):M=t[10];let N=M,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=P):P=t[11];let F=P,I;t[12]===r?I=t[13]:(I=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=I);let L=I,R;t[14]!==N||t[15]!==L?(R=function(e,t){F(e),L(N({[e]:t}),[e])},t[14]=N,t[15]=L,t[16]=R):R=t[16];let z=R,B;t[17]!==N||t[18]!==L?(B=function(e){F(e),L(N({[e]:null}),[e])},t[17]=N,t[18]=L,t[19]=B):B=t[19];let V=B,H;t[20]!==r||t[21]!==a?(H=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=wr(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=H):H=t[22];let U=H,W;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(W=function(e,t){return`${e} ${t}`},t[23]=W):W=t[23];let G=W,K;t[24]!==a||t[25]!==m?(K=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)=>G(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=K):K=t[26];let q=K,J;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(J={activationConstraint:{distance:4}},t[27]=J):J=t[27];let Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y={coordinateGetter:ja},t[28]=Y):Y=t[28];let ee=lo(uo(Ro,J),uo(La,Y)),te;t[29]!==z||t[30]!==p?(te=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=za(n,t);(!Object.hasOwn(p,e)||!nD(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=te):te=t[31];let ne=te,re;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=re):re=t[32];let ie=re,{addPropertySignal:ae,clearAddProperty:oe}=nS(),se;t[33]!==ae||t[34]!==j?(se=ae.get(j)??0,t[33]=ae,t[34]=j,t[35]=se):se=t[35];let ce=se,le,ue;t[36]===ce?(le=t[37],ue=t[38]):(le=()=>{ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},ue=[ce],t[36]=ce,t[37]=le,t[38]=ue),(0,Q.useEffect)(le,ue);let de,fe;t[39]!==oe||t[40]!==j?(de=()=>()=>oe(j),fe=[j,oe],t[39]=oe,t[40]=j,t[41]=de,t[42]=fe):(de=t[41],fe=t[42]),(0,Q.useEffect)(de,fe);let pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Na[e];return{...t,type:e,value:n,error:null}})},t[43]=pe):pe=t[43];let me=pe,he;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){S(t=>t&&{...t,value:e})},t[44]=he):he=t[44];let _e=he,ve;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=ve):ve=t[45];let ye=ve,be;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(be=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=N({[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[46]=r,t[47]=x,t[48]=N,t[49]=p,t[50]=be):be=t[50];let xe=be,Se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){S(null)},t[51]=Se):Se=t[51];let Ce=Se,we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){w({key:e,draft:e,error:null})},t[52]=we):we=t[52];let Te=we,Ee;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Ee):Ee=t[53];let De=Ee,Oe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){w(null)},t[54]=Oe):Oe=t[54];let ke=Oe,Ae;t[55]!==r||t[56]!==p||t[57]!==U||t[58]!==C?(Ae=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=U(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}),F(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=U,t[58]=C,t[59]=Ae):Ae=t[59];let je=Ae,Me;t[60]!==p||t[61]!==m?(Me=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=Me):Me=t[62];let Ne=Me,Pe;if(t[63]!==Ne){Pe=new Map;for(let e of Ne)Pe.set(e,(Pe.get(e)??0)+1);t[63]=Ne,t[64]=Pe}else Pe=t[64];if(Ne.length===0&&!x&&!h)return null;let Fe=!g,Ie;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>_(!e),t[65]=Ie):Ie=t[65];let Le=!g,Re;t[66]===Le?Re=t[67]:(Re=(0,Z.jsx)(_s,{"data-expanded":Le,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Le,t[67]=Re);let ze;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=ze):ze=t[68];let Be;t[69]===Re?Be=t[70]:(Be=(0,Z.jsx)(bs,{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:[Re,ze]})}),t[69]=Re,t[70]=Be);let Ve;t[71]===h?Ve=t[72]:(Ve=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)(Di,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=Ve);let He;if(t[73]!==Ne){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>G(e,t),t[75]=e):e=t[75],He=Ne.map(e),t[73]=Ne,t[74]=He}else He=t[74];let Ue;if(t[76]!==z||t[77]!==je||t[78]!==Pe||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==V||t[83]!==C||t[84]!==Ne||t[85]!==k||t[86]!==ne){let e;t[88]!==z||t[89]!==je||t[90]!==Pe||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==V||t[95]!==C||t[96]!==k||t[97]!==ne?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??Hi(n),i=C?.key===e?C:null,a=(Pe.get(e)??0)>1;return(0,Z.jsx)(qa,{sortableId:G(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Te(e),onChangeDraft:De,onCommit:je,onCancel:ke},onCommit:t=>z(e,t),onChangeType:t=>ne(e,t),onRemove:()=>V(e)},`${e}-${t}`)},t[88]=z,t[89]=je,t[90]=Pe,t[91]=E,t[92]=p,t[93]=y,t[94]=V,t[95]=C,t[96]=k,t[97]=ne,t[98]=e):e=t[98],Ue=Ne.map(e),t[76]=z,t[77]=je,t[78]=Pe,t[79]=E,t[80]=p,t[81]=y,t[82]=V,t[83]=C,t[84]=Ne,t[85]=k,t[86]=ne,t[87]=Ue}else Ue=t[87];let We;t[99]!==He||t[100]!==Ue?(We=(0,Z.jsx)(es,{items:He,strategy:so,children:Ue}),t[99]=He,t[100]=Ue,t[101]=We):We=t[101];let Ge;t[102]!==q||t[103]!==ee||t[104]!==We?(Ge=(0,Z.jsx)(ka,{sensors:ee,collisionDetection:Fa,onDragEnd:q,children:We}),t[102]=q,t[103]=ee,t[104]=We,t[105]=Ge):Ge=t[105];let Ke;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(Ke=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(qa,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:tD},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=Ke):Ke=t[110];let qe;t[111]!==r||t[112]!==x||t[113]!==xe?(qe=x?(0,Z.jsx)(Ua,{draft:x,onChangeName:ye,onChangeType:me,onChangeValue:_e,onCommit:xe,onCancel:Ce}):(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:ie,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(ge,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=xe,t[114]=qe):qe=t[114];let X;t[115]!==Ve||t[116]!==Ge||t[117]!==Ke||t[118]!==qe?(X=(0,Z.jsxs)(ys,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Ve,Ge,Ke,qe]}),t[115]=Ve,t[116]=Ge,t[117]=Ke,t[118]=qe,t[119]=X):X=t[119];let Je;return t[120]!==Fe||t[121]!==Be||t[122]!==X?(Je=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(xs,{open:Fe,onOpenChange:Ie,children:[Be,X]})}),t[120]=Fe,t[121]=Be,t[122]=X,t[123]=Je):Je=t[123],Je}function tD(){}function nD(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}var rD=G(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function iD(e){let t=e.threshold??rD;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function aD(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var oD=G(`ACTIVITY_MOUNT_LIMIT`,3);function sD(){return n(()=>import(`./SourceEditor-CWDD_0Ko.js`),__vite__mapDeps([47,1,35,2,36,37,22,38,39,40,41,21,6,3,7,4,10,12,9,42,48,24,46]),import.meta.url)}var cD=(0,Q.lazy)(async()=>({default:(await sD()).SourceEditor}));function lD(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ge(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 uD(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:lr._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?lr._({id:`Sc1bKE`,values:{docName:e}}):lr._({id:`ovIGrT`,values:{docName:e}}),actionLabel:lr._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:lr._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?lr._({id:`bmC18N`,values:{docName:e}}):lr._({id:`pAgkuZ`,values:{docName:e}})}:null}function dD(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}=pt(),{pages:u,loading:d}=ki(),f=lD(c,n,oD),p=(0,Q.useRef)(``),h=f.map(pD).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)M(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;ie(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)(yD,{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 pD(e){return e.docName}function mD(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 hD(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)(yb,{}),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)(cD,{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 gD(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)(fo,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(wt,{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:_D,children:[(0,Z.jsx)(fo,{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 _D(){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 yD(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=uD(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=HS(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=iD({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=()=>st(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=()=>{aD({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)(gD,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(JE,{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)(yb,{}),children:(0,Z.jsx)(UE,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(HE,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(XE,{provider:n.provider}),!i&&(0,Z.jsx)(eD,{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)(hD,{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)(Vw,{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)(mD,{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 bD(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function xD(e){let{value:t,unit:n}=bD(e);return n===`rem`?t*16:t}function SD(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var CD=3600*24*7;function wD(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?TD:m,O=g===void 0?CD:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=xD(b),J;t[6]===x?J=t[7]:(J=xD(x),t[6]=x,t[7]=J);let Y=J,ee;t[8]!==E||t[9]!==k?(ee=function(e){E&&(P.current=!0,j.current=H.current?0:xD(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=ee):ee=t[10];let te=ee,ne,re;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==Y||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ne=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=bD(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(Y,t)),u=SD(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(Y,u)),f=SD(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},re=[i,a,D,q,Y,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=Y,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=re):(ne=t[24],re=t[25]),(0,Q.useEffect)(ne,re);let ie;return t[26]===te?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=ie),ie}function TD(){}var ED=3600*24*7,DD=`18rem`,OD=`3rem`,kD=`app-file-sidebar`,AD=`14.625rem`,jD=`32rem`,MD=`sidebar_width`,ND=/^\d+(?:\.\d+)?(?:rem|px)$/,PD=Q.createContext(null);function FD(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${MD}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return ND.test(n)?n:e}function ID(){let e=Q.use(PD);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function LD(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?DD:c,[u]=Q.useState(zD),d;t[8]===u?d=t[9]:(d=()=>QS(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>FD(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=aC();return sC(`left`,QS(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),cC(`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(RD)},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: ${YS}px)`),t=()=>{let e=QS(u,window.innerWidth,`left`);p(e),C(sC(`left`,e,aC())===`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(kD)?.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=>{Ns(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":OD,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Gi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(PD.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function RD(e){return!e}function zD(){return or()}function BD(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}=ID();if(d===`none`){let e;t[7]===r?e=t[8]:(e=Gi(`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]:(_=Gi(`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=Gi(`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:kD,"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 VD(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}=ID(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=Ps(`toggle-files-sidebar`);l=Qi,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=kD,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]:(_=Gi(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)(I,{}):(0,Z.jsx)(gl,{}),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 HD(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}=ID(),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:AD,maxResizeWidth:jD,setIsDraggingRail:h,widthCookieName:MD,widthCookieMaxAge:ED},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}=wD(_),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=Gi(`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 UD(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}=ID(),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=Gi(`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 WD(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=Gi(`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 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=Gi(`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 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=Gi(`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 qD(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=Gi(`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 JD(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=Gi(`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 YD=ea(`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 XD(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?qi:`button`,{state:m}=ID(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Gi(YD({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)(Tr,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(nr,{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)(Yn,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function ZD(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function QD(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Xr.safeParse(t);return n.success?n.data.currentBranch??null:null}var $D=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:ZD({fetchBranch:QD,subscribeToEvent:ii}),eO=$D.subscribe,tO=$D.getSnapshot;function nO(){return(0,Q.useSyncExternalStore)(eO,tO,tO)}function rO(){let e=(0,$.c)(6),t=nO(),n=Mo(),{state:r}=ID(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&Jo(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function iO(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=rO();if(!o&&l===null)return null;let u=r??n,d=r!=null,{words:f,chars:p,tokens:m}=u,h;t[0]!==c||t[1]!==d||t[2]!==o?(h=c(o?d?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=c,t[1]=d,t[2]=o,t[3]=h):h=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=g):g=t[4];let _;t[5]===l?_=t[6]:(_=l===null?null:(0,Z.jsx)(aO,{identity:l}),t[5]=l,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[7]=_,t[8]=v);let y;t[9]!==c||t[10]!==u.chars||t[11]!==u.tokens||t[12]!==u.words||t[13]!==p||t[14]!==d||t[15]!==o||t[16]!==m||t[17]!==f?(y=o?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[d?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:c({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:f}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:p}})]}),(0,Z.jsxs)(`span`,{children:[u.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:m}})]})]}):null,t[9]=c,t[10]=u.chars,t[11]=u.tokens,t[12]=u.words,t[13]=p,t[14]=d,t[15]=o,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==h||t[20]!==v||t[21]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":h,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[g,v,y]}),t[19]=h,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function aO(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(nr,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(Ae,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function oO(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=Gi(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 sO(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=Gi(`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 cO(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=Gi(`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 lO(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=Gi(`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 uO(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=Gi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(_s,{}),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 dO=1,fO=2,pO=4;function mO(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>pO?[...u.slice(0,dO).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(dO,-fO)},...u.slice(-fO).map((e,t)=>d(e,u.length-fO+t))]:u.map((e,t)=>d(e,t));a=oO,t[8]===r?c=t[9]:(c=Gi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=sO,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(hO)}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 hO(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(uO,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(cO,{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)(qc,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(cO,{className:`min-w-0`,children:(0,Z.jsx)(lO,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var gO={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`},_O=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`,...gO,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},vO=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)(_O,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},yO=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)(_O,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function bO(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=Ms(`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=Ps(`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)(mO,{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)(Tr,{children:(0,Z.jsx)(yO,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(rs,{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)(nr,{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)(Yn,{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)(vO,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(rs,{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)(nr,{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)(Yn,{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)(as,{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)(Yn,{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)(Tr,{children:(0,Z.jsx)(ll,{})})}),(0,Z.jsx)(nr,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=Yn,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)(Tr,{children:u?(0,Z.jsx)(vl,{}):(0,Z.jsx)(_l,{})}),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)(nr,{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 xO(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var SO=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DqtdV56a.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 CO(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(TO,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(wO,{}),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)(eS,{children:[n,r]})}),t[3]=n,t[4]=i),i}function wO(){let e=(0,$.c)(5),t=fh(),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)(dS,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function TO(e){let t=(0,$.c)(144),{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:_}=pt(),{openDocumentTransition:v}=Et(),{requestAddProperty:y}=nS(),b=BS(f,d),x=US(d,n===`source`?`source`:`wysiwyg`),S=lC(f),C=S===`connected`||S===`synced`,w=HS(d)===`conflict`,T=(0,Q.useDeferredValue)(d),E=p?.kind===`missing`,D=!!d&&p?.kind!==`folder`,O;t[0]!==u||t[1]!==E?(O=E?u({id:`K-a33w`}):void 0,t[0]=u,t[1]=E,t[2]=O):O=t[2];let k=O,[A]=(0,Q.useState)(DO),j=A!==null,M;t[3]===A?M=t[4]:(M=()=>QS(A,window.innerWidth,`right`),t[3]=A,t[4]=M);let[N,P]=(0,Q.useState)(M),F=(0,Q.useRef)(N),I,L;t[5]===N?(I=t[6],L=t[7]):(I=()=>{F.current=N},L=[N],t[5]=N,t[6]=I,t[7]=L),(0,Q.useEffect)(I,L);let R=sb(),z;t[8]===N?z=t[9]:(z=()=>sC(`right`,N,aC())===`collapsed`,t[8]=N,t[9]=z);let[B]=(0,Q.useState)(z),[V,H]=(0,Q.useState)(B),W=(0,Q.useRef)(V),G,K;t[10]===V?(G=t[11],K=t[12]):(G=()=>{W.current=V},K=[V],t[10]=V,t[11]=G,t[12]=K),(0,Q.useEffect)(G,K);let[q,J]=(0,Q.useState)(!1),Y=(0,Q.useRef)(!1),[ee]=(0,Q.useState)(EO),te=(0,Q.useRef)(ee),ne=(0,Q.useRef)(null),re;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(e){ne.current!=null&&clearTimeout(ne.current),ne.current=setTimeout(()=>{qS(e),ne.current=null},100)},t[13]=re):re=t[13];let ie=re,ae,oe;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>()=>{ne.current!=null&&clearTimeout(ne.current)},ae=[],t[14]=ae,t[15]=oe):(ae=t[14],oe=t[15]),(0,Q.useEffect)(oe,ae);let[se,ce]=(0,Q.useState)(null),le;t[16]!==V||t[17]!==R?(le=function(){if(R.current==null)return;let e=F.current;V?(cC(`right`,e,`open`),R.current?.expand()):(cC(`right`,e,`collapsed`),R.current?.collapse())},t[16]=V,t[17]=R,t[18]=le):le=t[18];let ue=le,de,fe;t[19]!==A||t[20]!==R?(de=()=>{let e=window.matchMedia(`(min-width: ${XS}px)`),t=()=>{let e=QS(A,window.innerWidth,`right`);P(e);let t=sC(`right`,e,aC())===`collapsed`;H(t),t?R.current?.collapse():R.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},fe=[A,R],t[19]=A,t[20]=R,t[21]=de,t[22]=fe):(de=t[21],fe=t[22]),(0,Q.useEffect)(de,fe);let pe,me;t[23]!==se||t[24]!==j||t[25]!==R?(pe=()=>{if(se==null||j)return;let e=new ResizeObserver(()=>{W.current||Y.current||R.current?.resize(`${te.current}px`)});return e.observe(se),()=>e.disconnect()},me=[se,j,R],t[23]=se,t[24]=j,t[25]=R,t[26]=pe,t[27]=me):(pe=t[26],me=t[27]),(0,Q.useEffect)(pe,me);let he,ge;t[28]!==o||t[29]!==R?(he=()=>{let e=e=>{o(e),R.current?.expand()},t=gm();return t&&e(t),vm(t=>{gm(),e(t)})},ge=[o,R],t[28]=o,t[29]=R,t[30]=he,t[31]=ge):(he=t[30],ge=t[31]),(0,Q.useEffect)(he,ge);let _e,ve;t[32]!==_||t[33]!==R?(_e=()=>{_!==0&&R.current?.expand()},ve=[_,R],t[32]=_,t[33]=R,t[34]=_e,t[35]=ve):(_e=t[34],ve=t[35]),(0,Q.useEffect)(_e,ve);let ye,be;t[36]===V?(ye=t[37],be=t[38]):(ye=()=>{if(!V||!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()},be=[V],t[36]=V,t[37]=ye,t[38]=be),(0,Q.useLayoutEffect)(ye,be);let xe,Se;t[39]===V?(xe=t[40],Se=t[41]):(xe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!V})},Se=[V],t[39]=V,t[40]=xe,t[41]=Se),(0,Q.useEffect)(xe,Se);let Ce,we;t[42]===ue?(Ce=t[43],we=t[44]):(Ce=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&ue()})},we=[ue],t[42]=ue,t[43]=Ce,t[44]=we),(0,Q.useEffect)(Ce,we);let Te,Ee;t[45]===ue?(Te=t[46],Ee=t[47]):(Te=()=>{if(window.okDesktop!=null)return;let e=e=>{Ns(e,`toggle-document-panel`)&&(e.preventDefault(),ue())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ee=[ue],t[45]=ue,t[46]=Te,t[47]=Ee),(0,Q.useEffect)(Te,Ee);let De=(0,Q.useRef)(null),[Oe,ke]=(0,Q.useState)(null),Ae=p?.kind===`large-file`?p.docName:d,je,Me;t[48]===Ae?(je=t[49],Me=t[50]):(je=()=>{if(Ae&&Ae!==De.current){let e=De.current;De.current=Ae,ke(e)}},Me=[Ae],t[48]=Ae,t[49]=je,t[50]=Me),(0,Q.useEffect)(je,Me);let Ne;t[51]===v?Ne=t[52]:(Ne=function(e){let t=gr(e);window.location.hash===t?v(e):window.location.hash=t},t[51]=v,t[52]=Ne);let Pe=Ne;if(p?.kind===`large-file`){let e;t[53]!==Pe||t[54]!==Oe?(e=Oe?{previousDocName:Oe,onNavigateBack:Pe}:void 0,t[53]=Pe,t[54]=Oe,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)(Xx,{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)(Kx,{folderPath:p.folderPath}),t[61]=p.folderPath,t[62]=e),e}let e;t[63]===p.folderPath?e=t[64]:(e=(0,Z.jsx)(_S,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(Kx,{folderPath:p.folderPath})}),t[63]=p.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(vS,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(_S,{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)(SO,{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)(gS,{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)(vb,{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`?yr(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yb,{}),t[72]=e):e=t[72],e}let e;return t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yx,{}),t[73]=e):e=t[73],e}let Fe=n===`source`,Ie=!C,Le=V,Re;t[74]!==d||t[75]!==y?(Re=function(){d&&y(d)},t[74]=d,t[75]=y,t[76]=Re):Re=t[76];let Be=Re,Ve=T??d,He=Oe??void 0,Ue;t[77]!==k||t[78]!==Fe||t[79]!==Pe||t[80]!==m||t[81]!==Ve||t[82]!==He?(Ue=(0,Z.jsx)(dD,{activeDocName:Ve,isSourceMode:Fe,editorPlaceholder:k,previousDocName:He,onNavigateBack:Pe,onRecycle:m}),t[77]=k,t[78]=Fe,t[79]=Pe,t[80]=m,t[81]=Ve,t[82]=He,t[83]=Ue):Ue=t[83];let We;t[84]!==d||t[85]!==Fe?(We=(0,Z.jsx)(IS,{activeDocName:d,isSourceMode:Fe}),t[84]=d,t[85]=Fe,t[86]=We):We=t[86];let Ge;t[87]!==d||t[88]!==T?(Ge=xO({activeDocName:d,deferredActiveDocName:T,mountResolved:d!==null&&U(d),syncResolved:d!==null&&ze(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(yb,{}),d===null?null:(0,Z.jsx)(Zx,{docName:d})]}):null,t[87]=d,t[88]=T,t[89]=Ge):Ge=t[89];let Ke;t[90]!==Ue||t[91]!==We||t[92]!==Ge?(Ke=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[Ue,We,Ge]}),t[90]=Ue,t[91]=We,t[92]=Ge,t[93]=Ke):Ke=t[93];let qe;t[94]!==d||t[95]!==w||t[96]!==Le||t[97]!==Fe||t[98]!==r||t[99]!==Be||t[100]!==Ie||t[101]!==ue?(qe=!w&&(0,Z.jsx)(bO,{activeDocName:d,isSourceMode:Fe,sourceDisabled:Ie,onModeChange:r,showAddPropertyButton:!Fe,onAddProperty:Be,isPanelCollapsed:Le,onTogglePanel:ue}),t[94]=d,t[95]=w,t[96]=Le,t[97]=Fe,t[98]=r,t[99]=Be,t[100]=Ie,t[101]=ue,t[102]=qe):qe=t[102];let X;t[103]!==Ke||t[104]!==qe?(X=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[Ke,qe]}),t[103]=Ke,t[104]=qe,t[105]=X):X=t[105];let Je;t[106]!==x||t[107]!==D||t[108]!==b?(Je=(0,Z.jsx)(iO,{stats:b,selectionStats:x,showStats:D}),t[106]=x,t[107]=D,t[108]=b,t[109]=Je):Je=t[109];let Ye;t[110]!==X||t[111]!==Je?(Ye=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[X,Je]}),t[110]=X,t[111]=Je,t[112]=Ye):Ye=t[112];let Xe=Ye,Ze=q||void 0,Qe;t[113]===B?Qe=t[114]:(Qe=B?{defaultSize:`100%`}:{},t[113]=B,t[114]=Qe);let $e=q?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,et;t[115]!==Xe||t[116]!==Qe||t[117]!==$e?(et=(0,Z.jsx)(_S,{minSize:`30%`,...Qe,className:$e,children:Xe}),t[115]=Xe,t[116]=Qe,t[117]=$e,t[118]=et):et=t[118];let tt=j&&V,nt;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(nt=()=>{J(!0),Y.current=!0;let e=()=>{J(!1),Y.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[119]=nt):nt=t[119];let rt;t[120]===tt?rt=t[121]:(rt=(0,Z.jsx)(vS,{withHandle:!0,disabled:tt,onPointerDown:nt}),t[120]=tt,t[121]=rt);let it=B?0:`${ee}px`,at;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(at=e=>{H(e.asPercentage===0),e.inPixels>0&&Y.current&&(te.current=e.inPixels,ie(e.inPixels))},t[122]=at):at=t[122];let ot=!q&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,st;t[123]===ot?st=t[124]:(st=Gi(`flex flex-col bg-muted/20`,ot),t[123]=ot,t[124]=st);let ct;t[125]!==d||t[126]!==a||t[127]!==h||t[128]!==Fe||t[129]!==o||t[130]!==c||t[131]!==l?(ct=(0,Z.jsx)(mv,{docName:d,isSourceMode:Fe,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l}),t[125]=d,t[126]=a,t[127]=h,t[128]=Fe,t[129]=o,t[130]=c,t[131]=l,t[132]=ct):ct=t[132];let lt;t[133]!==V||t[134]!==R||t[135]!==it||t[136]!==st||t[137]!==ct?(lt=(0,Z.jsx)(_S,{id:`doc-panel`,panelRef:R,defaultSize:it,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:at,inert:V,className:st,children:ct}),t[133]=V,t[134]=R,t[135]=it,t[136]=st,t[137]=ct,t[138]=lt):lt=t[138];let ut;return t[139]!==Ze||t[140]!==et||t[141]!==rt||t[142]!==lt?(ut=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:ce,children:(0,Z.jsxs)(gS,{orientation:`horizontal`,"data-dragging":Ze,children:[et,rt,lt]})}),t[139]=Ze,t[140]=et,t[141]=rt,t[142]=lt,t[143]=ut):ut=t[143],ut}function EO(){return JS()}function DO(){return or()}function OO(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 kO(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 AO=1e3,jO=!1;function MO(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function NO(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:pa(i)?a=i:(a=void 0,jO||(jO=!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`&&(MO({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=kO(i),{current:c,crossDoc:l}=a?ca(a,n,Date.now()):{current:[],crossDoc:[]},u=PO,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>OO(e.current,p)&&OO(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,AO);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 PO(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var FO=`sync-status`;function IO(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,gs.warning(r({id:`HGNCsl`}),{id:FO,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,gs.success(r({id:`GhjUB_`}),{id:FO,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 LO=4,RO=3,zO={Bird:Mc,Cat:Rc,Dog:Kc,Fish:Zc,Mouse:Cl,Rabbit:Sl,Shrimp:Al,Snail:jl,Squirrel:Pl,Turtle:zl};Object.freeze(Object.keys(zO));function BO(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(zO,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var VO={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function HO(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=BO(n),c=s.kind===`animal`?zO[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=er(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Oi(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)(Tr,{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)(nr,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Yn,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function UO(e){let t=VO[e.icon];return e.displayName||t||lr._({id:`iEQQyu`})}function WO(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 GO(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=pt(),{presence:u,agentId:d}=n,f=UO(u),p=WO(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)(da,{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)(da,{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)(Tr,{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)(nr,{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)(Yn,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function KO(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?lr._({id:`9euN0m`,values:{count:n}}):lr._({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)(HO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(GO,{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 qO(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(HO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(GO,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function JO(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=pt(),{current:s,crossDoc:c}=NO(t,r,n);if(IO(lC(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,LO),n;e[6]===s?n=e[7]:(n=s.slice(LO),e[6]=s,e[7]=n);let r=n,u=c.slice(0,RO),d;e[8]===c?d=e[9]:(d=c.slice(RO),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=>qO(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)(KO,{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=>qO(e,p,!0,m)),f.length>0?(0,Z.jsx)(KO,{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 YO=`.md`,XO=/\.(md|mdx)$/i;function ZO(e,t=YO){return`${e}${t}`}function QO(e){return yk(e).replace(XO,``)}function $O(e){return Li(e)?nk(e.path):kr(e)?e.path:ZO(e.docName,e.docExt)}function ek(e){let t=yk(e).match(XO);return t?`.${t[1].toLowerCase()}`:void 0}function tk(e){return yk(e)}function nk(e){let t=yk(e.trim());return t?`${t}/`:``}function rk(e){return e.endsWith(`/`)?tk(e):QO(e)}function ik(e){return e.map($O)}function ak(e){return[...e].sort().join(`\0`)}function ok(e){return ak(ik(e))}function sk(e){let t=new Set;for(let n of e){if(Li(n)){let e=nk(n.path);e&&t.add(e)}let e=(Li(n)||kr(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Li(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=yk(e.replace(XO,``)).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 lk(e,t,n){let r=ek(e);if(r)return r;let i=n.find(e=>zn(e)&&e.docName===t);return i?i.docExt??YO:vk(e).includes(`.`)?void 0:YO}function uk(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(!kr(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 dk(e,t,n){if(ek(e))return null;let r=n.find(e=>kr(e)&&e.path===t);return r?r.path:vk(e).includes(`.`)?t:uk(t,n)}function fk(e,t){let n=e.kind===`directory`,r=n?tk(e.path):QO(e.path);if(n)return{kind:`folder`,name:yk(vk(e.path)).replace(XO,``),path:r,treePath:mk(e.path,!0)};let i=dk(e.path,r,t);if(i)return{kind:`asset`,name:yk(vk(i)),path:i,treePath:i};let a=lk(e.path,r,t);return{kind:`file`,name:yk(vk(e.path)).replace(XO,``),path:r,treePath:mk(e.path,!1),docExt:a}}function pk(e){return e.kind===`directory`?tk(e.path):e.path}function mk(e,t){return t?nk(e):XO.test(e)?e:`${e}${YO}`}function hk(e,t,n){let r=nk(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}${YO}`;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 gk(e,t){return e===`file`?mk(t,!1):`${tk(t)}/index${YO}`}function _k(e,t){return t.kind===`root`||t.directoryPath==null?vk(e):`${t.directoryPath}${vk(e)}`}function vk(e){let t=yk(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function yk(e){return e.endsWith(`/`)?e.slice(0,-1):e}function bk(e,t){return t.trim()}function xk(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function Sk(e,t){let n=bk(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function Ck(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=>zn(e)?{...e,docName:i.get(e.docName)??e.docName}:Li(e)?{...e,path:Ak(e.path,n)}:kr(e)?{...e,path:a.get(e.path)??Ak(e.path,n)}:e)}function wk(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=>zn(e)?!i.has(e.docName)&&!Pk(e.docName,n):Li(e)?!Pk(e.path,n):kr(e)?!a.has(e.path)&&!Pk(e.path,n):!0)}function Tk(e,t){if(e.kind!==`asset`||t.some(t=>kr(t)&&t.path===e.path))return e;let n=uk(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function Ek(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>jk(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>zn(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=>Li(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(zn(i)){let e=Nk(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Li(i)){let e=Mk(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function Dk(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function Ok(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function kk(e,t){let n=e.kind===`file`?ZO(e.path,e.docExt):e.path;return Lh(t.contentDir,n,t.pathSeparator)}function Ak(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 jk(e,t){return zn(e)&&zn(t)?e.docName===t.docName:Li(e)&&Li(t)||kr(e)&&kr(t)?e.path===t.path:!1}function Mk(e,t,n){return e===t?n:Nk(e,t,n)}function Nk(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function Pk(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function Fk(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)(zu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function Ik(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=Gi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Bu,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lk(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)(qu,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Rk(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=Gi(`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)(Vu,{children:(0,Z.jsx)(Hu,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zk(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=Gi(`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)(Uu,{"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 Bk(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=Gi(`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)(_s,{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)(Ju,{"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 Vk(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=Gi(`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)(Yu,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Hk(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=Gi(`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)(Gu,{children:(0,Z.jsx)(hs,{})})}),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)(Wu,{"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 Uk(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=Gi(`-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)(Ku,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Wk=[`.md`,`.mdx`],Gk=`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`,Kk=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,qk=Gi(Kk,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),Jk=`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`,Yk=`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 Xk(e){return Gi(Yk,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 Zk(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function Qk(e){let t=gr(e);window.location.hash!==t&&(window.location.hash=t)}function $k(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function eA(e,t){let n=[t,...Wk].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 tA(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}=ro(s),m;t[9]===d?m=t[10]:(m=po.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 nA(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=Wt(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=Wt(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)(Ik,{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)(zk,{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)(zk,{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)(zk,{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)(Uk,{}),(0,Z.jsx)(zk,{"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)(Rk,{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)(Fk,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function rA(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)(xl,{"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)(ss,{"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 iA(e){let t=(0,$.c)(1),{docName:n}=e;if(HS(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Di,{"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 aA(){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}=pt(),{_:E}=i(),{pageMeta:D}=ki(),O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,P]=(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?se(a):t?De(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 K=G,q,J;e[10]===t?(q=e[11],J=e[12]):(q=()=>{H.current=t},J=[t],e[10]=t,e[11]=q,e[12]=J),(0,Q.useEffect)(q,J);let Y,ee;e[13]===K?(Y=e[14],ee=e[15]):(Y=()=>{K&&(O.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ee=[K],e[13]=K,e[14]=Y,e[15]=ee),(0,Q.useEffect)(Y,ee);let te,ne;e[16]===k?(te=e[17],ne=e[18]):(te=()=>{k&&(R.current?.focus(),R.current?.select())},ne=[k],e[16]=k,e[17]=te,e[18]=ne),(0,Q.useEffect)(te,ne);let re,ie;e[19]!==v||e[20]!==k?(re=()=>{!k||v.includes(k.tabId)||(B.current=!0,V.current=null,A(null),M(``),P(null),L(!1))},ie=[v,k],e[19]=v,e[20]=k,e[21]=re,e[22]=ie):(re=e[21],ie=e[22]),(0,Q.useEffect)(re,ie);let ae=function(e,t){let n=t.split(`/`);B.current=!1,V.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),P(null)},oe=function(){B.current=!0,V.current=null,A(null),M(``),P(null),L(!1)},ce=async function(){if(B.current){B.current=!1;return}if(z.current)return;let e=k?.docName;if(!e){oe();return}let t=bk(`file`,eA(j,D.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){oe();return}if(t===V.current){R.current?.focus();return}if(!xk(t)){P(E({id:`P8yDjG`})),R.current?.focus();return}let i=Sk({kind:`file`,path:e,name:r},t);z.current=!0,L(!0),P(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(B.current){L(!1),z.current=!1;return}let r=await Tt(n,`Server error (HTTP ${n.status})`);if(!r.ok){P(r.title),L(!1),z.current=!1,V.current=t,R.current?.focus();return}let a=F(li,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=H.current,s=Dk(o,a);Kt(a);let c=!0;try{let e=Ok(a,p(),m);await Promise.all(e.map(e=>l(e))),S(a),Ti([`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}),gs.error(E({id:`MUBR8r`}))}B.current=!0,A(null),M(``),P(null),L(!1),z.current=!1,V.current=null,c&&s&&s!==o&&Qk(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),P(E({id:`HIb0vl`})),L(!1),z.current=!1,V.current=t,R.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===g?ue=e[24]:(ue=new Set(g),e[23]=g,e[24]=ue);let de=ue,fe;e[25]!==u||e[26]!==f||e[27]!==de?(fe=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[25]=u,e[26]=f,e[27]=de,e[28]=fe):fe=e[28];let pe=fe,me;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(me={activationConstraint:{distance:8}},e[29]=me):me=e[29];let he;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(he={coordinateGetter:ja},e[30]=he):he=e[30];let _e=lo(uo(Ro,me),uo(La,he)),ve;e[31]!==C||e[32]!==T?(ve=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(ya([...T],r,i),t)},e[31]=C,e[32]=T,e[33]=ve):ve=e[33];let ye=ve,be=le?``:void 0,xe;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(xe=Gi(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,le&&`[-webkit-app-region:drag]`),e[34]=xe):xe=e[34];let Se=$k,Ce;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=Gi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[35]=Ce):Ce=e[35];let we=ka,Te=Fa,Ee;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ee={container:typeof document<`u`?document.body:void 0},e[36]=Ee):Ee=e[36];let Oe=es,ke;e[37]===T?ke=e[38]:(ke=[...T],e[37]=T,e[38]=ke);let Ae=ao,je=T.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(nA,{tabId:e,canPin:!1,openTabs:T,closeTab:u,closeTabs:pe,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(tA,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Gi(Gk,t?Kk:qk),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:Jk,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:Xk(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(ss,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=Pe(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)(nA,{tabId:e,openTabs:T,closeTab:d,closeTabs:pe,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(tA,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(Gk,n?Kk:qk),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:Jk,onClick:()=>{o(e)},children:[s&&(0,Z.jsx)(`span`,{className:Gi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Gi(`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)(rA,{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)(nA,{tabId:e,openTabs:T,closeTab:d,closeTabs:pe,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsxs)(tA,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(Gk,n?Kk:qk),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:Jk,onClick:()=>{o(e)},children:[s?(0,Z.jsx)(`span`,{className:Gi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Gi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(rA,{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-${Zk(a)}`;return(0,Z.jsx)(nA,{disabled:v,tabId:e,openTabs:T,closeTab:d,closeTabs:pe,pinTab:b,pinnedTabIds:x,unpinTab:w,children:(0,Z.jsx)(tA,{tabId:e,disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(Gk,n?Kk:qk,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)(yS,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(wS,{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(eA(e.target.value,l)),P(null),V.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),oe())},onBlur:ce}),(0,Z.jsx)(xS,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(CS,{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:Jk,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),ae(e,a)},children:[(0,Z.jsx)(iA,{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)(rA,{accessibleLabel:g,closeTab:d,isPinned:i,tabId:e,unpinTab:w})]})})},e)}),Me;e[39]!==Oe||e[40]!==ke||e[41]!==Ae||e[42]!==je?(Me=(0,Z.jsx)(Oe,{items:ke,strategy:Ae,children:je}),e[39]=Oe,e[40]=ke,e[41]=Ae,e[42]=je,e[43]=Me):Me=e[43];let Ne;e[44]!==we||e[45]!==ye||e[46]!==_e||e[47]!==Te||e[48]!==Ee||e[49]!==Me?(Ne=(0,Z.jsx)(we,{sensors:_e,collisionDetection:Te,onDragEnd:ye,accessibility:Ee,children:Me}),e[44]=we,e[45]=ye,e[46]=_e,e[47]=Te,e[48]=Ee,e[49]=Me,e[50]=Ne):Ne=e[50];let Fe;e[51]===E?Fe=e[52]:(Fe=E({id:`3YvS-c`}),e[51]=E,e[52]=Fe);let Ie;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(ge,{"aria-hidden":`true`}),e[53]=Ie):Ie=e[53];let Le;e[54]!==_||e[55]!==Fe?(Le=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Fe,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ie})}),e[54]=_,e[55]=Fe,e[56]=Le):Le=e[56];let Re;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(nr,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[57]=Re):Re=e[57];let ze;e[58]===Le?ze=e[59]:(ze=(0,Z.jsxs)(Yn,{children:[Le,Re]}),e[58]=Le,e[59]=ze);let Be;e[60]!==Ce||e[61]!==Ne||e[62]!==ze?(Be=(0,Z.jsxs)(`div`,{className:Ce,children:[Ne,ze]}),e[60]=Ce,e[61]=Ne,e[62]=ze,e[63]=Be):Be=e[63];let Ve;return e[64]!==be||e[65]!==xe||e[66]!==Se||e[67]!==Be?(Ve=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":be,className:xe,onWheel:Se,children:Be}),e[64]=be,e[65]=xe,e[66]=Se,e[67]=Be,e[68]=Ve):Ve=e[68],Ve}function oA(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:Ne},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:kd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:ar},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:oA},{label:`Twitter`,href:`https://x.com/inkeep`,icon:sA}],lA=()=>{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)(Xe,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Tr,{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)(Yn,{children:[o,(0,Z.jsx)(nr,{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=>co(e,r),onAuxClick:e=>co(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 uA(e){let t=(0,$.c)(75),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=ug(),{dispatch:u}=$h(),{merged:d}=gt(),f=d?.appearance?.preview?.autoOpen??!0,[p,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(!1);if(ih())return null;let g=typeof window<`u`&&window.okDesktop!=null,_=r??p,v;t[0]!==a||t[1]!==r||t[2]!==l?(v=e=>{r===void 0&&m(e),a?.(e),e&&l()},t[0]=a,t[1]=r,t[2]=l,t[3]=v):v=t[3];let y=v,b=n===null,x=!!n?.selection,S;t[4]!==f||t[5]!==n?(S=n!==null&&n.docContext!==null?Ui(n.docContext.relativePath,f):``,t[4]=f,t[5]=n,t[6]=S):S=t[6];let C=S,w;t[7]!==u||t[8]!==n?(w=e=>{n!==null&&u(e.id,n)},t[7]=u,t[8]=n,t[9]=w):w=t[9];let T=w,E,D,O,k,A,j,M,N,P,F,I,L,R,z;if(t[10]!==y||t[11]!==T||t[12]!==n||t[13]!==_||t[14]!==C||t[15]!==c||t[16]!==b){let e;t[31]===c?e=t[32]:(e=e=>c[e.id]?.installed===!0,t[31]=c,t[32]=e),A=sh.filter(e);let r;t[33]===c?r=t[34]:(r=sh.some(e=>c[e.id]?.installed==null),t[33]=c,t[34]=r),j=r,O=c[`claude-code`]?.installed===!0;let i;t[35]!==n||t[36]!==C?(i=()=>{n!==null&&Db(C)},t[35]=n,t[36]=C,t[37]=i):i=t[37],k=i,D=Ya,R=_,z=y,M=!1;let a;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(a=g?()=>{h.current=!0}:void 0,t[38]=a):a=t[38];let o;t[39]===y?o=t[40]:(o=g?()=>{if(h.current){h.current=!1;return}y(!0)}:void 0,t[39]=y,t[40]=o);let l,u;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(ua,{className:`size-3.5`,"aria-hidden":`true`}),u=(0,Z.jsx)(s,{id:`O7_W_a`}),t[41]=l,t[42]=u):(l=t[41],u=t[42]),t[43]!==o||t[44]!==b?(N=(0,Z.jsx)(Ho,{asChild:!0,children:(0,Z.jsxs)(Qi,{variant:`ghost`,size:`sm`,disabled:b,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:a,onClick:o,children:[l,u]})}),t[43]=o,t[44]=b,t[45]=N):N=t[45],E=xo,P=`end`,F=`min-w-[220px]`,I=`open-in-agent-menu`;let d;t[46]!==T||t[47]!==C||t[48]!==c?(d=e=>{let t=c[e.id];return(0,Z.jsx)(Ob,{target:e,installState:t,isElectronHost:g,prompt:C,onSelect:()=>T(e)},e.id)},t[46]=T,t[47]=C,t[48]=c,t[49]=d):d=t[49],L=A.map(d),t[10]=y,t[11]=T,t[12]=n,t[13]=_,t[14]=C,t[15]=c,t[16]=b,t[17]=E,t[18]=D,t[19]=O,t[20]=k,t[21]=A,t[22]=j,t[23]=M,t[24]=N,t[25]=P,t[26]=F,t[27]=I,t[28]=L,t[29]=R,t[30]=z}else E=t[17],D=t[18],O=t[19],k=t[20],A=t[21],j=t[22],M=t[23],N=t[24],P=t[25],F=t[26],I=t[27],L=t[28],R=t[29],z=t[30];let B;t[50]!==A||t[51]!==x||t[52]!==j?(B=x&&A.length===0?(0,Z.jsx)(Wo,{disabled:!0,"data-testid":`open-in-agent-selection-empty`,children:j?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}):null,t[50]=A,t[51]=x,t[52]=j,t[53]=B):B=t[53];let V;t[54]!==o||t[55]!==O||t[56]!==k||t[57]!==n||t[58]!==x?(V=!O&&!x?(0,Z.jsxs)(Wo,{onSelect:k,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":o({id:`aA51jP`}),children:[(0,Z.jsx)(Bt,{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[54]=o,t[55]=O,t[56]=k,t[57]=n,t[58]=x,t[59]=V):V=t[59];let H;t[60]!==E||t[61]!==B||t[62]!==V||t[63]!==P||t[64]!==F||t[65]!==I||t[66]!==L?(H=(0,Z.jsxs)(E,{align:P,className:F,"data-testid":I,children:[L,B,V]}),t[60]=E,t[61]=B,t[62]=V,t[63]=P,t[64]=F,t[65]=I,t[66]=L,t[67]=H):H=t[67];let U;return t[68]!==D||t[69]!==M||t[70]!==N||t[71]!==H||t[72]!==R||t[73]!==z?(U=(0,Z.jsxs)(D,{open:R,onOpenChange:z,modal:M,children:[N,H]}),t[68]=D,t[69]=M,t[70]=N,t[71]=H,t[72]=R,t[73]=z,t[74]=U):U=t[74],U}var dA=50,fA=()=>{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,iS.preload()},dA))},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=ch)},u=(0,Z.jsx)(Ol,{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)(Tr,{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)(Yn,{children:[d,(0,Z.jsx)(nr,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function pA(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=Lo(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),m,h;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);let g=o?.hasRemote===!0,_=n===null,v;t[3]!==a||t[4]!==c||t[5]!==g||t[6]!==n||t[7]!==r?(v=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await xa({...n,hasRemote:g,onClickWhenNoRemote:r},{clipboardWrite:_o,toastSuccess:vA,toastError:_A,logEvent:gA});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{gs.error(a({id:`u3YnKw`}))}l(!1)}},t[3]=a,t[4]=c,t[5]=g,t[6]=n,t[7]=r,t[8]=v):v=t[8];let y=v,b=u!==null,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[9]=x):x=t[9];let S;t[10]!==a||t[11]!==n?.kind?(S=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=S):S=t[12];let C=c||_,w,T;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(kl,{className:`size-3.5`,"aria-hidden":!0}),T=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=w,t[14]=T):(w=t[13],T=t[14]);let E;t[15]!==y||t[16]!==S||t[17]!==C?(E=(0,Z.jsx)(rt,{asChild:!0,children:(0,Z.jsxs)(Qi,{variant:`ghost`,size:`sm`,"aria-label":S,onClick:y,disabled:C,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[w,T]})}),t[15]=y,t[16]=S,t[17]=C,t[18]=E):E=t[18];let D;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=D):D=t[19];let O;t[20]===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[20]=O):O=t[20];let k=u??``,A;t[21]===a?A=t[22]:(A=a({id:`5-FeN2`}),t[21]=a,t[22]=A);let j;t[23]!==k||t[24]!==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)(vs,{ref:f,readOnly:!0,value:k,onFocus:hA,onClick:mA,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":A})]}),t[23]=k,t[24]=A,t[25]=j):j=t[25];let M;return t[26]!==E||t[27]!==j||t[28]!==b?(M=(0,Z.jsxs)(p,{open:b,onOpenChange:x,children:[E,j]}),t[26]=E,t[27]=j,t[28]=b,t[29]=M):M=t[29],M}function mA(e){return e.currentTarget.select()}function hA(e){return e.currentTarget.select()}function gA(e){return console.log(e)}function _A(e){e!==`Link ready but could not copy to clipboard.`&&gs.error(e)}function vA(e){return gs.success(e)}function yA(e){let t=(0,$.c)(54),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=pt(),{state:p}=ID(),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=Ms(`toggle-files-sidebar`),t[0]=m):m=t[0];let h=m,g=Ms(`command-palette`),_=Mo(),[v,y]=(0,Q.useState)(!1),b;bb0:{if(f===null){let e;t[1]===_?e=t[2]:(e=Bh({workspace:_}),t[1]=_,t[2]=e),b=e;break bb0}if(f.kind===`folder`){if(!_){b=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==_?(e=Vh({folderRelativePath:f.folderPath,workspace:_}),t[3]=f.folderPath,t[4]=_,t[5]=e):e=t[5],b=e;break bb0}let e;t[6]!==d||t[7]!==_?(e=zh({docName:d,workspace:_}),t[6]=d,t[7]=_,t[8]=e):e=t[8],b=e}let x=c??b,S;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=$a(f.folderPath),t[9]=f.folderPath,t[10]=e),S=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Xo(d),t[11]=d,t[12]=e),S=e;break bb1}S=null}let C=S,w=typeof window<`u`&&window.okDesktop!=null,T=p===`collapsed`,E=w?``:void 0,D=w&&T&&`pl-[78px]`,k;t[13]===D?k=t[14]:(k=Gi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,w&&`[-webkit-app-region:drag]`,D,w&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[13]=D,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(VD,{className:Gi(`-ml-1 shrink-0 text-muted-foreground`,w&&`[-webkit-app-region:no-drag]`)})}),t[15]=A):A=t[15];let j;t[16]===p?j=t[17]:(j=(0,Z.jsxs)(Yn,{children:[A,(0,Z.jsx)(nr,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:h}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:h}})})]}),t[16]=p,t[17]=j);let M=T&&a&&(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Tr,{asChild:!0,children:(0,Z.jsx)(Qi,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:g}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Gi(`shrink-0 text-muted-foreground`,w&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(O,{"aria-hidden":`true`})})}),(0,Z.jsx)(nr,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:g}})})]}),N,P;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(vo,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),P=(0,Z.jsx)(aA,{}),t[18]=N,t[19]=P):(N=t[18],P=t[19]);let F;t[20]!==M||t[21]!==j?(F=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[j,M,N,P]}),t[20]=M,t[21]=j,t[22]=F):F=t[22];let I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=Gi(`flex shrink-0 items-center justify-end gap-2 px-3`,w&&`[&>*]:[-webkit-app-region:no-drag]`),t[23]=I):I=t[23];let L;t[24]!==x||t[25]!==l||t[26]!==o?(L=(0,Z.jsx)(uA,{input:x,open:o,onOpenChange:l}),t[24]=x,t[25]=l,t[26]=o,t[27]=L):L=t[27];let R;t[28]===y?R=t[29]:(R=()=>y(!0),t[28]=y,t[29]=R);let z;t[30]!==C||t[31]!==R?(z=(0,Z.jsx)(pA,{input:C,onClickWhenNoRemote:R}),t[30]=C,t[31]=R,t[32]=z):z=t[32];let B;t[33]!==v||t[34]!==y?(B=(0,Z.jsx)(Qo,{open:v,onOpenChange:y}),t[33]=v,t[34]=y,t[35]=B):B=t[35];let V;t[36]!==r||t[37]!==n?(V=(0,Z.jsx)(jo,{onSignIn:n,onSetIdentity:r}),t[36]=r,t[37]=n,t[38]=V):V=t[38];let H,U,W,G,K;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(JO,{}),U=(0,Z.jsx)(vo,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),W=(0,Z.jsx)(Qu,{}),G=(0,Z.jsx)(fA,{}),K=(0,Z.jsx)(lA,{}),t[39]=H,t[40]=U,t[41]=W,t[42]=G,t[43]=K):(H=t[39],U=t[40],W=t[41],G=t[42],K=t[43]);let q;t[44]!==L||t[45]!==z||t[46]!==B||t[47]!==V?(q=(0,Z.jsxs)(`div`,{className:I,children:[L,z,B,V,H,U,W,G,K]}),t[44]=L,t[45]=z,t[46]=B,t[47]=V,t[48]=q):q=t[48];let J;return t[49]!==F||t[50]!==q||t[51]!==E||t[52]!==k?(J=(0,Z.jsxs)(`header`,{"data-electron-drag":E,className:k,children:[F,q]}),t[49]=F,t[50]=q,t[51]=E,t[52]=k,t[53]=J):J=t[53],J}function bA(e){let t=(0,$.c)(48),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]=Hg(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(lv[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),w=So(),{projectLocalConfig:T,projectLocalSynced:E}=gt(),D=Mo(),{activeDocName:O}=pt(),k=w?.hasRemote,A=w?.pushPermission?.checkStatus,j;t[2]!==v||t[3]!==T||t[4]!==E||t[5]!==k||t[6]!==A?(j=Kg({autoSyncOnboardingDismissed:v,hasRemote:k,projectLocalSynced:E,projectLocalConfig:T,pushPermissionCheckStatus:A}),t[2]=v,t[3]=T,t[4]=E,t[5]=k,t[6]=A,t[7]=j):j=t[7];let M=j,N,P;t[8]===O?(N=t[9],P=t[10]):(N=()=>{let e=function(e){let t=e.detail;t&&O&&oc(O,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(Pg,e),()=>window.removeEventListener(Pg,e)},P=[O],t[8]=O,t[9]=N,t[10]=P),(0,Q.useEffect)(N,P),Ug(w?.pausedReason);let F;t[11]===s?F=t[12]:(F=function(e){l(e),s(e)},t[11]=s,t[12]=F);let I=F,L;t[13]===a?L=t[14]:(L=async function(){_(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?gs.success(a({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),gs.error(a({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),gs.error(a({id:`q7zsRM`}))}_(!1)},t[13]=a,t[14]=L);let R=L,z;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){x(e),e||C(null)},t[15]=z):z=t[15];let B=z,V;t[16]!==a||t[17]!==O||t[18]!==D?(V={openSelection(e){let t=Hh({docName:e.docName,workspace:D,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown})??zh({docName:O,workspace:D});return t===null?(gs.error(a({id:`_VRtd7`})),!1):(C(t),x(!0),!0)}},t[16]=a,t[17]=O,t[18]=D,t[19]=V):V=t[19];let H,U;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{p(`auth`),d(!0)},U=()=>{p(`identity`),d(!0)},t[20]=H,t[21]=U):(H=t[20],U=t[21]);let W;t[22]!==r||t[23]!==S||t[24]!==b?(W=(0,Z.jsx)(yA,{onSignIn:H,onSetIdentity:U,onOpenSearch:r,openInAgentMenuOpen:b,openInAgentMenuInput:S,onOpenInAgentMenuOpenChange:B}),t[22]=r,t[23]=S,t[24]=b,t[25]=W):W=t[25];let G;t[26]!==m||t[27]!==c||t[28]!==I||t[29]!==R||t[30]!==g?(G=(0,Z.jsx)(CO,{editorMode:c,onModeChange:I,activeTab:m,onActiveTabChange:h,onSaveVersion:R,saving:g}),t[26]=m,t[27]=c,t[28]=I,t[29]=R,t[30]=g,t[31]=G):G=t[31];let K;t[32]!==V||t[33]!==W||t[34]!==G?(K=(0,Z.jsxs)(pc,{value:V,children:[W,G]}),t[32]=V,t[33]=W,t[34]=G,t[35]=K):K=t[35];let q=f===`identity`,J;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{d(!1)},t[36]=J):J=t[36];let Y;t[37]!==u||t[38]!==q?(Y=(0,Z.jsx)(Ea,{open:u,onOpenChange:d,identityPrompt:q,onSuccess:J}),t[37]=u,t[38]=q,t[39]=Y):Y=t[39];let ee;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>y(!0),t[40]=ee):ee=t[40];let te;t[41]===M?te=t[42]:(te=(0,Z.jsx)(Wg,{open:M,onResolved:ee}),t[41]=M,t[42]=te);let ne;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(jg,{}),t[43]=ne):ne=t[43];let re;return t[44]!==K||t[45]!==Y||t[46]!==te?(re=(0,Z.jsxs)(Z.Fragment,{children:[K,Y,te,ne]}),t[44]=K,t[45]=Y,t[46]=te,t[47]=re):re=t[47],re}function xA(e){let t=gr(Pn(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function SA(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=to();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Di,{"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)(Di,{"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(CA),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 CA(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:()=>xA(e.file),children:[(0,Z.jsx)(Di,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var wA=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
29
29
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
30
30
  <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"/>
31
31
  </symbol>
@@ -1912,4 +1912,4 @@ Error generating stack: `+e.message+`
1912
1912
  ${SH(gH,ee)}
1913
1913
  ${SH(_H,Ic)}
1914
1914
  ${bH}
1915
- </svg>`,wH=`${GB}\n${aV}`;function TH(e){return{...nM({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 EH(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&hH.has(t)}function DH(e){return e===`darwin`?lr._({id:`LtSYdi`}):e===`win32`?lr._({id:`qi1F96`}):lr._({id:`hz7n6T`})}function OH(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=DH(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=Lh(r.contentDir,pk(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)(yt,{"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)(Wo,{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 kH(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=Wo,u=n===null,t[8]!==n||t[9]!==r?(d=()=>{n!==null&&(r(),MV(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)(Rl,{"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 AH(e,t){return fk({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function jH(e,t){return e!==t&&e.startsWith(t)}function MH(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>jH(e,t))).map(e=>AH(e,t))}function NH(e,t){return e===t||e.startsWith(`${t}/`)}function PH(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 FH(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)zn(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):kr(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=tk(e);NH(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function IH(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:NH(t.createdPath,e.path)}function LH(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,E,D,O,k,A,j,M,N;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){N=fk(n,x),O=n.kind===`directory`,k=N.kind===`asset`?null:N,C=k!==null&&u!==null;let e;t[18]!==S||t[19]!==O?(e=S(O?{id:`5D3Ior`}:{id:`dbhUX1`}),t[18]=S,t[19]=O,t[20]=e):e=t[20],D=e,j=f?.appearance?.sidebar?.showHiddenFiles??!1,A=f?.appearance?.sidebar?.showAllFiles??!1,w=d!==null;let r=l.getSelectedPaths(),i=r.includes(N.treePath)?MH(r,x):[];E=i.length>1?i:[N];let a=E.length;M=lr._({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]=E,t[11]=D,t[12]=O,t[13]=k,t[14]=A,t[15]=j,t[16]=M,t[17]=N}else C=t[8],w=t[9],E=t[10],D=t[11],O=t[12],k=t[13],A=t[14],j=t[15],M=t[16],N=t[17];let P=M,F;t[21]!==O||t[22]!==n||t[23]!==o?(F=O&&o?Lh(o.contentDir,pk(n),o.pathSeparator):null,t[21]=O,t[22]=n,t[23]=o,t[24]=F):F=t[24];let I=F,L;if(t[25]!==O||t[26]!==n||t[27]!==o){bb0:{if(!o||O){L=null;break bb0}let e=pk(n),t=e.lastIndexOf(`/`);if(t===-1){L=o.contentDir;break bb0}L=Lh(o.contentDir,e.slice(0,t),o.pathSeparator)}t[25]=O,t[26]=n,t[27]=o,t[28]=L}else L=t[28];let R=L,z;t[29]!==b||t[30]!==O||t[31]!==n||t[32]!==o?(z=b?null:O?Vh({folderRelativePath:pk(n),workspace:o}):zh({docName:QO(n.path),workspace:o}),t[29]=b,t[30]=O,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:`,Er(t.error)),gs.error(S({id:`P47EWZ`}),{description:Er(t.error)}))},t[38]=S,t[39]=d,t[40]=G):G=t[40];let K=G,q;t[41]!==S||t[42]!==d?(q=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,Er(t.error)),gs.error(S({id:`P47EWZ`}),{description:Er(t.error)}))},t[41]=S,t[42]=d,t[43]=q):q=t[43];let J=q,Y=0,ee=0;if(O){let e=nk(n.path);for(let t of y)(t===e||t.startsWith(e))&&(Y++,kV(l.getItem(t))?.isExpanded()&&ee++)}let te=O&&ee<Y,ne=O&&ee>0,ie;t[44]===W?ie=t[45]:(ie=e=>{e||W()},t[44]=W,t[45]=ie);let ae;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(Ho,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[46]=ae):ae=t[46];let oe;t[47]!==S||t[48]!==a||t[49]!==C||t[50]!==w||t[51]!==W||t[52]!==H||t[53]!==P||t[54]!==E||t[55]!==I||t[56]!==J||t[57]!==K||t[58]!==c||t[59]!==B||t[60]!==D||t[61]!==b||t[62]!==O||t[63]!==n||t[64]!==l||t[65]!==u||t[66]!==k||t[67]!==v||t[68]!==m||t[69]!==g||t[70]!==h||t[71]!==_||t[72]!==p||t[73]!==R||t[74]!==A||t[75]!==j||t[76]!==ne||t[77]!==te||t[78]!==N||t[79]!==o?(oe=(0,Z.jsx)(xo,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:O?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{H(),p(`file`,tk(n.path))},children:[(0,Z.jsx)(Nl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`MW64zN`})]}),(0,Z.jsxs)(To,{children:[(0,Z.jsxs)(Fo,{disabled:a,children:[(0,Z.jsx)(mo,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(go,{children:(0,Z.jsx)(OV,{parentDir:tk(n.path),onSelectTemplate:e=>{H(),m(tk(n.path),e)},ItemComponent:Wo})})]}),(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{H(),p(`folder`,tk(n.path))},children:[(0,Z.jsx)(el,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`tX5yOZ`})]}),(0,Z.jsx)(Vo,{}),(0,Z.jsx)(OH,{item:n,workspace:o,onClose:W}),(0,Z.jsx)(XV,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!1}),(0,Z.jsx)(kH,{dirAbsPath:I,onClose:W}),(0,Z.jsxs)(To,{children:[(0,Z.jsxs)(Fo,{children:[(0,Z.jsx)(Be,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(go,{children:[(0,Z.jsx)(Wo,{disabled:!o,onSelect:()=>{o&&(W(),mH(Lh(o.contentDir,pk(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(Wo,{onSelect:()=>{W(),mH(pk(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(Vo,{}),(0,Z.jsx)(ha,{checked:j,onCheckedChange:K,disabled:!w,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`K_wz1u`})}),(0,Z.jsx)(ha,{checked:A,onCheckedChange:J,disabled:!w,"data-testid":`file-tree-menu-show-all-files`,children:(0,Z.jsx)(s,{id:`i8dKs-`})}),te||ne?(0,Z.jsx)(Vo,{}):null,te?(0,Z.jsxs)(Wo,{onSelect:()=>{W(),_(n.path)},children:[(0,Z.jsx)(Vl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}):null,ne?(0,Z.jsxs)(Wo,{onSelect:()=>{W(),v(n.path)},children:[(0,Z.jsx)(Qc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]}):null,(0,Z.jsx)(Vo,{}),(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{N.kind!==`asset`&&(W(),h(N))},children:[(0,Z.jsx)(Ke,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)(Wo,{"data-testid":`file-tree-menu-hide`,disabled:!C,onSelect:()=>{if(!u||!k)return;W();let e=QB(k),t=Go(u.current()),n=Po(t,e);if(n===t)return;u.patch(Io(n));let r=k.path.split(`/`).pop()||k.path;gs.success(S({id:`4xtLTl`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(lt,{"aria-hidden":`true`}),D]}),(0,Z.jsxs)(Wo,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(E)},children:[(0,Z.jsx)(re,{"aria-hidden":`true`}),P]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(OH,{item:n,workspace:o,onClose:W}),!b&&(0,Z.jsx)(XV,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!0}),(0,Z.jsx)(kH,{dirAbsPath:R,onClose:W}),(0,Z.jsxs)(To,{children:[(0,Z.jsxs)(Fo,{children:[(0,Z.jsx)(Be,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(go,{children:[(0,Z.jsx)(Wo,{disabled:!o,onSelect:()=>{o&&(W(),mH(Lh(o.contentDir,pk(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(Wo,{onSelect:()=>{W(),mH(pk(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(Vo,{}),b?null:(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{W(),h(N)},children:[(0,Z.jsx)(Ke,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),k?(0,Z.jsxs)(Wo,{"data-testid":`file-tree-menu-hide`,disabled:!C,onSelect:()=>{if(!u)return;W();let e=QB(k),t=Go(u.current()),n=Po(t,e);if(n===t)return;u.patch(Io(n));let r=k.path.split(`/`).pop()||k.path;gs.success(S({id:`OD0FCX`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(lt,{"aria-hidden":`true`}),D]}):null,(0,Z.jsxs)(Wo,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(E)},children:[(0,Z.jsx)(re,{"aria-hidden":`true`}),P]})]})}),t[47]=S,t[48]=a,t[49]=C,t[50]=w,t[51]=W,t[52]=H,t[53]=P,t[54]=E,t[55]=I,t[56]=J,t[57]=K,t[58]=c,t[59]=B,t[60]=D,t[61]=b,t[62]=O,t[63]=n,t[64]=l,t[65]=u,t[66]=k,t[67]=v,t[68]=m,t[69]=g,t[70]=h,t[71]=_,t[72]=p,t[73]=R,t[74]=A,t[75]=j,t[76]=ne,t[77]=te,t[78]=N,t[79]=o,t[80]=oe):oe=t[80];let se;return t[81]!==oe||t[82]!==ie?(se=(0,Z.jsxs)(Ya,{open:!0,modal:!1,onOpenChange:ie,children:[ae,oe]}),t[81]=oe,t[82]=ie,t[83]=se):se=t[83],se}function RH(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}=pt(),{notifySidebarFileSelected:_}=ID(),{resolvedTheme:v}=Wr(),{addPage:y,pageMeta:b}=ki(),x;t[0]===b?x=t[1]:(x=function(e,t){return Ci(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`}),dH(gr(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=_r(e);m({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),dH(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),[P,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}=to(),[W,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(null),J=(0,Q.useRef)(O),Y;t[10]!==O||t[11]!==E||t[12]!==w||t[13]!==_||t[14]!==m?(Y=function(e,t){let n=t===void 0?O:t,r=gV(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,rk(e));return}if(r.kind===`asset`){m({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),dH(r.hash),_();return}if(r.kind===`folder`){E(r.path);return}let i=n.find(e=>zn(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]=Y):Y=t[15];let ee=Y,te;t[16]!==_||t[17]!==m?(te=function(e){m({kind:`asset`,target:e,assetPath:e,mediaKind:J.current.find(t=>kr(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),dH(fi(e)),_()},t[16]=_,t[17]=m,t[18]=te):te=t[18];let ne=te,re=(0,Q.useRef)(a),ie;t[19]===O?ie=t[20]:(ie=new Set(O.filter(kr).map(cU)),t[19]=O,t[20]=ie);let ae=ie,oe=(0,Q.useRef)(ae),se;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(se=[],t[21]=se):se=t[21];let ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(sU),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(!1),me=(0,Q.useRef)(null),he;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(he=new Map,t[22]=he):he=t[22];let ge=(0,Q.useRef)(he),_e=(0,Q.useRef)(!1),ve=(0,Q.useRef)(!1),ye=(0,Q.useRef)(null),be=(0,Q.useRef)(null),xe=(0,Q.useRef)(oU),Se=(0,Q.useRef)(aU),Ce=(0,Q.useRef)(iU),we=(0,Q.useRef)(rU),Te=(0,Q.useRef)(o),{selectedFilePath:Ee,selectedFolderPath:De,navigationPath:Oe}=hV(o,p?null:a),ke=Ee?ZO(Ee,O.find(e=>zn(e)&&e.docName===Ee)?.docExt):De?nk(De):o?.kind===`asset`?o.assetPath:null,Ae=ug().states,{dispatch:je}=$h(),Me;t[23]!==je||t[24]!==Ae?(Me={installStates:Ae,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:je},t[23]=je,t[24]=Ae,t[25]=Me):Me=t[25];let Ne=Me,{okignoreBinding:Pe,projectLocalBinding:Fe,merged:Ie}=gt(),Le=Ie?.appearance?.sidebar?.showHiddenFiles??!1,Re=Ie?.appearance?.sidebar?.showAllFiles??!1,ze;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>me.current===null,t[26]=ze):ze=t[26];let Be=ze,Ve;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=[],t[27]=Ve):Ve=t[27];let He;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(He={set:`complete`,spriteSheet:CH,byFileExtension:{md:{name:vH,viewBox:yH},mdx:{name:vH,viewBox:yH}}},t[28]=He):He=t[28];let Ue;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Ue={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[29]=Ue):Ue=t[29];let We;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(We={canDrag:Be,canDrop:Be,onDropComplete:e=>we.current(e),onDropError:nU},t[30]=We):We=t[30];let Ge,Ke;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Ge={canRename:Be,onRename:e=>Se.current(e),onError:e=>Ce.current(e)},Ke=e=>xe.current(e),t[31]=Ge,t[32]=Ke):(Ge=t[31],Ke=t[32]);let qe;t[33]===r?qe=t[34]:(qe={paths:Ve,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:He,unsafeCSS:wH,composition:Ue,dragAndDrop:We,renaming:Ge,onSelectionChange:Ke,renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=J.current.find(e=>zn(e)&&ZO(e.docName,e.docExt)===t.path);if(n?.isSymlink){let e=n.targetPath;return{icon:gH,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return EH(t.path)?{icon:_H,title:r({id:`i9toLO`})}:null}},t[33]=r,t[34]=qe);let{model:X}=zB(qe),Je;t[35]===X?Je=t[36]:(Je=function(e){let t=X.getItem(e)??X.getItem(nk(e));return t?.isDirectory()?nk(tk(t.getPath())):e},t[35]=X,t[36]=Je);let Ye=Je,Xe,Ze;t[37]===O?(Xe=t[38],Ze=t[39]):(Ze=ik(O),Xe=ak(Ze),t[37]=O,t[38]=Xe,t[39]=Ze);let Qe=Xe,$e=(0,Q.useRef)(Ze),et;t[40]===O?et=t[41]:(et=sk(O),t[40]=O,t[41]=et);let tt=et,nt=(0,Q.useRef)(tt),rt=De?ck(nk(De)).slice(0,-1):ck(ke??Oe),it=rt.join(`\0`),at;if(t[42]!==X){let e=()=>{let e=new Set;for(let t of nt.current)kV(X.getItem(t))?.isExpanded()&&e.add(t);return e};at=t=>{let n=new Set(sk(t??J.current)),r=e();for(let e of ce.current)r.add(e);return[...r].filter(e=>n.has(e))},t[42]=X,t[43]=at}else at=t[43];let ot=at,st;t[44]!==ot||t[45]!==X?(st=e=>{let t=ik(e??J.current);X.resetPaths(t,{initialExpandedPaths:ot(e)})},t[44]=ot,t[45]=X,t[46]=st):st=t[46];let ct=st,lt;t[47]!==X||t[48]!==ct?(lt=(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=>zn(e)&&e.docName===t);if(n==null||X.getItem(r)==null)continue;let i=ZO(r,n.docExt);X.move(r,i),o=i,a+=1}for(let{toPath:e}of i){let t=BB(e);if(t===``)continue;let n=e.slice(0,-t.length);X.getItem(n)!=null&&(X.getItem(e)??X.move(n,e),o=e,a+=1)}a!==0&&(ct(t),o!=null&&X.focusPath(o))},t[47]=X,t[48]=ct,t[49]=lt):lt=t[49];let ut=lt,dt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(dt=e=>{de.current=ok(e)},t[50]=dt):dt=t[50];let ft=dt,mt;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(mt=e=>oe.current.has(e),t[51]=mt):mt=t[51];let ht=mt,_t;t[52]!==r||t[53]!==y||t[54]!==E||t[55]!==w||t[56]!==ct?(_t=async function(e){if(e.kind===`asset`||me.current!==null)return;let t=()=>{R(null),me.current=null};me.current=e.path,R(e.path),N(null);try{let n=await Tt(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){gs.error(n.title),ct(),t();return}let i=F(Fn,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});gs.error(e),N(e),Ti([`files`,`backlinks`,`graph`]),ct(),t();return}for(let e of i.duplicatedDocNames)y(e);k(t=>{let n=Ek(t,e,i);return ct(n),ft(n),n}),Ti([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?E(i.path):w(i.path)),gs.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),gs.error(r({id:`EBVbtP`}),{description:i}),ct(),t()}},t[52]=r,t[53]=y,t[54]=E,t[55]=w,t[56]=ct,t[57]=_t):_t=t[57];let vt=_t,yt=(0,Q.useRef)(vt),bt;t[58]===vt?bt=t[59]:(bt=()=>{yt.current=vt},t[58]=vt,t[59]=bt),(0,Q.useEffect)(bt);let xt=function(e){let t=fH(e);if(!t||pH(t))return!1;let n=X.getFocusedPath()??X.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||ht(n))return!1;let r=pH(n);if(!r)return!1;let i=nk(t);if(!nt.current.includes(i))return!1;let a=`${t}${r}`;return $e.current.includes(a)?!1:(Qt({sourcePath:n,destinationPath:a,isFolder:!1}),X.move(n,a),!0)},St;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(St=e=>{let t=e??le.current;!t||le.current!==t||(t.disposeCommitListener(),le.current=null)},t[60]=St):St=t[60];let Ct=St,wt;t[61]!==r||t[62]!==Ct||t[63]!==l||t[64]!==c||t[65]!==ct?(wt=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;Ct(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 Tt(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?gs.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(R(null),ct());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;gs.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(R(null),ct());return}i&&(e.kind===`file`?l(e.createdPath):c([Zt(e.createdPath)],{force:!0})),i&&k(t=>{let n=wk(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return ft(n),n}),Ti([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&R(null)},t[61]=r,t[62]=Ct,t[63]=l,t[64]=c,t[65]=ct,t[66]=wt):wt=t[66];let Et=wt,Dt,Ot;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=()=>()=>{let e=le.current;e&&ue.current(e,{restoreLocation:!1,updateUi:!1}).catch(tU)},Ot=[],t[67]=Dt,t[68]=Ot):(Dt=t[67],Ot=t[68]),(0,Q.useEffect)(Dt,Ot);let kt,At;t[69]===r?(kt=t[70],At=t[71]):(kt=()=>{let e=!0,t=null,n=HV(async function(){t?.abort();let n=new AbortController;t=n;try{let t=ve.current,i=await fetch(t?`/api/documents?showAll=true`:`/api/documents`,{signal:n.signal,headers:t?UV:void 0});if(t&&WV(i)){let{entries:n,truncated:r}=await qV(i);if(!e)return;k(JV(Bi(n,_e.current||t),J.current,ge.current)),N(null),I(r?n.length:null)}else{let n=await Tt(i,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)N(n.title),I(null);else{let e=vi.safeParse(n.body);if(!e.success)N(r({id:`HlmZBk`})),I(null);else{let n=_e.current||t;k(JV(Bi(e.data.documents,n),J.current,ge.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());ye.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=ni(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,ye.current=null,n.dispose(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},At=[r],t[69]=r,t[70]=kt,t[71]=At),(0,Q.useEffect)(kt,At);let jt=(0,Q.useRef)(!0),Mt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=()=>{if(jt.current){jt.current=!1;return}ye.current?.()},t[72]=Mt):Mt=t[72];let Nt;t[73]===Le?Nt=t[74]:(Nt=[Le],t[73]=Le,t[74]=Nt),(0,Q.useEffect)(Mt,Nt);let Pt=(0,Q.useRef)(!0),Ft;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Ft=()=>{if(Pt.current){Pt.current=!1;return}ye.current?.()},t[75]=Ft):Ft=t[75];let It;t[76]===Re?It=t[77]:(It=[Re],t[76]=Re,t[77]=It),(0,Q.useEffect)(Ft,It);let Lt,Rt;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=F(Vi,n,`workspace`,null);r&&q({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(eU),()=>{e=!1}},Rt=[],t[78]=Lt,t[79]=Rt):(Lt=t[78],Rt=t[79]),(0,Q.useEffect)(Lt,Rt);let zt;t[80]!==ot||t[81]!==X||t[82]!==Qe?(zt=()=>{if(de.current===Qe){de.current=null;return}X.resetPaths($e.current,{initialExpandedPaths:ot()})},t[80]=ot,t[81]=X,t[82]=Qe,t[83]=zt):zt=t[83];let Bt;t[84]!==X||t[85]!==Qe?(Bt=[X,Qe],t[84]=X,t[85]=Qe,t[86]=Bt):Bt=t[86],(0,Q.useEffect)(zt,Bt),jV(X,ke,it,pe,Qe);let Vt;t[87]!==ke||t[88]!==A||t[89]!==X?(Vt=()=>{A||!ke||pV(be.current,X)},t[87]=ke,t[88]=A,t[89]=X,t[90]=Vt):Vt=t[90];let Ht;t[91]!==it||t[92]!==ke||t[93]!==A||t[94]!==X||t[95]!==Qe?(Ht=[ke,it,Qe,A,X],t[91]=it,t[92]=ke,t[93]=A,t[94]=X,t[95]=Qe,t[96]=Ht):Ht=t[96],(0,Q.useEffect)(Vt,Ht);let Ut,Wt;t[97]===X?(Ut=t[98],Wt=t[99]):(Ut=()=>X.subscribe(()=>{if(!X.isSearchOpen())for(let e of ce.current){let t=kV(X.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Wt=[X],t[97]=X,t[98]=Ut,t[99]=Wt),(0,Q.useEffect)(Ut,Wt);let Gt,qt;t[100]===X?(Gt=t[101],qt=t[102]):(Gt=()=>X.onMutation(`remove`,e=>{let t=le.current;!t||e.path!==t.renamePath||ue.current(t)}),qt=[X],t[100]=X,t[101]=Gt,t[102]=qt),(0,Q.useEffect)(Gt,qt);let Yt;t[103]!==y||t[104]!==u||t[105]!==d||t[106]!==ne||t[107]!==E||t[108]!==f||t[109]!==ut||t[110]!==g?(Yt=async(e,t,n,r)=>{let i=t===void 0?[]:t,a=n===void 0?[]:n,o=r?.docName??re.current,s=Dk(o,e),c=r?.folderPath??(Te.current?.kind===`folder`?Te.current.folderPath:null),l=c?Jt(c,i):null,p=r?.assetPath??(Te.current?.kind===`asset`?Te.current.assetPath:null),m=p?a.find(e=>e.fromPath===p)?.toPath??Jt(p,i):null;Kt(e);let h=Ok(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=Ck(t,e,i,a);return ut(t,n,e,a),ft(n),n}),c&&l&&l!==c?E(l):s&&s!==o?window.location.hash=gr(s):p&&m&&m!==p&&ne(m),Ti([`files`,`backlinks`,`graph`])},t[103]=y,t[104]=u,t[105]=d,t[106]=ne,t[107]=E,t[108]=f,t[109]=ut,t[110]=g,t[111]=Yt):Yt=t[111];let Xt=Yt;async function Qt(e){let t=!e.isFolder&&ht(e.sourcePath),n=t?e.sourcePath:mk(e.sourcePath,e.isFolder);R(n),N(null);try{let i=HB(e.sourcePath,e.destinationPath,e.isFolder,t);if(i.kind===`block`){gs.error(r({id:`FaBZwp`})),queueMicrotask(()=>{ct()}),Ct(),R(null);return}let a=t?i.destinationPath:mk(i.destinationPath,e.isFolder),o=e.isFolder?{kind:`folder`,fromPath:tk(n),toPath:tk(a)}:t?{kind:`asset`,fromPath:n,toPath:a}:{kind:`file`,fromPath:QO(n),toPath:QO(a)},s={docName:re.current,folderPath:Te.current?.kind===`folder`?Te.current.folderPath:null,assetPath:Te.current?.kind===`asset`?Te.current.assetPath:null},c=await Tt(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o)}),r({id:`gijbne`}));if(!c.ok){gs.error(c.title),ct();let e=le.current;e&&e.renamePath===n?await Et(e):Ct(),R(null);return}let l=F(li,c.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await Xt(l.renamed,e.isFolder?[{fromPath:tk(n),toPath:tk(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}),gs.error(r({id:`dDpCOp`}))}Ct(),R(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});gs.error(t),N(t),ct();let i=le.current;i&&i.renamePath===n?await Et(i):Ct(),R(null)}}let $t;t[112]!==r||t[113]!==Xt||t[114]!==ct?($t=async function(e){let t=e.draggedPaths.map(t=>{let n=_k(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter($H);if(t.length!==0){R(t[0]?.sourcePath??null),N(null);try{let e=[],n=[],i=[],a={docName:re.current,folderPath:Te.current?.kind===`folder`?Te.current.folderPath:null,assetPath:Te.current?.kind===`asset`?Te.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&ht(a.sourcePath),s=t?{kind:`folder`,fromPath:tk(a.sourcePath),toPath:tk(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:QO(a.sourcePath),toPath:QO(a.destinationTreePath)},c=await Tt(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){gs.error(c.title),ct(),R(null);return}let l=F(li,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:tk(a.sourcePath),toPath:tk(a.destinationTreePath)})}try{await Xt(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),gs.error(r({id:`8OxKZy`}))}R(null)}catch(e){console.warn(`[FileTree] move failed:`,e),gs.error(r({id:`HIb0vl`})),ct(),R(null)}}},t[112]=r,t[113]=Xt,t[114]=ct,t[115]=$t):$t=t[115];let en=$t,tn;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(tn=function(e){G({parentDir:e})},t[116]=tn):tn=t[116];let nn=tn,rn;t[117]!==r||t[118]!==y||t[119]!==Et||t[120]!==Ct||t[121]!==X||t[122]!==E||t[123]!==w||t[124]!==ct||t[125]!==Ze?(rn=async function(e,t,n){if(me.current)return;let i=le.current;i&&Ct(i);try{let i=hk(e,t,[...Ze,...nt.current]);R(i.renamePath),me.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=gk(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await Tt(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){gs.error(a.title),R(null),me.current=null;return}let s=QO(e),c=F(zi,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=>zn(e)&&e.docName===c))return e;let t=[...e,l];return ft(t),ge.current.set($O(l),Date.now()),t}),Ti([`files`,`backlinks`,`graph`]),w(c)}else{let e=tk(i.addPath),t=await Tt(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){gs.error(t.title),R(null),me.current=null;return}o=F(Vn,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=>Li(e)&&e.path===o))return e;let t=[...e,n];return ft(t),ge.current.set($O(n),Date.now()),t}),Ti([`files`]),E(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=le.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>Ct(t))};document.addEventListener(`keydown`,c,!0),le.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},R(null),me.current=null,X.add(i.addPath),X.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),gs.error(r({id:`S6l5dv`}));let t=le.current;t?await Et(t):Ct(),R(null),me.current=null,ct()}},t[117]=r,t[118]=y,t[119]=Et,t[120]=Ct,t[121]=X,t[122]=E,t[123]=w,t[124]=ct,t[125]=Ze,t[126]=rn):rn=t[126];let an=rn,on;t[127]===X?on=t[128]:(on=function(e){let t=nk(e);(0,Q.startTransition)(()=>{for(let e of nt.current)if(e===t||e.startsWith(t)){let t=kV(X.getItem(e));t&&t.expand()}})},t[127]=X,t[128]=on);let sn=on,cn;t[129]===X?cn=t[130]:(cn=function(e){let t=nk(e),n=new Set(ce.current);(0,Q.startTransition)(()=>{for(let e of[...nt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=kV(X.getItem(e));t&&t.collapse()}})},t[129]=X,t[130]=cn);let ln=cn,un;t[131]!==ee||t[132]!==rt||t[133]!==a||t[134]!==o||t[135]!==ae||t[136]!==L||t[137]!==Et||t[138]!==O||t[139]!==tt||t[140]!==en||t[141]!==Qt||t[142]!==Ye||t[143]!==xt||t[144]!==Re||t[145]!==Le||t[146]!==Ze?(un=()=>{J.current=O,re.current=a,Te.current=o,oe.current=ae,me.current=L,_e.current=Le,ve.current=Re,$e.current=Ze,nt.current=tt,ce.current=rt,ue.current=Et,xe.current=e=>{if(pe.current||e.length!==1)return;let t=e[0];t&&ee(Ye(t),O)},Ce.current=e=>{xt(e)||gs.error(e)},Se.current=Qt,we.current=en},t[131]=ee,t[132]=rt,t[133]=a,t[134]=o,t[135]=ae,t[136]=L,t[137]=Et,t[138]=O,t[139]=tt,t[140]=en,t[141]=Qt,t[142]=Ye,t[143]=xt,t[144]=Re,t[145]=Le,t[146]=Ze,t[147]=un):un=t[147],(0,Q.useLayoutEffect)(un);let dn,fn;t[148]===X?(dn=t[149],fn=t[150]):(dn=()=>{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||PH(e.target))return;let a=be.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=X.getFocusedPath()??X.getSelectedPaths()[0]??null;if(!t)return;let n=X.getItem(t)??X.getItem(nk(t)),r=n?.isDirectory()?nk(tk(n.getPath())):t;if(oe.current.has(r))return;yt.current(AH(r,J.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...nt.current,...$e.current]);pe.current=!0;for(let e of u)e&&X.getItem(e)?.select();queueMicrotask(()=>{pe.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},fn=[X],t[148]=X,t[149]=dn,t[150]=fn),(0,Q.useEffect)(dn,fn);let pn,mn;t[151]!==O.length||t[152]!==A?(pn=()=>{if(A||O.length===0)return;let e=be.current?.querySelector(Fj)?.shadowRoot;if(!e)return;let t=QH,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()},mn=[A,O.length],t[151]=O.length,t[152]=A,t[153]=pn,t[154]=mn):(pn=t[153],mn=t[154]),(0,Q.useEffect)(pn,mn);let hn,gn;t[155]!==O.length||t[156]!==A?(hn=()=>{if(A||O.length===0)return;let e=be.current?.querySelector(Fj)?.shadowRoot;if(!e)return;let t=()=>KB(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()},gn=[A,O.length],t[155]=O.length,t[156]=A,t[157]=hn,t[158]=gn):(hn=t[157],gn=t[158]),(0,Q.useEffect)(hn,gn);let _n,vn;t[159]!==O.length||t[160]!==A?(_n=()=>{if(A||O.length===0)return;let e=be.current?.querySelector(Fj)?.shadowRoot;if(!e)return;let t=()=>oV(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},vn=[A,O.length],t[159]=O.length,t[160]=A,t[161]=_n,t[162]=vn):(_n=t[161],vn=t[162]),(0,Q.useEffect)(_n,vn);let yn;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(yn={folderCount:0,expandedCount:0},t[163]=yn):yn=t[163];let bn=(0,Q.useRef)(yn),xn=(0,Q.useRef)(an),Sn=(0,Q.useRef)(nn),Cn;t[164]===an?Cn=t[165]:(Cn=()=>{xn.current=an,Sn.current=nn},t[164]=an,t[165]=Cn),(0,Q.useEffect)(Cn);let wn,Tn;t[166]===X?(wn=t[167],Tn=t[168]):(wn=()=>({startCreating(e,t){xn.current(e,t)},startCreatingFromTemplate(e){Sn.current(e)},createFromTemplate(e,t){xn.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of nt.current){let t=kV(X.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(ce.current);(0,Q.startTransition)(()=>{for(let t of[...nt.current].reverse()){if(e.has(t))continue;let n=kV(X.getItem(t));n&&n.collapse()}})},getFolderState(){let e=nt.current,t=0;for(let n of e)kV(X.getItem(n))?.isExpanded()&&t++;let n=e.length,r=bn.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return bn.current=i,i},subscribe(e){return X.subscribe(e)}}),Tn=[X],t[166]=X,t[167]=wn,t[168]=Tn),(0,Q.useImperativeHandle)(n,wn,Tn);let En;t[169]!==Ct||t[170]!==u||t[171]!==c||t[172]!==X?(En=async function(e,t,n){let r=FH(e,J.current,nt.current),i=le.current;i&&e.some(e=>IH(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Ct(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(ZH).map(XH)]);c([...[...a].map(YH),...[...o].map(JH),...[...s].map(qH)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?nk(t.path):t.kind===`asset`?t.path:ZO(t.path,t.docExt);X.getItem(e)&&X.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}k(e=>{let t=wk(e,[...a],void 0,[...s]);for(let e of o)t=wk(t,[],e);return ft(t),t}),Ti([`files`,`backlinks`,`graph`])},t[169]=Ct,t[170]=u,t[171]=c,t[172]=X,t[173]=En):En=t[173];let Dn=En,On;t[174]!==r||t[175]!==Dn?(On=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;R(a.path);let o=await Tt(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 Dn(i,t,n),gs.error(o.title),!1;let s=F(Gn,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await Dn(i,t,n),!0},t[174]=r,t[175]=Dn,t[176]=On):On=t[176];let kn=On,An;t[177]===Symbol.for(`react.memo_cache_sentinel`)?(An=async function(e,t,n){let r=[],i=[];for(let a of e){R(a.path);let e=kk(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:SV(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[177]=An):An=t[177];let jn=An,Mn;t[178]===r?Mn=t[179]:(Mn=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await Tt(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=F(oi,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;gs.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]=Mn);let Nn=Mn,Pn;t[180]!==r||t[181]!==U||t[182]!==Dn||t[183]!==kn||t[184]!==Nn||t[185]!==ct||t[186]!==K?(Pn=async function(e){let t=e.map(e=>Tk(e,J.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(KH),t=i.length>e.length?`, +${i.length-e.length} more`:``;gs.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&&K){let{trashed:e,failed:n}=await jn(t,a,K);if(e.length>0){let t=await Nn(e);t?await Dn(e,t.deletedDocNames,t.deletedFolderPaths):await Dn(e,e.filter(GH).map(WH),e.filter(UH).map(HH))}n.length>0&&H({failed:n,originalTargets:[...t]}),R(null)}else{let e=await kn(t);R(null),e||ct()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),gs.error(r({id:`0eHrMb`}),{description:n}),R(null),ct()}},t[180]=r,t[181]=U,t[182]=Dn,t[183]=kn,t[184]=Nn,t[185]=ct,t[186]=K,t[187]=Pn):Pn=t[187];let In=Pn,Ln;t[188]!==r||t[189]!==kn||t[190]!==ct||t[191]!==V?(Ln=async function(){if(!V)return;let e=new Set(V.failed.map(VH)),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 kn(t);R(null),e||ct()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),gs.error(r({id:`0eHrMb`}),{description:n}),R(null),ct()}}},t[188]=r,t[189]=kn,t[190]=ct,t[191]=V,t[192]=Ln):Ln=t[192];let Rn=Ln,Bn;t[193]!==In||t[194]!==V?(Bn=async function(){if(!V)return;let e=new Set(V.failed.map(BH)),t=V.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));H(null),await In(t)},t[193]=In,t[194]=V,t[195]=Bn):Bn=t[195];let Hn=Bn,Un=(0,Q.useRef)(In),Wn;t[196]===In?Wn=t[197]:(Wn=()=>{Un.current=In},t[196]=In,t[197]=Wn),(0,Q.useEffect)(Wn);let Kn,qn;t[198]===Symbol.for(`react.memo_cache_sentinel`)?(Kn=()=>LV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=J.current.find(e=>zn(e)&&e.docName===t);Un.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Un.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){Un.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}))}),qn=[],t[198]=Kn,t[199]=qn):(Kn=t[198],qn=t[199]),(0,Q.useEffect)(Kn,qn);let Jn,Yn;t[200]===Symbol.for(`react.memo_cache_sentinel`)?(Jn=()=>VV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=J.current.find(e=>zn(e)&&e.docName===t);yt.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){yt.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}))}),Yn=[],t[200]=Jn,t[201]=Yn):(Jn=t[200],Yn=t[201]),(0,Q.useEffect)(Jn,Yn);let Xn,Zn;t[202]===X?(Xn=t[203],Zn=t[204]):(Xn=()=>zV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ZO(t,J.current.find(e=>zn(e)&&e.docName===t)?.docExt);X.startRenaming(n);return}if(e.kind===`folder`){X.startRenaming(e.folderPath);return}if(e.kind===`asset`){X.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),Zn=[X],t[202]=X,t[203]=Xn,t[204]=Zn),(0,Q.useEffect)(Xn,Zn);let Qn;t[205]===Symbol.for(`react.memo_cache_sentinel`)?(Qn=function(){let e=fe.current;e&&lH(e),fe.current=null},t[205]=Qn):Qn=t[205];let $n=Qn,er;t[206]===h?er=t[207]:(er=function(e){let t=lU(e.nativeEvent);if(!t||t.endsWith(`/`)){$n();return}let n=QO(t),r=J.current.find(e=>$O(e)===t);if(r&&kr(r)){$n();return}if(r&&zn(r)&&Ii(r.size)){$n();return}fe.current!==n&&($n(),fe.current=n,cH(n,e=>h(e)))},t[206]=h,t[207]=er);let tr=er,nr;t[208]!==ee||t[209]!==X||t[210]!==E?(nr=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=uU(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?nk(n):n;if(X.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=tk(r);if(window.location.hash===_r(e))return;queueMicrotask(()=>E(e));return}let i=QO(r);window.location.hash!==gr(i)&&queueMicrotask(()=>ee(r))},t[208]=ee,t[209]=X,t[210]=E,t[211]=nr):nr=t[211];let rr=nr;if(A){let e;return t[212]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(fU,{}),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]===an?n=t[217]:(n=()=>an(`file`,``),t[216]=an,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 ir=L!==null,ar=z?.targets[0]??null,or;t[221]!==M||t[222]!==P?(or=(M||P!==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}),P!==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:P}})})]}),t[221]=M,t[222]=P,t[223]=or):or=t[223];let sr;t[224]===v?sr=t[225]:(sr=TH(v),t[224]=v,t[225]=sr);let cr;t[226]!==ir||t[227]!==ae||t[228]!==ln||t[229]!==O||t[230]!==sn||t[231]!==tt||t[232]!==vt||t[233]!==Ne||t[234]!==Ie||t[235]!==X||t[236]!==Pe||t[237]!==Fe||t[238]!==an||t[239]!==K?(cr=(e,t)=>(0,Z.jsx)(LH,{item:e,context:t,anyActionBusy:ir,workspace:K,handoff:Ne,model:X,okignoreBinding:Pe,projectLocalBinding:Fe,mergedConfig:Ie,onStartCreating:an,onCreateFromTemplate:(e,t)=>an(`file`,e,{template:t}),onDuplicate:vt,onDelete:e=>B({targets:e}),onExpandSubtree:sn,onCollapseSubtree:ln,folderTreePaths:tt,isAsset:ae.has(e.path),documents:O}),t[226]=ir,t[227]=ae,t[228]=ln,t[229]=O,t[230]=sn,t[231]=tt,t[232]=vt,t[233]=Ne,t[234]=Ie,t[235]=X,t[236]=Pe,t[237]=Fe,t[238]=an,t[239]=K,t[240]=cr):cr=t[240];let lr;t[241]!==rr||t[242]!==tr||t[243]!==X||t[244]!==or||t[245]!==sr||t[246]!==cr?(lr=(0,Z.jsx)(`div`,{ref:be,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(RB,{header:or,model:X,style:sr,onClickCapture:rr,onMouseMove:tr,onMouseLeave:$n,renderContextMenu:cr})}),t[241]=rr,t[242]=tr,t[243]=X,t[244]=or,t[245]=sr,t[246]=cr,t[247]=lr):lr=t[247];let ur=!!z,dr;t[248]===L?dr=t[249]:(dr=e=>{!e&&!L&&B(null)},t[248]=L,t[249]=dr);let fr;t[250]!==r||t[251]!==L||t[252]!==z||t[253]!==In||t[254]!==ar?(fr=z&&ar&&(0,Z.jsx)(_a,{...(()=>{let e=yV(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=ar.name;return{itemName:t===1?ar.kind===`folder`?`${ar.name}/`:ar.kind===`file`?`${ar.name}${ar.docExt??`.md`}`:ar.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):ar.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]=ar,t[255]=fr):fr=t[255];let pr;t[256]!==ur||t[257]!==dr||t[258]!==fr?(pr=(0,Z.jsx)(ps,{open:ur,onOpenChange:dr,children:fr}),t[256]=ur,t[257]=dr,t[258]=fr,t[259]=pr):pr=t[259];let mr=!!V,hr;t[260]===L?hr=t[261]:(hr=e=>{!e&&!L&&H(null)},t[260]=L,t[261]=hr);let vr;t[262]!==L||t[263]!==Rn||t[264]!==Hn||t[265]!==V?(vr=V&&(0,Z.jsx)(EV,{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]=vr):vr=t[266];let yr;t[267]!==mr||t[268]!==hr||t[269]!==vr?(yr=(0,Z.jsx)(ps,{open:mr,onOpenChange:hr,children:vr}),t[267]=mr,t[268]=hr,t[269]=vr,t[270]=yr):yr=t[270];let br=W!==null,xr;t[271]===Symbol.for(`react.memo_cache_sentinel`)?(xr=e=>{e||G(null)},t[271]=xr):xr=t[271];let Sr=W?.parentDir??``,Cr;t[272]!==Sr||t[273]!==br?(Cr=(0,Z.jsx)(km,{open:br,onOpenChange:xr,kind:`file`,initialDir:Sr,defaultToTemplate:!0}),t[272]=Sr,t[273]=br,t[274]=Cr):Cr=t[274];let wr;return t[275]!==Cr||t[276]!==lr||t[277]!==pr||t[278]!==yr?(wr=(0,Z.jsxs)(Z.Fragment,{children:[lr,pr,yr,Cr]}),t[275]=Cr,t[276]=lr,t[277]=pr,t[278]=yr,t[279]=wr):wr=t[279],wr}function zH(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:bV(e)},`${e.kind}:${e.path}`)}function BH(e){return`${e.kind}:${e.path}`}function VH(e){return`${e.kind}:${e.path}`}function HH(e){return e.path}function UH(e){return e.kind===`folder`}function WH(e){return e.path}function GH(e){return e.kind===`file`}function KH(e){return e.file}function qH(e){return Je(e)}function JH(e){return Zt(e)}function YH(e){return De(e)}function XH(e){return e.path}function ZH(e){return e.kind===`asset`}function QH(e){return e.endsWith(`/`)?e.slice(0,-1):e}function $H(e){return!!e}function eU(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function tU(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function nU(e){gs.error(e)}function rU(){}function iU(e){return gs.error(e)}function aU(){}function oU(){}async function sU(){}function cU(e){return $O(e)}function lU(e){return uU(e)?.dataset.itemPath??null}function uU(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var dU=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function fU(){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=dU.map(pU),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 pU(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Sa,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Sa,{className:`h-3 ${e}`})]},t)}function mU(e){return e?lr._({id:`wTcjov`}):null}function hU(e){let t=(0,$.c)(37),{_:n}=i(),r=ih(),{merged:a}=gt(),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=mU(p),r;t[14]===l?r=t[15]:(r=e=>l[e.id]?.installed===!0,t[14]=l,t[15]=r);let i=sh.filter(r);g=l[`claude-code`]?.installed===!0;let a;t[16]!==o||t[17]!==c?(a=c!==null&&c.docContext!==null?Ui(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&&Db(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=Lk,t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(Bk,{children:[(0,Z.jsx)(ua,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[22]=y):y=t[22],m=Vk,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)(zk,{disabled:!r,onSelect:()=>{c&&u(t.id,c)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(xb,{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)(zk,{onSelect:_,disabled:p,"data-testid":`empty-space-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(Bt,{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 gU=(e,t,n)=>Kl(e,t,n,`ProjectSwitcher`);function _U(e){let t=(0,$.c)(90),{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,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),g=nO(),_;t[1]!==r||t[2]!==n.project||t[3]!==l?(_=()=>{if(!l)return;let e=!1;return gU(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]=_):_=t[4];let v;t[5]!==r||t[6]!==n||t[7]!==l?(v=[l,n,r],t[5]=r,t[6]=n,t[7]=l,t[8]=v):v=t[8],(0,Q.useEffect)(_,v);let y;t[9]!==r||t[10]!==n.project?(y=e=>{d(!1),gU(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[9]=r,t[10]=n.project,t[11]=y):y=t[11];let b=y,x;t[12]!==r||t[13]!==n.dialog||t[14]!==n.project?(x=()=>{d(!1),gU(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]=x):x=t[15];let S=x,C;t[16]!==r||t[17]!==n.navigator?(C=()=>{d(!1),gU(()=>n.navigator.open(),r({id:`jol95m`}))},t[16]=r,t[17]=n.navigator,t[18]=C):C=t[18];let w=C,T;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{d(!1),h(!0)},t[19]=T):T=t[19];let E=T,D=n.config.projectPath,k,A,j,M,N,P,F,I,L,R;if(t[20]!==r||t[21]!==g||t[22]!==n.config.projectName||t[23]!==n.config.projectPath||t[24]!==D||t[25]!==l||t[26]!==b||t[27]!==o||t[28]!==f){let e;t[39]===D?e=t[40]:(e=e=>e.path!==D,t[39]=D,t[40]=e);let i=o.filter(e),a=f.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;A=Ya,P=l,t[41]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{d(e),e||p(``)},t[41]=F):F=t[41];let u=g!==null&&`h-auto py-1.5`,m;t[42]===u?m=t[43]:(m=Gi(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,u),t[42]=u,t[43]=m);let h;t[44]===r?h=t[45]:(h=r({id:`zZ_I5K`}),t[44]=r,t[45]=h);let _;t[46]===n.config.projectName?_=t[47]:(_=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[46]=n.config.projectName,t[47]=_);let v;t[48]===g?v=t[49]:(v=g===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(Ae,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:g})]}),t[48]=g,t[49]=v);let y;t[50]!==_||t[51]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[_,v]}),t[50]=_,t[51]=v,t[52]=y):y=t[52];let x;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(zc,{"aria-hidden":`true`,className:`opacity-60`}),t[53]=x):x=t[53],t[54]!==n.config.projectPath||t[55]!==m||t[56]!==h||t[57]!==y?(I=(0,Z.jsx)(Ho,{asChild:!0,children:(0,Z.jsxs)(XD,{className:m,"data-testid":`project-switcher-trigger`,"aria-label":h,title:n.config.projectPath,children:[y,x]})}),t[54]=n.config.projectPath,t[55]=m,t[56]=h,t[57]=y,t[58]=I):I=t[58],k=xo,L=`start`,R=`top`,j=`min-w-[260px]`,M=`project-switcher-menu`,N=i.length===0?(0,Z.jsx)(No,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(yS,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(wS,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:f,onChange:e=>p(e.target.value),onKeyDown:vU,"data-testid":`project-switcher-search`}),(0,Z.jsx)(xS,{children:(0,Z.jsx)(O,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Vo,{}),c.length===0?(0,Z.jsx)(No,{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)(Wo,{disabled:e.missing,onSelect:()=>b(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]=g,t[22]=n.config.projectName,t[23]=n.config.projectPath,t[24]=D,t[25]=l,t[26]=b,t[27]=o,t[28]=f,t[29]=k,t[30]=A,t[31]=j,t[32]=M,t[33]=N,t[34]=P,t[35]=F,t[36]=I,t[37]=L,t[38]=R}else k=t[29],A=t[30],j=t[31],M=t[32],N=t[33],P=t[34],F=t[35],I=t[36],L=t[37],R=t[38];let z;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Vo,{}),t[59]=z):z=t[59];let B,V;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(yt,{"aria-hidden":`true`,className:`text-muted-foreground`}),V=(0,Z.jsx)(s,{id:`PVUn_c`}),t[60]=B,t[61]=V):(B=t[60],V=t[61]);let H;t[62]===S?H=t[63]:(H=(0,Z.jsxs)(Wo,{onSelect:S,"data-testid":`project-switcher-open-folder`,children:[B,V]}),t[62]=S,t[63]=H);let U,W;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(u,{"aria-hidden":`true`,className:`text-muted-foreground`}),W=(0,Z.jsx)(s,{id:`2Xs2jo`}),t[64]=U,t[65]=W):(U=t[64],W=t[65]);let G;t[66]===w?G=t[67]:(G=(0,Z.jsxs)(Wo,{onSelect:w,"data-testid":`project-switcher-switch-project`,children:[U,W]}),t[66]=w,t[67]=G);let K;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsxs)(Wo,{onSelect:E,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(ge,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[68]=K):K=t[68];let q;t[69]!==k||t[70]!==j||t[71]!==M||t[72]!==N||t[73]!==H||t[74]!==G||t[75]!==L||t[76]!==R?(q=(0,Z.jsxs)(k,{align:L,side:R,className:j,"data-testid":M,children:[N,z,H,G,K]}),t[69]=k,t[70]=j,t[71]=M,t[72]=N,t[73]=H,t[74]=G,t[75]=L,t[76]=R,t[77]=q):q=t[77];let J;t[78]!==A||t[79]!==P||t[80]!==F||t[81]!==I||t[82]!==q?(J=(0,Z.jsxs)(A,{open:P,onOpenChange:F,children:[I,q]}),t[78]=A,t[79]=P,t[80]=F,t[81]=I,t[82]=q,t[83]=J):J=t[83];let Y;t[84]!==n||t[85]!==m?(Y=(0,Z.jsx)(bd,{open:m,onOpenChange:h,bridge:n}),t[84]=n,t[85]=m,t[86]=Y):Y=t[86];let ee;return t[87]!==J||t[88]!==Y?(ee=(0,Z.jsxs)(Z.Fragment,{children:[J,Y]}),t[87]=J,t[88]=Y,t[89]=ee):ee=t[89],ee}function vU(e){return e.stopPropagation()}function yU(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})),si(`sidebarSearchPill`)}function bU(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Gi(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(O,{"aria-hidden":`true`}),t[2]=a):a=t[2];let 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:Ms(`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 xU(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)(ss,{"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 SU(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 CU(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Pp,Np,Np),n;e[0]===t?n=e[1]:(n=SU(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),Mp(r.id)},e[2]=r,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(xU,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function wU(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Lh(n.contentDir,Rh(t),n.pathSeparator):e?.kind===`folder`?Lh(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?Lh(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function TU(e,t,n){if((e?.kind===`doc`||e?.kind===`folder-index`)&&t){let e=t.lastIndexOf(`/`);return e<0?n.contentDir:Lh(n.contentDir,t.slice(0,e),n.pathSeparator)}if(e?.kind===`folder`)return Lh(n.contentDir,e.folderPath,n.pathSeparator);if(e?.kind===`asset`){let t=e.assetPath.lastIndexOf(`/`);return t<0?n.contentDir:Lh(n.contentDir,e.assetPath.slice(0,t),n.pathSeparator)}return n.contentDir}function EU(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Rh(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function DU(e,t,n){return e===null?Bh({workspace:n}):e.kind===`folder`?n?Vh({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?zh({docName:t,workspace:n}):null}var OU={folderCount:0,expandedCount:0},kU=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function AU(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(kU)!==null}function jU(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)(NU,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var MU=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)(Tr,{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)(nr,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Yn,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function NU(e){let t=(0,$.c)(200),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=pt(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:qr(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}=ID(),h=ih(),g=p===`expanded`,_=f&&p===`collapsed`,[v,y]=(0,Q.useState)(OU),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 dx(e=>{let t=e.initialDir??``;if(e.template){a.createFromTemplate(e.template.folder,e.template.name);return}a.startCreating(`file`,t)})},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=eo(``),O=eo(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=Mo(),P=ug().states,{dispatch:F}=$h(),I;t[9]===N?I=t[10]:(I=Bh({workspace:N}),t[9]=N,t[10]=I);let L=I,{projectLocalBinding:R,merged:z}=gt(),B=z?.appearance?.sidebar?.showHiddenFiles??!1,V=z?.appearance?.sidebar?.showAllFiles??!1,H=w&&!T,U=w&&!E,G=H||U,K=FU,q;t[11]!==a||t[12]!==N?(q=()=>{N&&a?.startCreating(`file`,``)},t[11]=a,t[12]=N,t[13]=q):q=t[13];let J=q,Y;t[14]!==a||t[15]!==N?(Y=e=>{N&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=N,t[16]=Y):Y=t[16];let ee=Y,te;t[17]!==a||t[18]!==N?(te=()=>{N&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=N,t[19]=te):te=t[19];let ne=te,re;t[20]===N?re=t[21]:(re=()=>{!N||!M||M.shell.showItemInFolder(N.contentDir)},t[20]=N,t[21]=re);let ie=re,ae;t[22]===N?ae=t[23]:(ae=()=>{!N||!M||MV(M,N.contentDir)},t[22]=N,t[23]=ae);let oe=ae,se;t[24]!==r||t[25]!==N?(se=async()=>{if(N)try{await navigator.clipboard.writeText(N.contentDir),gs.success(r({id:`6_ZOw4`}),{description:N.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),gs.error(r({id:`vfRlCI`}))}},t[24]=r,t[25]=N,t[26]=se):se=t[26];let ce=se,le;t[27]!==r||t[28]!==R?(le=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,Er(t.error)),gs.error(r({id:`P47EWZ`}),{description:Er(t.error)}))},t[27]=r,t[28]=R,t[29]=le):le=t[29];let ue=le,de;t[30]!==r||t[31]!==R?(de=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,Er(t.error)),gs.error(r({id:`P47EWZ`}),{description:Er(t.error)}))},t[30]=r,t[31]=R,t[32]=de):de=t[32];let fe=de,pe;t[33]===a?pe=t[34]:(pe=()=>{a?.expandAll()},t[33]=a,t[34]=pe);let me=pe,he;t[35]===a?he=t[36]:(he=()=>{a?.collapseAll()},t[35]=a,t[36]=he);let ge=he,_e,ve;t[37]!==V||t[38]!==U||t[39]!==H||t[40]!==B||t[41]!==p?(_e=()=>{M&&M.editor.notifyViewMenuStateChanged({showHiddenFiles:B,showAllFiles:V,canExpandAll:H,canCollapseAll:U,sidebarVisible:p===`expanded`})},ve=[M,B,V,H,U,p],t[37]=V,t[38]=U,t[39]=H,t[40]=B,t[41]=p,t[42]=_e,t[43]=ve):(_e=t[42],ve=t[43]),(0,Q.useEffect)(_e,ve);let ye,be;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?(ye=()=>{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;RV(l);return;case`duplicate`:if(!l)return;BV(l);return;case`move-to-trash`:if(!l)return;IV(l);return;case`reveal-in-finder`:{if(!M||!N)return;let e=wU(l,c,N);M.shell.showItemInFolder(e);return}case`open-in-terminal`:if(!M||!N)return;MV(M,TU(l,c,N));return;case`send-to-ai`:{let e=sh.filter(e=>P[e.id]?.installed===!0);if(e.length===0){gs.error(r({id:`LKOLNn`}));return}let t=DU(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=wU(l,c,N);navigator.clipboard.writeText(e).then(()=>gs.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),gs.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=EU(l,c);if(e===``){gs.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>gs.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),gs.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:`,Er(e.error)),gs.error(r({id:`P47EWZ`}),{description:Er(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:`,Er(e.error)),gs.error(r({id:`P47EWZ`}),{description:Er(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}})},be=[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]=ye,t[57]=be):(ye=t[56],be=t[57]),(0,Q.useEffect)(ye,be);let xe=f&&g&&`motion-safe:delay-100`,Se=_&&`opacity-0`,Ce;t[58]!==xe||t[59]!==Se?(Ce=Gi(`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`,xe,Se,f&&`[-webkit-app-region:drag]`),t[58]=xe,t[59]=Se,t[60]=Ce):Ce=t[60];let we;t[61]===g?we=t[62]:(we=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]=we);let Te;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Te=Gi(`flex items-center gap-1`,f&&`[&>*]:[-webkit-app-region:no-drag]`),t[63]=Te):Te=t[63];let Ee;t[64]!==r||t[65]!==T||t[66]!==w||t[67]!==E||t[68]!==a?(Ee=w?(0,Z.jsxs)(Ya,{children:[(0,Z.jsx)(Ho,{asChild:!0,children:(0,Z.jsx)(MU,{icon:cl,label:r({id:`Lu_dOh`})})}),(0,Z.jsxs)(xo,{align:`end`,children:[T?null:(0,Z.jsxs)(Wo,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(Vl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}),E?null:(0,Z.jsxs)(Wo,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(Qc,{"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]=Ee):Ee=t[69];let De;t[70]===r?De=t[71]:(De=r({id:`MW64zN`}),t[70]=r,t[71]=De);let Oe;t[72]!==d||t[73]!==a?(Oe=()=>a?.startCreating(`file`,d),t[72]=d,t[73]=a,t[74]=Oe):Oe=t[74];let ke;t[75]!==De||t[76]!==Oe?(ke=(0,Z.jsx)(MU,{icon:Nl,label:De,onClick:Oe}),t[75]=De,t[76]=Oe,t[77]=ke):ke=t[77];let Ae;t[78]!==r||t[79]!==j||t[80]!==d||t[81]!==a?(Ae=j?(0,Z.jsxs)(Ya,{children:[(0,Z.jsx)(Ho,{asChild:!0,children:(0,Z.jsx)(MU,{icon:mo,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(xo,{align:`end`,children:(0,Z.jsx)(OV,{parentDir:d,onSelectTemplate:e=>a?.createFromTemplate(d,e),ItemComponent:Wo})})]}):null,t[78]=r,t[79]=j,t[80]=d,t[81]=a,t[82]=Ae):Ae=t[82];let je;t[83]===r?je=t[84]:(je=r({id:`tX5yOZ`}),t[83]=r,t[84]=je);let Me;t[85]!==d||t[86]!==a?(Me=()=>a?.startCreating(`folder`,d),t[85]=d,t[86]=a,t[87]=Me):Me=t[87];let Ne;t[88]!==je||t[89]!==Me?(Ne=(0,Z.jsx)(MU,{icon:el,label:je,onClick:Me}),t[88]=je,t[89]=Me,t[90]=Ne):Ne=t[90];let Pe;t[91]!==Ee||t[92]!==ke||t[93]!==Ae||t[94]!==Ne?(Pe=(0,Z.jsxs)(`div`,{className:Te,children:[Ee,ke,Ae,Ne]}),t[91]=Ee,t[92]=ke,t[93]=Ae,t[94]=Ne,t[95]=Pe):Pe=t[95];let Fe;t[96]!==Ce||t[97]!==we||t[98]!==Pe?(Fe=(0,Z.jsxs)(WD,{"data-electron-drag":f?``:void 0,className:Ce,children:[we,Pe]}),t[96]=Ce,t[97]=we,t[98]=Pe,t[99]=Fe):Fe=t[99];let Ie=f&&g&&`motion-safe:delay-100`,Le=_&&`opacity-0`,Re;t[100]!==Ie||t[101]!==Le?(Re=Gi(`px-2 pb-2`,f&&`[-webkit-app-region:no-drag]`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ie,Le),t[100]=Ie,t[101]=Le,t[102]=Re):Re=t[102];let ze;t[103]===p?ze=t[104]:(ze=[p],t[103]=p,t[104]=ze);let Ve;t[105]===n?Ve=t[106]:(Ve=(0,Z.jsx)(bU,{onClick:n}),t[105]=n,t[106]=Ve);let He;t[107]!==ze||t[108]!==Ve?(He=(0,Z.jsx)(W,{fallbackRender:PU,onError:yU,resetKeys:ze,children:Ve}),t[107]=ze,t[108]=Ve,t[109]=He):He=t[109];let Ue;t[110]!==Re||t[111]!==He?(Ue=(0,Z.jsx)(`div`,{className:Re,children:He}),t[110]=Re,t[111]=He,t[112]=Ue):Ue=t[112];let We;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsxs)(KD,{children:[(0,Z.jsx)(SA,{}),(0,Z.jsx)(RH,{ref:o})]}),t[113]=We):We=t[113];let Ge;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsxs)(GD,{className:`px-0`,children:[(0,Z.jsx)(CU,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(qD,{children:(0,Z.jsx)(JD,{children:(0,Z.jsx)(_U,{bridge:window.okDesktop})})}):null]}),t[114]=Ge):Ge=t[114];let Ke=!(h&&p===`collapsed`),qe;t[115]===Ke?qe=t[116]:(qe=(0,Z.jsx)(HD,{enableToggle:!1,enableDrag:Ke}),t[115]=Ke,t[116]=qe);let X;t[117]!==Fe||t[118]!==Ue||t[119]!==qe?(X=(0,Z.jsx)(Ik,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:K,children:[Fe,Ue,We,Ge,qe]})}),t[117]=Fe,t[118]=Ue,t[119]=qe,t[120]=X):X=t[120];let Je=!N,Ye,Xe;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(Nl,{"aria-hidden":`true`}),Xe=(0,Z.jsx)(s,{id:`MW64zN`}),t[121]=Ye,t[122]=Xe):(Ye=t[121],Xe=t[122]);let Ze;t[123]!==J||t[124]!==Je?(Ze=(0,Z.jsxs)(zk,{disabled:Je,onSelect:J,"data-testid":`empty-space-menu-new-file`,children:[Ye,Xe]}),t[123]=J,t[124]=Je,t[125]=Ze):Ze=t[125];let Qe=!N||!A,$e,et;t[126]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,Z.jsx)(mo,{"aria-hidden":`true`}),et=(0,Z.jsx)(s,{id:`Uuj_R4`}),t[126]=$e,t[127]=et):($e=t[126],et=t[127]);let tt;t[128]===Qe?tt=t[129]:(tt=(0,Z.jsxs)(Bk,{disabled:Qe,"data-testid":`empty-space-menu-new-from-template`,children:[$e,et]}),t[128]=Qe,t[129]=tt);let nt;t[130]===ee?nt=t[131]:(nt=(0,Z.jsx)(Vk,{children:(0,Z.jsx)(OV,{parentDir:``,onSelectTemplate:ee,ItemComponent:zk})}),t[130]=ee,t[131]=nt);let rt;t[132]!==tt||t[133]!==nt?(rt=(0,Z.jsxs)(Lk,{children:[tt,nt]}),t[132]=tt,t[133]=nt,t[134]=rt):rt=t[134];let it=!N,at,ot;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(el,{"aria-hidden":`true`}),ot=(0,Z.jsx)(s,{id:`tX5yOZ`}),t[135]=at,t[136]=ot):(at=t[135],ot=t[136]);let st;t[137]!==ne||t[138]!==it?(st=(0,Z.jsxs)(zk,{disabled:it,onSelect:ne,"data-testid":`empty-space-menu-new-folder`,children:[at,ot]}),t[137]=ne,t[138]=it,t[139]=st):st=t[139];let ct;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(Uk,{}),t[140]=ct):ct=t[140];let lt;t[141]!==r||t[142]!==ie||t[143]!==N?(lt=M?(0,Z.jsxs)(zk,{disabled:!N,onSelect:ie,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(N?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(yt,{"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]=ie,t[143]=N,t[144]=lt):lt=t[144];let ut;t[145]!==F||t[146]!==L||t[147]!==P?(ut=(0,Z.jsx)(hU,{input:L,installStates:P,dispatch:F,webFallbackVisible:!1}),t[145]=F,t[146]=L,t[147]=P,t[148]=ut):ut=t[148];let dt;t[149]!==r||t[150]!==oe||t[151]!==N?(dt=M?(0,Z.jsxs)(zk,{disabled:!N,onSelect:oe,"data-testid":`empty-space-menu-open-in-terminal`,"aria-label":r(N?{id:`BJpGCq`}:{id:`_6IEmc`}),children:[(0,Z.jsx)(Rl,{"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]=oe,t[151]=N,t[152]=dt):dt=t[152];let ft=!N,mt;t[153]!==r||t[154]!==N?(mt=r(N?{id:`Up2_7p`}:{id:`U8CD-l`}),t[153]=r,t[154]=N,t[155]=mt):mt=t[155];let ht;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,Z.jsx)(Be,{"aria-hidden":`true`}),t[156]=ht):ht=t[156];let _t;t[157]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[157]=_t):_t=t[157];let vt;t[158]===N?vt=t[159]:(vt=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]=vt);let bt;t[160]!==ce||t[161]!==ft||t[162]!==mt||t[163]!==vt?(bt=(0,Z.jsxs)(zk,{disabled:ft,onSelect:ce,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":mt,children:[ht,_t,vt]}),t[160]=ce,t[161]=ft,t[162]=mt,t[163]=vt,t[164]=bt):bt=t[164];let xt;t[165]===Symbol.for(`react.memo_cache_sentinel`)?(xt=(0,Z.jsx)(Uk,{}),t[165]=xt):xt=t[165];let St=R===null,Ct;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(s,{id:`K_wz1u`}),t[166]=Ct):Ct=t[166];let wt;t[167]!==ue||t[168]!==B||t[169]!==St?(wt=(0,Z.jsx)(Hk,{checked:B,onCheckedChange:ue,disabled:St,"data-testid":`empty-space-menu-show-hidden-files`,children:Ct}),t[167]=ue,t[168]=B,t[169]=St,t[170]=wt):wt=t[170];let Tt=R===null,Et;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(Et=(0,Z.jsx)(s,{id:`i8dKs-`}),t[171]=Et):Et=t[171];let Dt;t[172]!==fe||t[173]!==V||t[174]!==Tt?(Dt=(0,Z.jsx)(Hk,{checked:V,onCheckedChange:fe,disabled:Tt,"data-testid":`empty-space-menu-show-all-files`,children:Et}),t[172]=fe,t[173]=V,t[174]=Tt,t[175]=Dt):Dt=t[175];let Ot;t[176]===G?Ot=t[177]:(Ot=G?(0,Z.jsx)(Uk,{}):null,t[176]=G,t[177]=Ot);let kt;t[178]!==me||t[179]!==H?(kt=H?(0,Z.jsxs)(zk,{onSelect:me,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Vl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[178]=me,t[179]=H,t[180]=kt):kt=t[180];let At;t[181]!==ge||t[182]!==U?(At=U?(0,Z.jsxs)(zk,{onSelect:ge,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Qc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[181]=ge,t[182]=U,t[183]=At):At=t[183];let jt;t[184]!==Ze||t[185]!==rt||t[186]!==st||t[187]!==lt||t[188]!==ut||t[189]!==dt||t[190]!==bt||t[191]!==wt||t[192]!==Dt||t[193]!==Ot||t[194]!==kt||t[195]!==At?(jt=(0,Z.jsxs)(Rk,{children:[Ze,rt,st,ct,lt,ut,dt,bt,xt,wt,Dt,Ot,kt,At]}),t[184]=Ze,t[185]=rt,t[186]=st,t[187]=lt,t[188]=ut,t[189]=dt,t[190]=bt,t[191]=wt,t[192]=Dt,t[193]=Ot,t[194]=kt,t[195]=At,t[196]=jt):jt=t[196];let Mt;return t[197]!==X||t[198]!==jt?(Mt=(0,Z.jsx)(BD,{variant:`inset`,children:(0,Z.jsxs)(Fk,{children:[X,jt]})}),t[197]=X,t[198]=jt,t[199]=Mt):Mt=t[199],Mt}function PU(){return null}function FU(e){AU(e.target)&&(e.preventDefault(),e.stopPropagation())}function IU(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function LU(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function RU(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var zU={phase:`loading`};function BU(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function VU(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function HU(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=RU(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function UU(e){return e!==null&&e.kind===`project-branch-switch`}function WU(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,a=r===void 0?Wd:r,{_:o}=i(),c=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,XU),[l,u]=(0,Q.useState)(zU),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(!1),p;t[0]===c?p=t[1]:(p=UU(c)?c:null,t[0]=c,t[1]=p);let m=p,h;t[2]!==o||t[3]!==m?.share.target.kind?(h=m?.share.target.kind===`folder`?o({id:`ugoTXs`}):o({id:`XH30C4`}),t[2]=o,t[3]=m?.share.target.kind,t[4]=h):h=t[4];let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{u(zU),d.current=!1,f.current=!1},t[5]=_):_=t[5];let v;t[6]===c?v=t[7]:(v=[c],t[6]=c,t[7]=v),(0,Q.useEffect)(_,v);let y;t[8]!==m||t[9]!==n?(y=()=>{m&&(d.current||(d.current=!0,n.project.fetchBranchInfo({projectPath:m.projectPath,branch:m.share.branch,kind:m.share.target.kind,path:C(m.share.target)}).then(e=>{u(t=>BU(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),u(YU)})))},t[8]=m,t[9]=n,t[10]=y):y=t[10];let b;t[11]===m?b=t[12]:(b=[m],t[11]=m,t[12]=b),(0,Q.useEffect)(y,b);let x;t[13]!==o||t[14]!==m||t[15]!==l.phase||t[16]!==n||t[17]!==a||t[18]!==g?(x=()=>{if(l.phase!==`awaiting-cc1-recycle`||!m)return;let e=m.share.branch;if(!e){a.dismiss();return}if(f.current)return;f.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:m.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(Xl({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:m.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:m.share.target.kind,path:C(m.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),gs.error(o({id:`gQV-9w`,values:{targetNoun:g}}))}),a.dismiss();return}console.log(Xl({branch_dialog_action:`branch-switch-timeout`,branch:e})),gs.error(o({id:`LBwUR6`,values:{targetNoun:g}})),a.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),gs.error(o({id:`Jw6EC4`,values:{targetNoun:g}})),a.dismiss())}),()=>{t=!0}},t[13]=o,t[14]=m,t[15]=l.phase,t[16]=n,t[17]=a,t[18]=g,t[19]=x):x=t[19];let S;if(t[20]!==m||t[21]!==l.phase?(S=[l.phase,m],t[20]=m,t[21]=l.phase,t[22]=S):S=t[22],(0,Q.useEffect)(x,S),!m)return null;let{share:w,projectPath:T,currentBranch:E}=m,D=w.branch,O;t[23]!==o||t[24]!==l.info||t[25]!==l.phase||t[26]!==n.project||t[27]!==T||t[28]!==w.target||t[29]!==D||t[30]!==a?(O=function(){l.phase===`ready`&&IU(l.info).switchEnabled&&(console.log(Xl({branch_dialog_action:`switch`,branch_action:`switch`,branch:D})),u(e=>VU(e,C(w.target))),n.project.runCheckout({projectPath:T,branch:D}).then(e=>{let t=null,n=!1;u(r=>{let{state:i,sideEffect:a}=HU(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?gs.error(o({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?gs.error(o({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&gs.error(o({id:`c863eW`,values:{shareBranch:D}})),n&&a.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),u(JU),gs.error(o({id:`c863eW`,values:{shareBranch:D}}))}))},t[23]=o,t[24]=l.info,t[25]=l.phase,t[26]=n.project,t[27]=T,t[28]=w.target,t[29]=D,t[30]=a,t[31]=O):O=t[31];let k=O,A;t[32]!==o||t[33]!==n.project||t[34]!==T||t[35]!==w.target||t[36]!==D||t[37]!==a||t[38]!==g?(A=function(){console.log(Xl({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:C(w.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),gs.error(o({id:`b5aNbi`,values:{targetNoun:g}}))}),a.dismiss()},t[32]=o,t[33]=n.project,t[34]=T,t[35]=w.target,t[36]=D,t[37]=a,t[38]=g,t[39]=A):A=t[39];let j=A,M;t[40]!==o||t[41]!==l.otherWorktreePath||t[42]!==l.phase||t[43]!==n.project||t[44]!==w.target||t[45]!==D||t[46]!==a?(M=function(){if(l.phase!==`branch-in-other-worktree`)return;let e=l.otherWorktreePath;console.log(Xl({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:C(w.target)},pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),gs.error(o({id:`LdABLa`,values:{target:e}}))}),a.dismiss()},t[40]=o,t[41]=l.otherWorktreePath,t[42]=l.phase,t[43]=n.project,t[44]=w.target,t[45]=D,t[46]=a,t[47]=M):M=t[47];let N=M,P;t[48]===a?P=t[49]:(P=function(){console.log(Xl({branch_dialog_action:`cancel`})),a.dismiss()},t[48]=a,t[49]=P);let F=P,I,L,R,z,B,V,H,U,W,G,K,q,J,Y,ee,te,ne;if(t[50]!==o||t[51]!==l.info||t[52]!==l.otherWorktreePath||t[53]!==l.phase||t[54]!==F||t[55]!==E||t[56]!==w.branch||t[57]!==w.owner||t[58]!==w.repo||t[59]!==w.target||t[60]!==D||t[61]!==g){ne=l.phase===`ready`||l.phase===`switching`?IU(l.info):null;let e;t[79]!==l.info||t[80]!==l.phase||t[81]!==E?(e=l.phase===`ready`||l.phase===`switching`?LU(l.info):E??`HEAD`,t[79]=l.info,t[80]=l.phase,t[81]=E,t[82]=e):e=t[82];let n=e;V=l.phase===`switching`||l.phase===`awaiting-cc1-recycle`;let r;t[83]===o?r=t[84]:(r=o({id:`OuY8t9`}),t[83]=o,t[84]=r),z=r;let i;t[85]!==o||t[86]!==D?(i=o({id:`_BthEY`,values:{shareBranch:D}}),t[85]=o,t[86]=D,t[87]=i):i=t[87],B=i;let a=l.phase===`loading`,c=l.phase===`error`;R=ps,ee=!0,t[88]===F?te=t[89]:(te=e=>{e||F()},t[88]=F,t[89]=te),L=ls,G=`sm:max-w-xl`,K=`share-branch-switch-dialog`,q=qU,J=KU;let u;t[90]===g?u=t[91]:(u=(0,Z.jsx)(cs,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:g}})}),t[90]=g,t[91]=u);let d=w.owner,f=w.repo,p;t[92]===w.target?p=t[93]:(p=C(w.target),t[92]=w.target,t[93]=p);let m;t[94]!==w.owner||t[95]!==w.repo||t[96]!==p?(m=(0,Z.jsx)(os,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`f8jU-L`,values:{0:d,1:f,2:p}})}),t[94]=w.owner,t[95]=w.repo,t[96]=p,t[97]=m):m=t[97],t[98]!==u||t[99]!==m?(Y=(0,Z.jsxs)(fs,{children:[u,m]}),t[98]=u,t[99]=m,t[100]=Y):Y=t[100],I=us;let h=w.owner,_=w.repo,v;t[101]===w.target?v=t[102]:(v=C(w.target),t[101]=w.target,t[102]=v),t[103]!==w.branch||t[104]!==w.owner||t[105]!==w.repo||t[106]!==w.target.kind||t[107]!==v?(H=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(Id,{owner:h,repo:_,path:v,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=w.branch,t[104]=w.owner,t[105]=w.repo,t[106]=w.target.kind,t[107]=v,t[108]=H):H=t[108],U=l.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(s,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:l.otherWorktreePath})]}):a?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(wt,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`w4hMYl`})}):ne?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XnoA1k`,values:{targetNoun:g,shareBranch:D},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):ne?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`sZ2IOu`,values:{targetNoun:g,shareBranch:D,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_902BE`,values:{targetNoun:g,shareBranch:D,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),W=ne&&!ne.switchEnabled&&ne.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(s,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:ne.conflictingFiles.map(GU)})]}):null,t[50]=o,t[51]=l.info,t[52]=l.otherWorktreePath,t[53]=l.phase,t[54]=F,t[55]=E,t[56]=w.branch,t[57]=w.owner,t[58]=w.repo,t[59]=w.target,t[60]=D,t[61]=g,t[62]=I,t[63]=L,t[64]=R,t[65]=z,t[66]=B,t[67]=V,t[68]=H,t[69]=U,t[70]=W,t[71]=G,t[72]=K,t[73]=q,t[74]=J,t[75]=Y,t[76]=ee,t[77]=te,t[78]=ne}else I=t[62],L=t[63],R=t[64],z=t[65],B=t[66],V=t[67],H=t[68],U=t[69],W=t[70],G=t[71],K=t[72],q=t[73],J=t[74],Y=t[75],ee=t[76],te=t[77],ne=t[78];let re;t[109]===V?re=t[110]:(re=V?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(wt,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CU3AiE`})]}):null,t[109]=V,t[110]=re);let ie;t[111]!==I||t[112]!==H||t[113]!==U||t[114]!==W||t[115]!==re?(ie=(0,Z.jsxs)(I,{children:[H,U,W,re]}),t[111]=I,t[112]=H,t[113]=U,t[114]=W,t[115]=re,t[116]=ie):ie=t[116];let ae;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(s,{id:`dEgA5A`}),t[117]=ae):ae=t[117];let oe;t[118]===F?oe=t[119]:(oe=(0,Z.jsx)(Qi,{variant:`ghost`,className:`font-mono uppercase`,onClick:F,"data-testid":`share-branch-switch-cancel`,children:ae}),t[118]=F,t[119]=oe);let se;t[120]!==l.phase||t[121]!==j||t[122]!==N||t[123]!==k||t[124]!==z||t[125]!==B||t[126]!==V||t[127]!==ne?(se=l.phase===`branch-in-other-worktree`?(0,Z.jsx)(Qi,{onClick:N,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(s,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[ne?.openCurrentEnabled?(0,Z.jsxs)(Qi,{variant:`outline`,className:`font-mono uppercase`,onClick:j,disabled:V,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(fl,{className:`size-3.5`,"aria-hidden":!0}),z]}):null,(0,Z.jsx)(Qi,{onClick:k,disabled:!ne?.switchEnabled||V,"aria-disabled":!ne?.switchEnabled||V,"aria-describedby":ne&&!ne.switchEnabled&&ne.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:V?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),B]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ae,{className:`size-3.5`,"aria-hidden":!0}),B]})})]}),t[120]=l.phase,t[121]=j,t[122]=N,t[123]=k,t[124]=z,t[125]=B,t[126]=V,t[127]=ne,t[128]=se):se=t[128];let ce;t[129]!==oe||t[130]!==se?(ce=(0,Z.jsxs)(ds,{className:`sm:justify-between`,children:[oe,se]}),t[129]=oe,t[130]=se,t[131]=ce):ce=t[131];let le;t[132]!==L||t[133]!==G||t[134]!==K||t[135]!==q||t[136]!==J||t[137]!==Y||t[138]!==ie||t[139]!==ce?(le=(0,Z.jsxs)(L,{className:G,"data-testid":K,onInteractOutside:q,onPointerDownOutside:J,children:[Y,ie,ce]}),t[132]=L,t[133]=G,t[134]=K,t[135]=q,t[136]=J,t[137]=Y,t[138]=ie,t[139]=ce,t[140]=le):le=t[140];let ue;return t[141]!==R||t[142]!==ee||t[143]!==te||t[144]!==le?(ue=(0,Z.jsx)(R,{open:ee,onOpenChange:te,children:le}),t[141]=R,t[142]=ee,t[143]=te,t[144]=le,t[145]=ue):ue=t[145],ue}function GU(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function KU(e){e.preventDefault()}function qU(e){e.preventDefault()}function JU(e){return HU(e,null).state}function YU(e){return BU(e,null)}function XU(){return null}function ZU(){let e=(0,$.c)(17),t=Dn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=pt(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new zt,i=new Ze({url:n,name:Mi,document:e,onStateless:e=>{let{payload:t}=e;fe(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:rW,onConfigValidationRejected:nW,onConfigIgnoreNestedError:tW,onUnknown:eW})},onClose:$U,onDisconnect:QU}),a=ni(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`,()=>{Ti([`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 QU(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function $U(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function eW(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function tW(e){Bo(e)}function nW(e){Uo(e)}function rW(e){Ti([e.ch])}var iW=`#install-claude-desktop`;function aW(e){return e===`#settings`||e===iW}function oW(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function sW(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=pt(),{openTargetTransition:i}=Et(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=ki(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=oW(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(aW(window.location.hash))return;let e=Hn(window.location.hash);if(e){let t=_i(e.split(`.`).pop()??``);b(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}if(Sr(window.location.hash)){b(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let n=yr(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=ji(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=Yr(Kr(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 cW(){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)(lW,t),null}function lW(){let e=fW;if(!e(window.location.hash))return;let t=new AbortController;return _e(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(dW))}).catch(uW),()=>t.abort()}function uW(){}function dW(){}function fW(e){return!aW(e)&&!Hn(e)&&!yr(e)&&(e===``||e===`#`||e===`#/`)}function pW(){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)(mW,t),null}function mW(){let e=function(e){let t=e.target;lh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=ch))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function hW(){let e=(0,$.c)(4),{activeTarget:t}=pt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function gW(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=pt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:qr(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;Dm({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)(km,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function _W(){let e=(0,$.c)(18),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Og,{}),e[0]=a):a=e[0];let o,s,c,l,u,d,f,p,m,h;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ZU,{}),c=(0,Z.jsx)(sW,{}),l=(0,Z.jsx)(cW,{}),u=(0,Z.jsx)(hW,{}),d=(0,Z.jsx)(gW,{}),f=(0,Z.jsx)(pW,{}),p=!1,m=t?(0,Z.jsx)(kg,{bridge:t}):null,h=(0,Z.jsx)(Md,{}),s=t?(0,Z.jsx)(WU,{bridge:t}):null,e[1]=o,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=m,e[10]=h):(o=e[1],s=e[2],c=e[3],l=e[4],u=e[5],d=e[6],f=e[7],p=e[8],m=e[9],h=e[10]);let g;e[11]===r?g=e[12]:(g=(0,Z.jsx)(bg,{bridge:t,open:r,onOpenChange:i}),e[11]=r,e[12]=g);let _;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=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[13]=_):_=e[13];let v;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(jU,{onOpenSearch:()=>i(!0)}),e[14]=v):v=e[14];let y;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(LD,{className:`h-screen overflow-hidden`,children:[v,(0,Z.jsx)(UD,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(bA,{onOpenSearch:()=>i(!0)})})]}),e[15]=y):y=e[15];let b;return e[16]===g?b=e[17]:(b=(0,Z.jsx)(x,{name:`app`,children:(0,Z.jsx)(Pt,{children:(0,Z.jsxs)(Lt,{children:[a,(0,Z.jsxs)(yi,{children:[o,c,l,u,d,f,p,m,h,s,g,_,y]})]})})}),e[16]=g,e[17]=b),b}gc(),pf({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Ef(),ep()&&op(),Fp(),typeof window<`u`&&Of({bridge:window.okDesktop}),typeof window<`u`&&Vf({bridge:window.okDesktop}),typeof window<`u`&&As({bridge:window.okDesktop}),typeof window<`u`&&Es({bridge:window.okDesktop}),typeof window<`u`&&jf({bridge:window.okDesktop}),typeof window<`u`&&Gd({bridge:window.okDesktop});var vW=new Tc({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),yW=document.getElementById(`root`);if(!yW)throw Error(`Root element not found`);var bW=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Fc.createRoot)(yW).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:lr,children:(0,Z.jsx)(yn,{client:vW,children:(0,Z.jsxs)(Rr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(fr,{children:bW&&window.okDesktop?(0,Z.jsx)(of,{bridge:window.okDesktop}):(0,Z.jsx)(_W,{})}),(0,Z.jsx)(df,{richColors:!0,closeButton:!0})]})})})}));
1915
+ </svg>`,wH=`${GB}\n${aV}`;function TH(e){return{...nM({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 EH(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&hH.has(t)}function DH(e){return e===`darwin`?lr._({id:`LtSYdi`}):e===`win32`?lr._({id:`qi1F96`}):lr._({id:`hz7n6T`})}function OH(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=DH(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=Lh(r.contentDir,pk(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)(yt,{"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)(Wo,{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 kH(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=Wo,u=n===null,t[8]!==n||t[9]!==r?(d=()=>{n!==null&&(r(),MV(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)(Rl,{"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 AH(e,t){return fk({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function jH(e,t){return e!==t&&e.startsWith(t)}function MH(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>jH(e,t))).map(e=>AH(e,t))}function NH(e,t){return e===t||e.startsWith(`${t}/`)}function PH(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 FH(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)zn(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):kr(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=tk(e);NH(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function IH(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:NH(t.createdPath,e.path)}function LH(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,E,D,O,k,A,j,M,N;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){N=fk(n,x),O=n.kind===`directory`,k=N.kind===`asset`?null:N,C=k!==null&&u!==null;let e;t[18]!==S||t[19]!==O?(e=S(O?{id:`5D3Ior`}:{id:`dbhUX1`}),t[18]=S,t[19]=O,t[20]=e):e=t[20],D=e,j=f?.appearance?.sidebar?.showHiddenFiles??!1,A=f?.appearance?.sidebar?.showAllFiles??!1,w=d!==null;let r=l.getSelectedPaths(),i=r.includes(N.treePath)?MH(r,x):[];E=i.length>1?i:[N];let a=E.length;M=lr._({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]=E,t[11]=D,t[12]=O,t[13]=k,t[14]=A,t[15]=j,t[16]=M,t[17]=N}else C=t[8],w=t[9],E=t[10],D=t[11],O=t[12],k=t[13],A=t[14],j=t[15],M=t[16],N=t[17];let P=M,F;t[21]!==O||t[22]!==n||t[23]!==o?(F=O&&o?Lh(o.contentDir,pk(n),o.pathSeparator):null,t[21]=O,t[22]=n,t[23]=o,t[24]=F):F=t[24];let I=F,L;if(t[25]!==O||t[26]!==n||t[27]!==o){bb0:{if(!o||O){L=null;break bb0}let e=pk(n),t=e.lastIndexOf(`/`);if(t===-1){L=o.contentDir;break bb0}L=Lh(o.contentDir,e.slice(0,t),o.pathSeparator)}t[25]=O,t[26]=n,t[27]=o,t[28]=L}else L=t[28];let R=L,z;t[29]!==b||t[30]!==O||t[31]!==n||t[32]!==o?(z=b?null:O?Vh({folderRelativePath:pk(n),workspace:o}):zh({docName:QO(n.path),workspace:o}),t[29]=b,t[30]=O,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:`,Er(t.error)),gs.error(S({id:`P47EWZ`}),{description:Er(t.error)}))},t[38]=S,t[39]=d,t[40]=G):G=t[40];let K=G,q;t[41]!==S||t[42]!==d?(q=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,Er(t.error)),gs.error(S({id:`P47EWZ`}),{description:Er(t.error)}))},t[41]=S,t[42]=d,t[43]=q):q=t[43];let J=q,Y=0,ee=0;if(O){let e=nk(n.path);for(let t of y)(t===e||t.startsWith(e))&&(Y++,kV(l.getItem(t))?.isExpanded()&&ee++)}let te=O&&ee<Y,ne=O&&ee>0,ie;t[44]===W?ie=t[45]:(ie=e=>{e||W()},t[44]=W,t[45]=ie);let ae;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(Ho,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[46]=ae):ae=t[46];let oe;t[47]!==S||t[48]!==a||t[49]!==C||t[50]!==w||t[51]!==W||t[52]!==H||t[53]!==P||t[54]!==E||t[55]!==I||t[56]!==J||t[57]!==K||t[58]!==c||t[59]!==B||t[60]!==D||t[61]!==b||t[62]!==O||t[63]!==n||t[64]!==l||t[65]!==u||t[66]!==k||t[67]!==v||t[68]!==m||t[69]!==g||t[70]!==h||t[71]!==_||t[72]!==p||t[73]!==R||t[74]!==A||t[75]!==j||t[76]!==ne||t[77]!==te||t[78]!==N||t[79]!==o?(oe=(0,Z.jsx)(xo,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:O?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{H(),p(`file`,tk(n.path))},children:[(0,Z.jsx)(Nl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`MW64zN`})]}),(0,Z.jsxs)(To,{children:[(0,Z.jsxs)(Fo,{disabled:a,children:[(0,Z.jsx)(mo,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(go,{children:(0,Z.jsx)(OV,{parentDir:tk(n.path),onSelectTemplate:e=>{H(),m(tk(n.path),e)},ItemComponent:Wo})})]}),(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{H(),p(`folder`,tk(n.path))},children:[(0,Z.jsx)(el,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`tX5yOZ`})]}),(0,Z.jsx)(Vo,{}),(0,Z.jsx)(OH,{item:n,workspace:o,onClose:W}),(0,Z.jsx)(XV,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!1}),(0,Z.jsx)(kH,{dirAbsPath:I,onClose:W}),(0,Z.jsxs)(To,{children:[(0,Z.jsxs)(Fo,{children:[(0,Z.jsx)(Be,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(go,{children:[(0,Z.jsx)(Wo,{disabled:!o,onSelect:()=>{o&&(W(),mH(Lh(o.contentDir,pk(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(Wo,{onSelect:()=>{W(),mH(pk(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(Vo,{}),(0,Z.jsx)(ha,{checked:j,onCheckedChange:K,disabled:!w,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`K_wz1u`})}),(0,Z.jsx)(ha,{checked:A,onCheckedChange:J,disabled:!w,"data-testid":`file-tree-menu-show-all-files`,children:(0,Z.jsx)(s,{id:`i8dKs-`})}),te||ne?(0,Z.jsx)(Vo,{}):null,te?(0,Z.jsxs)(Wo,{onSelect:()=>{W(),_(n.path)},children:[(0,Z.jsx)(Vl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}):null,ne?(0,Z.jsxs)(Wo,{onSelect:()=>{W(),v(n.path)},children:[(0,Z.jsx)(Qc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]}):null,(0,Z.jsx)(Vo,{}),(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{N.kind!==`asset`&&(W(),h(N))},children:[(0,Z.jsx)(Ke,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)(Wo,{"data-testid":`file-tree-menu-hide`,disabled:!C,onSelect:()=>{if(!u||!k)return;W();let e=QB(k),t=Go(u.current()),n=Po(t,e);if(n===t)return;u.patch(Io(n));let r=k.path.split(`/`).pop()||k.path;gs.success(S({id:`4xtLTl`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(lt,{"aria-hidden":`true`}),D]}),(0,Z.jsxs)(Wo,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(E)},children:[(0,Z.jsx)(re,{"aria-hidden":`true`}),P]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(OH,{item:n,workspace:o,onClose:W}),!b&&(0,Z.jsx)(XV,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!0}),(0,Z.jsx)(kH,{dirAbsPath:R,onClose:W}),(0,Z.jsxs)(To,{children:[(0,Z.jsxs)(Fo,{children:[(0,Z.jsx)(Be,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(go,{children:[(0,Z.jsx)(Wo,{disabled:!o,onSelect:()=>{o&&(W(),mH(Lh(o.contentDir,pk(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(Wo,{onSelect:()=>{W(),mH(pk(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(Vo,{}),b?null:(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{W(),h(N)},children:[(0,Z.jsx)(Ke,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Wo,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(T,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),k?(0,Z.jsxs)(Wo,{"data-testid":`file-tree-menu-hide`,disabled:!C,onSelect:()=>{if(!u)return;W();let e=QB(k),t=Go(u.current()),n=Po(t,e);if(n===t)return;u.patch(Io(n));let r=k.path.split(`/`).pop()||k.path;gs.success(S({id:`OD0FCX`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(lt,{"aria-hidden":`true`}),D]}):null,(0,Z.jsxs)(Wo,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(E)},children:[(0,Z.jsx)(re,{"aria-hidden":`true`}),P]})]})}),t[47]=S,t[48]=a,t[49]=C,t[50]=w,t[51]=W,t[52]=H,t[53]=P,t[54]=E,t[55]=I,t[56]=J,t[57]=K,t[58]=c,t[59]=B,t[60]=D,t[61]=b,t[62]=O,t[63]=n,t[64]=l,t[65]=u,t[66]=k,t[67]=v,t[68]=m,t[69]=g,t[70]=h,t[71]=_,t[72]=p,t[73]=R,t[74]=A,t[75]=j,t[76]=ne,t[77]=te,t[78]=N,t[79]=o,t[80]=oe):oe=t[80];let se;return t[81]!==oe||t[82]!==ie?(se=(0,Z.jsxs)(Ya,{open:!0,modal:!1,onOpenChange:ie,children:[ae,oe]}),t[81]=oe,t[82]=ie,t[83]=se):se=t[83],se}function RH(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}=pt(),{notifySidebarFileSelected:_}=ID(),{resolvedTheme:v}=Wr(),{addPage:y,pageMeta:b}=ki(),x;t[0]===b?x=t[1]:(x=function(e,t){return Ci(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`}),dH(gr(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=_r(e);m({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),dH(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),[P,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}=to(),[W,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(null),J=(0,Q.useRef)(O),Y;t[10]!==O||t[11]!==E||t[12]!==w||t[13]!==_||t[14]!==m?(Y=function(e,t){let n=t===void 0?O:t,r=gV(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,rk(e));return}if(r.kind===`asset`){m({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),dH(r.hash),_();return}if(r.kind===`folder`){E(r.path);return}let i=n.find(e=>zn(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]=Y):Y=t[15];let ee=Y,te;t[16]!==_||t[17]!==m?(te=function(e){m({kind:`asset`,target:e,assetPath:e,mediaKind:J.current.find(t=>kr(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),dH(fi(e)),_()},t[16]=_,t[17]=m,t[18]=te):te=t[18];let ne=te,re=(0,Q.useRef)(a),ie;t[19]===O?ie=t[20]:(ie=new Set(O.filter(kr).map(cU)),t[19]=O,t[20]=ie);let ae=ie,oe=(0,Q.useRef)(ae),se;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(se=[],t[21]=se):se=t[21];let ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue=(0,Q.useRef)(sU),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(!1),me=(0,Q.useRef)(null),he;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(he=new Map,t[22]=he):he=t[22];let ge=(0,Q.useRef)(he),_e=(0,Q.useRef)(!1),ve=(0,Q.useRef)(!1),ye=(0,Q.useRef)(null),be=(0,Q.useRef)(null),xe=(0,Q.useRef)(oU),Se=(0,Q.useRef)(aU),Ce=(0,Q.useRef)(iU),we=(0,Q.useRef)(rU),Te=(0,Q.useRef)(o),{selectedFilePath:Ee,selectedFolderPath:De,navigationPath:Oe}=hV(o,p?null:a),ke=Ee?ZO(Ee,O.find(e=>zn(e)&&e.docName===Ee)?.docExt):De?nk(De):o?.kind===`asset`?o.assetPath:null,Ae=ug().states,{dispatch:je}=$h(),Me;t[23]!==je||t[24]!==Ae?(Me={installStates:Ae,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:je},t[23]=je,t[24]=Ae,t[25]=Me):Me=t[25];let Ne=Me,{okignoreBinding:Pe,projectLocalBinding:Fe,merged:Ie}=gt(),Le=Ie?.appearance?.sidebar?.showHiddenFiles??!1,Re=Ie?.appearance?.sidebar?.showAllFiles??!1,ze;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>me.current===null,t[26]=ze):ze=t[26];let Be=ze,Ve;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=[],t[27]=Ve):Ve=t[27];let He;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(He={set:`complete`,spriteSheet:CH,byFileExtension:{md:{name:vH,viewBox:yH},mdx:{name:vH,viewBox:yH}}},t[28]=He):He=t[28];let Ue;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Ue={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[29]=Ue):Ue=t[29];let We;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(We={canDrag:Be,canDrop:Be,onDropComplete:e=>we.current(e),onDropError:nU},t[30]=We):We=t[30];let Ge,Ke;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Ge={canRename:Be,onRename:e=>Se.current(e),onError:e=>Ce.current(e)},Ke=e=>xe.current(e),t[31]=Ge,t[32]=Ke):(Ge=t[31],Ke=t[32]);let qe;t[33]===r?qe=t[34]:(qe={paths:Ve,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:He,unsafeCSS:wH,composition:Ue,dragAndDrop:We,renaming:Ge,onSelectionChange:Ke,renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=J.current.find(e=>zn(e)&&ZO(e.docName,e.docExt)===t.path);if(n?.isSymlink){let e=n.targetPath;return{icon:gH,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return EH(t.path)?{icon:_H,title:r({id:`i9toLO`})}:null}},t[33]=r,t[34]=qe);let{model:X}=zB(qe),Je;t[35]===X?Je=t[36]:(Je=function(e){let t=X.getItem(e)??X.getItem(nk(e));return t?.isDirectory()?nk(tk(t.getPath())):e},t[35]=X,t[36]=Je);let Ye=Je,Xe,Ze;t[37]===O?(Xe=t[38],Ze=t[39]):(Ze=ik(O),Xe=ak(Ze),t[37]=O,t[38]=Xe,t[39]=Ze);let Qe=Xe,$e=(0,Q.useRef)(Ze),et;t[40]===O?et=t[41]:(et=sk(O),t[40]=O,t[41]=et);let tt=et,nt=(0,Q.useRef)(tt),rt=De?ck(nk(De)).slice(0,-1):ck(ke??Oe),it=rt.join(`\0`),at;if(t[42]!==X){let e=()=>{let e=new Set;for(let t of nt.current)kV(X.getItem(t))?.isExpanded()&&e.add(t);return e};at=t=>{let n=new Set(sk(t??J.current)),r=e();for(let e of ce.current)r.add(e);return[...r].filter(e=>n.has(e))},t[42]=X,t[43]=at}else at=t[43];let ot=at,st;t[44]!==ot||t[45]!==X?(st=e=>{let t=ik(e??J.current);X.resetPaths(t,{initialExpandedPaths:ot(e)})},t[44]=ot,t[45]=X,t[46]=st):st=t[46];let ct=st,lt;t[47]!==X||t[48]!==ct?(lt=(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=>zn(e)&&e.docName===t);if(n==null||X.getItem(r)==null)continue;let i=ZO(r,n.docExt);X.move(r,i),o=i,a+=1}for(let{toPath:e}of i){let t=BB(e);if(t===``)continue;let n=e.slice(0,-t.length);X.getItem(n)!=null&&(X.getItem(e)??X.move(n,e),o=e,a+=1)}a!==0&&(ct(t),o!=null&&X.focusPath(o))},t[47]=X,t[48]=ct,t[49]=lt):lt=t[49];let ut=lt,dt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(dt=e=>{de.current=ok(e)},t[50]=dt):dt=t[50];let ft=dt,mt;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(mt=e=>oe.current.has(e),t[51]=mt):mt=t[51];let ht=mt,_t;t[52]!==r||t[53]!==y||t[54]!==E||t[55]!==w||t[56]!==ct?(_t=async function(e){if(e.kind===`asset`||me.current!==null)return;let t=()=>{R(null),me.current=null};me.current=e.path,R(e.path),N(null);try{let n=await Tt(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){gs.error(n.title),ct(),t();return}let i=F(Fn,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});gs.error(e),N(e),Ti([`files`,`backlinks`,`graph`]),ct(),t();return}for(let e of i.duplicatedDocNames)y(e);k(t=>{let n=Ek(t,e,i);return ct(n),ft(n),n}),Ti([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?E(i.path):w(i.path)),gs.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),gs.error(r({id:`EBVbtP`}),{description:i}),ct(),t()}},t[52]=r,t[53]=y,t[54]=E,t[55]=w,t[56]=ct,t[57]=_t):_t=t[57];let vt=_t,yt=(0,Q.useRef)(vt),bt;t[58]===vt?bt=t[59]:(bt=()=>{yt.current=vt},t[58]=vt,t[59]=bt),(0,Q.useEffect)(bt);let xt=function(e){let t=fH(e);if(!t||pH(t))return!1;let n=X.getFocusedPath()??X.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||ht(n))return!1;let r=pH(n);if(!r)return!1;let i=nk(t);if(!nt.current.includes(i))return!1;let a=`${t}${r}`;return $e.current.includes(a)?!1:(Qt({sourcePath:n,destinationPath:a,isFolder:!1}),X.move(n,a),!0)},St;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(St=e=>{let t=e??le.current;!t||le.current!==t||(t.disposeCommitListener(),le.current=null)},t[60]=St):St=t[60];let Ct=St,wt;t[61]!==r||t[62]!==Ct||t[63]!==l||t[64]!==c||t[65]!==ct?(wt=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;Ct(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 Tt(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?gs.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(R(null),ct());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;gs.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(R(null),ct());return}i&&(e.kind===`file`?l(e.createdPath):c([Zt(e.createdPath)],{force:!0})),i&&k(t=>{let n=wk(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return ft(n),n}),Ti([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&R(null)},t[61]=r,t[62]=Ct,t[63]=l,t[64]=c,t[65]=ct,t[66]=wt):wt=t[66];let Et=wt,Dt,Ot;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=()=>()=>{let e=le.current;e&&ue.current(e,{restoreLocation:!1,updateUi:!1}).catch(tU)},Ot=[],t[67]=Dt,t[68]=Ot):(Dt=t[67],Ot=t[68]),(0,Q.useEffect)(Dt,Ot);let kt,At;t[69]===r?(kt=t[70],At=t[71]):(kt=()=>{let e=!0,t=null,n=HV(async function(){t?.abort();let n=new AbortController;t=n;try{let t=ve.current,i=await fetch(t?`/api/documents?showAll=true`:`/api/documents`,{signal:n.signal,headers:t?UV:void 0});if(t&&WV(i)){let{entries:n,truncated:r}=await qV(i);if(!e)return;k(JV(Bi(n,_e.current||t),J.current,ge.current)),N(null),I(r?n.length:null)}else{let n=await Tt(i,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)N(n.title),I(null);else{let e=vi.safeParse(n.body);if(!e.success)N(r({id:`HlmZBk`})),I(null);else{let n=_e.current||t;k(JV(Bi(e.data.documents,n),J.current,ge.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());ye.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=ni(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,ye.current=null,n.dispose(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},At=[r],t[69]=r,t[70]=kt,t[71]=At),(0,Q.useEffect)(kt,At);let jt=(0,Q.useRef)(!0),Mt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=()=>{if(jt.current){jt.current=!1;return}ye.current?.()},t[72]=Mt):Mt=t[72];let Nt;t[73]===Le?Nt=t[74]:(Nt=[Le],t[73]=Le,t[74]=Nt),(0,Q.useEffect)(Mt,Nt);let Pt=(0,Q.useRef)(!0),Ft;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Ft=()=>{if(Pt.current){Pt.current=!1;return}ye.current?.()},t[75]=Ft):Ft=t[75];let It;t[76]===Re?It=t[77]:(It=[Re],t[76]=Re,t[77]=It),(0,Q.useEffect)(Ft,It);let Lt,Rt;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=F(Vi,n,`workspace`,null);r&&q({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(eU),()=>{e=!1}},Rt=[],t[78]=Lt,t[79]=Rt):(Lt=t[78],Rt=t[79]),(0,Q.useEffect)(Lt,Rt);let zt;t[80]!==ot||t[81]!==X||t[82]!==Qe?(zt=()=>{if(de.current===Qe){de.current=null;return}X.resetPaths($e.current,{initialExpandedPaths:ot()})},t[80]=ot,t[81]=X,t[82]=Qe,t[83]=zt):zt=t[83];let Bt;t[84]!==X||t[85]!==Qe?(Bt=[X,Qe],t[84]=X,t[85]=Qe,t[86]=Bt):Bt=t[86],(0,Q.useEffect)(zt,Bt),jV(X,ke,it,pe,Qe);let Vt;t[87]!==ke||t[88]!==A||t[89]!==X?(Vt=()=>{A||!ke||pV(be.current,X)},t[87]=ke,t[88]=A,t[89]=X,t[90]=Vt):Vt=t[90];let Ht;t[91]!==it||t[92]!==ke||t[93]!==A||t[94]!==X||t[95]!==Qe?(Ht=[ke,it,Qe,A,X],t[91]=it,t[92]=ke,t[93]=A,t[94]=X,t[95]=Qe,t[96]=Ht):Ht=t[96],(0,Q.useEffect)(Vt,Ht);let Ut,Wt;t[97]===X?(Ut=t[98],Wt=t[99]):(Ut=()=>X.subscribe(()=>{if(!X.isSearchOpen())for(let e of ce.current){let t=kV(X.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Wt=[X],t[97]=X,t[98]=Ut,t[99]=Wt),(0,Q.useEffect)(Ut,Wt);let Gt,qt;t[100]===X?(Gt=t[101],qt=t[102]):(Gt=()=>X.onMutation(`remove`,e=>{let t=le.current;!t||e.path!==t.renamePath||ue.current(t)}),qt=[X],t[100]=X,t[101]=Gt,t[102]=qt),(0,Q.useEffect)(Gt,qt);let Yt;t[103]!==y||t[104]!==u||t[105]!==d||t[106]!==ne||t[107]!==E||t[108]!==f||t[109]!==ut||t[110]!==g?(Yt=async(e,t,n,r)=>{let i=t===void 0?[]:t,a=n===void 0?[]:n,o=r?.docName??re.current,s=Dk(o,e),c=r?.folderPath??(Te.current?.kind===`folder`?Te.current.folderPath:null),l=c?Jt(c,i):null,p=r?.assetPath??(Te.current?.kind===`asset`?Te.current.assetPath:null),m=p?a.find(e=>e.fromPath===p)?.toPath??Jt(p,i):null;Kt(e);let h=Ok(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=Ck(t,e,i,a);return ut(t,n,e,a),ft(n),n}),c&&l&&l!==c?E(l):s&&s!==o?window.location.hash=gr(s):p&&m&&m!==p&&ne(m),Ti([`files`,`backlinks`,`graph`])},t[103]=y,t[104]=u,t[105]=d,t[106]=ne,t[107]=E,t[108]=f,t[109]=ut,t[110]=g,t[111]=Yt):Yt=t[111];let Xt=Yt;async function Qt(e){let t=!e.isFolder&&ht(e.sourcePath),n=t?e.sourcePath:mk(e.sourcePath,e.isFolder);R(n),N(null);try{let i=HB(e.sourcePath,e.destinationPath,e.isFolder,t);if(i.kind===`block`){gs.error(r({id:`FaBZwp`})),queueMicrotask(()=>{ct()}),Ct(),R(null);return}let a=t?i.destinationPath:mk(i.destinationPath,e.isFolder),o=e.isFolder?{kind:`folder`,fromPath:tk(n),toPath:tk(a)}:t?{kind:`asset`,fromPath:n,toPath:a}:{kind:`file`,fromPath:QO(n),toPath:QO(a)},s={docName:re.current,folderPath:Te.current?.kind===`folder`?Te.current.folderPath:null,assetPath:Te.current?.kind===`asset`?Te.current.assetPath:null},c=await Tt(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o)}),r({id:`gijbne`}));if(!c.ok){gs.error(c.title),ct();let e=le.current;e&&e.renamePath===n?await Et(e):Ct(),R(null);return}let l=F(li,c.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await Xt(l.renamed,e.isFolder?[{fromPath:tk(n),toPath:tk(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}),gs.error(r({id:`dDpCOp`}))}Ct(),R(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});gs.error(t),N(t),ct();let i=le.current;i&&i.renamePath===n?await Et(i):Ct(),R(null)}}let $t;t[112]!==r||t[113]!==Xt||t[114]!==ct?($t=async function(e){let t=e.draggedPaths.map(t=>{let n=_k(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter($H);if(t.length!==0){R(t[0]?.sourcePath??null),N(null);try{let e=[],n=[],i=[],a={docName:re.current,folderPath:Te.current?.kind===`folder`?Te.current.folderPath:null,assetPath:Te.current?.kind===`asset`?Te.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&ht(a.sourcePath),s=t?{kind:`folder`,fromPath:tk(a.sourcePath),toPath:tk(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:QO(a.sourcePath),toPath:QO(a.destinationTreePath)},c=await Tt(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){gs.error(c.title),ct(),R(null);return}let l=F(li,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:tk(a.sourcePath),toPath:tk(a.destinationTreePath)})}try{await Xt(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),gs.error(r({id:`8OxKZy`}))}R(null)}catch(e){console.warn(`[FileTree] move failed:`,e),gs.error(r({id:`HIb0vl`})),ct(),R(null)}}},t[112]=r,t[113]=Xt,t[114]=ct,t[115]=$t):$t=t[115];let en=$t,tn;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(tn=function(e){G({parentDir:e})},t[116]=tn):tn=t[116];let nn=tn,rn;t[117]!==r||t[118]!==y||t[119]!==Et||t[120]!==Ct||t[121]!==X||t[122]!==E||t[123]!==w||t[124]!==ct||t[125]!==Ze?(rn=async function(e,t,n){if(me.current)return;let i=le.current;i&&Ct(i);try{let i=hk(e,t,[...Ze,...nt.current]);R(i.renamePath),me.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=gk(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await Tt(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){gs.error(a.title),R(null),me.current=null;return}let s=QO(e),c=F(zi,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=>zn(e)&&e.docName===c))return e;let t=[...e,l];return ft(t),ge.current.set($O(l),Date.now()),t}),Ti([`files`,`backlinks`,`graph`]),w(c)}else{let e=tk(i.addPath),t=await Tt(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){gs.error(t.title),R(null),me.current=null;return}o=F(Vn,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=>Li(e)&&e.path===o))return e;let t=[...e,n];return ft(t),ge.current.set($O(n),Date.now()),t}),Ti([`files`]),E(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=le.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>Ct(t))};document.addEventListener(`keydown`,c,!0),le.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},R(null),me.current=null,X.add(i.addPath),X.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),gs.error(r({id:`S6l5dv`}));let t=le.current;t?await Et(t):Ct(),R(null),me.current=null,ct()}},t[117]=r,t[118]=y,t[119]=Et,t[120]=Ct,t[121]=X,t[122]=E,t[123]=w,t[124]=ct,t[125]=Ze,t[126]=rn):rn=t[126];let an=rn,on;t[127]===X?on=t[128]:(on=function(e){let t=nk(e);(0,Q.startTransition)(()=>{for(let e of nt.current)if(e===t||e.startsWith(t)){let t=kV(X.getItem(e));t&&t.expand()}})},t[127]=X,t[128]=on);let sn=on,cn;t[129]===X?cn=t[130]:(cn=function(e){let t=nk(e),n=new Set(ce.current);(0,Q.startTransition)(()=>{for(let e of[...nt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=kV(X.getItem(e));t&&t.collapse()}})},t[129]=X,t[130]=cn);let ln=cn,un;t[131]!==ee||t[132]!==rt||t[133]!==a||t[134]!==o||t[135]!==ae||t[136]!==L||t[137]!==Et||t[138]!==O||t[139]!==tt||t[140]!==en||t[141]!==Qt||t[142]!==Ye||t[143]!==xt||t[144]!==Re||t[145]!==Le||t[146]!==Ze?(un=()=>{J.current=O,re.current=a,Te.current=o,oe.current=ae,me.current=L,_e.current=Le,ve.current=Re,$e.current=Ze,nt.current=tt,ce.current=rt,ue.current=Et,xe.current=e=>{if(pe.current||e.length!==1)return;let t=e[0];t&&ee(Ye(t),O)},Ce.current=e=>{xt(e)||gs.error(e)},Se.current=Qt,we.current=en},t[131]=ee,t[132]=rt,t[133]=a,t[134]=o,t[135]=ae,t[136]=L,t[137]=Et,t[138]=O,t[139]=tt,t[140]=en,t[141]=Qt,t[142]=Ye,t[143]=xt,t[144]=Re,t[145]=Le,t[146]=Ze,t[147]=un):un=t[147],(0,Q.useLayoutEffect)(un);let dn,fn;t[148]===X?(dn=t[149],fn=t[150]):(dn=()=>{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||PH(e.target))return;let a=be.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=X.getFocusedPath()??X.getSelectedPaths()[0]??null;if(!t)return;let n=X.getItem(t)??X.getItem(nk(t)),r=n?.isDirectory()?nk(tk(n.getPath())):t;if(oe.current.has(r))return;yt.current(AH(r,J.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...nt.current,...$e.current]);pe.current=!0;for(let e of u)e&&X.getItem(e)?.select();queueMicrotask(()=>{pe.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},fn=[X],t[148]=X,t[149]=dn,t[150]=fn),(0,Q.useEffect)(dn,fn);let pn,mn;t[151]!==O.length||t[152]!==A?(pn=()=>{if(A||O.length===0)return;let e=be.current?.querySelector(Fj)?.shadowRoot;if(!e)return;let t=QH,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()},mn=[A,O.length],t[151]=O.length,t[152]=A,t[153]=pn,t[154]=mn):(pn=t[153],mn=t[154]),(0,Q.useEffect)(pn,mn);let hn,gn;t[155]!==O.length||t[156]!==A?(hn=()=>{if(A||O.length===0)return;let e=be.current?.querySelector(Fj)?.shadowRoot;if(!e)return;let t=()=>KB(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()},gn=[A,O.length],t[155]=O.length,t[156]=A,t[157]=hn,t[158]=gn):(hn=t[157],gn=t[158]),(0,Q.useEffect)(hn,gn);let _n,vn;t[159]!==O.length||t[160]!==A?(_n=()=>{if(A||O.length===0)return;let e=be.current?.querySelector(Fj)?.shadowRoot;if(!e)return;let t=()=>oV(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},vn=[A,O.length],t[159]=O.length,t[160]=A,t[161]=_n,t[162]=vn):(_n=t[161],vn=t[162]),(0,Q.useEffect)(_n,vn);let yn;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(yn={folderCount:0,expandedCount:0},t[163]=yn):yn=t[163];let bn=(0,Q.useRef)(yn),xn=(0,Q.useRef)(an),Sn=(0,Q.useRef)(nn),Cn;t[164]===an?Cn=t[165]:(Cn=()=>{xn.current=an,Sn.current=nn},t[164]=an,t[165]=Cn),(0,Q.useEffect)(Cn);let wn,Tn;t[166]===X?(wn=t[167],Tn=t[168]):(wn=()=>({startCreating(e,t){xn.current(e,t)},startCreatingFromTemplate(e){Sn.current(e)},createFromTemplate(e,t){xn.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of nt.current){let t=kV(X.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(ce.current);(0,Q.startTransition)(()=>{for(let t of[...nt.current].reverse()){if(e.has(t))continue;let n=kV(X.getItem(t));n&&n.collapse()}})},getFolderState(){let e=nt.current,t=0;for(let n of e)kV(X.getItem(n))?.isExpanded()&&t++;let n=e.length,r=bn.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return bn.current=i,i},subscribe(e){return X.subscribe(e)}}),Tn=[X],t[166]=X,t[167]=wn,t[168]=Tn),(0,Q.useImperativeHandle)(n,wn,Tn);let En;t[169]!==Ct||t[170]!==u||t[171]!==c||t[172]!==X?(En=async function(e,t,n){let r=FH(e,J.current,nt.current),i=le.current;i&&e.some(e=>IH(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Ct(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(ZH).map(XH)]);c([...[...a].map(YH),...[...o].map(JH),...[...s].map(qH)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?nk(t.path):t.kind===`asset`?t.path:ZO(t.path,t.docExt);X.getItem(e)&&X.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}k(e=>{let t=wk(e,[...a],void 0,[...s]);for(let e of o)t=wk(t,[],e);return ft(t),t}),Ti([`files`,`backlinks`,`graph`])},t[169]=Ct,t[170]=u,t[171]=c,t[172]=X,t[173]=En):En=t[173];let Dn=En,On;t[174]!==r||t[175]!==Dn?(On=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;R(a.path);let o=await Tt(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 Dn(i,t,n),gs.error(o.title),!1;let s=F(Gn,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await Dn(i,t,n),!0},t[174]=r,t[175]=Dn,t[176]=On):On=t[176];let kn=On,An;t[177]===Symbol.for(`react.memo_cache_sentinel`)?(An=async function(e,t,n){let r=[],i=[];for(let a of e){R(a.path);let e=kk(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:SV(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[177]=An):An=t[177];let jn=An,Mn;t[178]===r?Mn=t[179]:(Mn=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await Tt(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=F(oi,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;gs.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]=Mn);let Nn=Mn,Pn;t[180]!==r||t[181]!==U||t[182]!==Dn||t[183]!==kn||t[184]!==Nn||t[185]!==ct||t[186]!==K?(Pn=async function(e){let t=e.map(e=>Tk(e,J.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(KH),t=i.length>e.length?`, +${i.length-e.length} more`:``;gs.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&&K){let{trashed:e,failed:n}=await jn(t,a,K);if(e.length>0){let t=await Nn(e);t?await Dn(e,t.deletedDocNames,t.deletedFolderPaths):await Dn(e,e.filter(GH).map(WH),e.filter(UH).map(HH))}n.length>0&&H({failed:n,originalTargets:[...t]}),R(null)}else{let e=await kn(t);R(null),e||ct()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),gs.error(r({id:`0eHrMb`}),{description:n}),R(null),ct()}},t[180]=r,t[181]=U,t[182]=Dn,t[183]=kn,t[184]=Nn,t[185]=ct,t[186]=K,t[187]=Pn):Pn=t[187];let In=Pn,Ln;t[188]!==r||t[189]!==kn||t[190]!==ct||t[191]!==V?(Ln=async function(){if(!V)return;let e=new Set(V.failed.map(VH)),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 kn(t);R(null),e||ct()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),gs.error(r({id:`0eHrMb`}),{description:n}),R(null),ct()}}},t[188]=r,t[189]=kn,t[190]=ct,t[191]=V,t[192]=Ln):Ln=t[192];let Rn=Ln,Bn;t[193]!==In||t[194]!==V?(Bn=async function(){if(!V)return;let e=new Set(V.failed.map(BH)),t=V.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));H(null),await In(t)},t[193]=In,t[194]=V,t[195]=Bn):Bn=t[195];let Hn=Bn,Un=(0,Q.useRef)(In),Wn;t[196]===In?Wn=t[197]:(Wn=()=>{Un.current=In},t[196]=In,t[197]=Wn),(0,Q.useEffect)(Wn);let Kn,qn;t[198]===Symbol.for(`react.memo_cache_sentinel`)?(Kn=()=>LV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=J.current.find(e=>zn(e)&&e.docName===t);Un.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Un.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){Un.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}))}),qn=[],t[198]=Kn,t[199]=qn):(Kn=t[198],qn=t[199]),(0,Q.useEffect)(Kn,qn);let Jn,Yn;t[200]===Symbol.for(`react.memo_cache_sentinel`)?(Jn=()=>VV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=J.current.find(e=>zn(e)&&e.docName===t);yt.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){yt.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}))}),Yn=[],t[200]=Jn,t[201]=Yn):(Jn=t[200],Yn=t[201]),(0,Q.useEffect)(Jn,Yn);let Xn,Zn;t[202]===X?(Xn=t[203],Zn=t[204]):(Xn=()=>zV(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ZO(t,J.current.find(e=>zn(e)&&e.docName===t)?.docExt);X.startRenaming(n);return}if(e.kind===`folder`){X.startRenaming(e.folderPath);return}if(e.kind===`asset`){X.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),Zn=[X],t[202]=X,t[203]=Xn,t[204]=Zn),(0,Q.useEffect)(Xn,Zn);let Qn;t[205]===Symbol.for(`react.memo_cache_sentinel`)?(Qn=function(){let e=fe.current;e&&lH(e),fe.current=null},t[205]=Qn):Qn=t[205];let $n=Qn,er;t[206]===h?er=t[207]:(er=function(e){let t=lU(e.nativeEvent);if(!t||t.endsWith(`/`)){$n();return}let n=QO(t),r=J.current.find(e=>$O(e)===t);if(r&&kr(r)){$n();return}if(r&&zn(r)&&Ii(r.size)){$n();return}fe.current!==n&&($n(),fe.current=n,cH(n,e=>h(e)))},t[206]=h,t[207]=er);let tr=er,nr;t[208]!==ee||t[209]!==X||t[210]!==E?(nr=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=uU(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?nk(n):n;if(X.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=tk(r);if(window.location.hash===_r(e))return;queueMicrotask(()=>E(e));return}let i=QO(r);window.location.hash!==gr(i)&&queueMicrotask(()=>ee(r))},t[208]=ee,t[209]=X,t[210]=E,t[211]=nr):nr=t[211];let rr=nr;if(A){let e;return t[212]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(fU,{}),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]===an?n=t[217]:(n=()=>an(`file`,``),t[216]=an,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 ir=L!==null,ar=z?.targets[0]??null,or;t[221]!==M||t[222]!==P?(or=(M||P!==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}),P!==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:P}})})]}),t[221]=M,t[222]=P,t[223]=or):or=t[223];let sr;t[224]===v?sr=t[225]:(sr=TH(v),t[224]=v,t[225]=sr);let cr;t[226]!==ir||t[227]!==ae||t[228]!==ln||t[229]!==O||t[230]!==sn||t[231]!==tt||t[232]!==vt||t[233]!==Ne||t[234]!==Ie||t[235]!==X||t[236]!==Pe||t[237]!==Fe||t[238]!==an||t[239]!==K?(cr=(e,t)=>(0,Z.jsx)(LH,{item:e,context:t,anyActionBusy:ir,workspace:K,handoff:Ne,model:X,okignoreBinding:Pe,projectLocalBinding:Fe,mergedConfig:Ie,onStartCreating:an,onCreateFromTemplate:(e,t)=>an(`file`,e,{template:t}),onDuplicate:vt,onDelete:e=>B({targets:e}),onExpandSubtree:sn,onCollapseSubtree:ln,folderTreePaths:tt,isAsset:ae.has(e.path),documents:O}),t[226]=ir,t[227]=ae,t[228]=ln,t[229]=O,t[230]=sn,t[231]=tt,t[232]=vt,t[233]=Ne,t[234]=Ie,t[235]=X,t[236]=Pe,t[237]=Fe,t[238]=an,t[239]=K,t[240]=cr):cr=t[240];let lr;t[241]!==rr||t[242]!==tr||t[243]!==X||t[244]!==or||t[245]!==sr||t[246]!==cr?(lr=(0,Z.jsx)(`div`,{ref:be,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(RB,{header:or,model:X,style:sr,onClickCapture:rr,onMouseMove:tr,onMouseLeave:$n,renderContextMenu:cr})}),t[241]=rr,t[242]=tr,t[243]=X,t[244]=or,t[245]=sr,t[246]=cr,t[247]=lr):lr=t[247];let ur=!!z,dr;t[248]===L?dr=t[249]:(dr=e=>{!e&&!L&&B(null)},t[248]=L,t[249]=dr);let fr;t[250]!==r||t[251]!==L||t[252]!==z||t[253]!==In||t[254]!==ar?(fr=z&&ar&&(0,Z.jsx)(_a,{...(()=>{let e=yV(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=ar.name;return{itemName:t===1?ar.kind===`folder`?`${ar.name}/`:ar.kind===`file`?`${ar.name}${ar.docExt??`.md`}`:ar.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):ar.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]=ar,t[255]=fr):fr=t[255];let pr;t[256]!==ur||t[257]!==dr||t[258]!==fr?(pr=(0,Z.jsx)(ps,{open:ur,onOpenChange:dr,children:fr}),t[256]=ur,t[257]=dr,t[258]=fr,t[259]=pr):pr=t[259];let mr=!!V,hr;t[260]===L?hr=t[261]:(hr=e=>{!e&&!L&&H(null)},t[260]=L,t[261]=hr);let vr;t[262]!==L||t[263]!==Rn||t[264]!==Hn||t[265]!==V?(vr=V&&(0,Z.jsx)(EV,{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]=vr):vr=t[266];let yr;t[267]!==mr||t[268]!==hr||t[269]!==vr?(yr=(0,Z.jsx)(ps,{open:mr,onOpenChange:hr,children:vr}),t[267]=mr,t[268]=hr,t[269]=vr,t[270]=yr):yr=t[270];let br=W!==null,xr;t[271]===Symbol.for(`react.memo_cache_sentinel`)?(xr=e=>{e||G(null)},t[271]=xr):xr=t[271];let Sr=W?.parentDir??``,Cr;t[272]!==Sr||t[273]!==br?(Cr=(0,Z.jsx)(km,{open:br,onOpenChange:xr,kind:`file`,initialDir:Sr,defaultToTemplate:!0}),t[272]=Sr,t[273]=br,t[274]=Cr):Cr=t[274];let wr;return t[275]!==Cr||t[276]!==lr||t[277]!==pr||t[278]!==yr?(wr=(0,Z.jsxs)(Z.Fragment,{children:[lr,pr,yr,Cr]}),t[275]=Cr,t[276]=lr,t[277]=pr,t[278]=yr,t[279]=wr):wr=t[279],wr}function zH(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:bV(e)},`${e.kind}:${e.path}`)}function BH(e){return`${e.kind}:${e.path}`}function VH(e){return`${e.kind}:${e.path}`}function HH(e){return e.path}function UH(e){return e.kind===`folder`}function WH(e){return e.path}function GH(e){return e.kind===`file`}function KH(e){return e.file}function qH(e){return Je(e)}function JH(e){return Zt(e)}function YH(e){return De(e)}function XH(e){return e.path}function ZH(e){return e.kind===`asset`}function QH(e){return e.endsWith(`/`)?e.slice(0,-1):e}function $H(e){return!!e}function eU(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function tU(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function nU(e){gs.error(e)}function rU(){}function iU(e){return gs.error(e)}function aU(){}function oU(){}async function sU(){}function cU(e){return $O(e)}function lU(e){return uU(e)?.dataset.itemPath??null}function uU(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var dU=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function fU(){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=dU.map(pU),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 pU(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Sa,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Sa,{className:`h-3 ${e}`})]},t)}function mU(e){return e?lr._({id:`wTcjov`}):null}function hU(e){let t=(0,$.c)(37),{_:n}=i(),r=ih(),{merged:a}=gt(),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=mU(p),r;t[14]===l?r=t[15]:(r=e=>l[e.id]?.installed===!0,t[14]=l,t[15]=r);let i=sh.filter(r);g=l[`claude-code`]?.installed===!0;let a;t[16]!==o||t[17]!==c?(a=c!==null&&c.docContext!==null?Ui(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&&Db(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=Lk,t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(Bk,{children:[(0,Z.jsx)(ua,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[22]=y):y=t[22],m=Vk,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)(zk,{disabled:!r,onSelect:()=>{c&&u(t.id,c)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(xb,{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)(zk,{onSelect:_,disabled:p,"data-testid":`empty-space-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(Bt,{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 gU=(e,t,n)=>Kl(e,t,n,`ProjectSwitcher`);function _U(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),g=nO(),_=typeof window<`u`&&window.okDesktop!=null,v=(0,Q.useRef)(!1),y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{d(e),e||p(``)},t[1]=y):y=t[1];let b=y,x;t[2]!==r||t[3]!==n.project||t[4]!==l?(x=()=>{if(!l)return;let e=!1;return gU(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=l,t[5]=x):x=t[5];let S;t[6]!==r||t[7]!==n||t[8]!==l?(S=[l,n,r],t[6]=r,t[7]=n,t[8]=l,t[9]=S):S=t[9],(0,Q.useEffect)(x,S);let C;t[10]!==r||t[11]!==n.project?(C=e=>{d(!1),gU(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=C):C=t[12];let w=C,T;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(T=()=>{d(!1),gU(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=T):T=t[16];let E=T,D;t[17]!==r||t[18]!==n.navigator?(D=()=>{d(!1),gU(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=D):D=t[19];let k=D,A;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{d(!1),h(!0)},t[20]=A):A=t[20];let j=A,M=n.config.projectPath,N,P,F,I,L,R,z,B,V,H,U;if(t[21]!==r||t[22]!==g||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==M||t[26]!==l||t[27]!==w||t[28]!==o||t[29]!==f){let e;t[41]===M?e=t[42]:(e=e=>e.path!==M,t[41]=M,t[42]=e);let i=o.filter(e),a=f.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;P=Ya,z=l,B=b,V=!1;let u=g!==null&&`h-auto py-1.5`,d;t[43]===u?d=t[44]:(d=Gi(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,u),t[43]=u,t[44]=d);let m;t[45]===r?m=t[46]:(m=r({id:`zZ_I5K`}),t[45]=r,t[46]=m);let h;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(h=_?()=>{v.current=!0}:void 0,t[47]=h):h=t[47];let y;t[48]===l?y=t[49]:(y=_?()=>{if(v.current){v.current=!1;return}b(!l)}:void 0,t[48]=l,t[49]=y);let x;t[50]===n.config.projectName?x=t[51]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=x);let S;t[52]===g?S=t[53]:(S=g===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(Ae,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:g})]}),t[52]=g,t[53]=S);let C;t[54]!==x||t[55]!==S?(C=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x,S]}),t[54]=x,t[55]=S,t[56]=C):C=t[56];let T;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(zc,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=T):T=t[57],t[58]!==n.config.projectPath||t[59]!==d||t[60]!==m||t[61]!==y||t[62]!==C?(H=(0,Z.jsx)(Ho,{asChild:!0,children:(0,Z.jsxs)(XD,{className:d,"data-testid":`project-switcher-trigger`,"aria-label":m,title:n.config.projectPath,onPointerDown:h,onClick:y,children:[C,T]})}),t[58]=n.config.projectPath,t[59]=d,t[60]=m,t[61]=y,t[62]=C,t[63]=H):H=t[63],N=xo,U=`start`,F=`top`,I=`min-w-[260px]`,L=`project-switcher-menu`,R=i.length===0?(0,Z.jsx)(No,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(yS,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(wS,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:f,onChange:e=>p(e.target.value),onKeyDown:vU,"data-testid":`project-switcher-search`}),(0,Z.jsx)(xS,{children:(0,Z.jsx)(O,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Vo,{}),c.length===0?(0,Z.jsx)(No,{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)(Wo,{disabled:e.missing,onSelect:()=>w(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[21]=r,t[22]=g,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=M,t[26]=l,t[27]=w,t[28]=o,t[29]=f,t[30]=N,t[31]=P,t[32]=F,t[33]=I,t[34]=L,t[35]=R,t[36]=z,t[37]=B,t[38]=V,t[39]=H,t[40]=U}else N=t[30],P=t[31],F=t[32],I=t[33],L=t[34],R=t[35],z=t[36],B=t[37],V=t[38],H=t[39],U=t[40];let W;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Vo,{}),t[64]=W):W=t[64];let G,K;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(yt,{"aria-hidden":`true`,className:`text-muted-foreground`}),K=(0,Z.jsx)(s,{id:`PVUn_c`}),t[65]=G,t[66]=K):(G=t[65],K=t[66]);let q;t[67]===E?q=t[68]:(q=(0,Z.jsxs)(Wo,{onSelect:E,"data-testid":`project-switcher-open-folder`,children:[G,K]}),t[67]=E,t[68]=q);let J,Y;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(u,{"aria-hidden":`true`,className:`text-muted-foreground`}),Y=(0,Z.jsx)(s,{id:`2Xs2jo`}),t[69]=J,t[70]=Y):(J=t[69],Y=t[70]);let ee;t[71]===k?ee=t[72]:(ee=(0,Z.jsxs)(Wo,{onSelect:k,"data-testid":`project-switcher-switch-project`,children:[J,Y]}),t[71]=k,t[72]=ee);let te;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsxs)(Wo,{onSelect:j,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(ge,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[73]=te):te=t[73];let ne;t[74]!==N||t[75]!==F||t[76]!==I||t[77]!==L||t[78]!==R||t[79]!==q||t[80]!==ee||t[81]!==U?(ne=(0,Z.jsxs)(N,{align:U,side:F,className:I,"data-testid":L,children:[R,W,q,ee,te]}),t[74]=N,t[75]=F,t[76]=I,t[77]=L,t[78]=R,t[79]=q,t[80]=ee,t[81]=U,t[82]=ne):ne=t[82];let re;t[83]!==P||t[84]!==z||t[85]!==B||t[86]!==V||t[87]!==H||t[88]!==ne?(re=(0,Z.jsxs)(P,{open:z,onOpenChange:B,modal:V,children:[H,ne]}),t[83]=P,t[84]=z,t[85]=B,t[86]=V,t[87]=H,t[88]=ne,t[89]=re):re=t[89];let ie;t[90]!==n||t[91]!==m?(ie=(0,Z.jsx)(bd,{open:m,onOpenChange:h,bridge:n}),t[90]=n,t[91]=m,t[92]=ie):ie=t[92];let ae;return t[93]!==re||t[94]!==ie?(ae=(0,Z.jsxs)(Z.Fragment,{children:[re,ie]}),t[93]=re,t[94]=ie,t[95]=ae):ae=t[95],ae}function vU(e){return e.stopPropagation()}function yU(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})),si(`sidebarSearchPill`)}function bU(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Gi(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(O,{"aria-hidden":`true`}),t[2]=a):a=t[2];let 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:Ms(`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 xU(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)(ss,{"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 SU(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 CU(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Pp,Np,Np),n;e[0]===t?n=e[1]:(n=SU(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),Mp(r.id)},e[2]=r,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(xU,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function wU(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Lh(n.contentDir,Rh(t),n.pathSeparator):e?.kind===`folder`?Lh(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?Lh(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function TU(e,t,n){if((e?.kind===`doc`||e?.kind===`folder-index`)&&t){let e=t.lastIndexOf(`/`);return e<0?n.contentDir:Lh(n.contentDir,t.slice(0,e),n.pathSeparator)}if(e?.kind===`folder`)return Lh(n.contentDir,e.folderPath,n.pathSeparator);if(e?.kind===`asset`){let t=e.assetPath.lastIndexOf(`/`);return t<0?n.contentDir:Lh(n.contentDir,e.assetPath.slice(0,t),n.pathSeparator)}return n.contentDir}function EU(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Rh(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function DU(e,t,n){return e===null?Bh({workspace:n}):e.kind===`folder`?n?Vh({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?zh({docName:t,workspace:n}):null}var OU={folderCount:0,expandedCount:0},kU=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function AU(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(kU)!==null}function jU(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)(NU,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var MU=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)(Tr,{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)(nr,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Yn,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function NU(e){let t=(0,$.c)(200),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=pt(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:qr(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}=ID(),h=ih(),g=p===`expanded`,_=f&&p===`collapsed`,[v,y]=(0,Q.useState)(OU),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 dx(e=>{let t=e.initialDir??``;if(e.template){a.createFromTemplate(e.template.folder,e.template.name);return}a.startCreating(`file`,t)})},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=eo(``),O=eo(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=Mo(),P=ug().states,{dispatch:F}=$h(),I;t[9]===N?I=t[10]:(I=Bh({workspace:N}),t[9]=N,t[10]=I);let L=I,{projectLocalBinding:R,merged:z}=gt(),B=z?.appearance?.sidebar?.showHiddenFiles??!1,V=z?.appearance?.sidebar?.showAllFiles??!1,H=w&&!T,U=w&&!E,G=H||U,K=FU,q;t[11]!==a||t[12]!==N?(q=()=>{N&&a?.startCreating(`file`,``)},t[11]=a,t[12]=N,t[13]=q):q=t[13];let J=q,Y;t[14]!==a||t[15]!==N?(Y=e=>{N&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=N,t[16]=Y):Y=t[16];let ee=Y,te;t[17]!==a||t[18]!==N?(te=()=>{N&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=N,t[19]=te):te=t[19];let ne=te,re;t[20]===N?re=t[21]:(re=()=>{!N||!M||M.shell.showItemInFolder(N.contentDir)},t[20]=N,t[21]=re);let ie=re,ae;t[22]===N?ae=t[23]:(ae=()=>{!N||!M||MV(M,N.contentDir)},t[22]=N,t[23]=ae);let oe=ae,se;t[24]!==r||t[25]!==N?(se=async()=>{if(N)try{await navigator.clipboard.writeText(N.contentDir),gs.success(r({id:`6_ZOw4`}),{description:N.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),gs.error(r({id:`vfRlCI`}))}},t[24]=r,t[25]=N,t[26]=se):se=t[26];let ce=se,le;t[27]!==r||t[28]!==R?(le=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,Er(t.error)),gs.error(r({id:`P47EWZ`}),{description:Er(t.error)}))},t[27]=r,t[28]=R,t[29]=le):le=t[29];let ue=le,de;t[30]!==r||t[31]!==R?(de=e=>{if(R===null)return;let t=R.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,Er(t.error)),gs.error(r({id:`P47EWZ`}),{description:Er(t.error)}))},t[30]=r,t[31]=R,t[32]=de):de=t[32];let fe=de,pe;t[33]===a?pe=t[34]:(pe=()=>{a?.expandAll()},t[33]=a,t[34]=pe);let me=pe,he;t[35]===a?he=t[36]:(he=()=>{a?.collapseAll()},t[35]=a,t[36]=he);let ge=he,_e,ve;t[37]!==V||t[38]!==U||t[39]!==H||t[40]!==B||t[41]!==p?(_e=()=>{M&&M.editor.notifyViewMenuStateChanged({showHiddenFiles:B,showAllFiles:V,canExpandAll:H,canCollapseAll:U,sidebarVisible:p===`expanded`})},ve=[M,B,V,H,U,p],t[37]=V,t[38]=U,t[39]=H,t[40]=B,t[41]=p,t[42]=_e,t[43]=ve):(_e=t[42],ve=t[43]),(0,Q.useEffect)(_e,ve);let ye,be;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?(ye=()=>{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;RV(l);return;case`duplicate`:if(!l)return;BV(l);return;case`move-to-trash`:if(!l)return;IV(l);return;case`reveal-in-finder`:{if(!M||!N)return;let e=wU(l,c,N);M.shell.showItemInFolder(e);return}case`open-in-terminal`:if(!M||!N)return;MV(M,TU(l,c,N));return;case`send-to-ai`:{let e=sh.filter(e=>P[e.id]?.installed===!0);if(e.length===0){gs.error(r({id:`LKOLNn`}));return}let t=DU(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=wU(l,c,N);navigator.clipboard.writeText(e).then(()=>gs.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),gs.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=EU(l,c);if(e===``){gs.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>gs.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),gs.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:`,Er(e.error)),gs.error(r({id:`P47EWZ`}),{description:Er(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:`,Er(e.error)),gs.error(r({id:`P47EWZ`}),{description:Er(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}})},be=[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]=ye,t[57]=be):(ye=t[56],be=t[57]),(0,Q.useEffect)(ye,be);let xe=f&&g&&`motion-safe:delay-100`,Se=_&&`opacity-0`,Ce;t[58]!==xe||t[59]!==Se?(Ce=Gi(`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`,xe,Se,f&&`[-webkit-app-region:drag]`),t[58]=xe,t[59]=Se,t[60]=Ce):Ce=t[60];let we;t[61]===g?we=t[62]:(we=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]=we);let Te;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Te=Gi(`flex items-center gap-1`,f&&`[&>*]:[-webkit-app-region:no-drag]`),t[63]=Te):Te=t[63];let Ee;t[64]!==r||t[65]!==T||t[66]!==w||t[67]!==E||t[68]!==a?(Ee=w?(0,Z.jsxs)(Ya,{children:[(0,Z.jsx)(Ho,{asChild:!0,children:(0,Z.jsx)(MU,{icon:cl,label:r({id:`Lu_dOh`})})}),(0,Z.jsxs)(xo,{align:`end`,children:[T?null:(0,Z.jsxs)(Wo,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(Vl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}),E?null:(0,Z.jsxs)(Wo,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(Qc,{"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]=Ee):Ee=t[69];let De;t[70]===r?De=t[71]:(De=r({id:`MW64zN`}),t[70]=r,t[71]=De);let Oe;t[72]!==d||t[73]!==a?(Oe=()=>a?.startCreating(`file`,d),t[72]=d,t[73]=a,t[74]=Oe):Oe=t[74];let ke;t[75]!==De||t[76]!==Oe?(ke=(0,Z.jsx)(MU,{icon:Nl,label:De,onClick:Oe}),t[75]=De,t[76]=Oe,t[77]=ke):ke=t[77];let Ae;t[78]!==r||t[79]!==j||t[80]!==d||t[81]!==a?(Ae=j?(0,Z.jsxs)(Ya,{children:[(0,Z.jsx)(Ho,{asChild:!0,children:(0,Z.jsx)(MU,{icon:mo,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(xo,{align:`end`,children:(0,Z.jsx)(OV,{parentDir:d,onSelectTemplate:e=>a?.createFromTemplate(d,e),ItemComponent:Wo})})]}):null,t[78]=r,t[79]=j,t[80]=d,t[81]=a,t[82]=Ae):Ae=t[82];let je;t[83]===r?je=t[84]:(je=r({id:`tX5yOZ`}),t[83]=r,t[84]=je);let Me;t[85]!==d||t[86]!==a?(Me=()=>a?.startCreating(`folder`,d),t[85]=d,t[86]=a,t[87]=Me):Me=t[87];let Ne;t[88]!==je||t[89]!==Me?(Ne=(0,Z.jsx)(MU,{icon:el,label:je,onClick:Me}),t[88]=je,t[89]=Me,t[90]=Ne):Ne=t[90];let Pe;t[91]!==Ee||t[92]!==ke||t[93]!==Ae||t[94]!==Ne?(Pe=(0,Z.jsxs)(`div`,{className:Te,children:[Ee,ke,Ae,Ne]}),t[91]=Ee,t[92]=ke,t[93]=Ae,t[94]=Ne,t[95]=Pe):Pe=t[95];let Fe;t[96]!==Ce||t[97]!==we||t[98]!==Pe?(Fe=(0,Z.jsxs)(WD,{"data-electron-drag":f?``:void 0,className:Ce,children:[we,Pe]}),t[96]=Ce,t[97]=we,t[98]=Pe,t[99]=Fe):Fe=t[99];let Ie=f&&g&&`motion-safe:delay-100`,Le=_&&`opacity-0`,Re;t[100]!==Ie||t[101]!==Le?(Re=Gi(`px-2 pb-2`,f&&`[-webkit-app-region:no-drag]`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ie,Le),t[100]=Ie,t[101]=Le,t[102]=Re):Re=t[102];let ze;t[103]===p?ze=t[104]:(ze=[p],t[103]=p,t[104]=ze);let Ve;t[105]===n?Ve=t[106]:(Ve=(0,Z.jsx)(bU,{onClick:n}),t[105]=n,t[106]=Ve);let He;t[107]!==ze||t[108]!==Ve?(He=(0,Z.jsx)(W,{fallbackRender:PU,onError:yU,resetKeys:ze,children:Ve}),t[107]=ze,t[108]=Ve,t[109]=He):He=t[109];let Ue;t[110]!==Re||t[111]!==He?(Ue=(0,Z.jsx)(`div`,{className:Re,children:He}),t[110]=Re,t[111]=He,t[112]=Ue):Ue=t[112];let We;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsxs)(KD,{children:[(0,Z.jsx)(SA,{}),(0,Z.jsx)(RH,{ref:o})]}),t[113]=We):We=t[113];let Ge;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsxs)(GD,{className:`px-0`,children:[(0,Z.jsx)(CU,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(qD,{children:(0,Z.jsx)(JD,{children:(0,Z.jsx)(_U,{bridge:window.okDesktop})})}):null]}),t[114]=Ge):Ge=t[114];let Ke=!(h&&p===`collapsed`),qe;t[115]===Ke?qe=t[116]:(qe=(0,Z.jsx)(HD,{enableToggle:!1,enableDrag:Ke}),t[115]=Ke,t[116]=qe);let X;t[117]!==Fe||t[118]!==Ue||t[119]!==qe?(X=(0,Z.jsx)(Ik,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:K,children:[Fe,Ue,We,Ge,qe]})}),t[117]=Fe,t[118]=Ue,t[119]=qe,t[120]=X):X=t[120];let Je=!N,Ye,Xe;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(Nl,{"aria-hidden":`true`}),Xe=(0,Z.jsx)(s,{id:`MW64zN`}),t[121]=Ye,t[122]=Xe):(Ye=t[121],Xe=t[122]);let Ze;t[123]!==J||t[124]!==Je?(Ze=(0,Z.jsxs)(zk,{disabled:Je,onSelect:J,"data-testid":`empty-space-menu-new-file`,children:[Ye,Xe]}),t[123]=J,t[124]=Je,t[125]=Ze):Ze=t[125];let Qe=!N||!A,$e,et;t[126]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,Z.jsx)(mo,{"aria-hidden":`true`}),et=(0,Z.jsx)(s,{id:`Uuj_R4`}),t[126]=$e,t[127]=et):($e=t[126],et=t[127]);let tt;t[128]===Qe?tt=t[129]:(tt=(0,Z.jsxs)(Bk,{disabled:Qe,"data-testid":`empty-space-menu-new-from-template`,children:[$e,et]}),t[128]=Qe,t[129]=tt);let nt;t[130]===ee?nt=t[131]:(nt=(0,Z.jsx)(Vk,{children:(0,Z.jsx)(OV,{parentDir:``,onSelectTemplate:ee,ItemComponent:zk})}),t[130]=ee,t[131]=nt);let rt;t[132]!==tt||t[133]!==nt?(rt=(0,Z.jsxs)(Lk,{children:[tt,nt]}),t[132]=tt,t[133]=nt,t[134]=rt):rt=t[134];let it=!N,at,ot;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(el,{"aria-hidden":`true`}),ot=(0,Z.jsx)(s,{id:`tX5yOZ`}),t[135]=at,t[136]=ot):(at=t[135],ot=t[136]);let st;t[137]!==ne||t[138]!==it?(st=(0,Z.jsxs)(zk,{disabled:it,onSelect:ne,"data-testid":`empty-space-menu-new-folder`,children:[at,ot]}),t[137]=ne,t[138]=it,t[139]=st):st=t[139];let ct;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(Uk,{}),t[140]=ct):ct=t[140];let lt;t[141]!==r||t[142]!==ie||t[143]!==N?(lt=M?(0,Z.jsxs)(zk,{disabled:!N,onSelect:ie,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(N?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(yt,{"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]=ie,t[143]=N,t[144]=lt):lt=t[144];let ut;t[145]!==F||t[146]!==L||t[147]!==P?(ut=(0,Z.jsx)(hU,{input:L,installStates:P,dispatch:F,webFallbackVisible:!1}),t[145]=F,t[146]=L,t[147]=P,t[148]=ut):ut=t[148];let dt;t[149]!==r||t[150]!==oe||t[151]!==N?(dt=M?(0,Z.jsxs)(zk,{disabled:!N,onSelect:oe,"data-testid":`empty-space-menu-open-in-terminal`,"aria-label":r(N?{id:`BJpGCq`}:{id:`_6IEmc`}),children:[(0,Z.jsx)(Rl,{"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]=oe,t[151]=N,t[152]=dt):dt=t[152];let ft=!N,mt;t[153]!==r||t[154]!==N?(mt=r(N?{id:`Up2_7p`}:{id:`U8CD-l`}),t[153]=r,t[154]=N,t[155]=mt):mt=t[155];let ht;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,Z.jsx)(Be,{"aria-hidden":`true`}),t[156]=ht):ht=t[156];let _t;t[157]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[157]=_t):_t=t[157];let vt;t[158]===N?vt=t[159]:(vt=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]=vt);let bt;t[160]!==ce||t[161]!==ft||t[162]!==mt||t[163]!==vt?(bt=(0,Z.jsxs)(zk,{disabled:ft,onSelect:ce,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":mt,children:[ht,_t,vt]}),t[160]=ce,t[161]=ft,t[162]=mt,t[163]=vt,t[164]=bt):bt=t[164];let xt;t[165]===Symbol.for(`react.memo_cache_sentinel`)?(xt=(0,Z.jsx)(Uk,{}),t[165]=xt):xt=t[165];let St=R===null,Ct;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(s,{id:`K_wz1u`}),t[166]=Ct):Ct=t[166];let wt;t[167]!==ue||t[168]!==B||t[169]!==St?(wt=(0,Z.jsx)(Hk,{checked:B,onCheckedChange:ue,disabled:St,"data-testid":`empty-space-menu-show-hidden-files`,children:Ct}),t[167]=ue,t[168]=B,t[169]=St,t[170]=wt):wt=t[170];let Tt=R===null,Et;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(Et=(0,Z.jsx)(s,{id:`i8dKs-`}),t[171]=Et):Et=t[171];let Dt;t[172]!==fe||t[173]!==V||t[174]!==Tt?(Dt=(0,Z.jsx)(Hk,{checked:V,onCheckedChange:fe,disabled:Tt,"data-testid":`empty-space-menu-show-all-files`,children:Et}),t[172]=fe,t[173]=V,t[174]=Tt,t[175]=Dt):Dt=t[175];let Ot;t[176]===G?Ot=t[177]:(Ot=G?(0,Z.jsx)(Uk,{}):null,t[176]=G,t[177]=Ot);let kt;t[178]!==me||t[179]!==H?(kt=H?(0,Z.jsxs)(zk,{onSelect:me,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Vl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[178]=me,t[179]=H,t[180]=kt):kt=t[180];let At;t[181]!==ge||t[182]!==U?(At=U?(0,Z.jsxs)(zk,{onSelect:ge,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Qc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[181]=ge,t[182]=U,t[183]=At):At=t[183];let jt;t[184]!==Ze||t[185]!==rt||t[186]!==st||t[187]!==lt||t[188]!==ut||t[189]!==dt||t[190]!==bt||t[191]!==wt||t[192]!==Dt||t[193]!==Ot||t[194]!==kt||t[195]!==At?(jt=(0,Z.jsxs)(Rk,{children:[Ze,rt,st,ct,lt,ut,dt,bt,xt,wt,Dt,Ot,kt,At]}),t[184]=Ze,t[185]=rt,t[186]=st,t[187]=lt,t[188]=ut,t[189]=dt,t[190]=bt,t[191]=wt,t[192]=Dt,t[193]=Ot,t[194]=kt,t[195]=At,t[196]=jt):jt=t[196];let Mt;return t[197]!==X||t[198]!==jt?(Mt=(0,Z.jsx)(BD,{variant:`inset`,children:(0,Z.jsxs)(Fk,{children:[X,jt]})}),t[197]=X,t[198]=jt,t[199]=Mt):Mt=t[199],Mt}function PU(){return null}function FU(e){AU(e.target)&&(e.preventDefault(),e.stopPropagation())}function IU(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function LU(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function RU(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var zU={phase:`loading`};function BU(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function VU(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function HU(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=RU(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function UU(e){return e!==null&&e.kind===`project-branch-switch`}function WU(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,a=r===void 0?Wd:r,{_:o}=i(),c=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,XU),[l,u]=(0,Q.useState)(zU),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(!1),p;t[0]===c?p=t[1]:(p=UU(c)?c:null,t[0]=c,t[1]=p);let m=p,h;t[2]!==o||t[3]!==m?.share.target.kind?(h=m?.share.target.kind===`folder`?o({id:`ugoTXs`}):o({id:`XH30C4`}),t[2]=o,t[3]=m?.share.target.kind,t[4]=h):h=t[4];let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{u(zU),d.current=!1,f.current=!1},t[5]=_):_=t[5];let v;t[6]===c?v=t[7]:(v=[c],t[6]=c,t[7]=v),(0,Q.useEffect)(_,v);let y;t[8]!==m||t[9]!==n?(y=()=>{m&&(d.current||(d.current=!0,n.project.fetchBranchInfo({projectPath:m.projectPath,branch:m.share.branch,kind:m.share.target.kind,path:C(m.share.target)}).then(e=>{u(t=>BU(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),u(YU)})))},t[8]=m,t[9]=n,t[10]=y):y=t[10];let b;t[11]===m?b=t[12]:(b=[m],t[11]=m,t[12]=b),(0,Q.useEffect)(y,b);let x;t[13]!==o||t[14]!==m||t[15]!==l.phase||t[16]!==n||t[17]!==a||t[18]!==g?(x=()=>{if(l.phase!==`awaiting-cc1-recycle`||!m)return;let e=m.share.branch;if(!e){a.dismiss();return}if(f.current)return;f.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:m.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(Xl({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:m.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:m.share.target.kind,path:C(m.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),gs.error(o({id:`gQV-9w`,values:{targetNoun:g}}))}),a.dismiss();return}console.log(Xl({branch_dialog_action:`branch-switch-timeout`,branch:e})),gs.error(o({id:`LBwUR6`,values:{targetNoun:g}})),a.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),gs.error(o({id:`Jw6EC4`,values:{targetNoun:g}})),a.dismiss())}),()=>{t=!0}},t[13]=o,t[14]=m,t[15]=l.phase,t[16]=n,t[17]=a,t[18]=g,t[19]=x):x=t[19];let S;if(t[20]!==m||t[21]!==l.phase?(S=[l.phase,m],t[20]=m,t[21]=l.phase,t[22]=S):S=t[22],(0,Q.useEffect)(x,S),!m)return null;let{share:w,projectPath:T,currentBranch:E}=m,D=w.branch,O;t[23]!==o||t[24]!==l.info||t[25]!==l.phase||t[26]!==n.project||t[27]!==T||t[28]!==w.target||t[29]!==D||t[30]!==a?(O=function(){l.phase===`ready`&&IU(l.info).switchEnabled&&(console.log(Xl({branch_dialog_action:`switch`,branch_action:`switch`,branch:D})),u(e=>VU(e,C(w.target))),n.project.runCheckout({projectPath:T,branch:D}).then(e=>{let t=null,n=!1;u(r=>{let{state:i,sideEffect:a}=HU(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?gs.error(o({id:`NJyQi_`,values:{shareBranch:D}})):t===`fetch-failed`?gs.error(o({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&gs.error(o({id:`c863eW`,values:{shareBranch:D}})),n&&a.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),u(JU),gs.error(o({id:`c863eW`,values:{shareBranch:D}}))}))},t[23]=o,t[24]=l.info,t[25]=l.phase,t[26]=n.project,t[27]=T,t[28]=w.target,t[29]=D,t[30]=a,t[31]=O):O=t[31];let k=O,A;t[32]!==o||t[33]!==n.project||t[34]!==T||t[35]!==w.target||t[36]!==D||t[37]!==a||t[38]!==g?(A=function(){console.log(Xl({branch_dialog_action:`open-current`,branch:D})),n.project.open({path:T,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:C(w.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),gs.error(o({id:`b5aNbi`,values:{targetNoun:g}}))}),a.dismiss()},t[32]=o,t[33]=n.project,t[34]=T,t[35]=w.target,t[36]=D,t[37]=a,t[38]=g,t[39]=A):A=t[39];let j=A,M;t[40]!==o||t[41]!==l.otherWorktreePath||t[42]!==l.phase||t[43]!==n.project||t[44]!==w.target||t[45]!==D||t[46]!==a?(M=function(){if(l.phase!==`branch-in-other-worktree`)return;let e=l.otherWorktreePath;console.log(Xl({branch_dialog_action:`pivot-to-other-worktree`,branch:D})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:w.target.kind,path:C(w.target)},pendingBranch:D}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),gs.error(o({id:`LdABLa`,values:{target:e}}))}),a.dismiss()},t[40]=o,t[41]=l.otherWorktreePath,t[42]=l.phase,t[43]=n.project,t[44]=w.target,t[45]=D,t[46]=a,t[47]=M):M=t[47];let N=M,P;t[48]===a?P=t[49]:(P=function(){console.log(Xl({branch_dialog_action:`cancel`})),a.dismiss()},t[48]=a,t[49]=P);let F=P,I,L,R,z,B,V,H,U,W,G,K,q,J,Y,ee,te,ne;if(t[50]!==o||t[51]!==l.info||t[52]!==l.otherWorktreePath||t[53]!==l.phase||t[54]!==F||t[55]!==E||t[56]!==w.branch||t[57]!==w.owner||t[58]!==w.repo||t[59]!==w.target||t[60]!==D||t[61]!==g){ne=l.phase===`ready`||l.phase===`switching`?IU(l.info):null;let e;t[79]!==l.info||t[80]!==l.phase||t[81]!==E?(e=l.phase===`ready`||l.phase===`switching`?LU(l.info):E??`HEAD`,t[79]=l.info,t[80]=l.phase,t[81]=E,t[82]=e):e=t[82];let n=e;V=l.phase===`switching`||l.phase===`awaiting-cc1-recycle`;let r;t[83]===o?r=t[84]:(r=o({id:`OuY8t9`}),t[83]=o,t[84]=r),z=r;let i;t[85]!==o||t[86]!==D?(i=o({id:`_BthEY`,values:{shareBranch:D}}),t[85]=o,t[86]=D,t[87]=i):i=t[87],B=i;let a=l.phase===`loading`,c=l.phase===`error`;R=ps,ee=!0,t[88]===F?te=t[89]:(te=e=>{e||F()},t[88]=F,t[89]=te),L=ls,G=`sm:max-w-xl`,K=`share-branch-switch-dialog`,q=qU,J=KU;let u;t[90]===g?u=t[91]:(u=(0,Z.jsx)(cs,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:g}})}),t[90]=g,t[91]=u);let d=w.owner,f=w.repo,p;t[92]===w.target?p=t[93]:(p=C(w.target),t[92]=w.target,t[93]=p);let m;t[94]!==w.owner||t[95]!==w.repo||t[96]!==p?(m=(0,Z.jsx)(os,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`f8jU-L`,values:{0:d,1:f,2:p}})}),t[94]=w.owner,t[95]=w.repo,t[96]=p,t[97]=m):m=t[97],t[98]!==u||t[99]!==m?(Y=(0,Z.jsxs)(fs,{children:[u,m]}),t[98]=u,t[99]=m,t[100]=Y):Y=t[100],I=us;let h=w.owner,_=w.repo,v;t[101]===w.target?v=t[102]:(v=C(w.target),t[101]=w.target,t[102]=v),t[103]!==w.branch||t[104]!==w.owner||t[105]!==w.repo||t[106]!==w.target.kind||t[107]!==v?(H=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(Id,{owner:h,repo:_,path:v,kind:w.target.kind,branch:w.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=w.branch,t[104]=w.owner,t[105]=w.repo,t[106]=w.target.kind,t[107]=v,t[108]=H):H=t[108],U=l.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(s,{id:`yjExfe`,values:{shareBranch:D},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:l.otherWorktreePath})]}):a?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(wt,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`w4hMYl`})}):ne?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XnoA1k`,values:{targetNoun:g,shareBranch:D},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):ne?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`sZ2IOu`,values:{targetNoun:g,shareBranch:D,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_902BE`,values:{targetNoun:g,shareBranch:D,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),W=ne&&!ne.switchEnabled&&ne.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(s,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:ne.conflictingFiles.map(GU)})]}):null,t[50]=o,t[51]=l.info,t[52]=l.otherWorktreePath,t[53]=l.phase,t[54]=F,t[55]=E,t[56]=w.branch,t[57]=w.owner,t[58]=w.repo,t[59]=w.target,t[60]=D,t[61]=g,t[62]=I,t[63]=L,t[64]=R,t[65]=z,t[66]=B,t[67]=V,t[68]=H,t[69]=U,t[70]=W,t[71]=G,t[72]=K,t[73]=q,t[74]=J,t[75]=Y,t[76]=ee,t[77]=te,t[78]=ne}else I=t[62],L=t[63],R=t[64],z=t[65],B=t[66],V=t[67],H=t[68],U=t[69],W=t[70],G=t[71],K=t[72],q=t[73],J=t[74],Y=t[75],ee=t[76],te=t[77],ne=t[78];let re;t[109]===V?re=t[110]:(re=V?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(wt,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CU3AiE`})]}):null,t[109]=V,t[110]=re);let ie;t[111]!==I||t[112]!==H||t[113]!==U||t[114]!==W||t[115]!==re?(ie=(0,Z.jsxs)(I,{children:[H,U,W,re]}),t[111]=I,t[112]=H,t[113]=U,t[114]=W,t[115]=re,t[116]=ie):ie=t[116];let ae;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(s,{id:`dEgA5A`}),t[117]=ae):ae=t[117];let oe;t[118]===F?oe=t[119]:(oe=(0,Z.jsx)(Qi,{variant:`ghost`,className:`font-mono uppercase`,onClick:F,"data-testid":`share-branch-switch-cancel`,children:ae}),t[118]=F,t[119]=oe);let se;t[120]!==l.phase||t[121]!==j||t[122]!==N||t[123]!==k||t[124]!==z||t[125]!==B||t[126]!==V||t[127]!==ne?(se=l.phase===`branch-in-other-worktree`?(0,Z.jsx)(Qi,{onClick:N,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(s,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[ne?.openCurrentEnabled?(0,Z.jsxs)(Qi,{variant:`outline`,className:`font-mono uppercase`,onClick:j,disabled:V,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(fl,{className:`size-3.5`,"aria-hidden":!0}),z]}):null,(0,Z.jsx)(Qi,{onClick:k,disabled:!ne?.switchEnabled||V,"aria-disabled":!ne?.switchEnabled||V,"aria-describedby":ne&&!ne.switchEnabled&&ne.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:V?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),B]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ae,{className:`size-3.5`,"aria-hidden":!0}),B]})})]}),t[120]=l.phase,t[121]=j,t[122]=N,t[123]=k,t[124]=z,t[125]=B,t[126]=V,t[127]=ne,t[128]=se):se=t[128];let ce;t[129]!==oe||t[130]!==se?(ce=(0,Z.jsxs)(ds,{className:`sm:justify-between`,children:[oe,se]}),t[129]=oe,t[130]=se,t[131]=ce):ce=t[131];let le;t[132]!==L||t[133]!==G||t[134]!==K||t[135]!==q||t[136]!==J||t[137]!==Y||t[138]!==ie||t[139]!==ce?(le=(0,Z.jsxs)(L,{className:G,"data-testid":K,onInteractOutside:q,onPointerDownOutside:J,children:[Y,ie,ce]}),t[132]=L,t[133]=G,t[134]=K,t[135]=q,t[136]=J,t[137]=Y,t[138]=ie,t[139]=ce,t[140]=le):le=t[140];let ue;return t[141]!==R||t[142]!==ee||t[143]!==te||t[144]!==le?(ue=(0,Z.jsx)(R,{open:ee,onOpenChange:te,children:le}),t[141]=R,t[142]=ee,t[143]=te,t[144]=le,t[145]=ue):ue=t[145],ue}function GU(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function KU(e){e.preventDefault()}function qU(e){e.preventDefault()}function JU(e){return HU(e,null).state}function YU(e){return BU(e,null)}function XU(){return null}function ZU(){let e=(0,$.c)(17),t=Dn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=pt(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new zt,i=new Ze({url:n,name:Mi,document:e,onStateless:e=>{let{payload:t}=e;fe(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:rW,onConfigValidationRejected:nW,onConfigIgnoreNestedError:tW,onUnknown:eW})},onClose:$U,onDisconnect:QU}),a=ni(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`,()=>{Ti([`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 QU(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function $U(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function eW(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function tW(e){Bo(e)}function nW(e){Uo(e)}function rW(e){Ti([e.ch])}var iW=`#install-claude-desktop`;function aW(e){return e===`#settings`||e===iW}function oW(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function sW(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=pt(),{openTargetTransition:i}=Et(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=ki(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=oW(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(aW(window.location.hash))return;let e=Hn(window.location.hash);if(e){let t=_i(e.split(`.`).pop()??``);b(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}if(Sr(window.location.hash)){b(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let n=yr(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=ji(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=Yr(Kr(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 cW(){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)(lW,t),null}function lW(){let e=fW;if(!e(window.location.hash))return;let t=new AbortController;return _e(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(dW))}).catch(uW),()=>t.abort()}function uW(){}function dW(){}function fW(e){return!aW(e)&&!Hn(e)&&!yr(e)&&(e===``||e===`#`||e===`#/`)}function pW(){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)(mW,t),null}function mW(){let e=function(e){let t=e.target;lh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=ch))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function hW(){let e=(0,$.c)(4),{activeTarget:t}=pt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function gW(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=pt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:qr(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;Dm({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)(km,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function _W(){let e=(0,$.c)(18),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Og,{}),e[0]=a):a=e[0];let o,s,c,l,u,d,f,p,m,h;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ZU,{}),c=(0,Z.jsx)(sW,{}),l=(0,Z.jsx)(cW,{}),u=(0,Z.jsx)(hW,{}),d=(0,Z.jsx)(gW,{}),f=(0,Z.jsx)(pW,{}),p=!1,m=t?(0,Z.jsx)(kg,{bridge:t}):null,h=(0,Z.jsx)(Md,{}),s=t?(0,Z.jsx)(WU,{bridge:t}):null,e[1]=o,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=m,e[10]=h):(o=e[1],s=e[2],c=e[3],l=e[4],u=e[5],d=e[6],f=e[7],p=e[8],m=e[9],h=e[10]);let g;e[11]===r?g=e[12]:(g=(0,Z.jsx)(bg,{bridge:t,open:r,onOpenChange:i}),e[11]=r,e[12]=g);let _;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=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[13]=_):_=e[13];let v;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(jU,{onOpenSearch:()=>i(!0)}),e[14]=v):v=e[14];let y;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(LD,{className:`h-screen overflow-hidden`,children:[v,(0,Z.jsx)(UD,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(bA,{onOpenSearch:()=>i(!0)})})]}),e[15]=y):y=e[15];let b;return e[16]===g?b=e[17]:(b=(0,Z.jsx)(x,{name:`app`,children:(0,Z.jsx)(Pt,{children:(0,Z.jsxs)(Lt,{children:[a,(0,Z.jsxs)(yi,{children:[o,c,l,u,d,f,p,m,h,s,g,_,y]})]})})}),e[16]=g,e[17]=b),b}gc(),pf({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Ef(),ep()&&op(),Fp(),typeof window<`u`&&Of({bridge:window.okDesktop}),typeof window<`u`&&Vf({bridge:window.okDesktop}),typeof window<`u`&&As({bridge:window.okDesktop}),typeof window<`u`&&Es({bridge:window.okDesktop}),typeof window<`u`&&jf({bridge:window.okDesktop}),typeof window<`u`&&Gd({bridge:window.okDesktop});var vW=new Tc({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),yW=document.getElementById(`root`);if(!yW)throw Error(`Root element not found`);var bW=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Fc.createRoot)(yW).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:lr,children:(0,Z.jsx)(yn,{client:vW,children:(0,Z.jsxs)(Rr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(fr,{children:bW&&window.okDesktop?(0,Z.jsx)(of,{bridge:window.okDesktop}):(0,Z.jsx)(_W,{})}),(0,Z.jsx)(df,{richColors:!0,closeButton:!0})]})})})}));