@inkeep/open-knowledge 0.7.0-beta.1 → 0.7.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +34 -34
- package/dist/constants-DtTZVMOd.mjs +2 -0
- package/dist/dist-CIk4fcuB.mjs +1 -0
- package/dist/{dist-Di8PRueX.mjs → dist-LKJ3ntBn.mjs} +4 -4
- package/dist/index.mjs +1 -1
- package/dist/init-B8ysGiEE.mjs +1 -0
- package/dist/init-DQVhegZb.mjs +409 -0
- package/dist/{loader-D-OC1qlW.mjs → loader-BnGD5W-Q.mjs} +3 -3
- package/dist/loader-OfXrbUvm.mjs +1 -0
- package/dist/preview-CAj1T6yE.mjs +1 -0
- package/dist/{preview-D0bxM-7z.mjs → preview-Dh9y1nS_.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-cxebDRrV.js → ActivityModeContent-czEDk63C.js} +1 -1
- package/dist/public/assets/{DocumentContext-B5BGj6vR.js → DocumentContext-BIMINsvD.js} +8 -8
- package/dist/public/assets/{SettingsDialogBody-DEFwKiJB.js → SettingsDialogBody-D3JtwH7E.js} +1 -1
- package/dist/public/assets/{SourceEditor-ZzF4LdYG.js → SourceEditor-BKUWyZoX.js} +1 -1
- package/dist/public/assets/{config-validation-events-B5h7RDNY.js → config-validation-events-BU8q0wmb.js} +1 -1
- package/dist/public/assets/index-BKpPozSD.css +1 -0
- package/dist/public/assets/{index-DinBQ-eY.js → index-C2wMh4DC.js} +6 -6
- package/dist/public/assets/{typing-burst-detector-OVZBfkMr.js → typing-burst-detector-B70or2--.js} +1 -1
- package/dist/public/index.html +5 -5
- package/dist/{repair-launch-json-DillBce5.mjs → repair-launch-json-7_3mzdwb.mjs} +2 -2
- package/dist/{repair-mcp-configs-DrhxV28s.mjs → repair-mcp-configs-CbI3iooK.mjs} +2 -2
- package/dist/{src-CKm1rGW4.mjs → src-DOeC-Bmh.mjs} +2 -2
- package/dist/{start-B2hXGRd8.mjs → start-DvtzzZ9j.mjs} +2 -2
- package/dist/start-hZQNgjz1.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-CflqTJEV.mjs +0 -2
- package/dist/dist-CnCjIzK3.mjs +0 -1
- package/dist/init-BJckqR1i.mjs +0 -1
- package/dist/init-CIud-WTI.mjs +0 -409
- package/dist/loader-S7TTlgup.mjs +0 -1
- package/dist/preview-BD-NXRMe.mjs +0 -1
- package/dist/public/assets/index-BuIw4oeG.css +0 -1
- package/dist/start-Cx17jyxZ.mjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DPRMO_b_.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-RTxXUjwn.js","./compiler-runtime-Cs91PcD2.js","./button-DenIdY-r.js","./checkbox-BSqPN8L7.js","./dialog-C1dBa8-m.js","./collapsible-BhpeB6tu.js","./textarea-C_bHQrXh.js","./project-paths-eyh51nmQ.js","./McpConsentDialogBody-cnhKG6kN.js","./label-DCMZaJ38.js","./mcp-consent-store-19Boxoxe.js","./ActivityPanelDiffView-LNHry3BJ.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-DDRNPZvZ.js","./prop-types-CshEEa52.js","./w3c-keyname-B5t0fahT.js","./toggle-group-DPMvPSnm.js","./panel-BNBODYwB.js","./min-CHzARyU6.js","./src-Dz70a8sm.js","./colors-CuFmRbNJ.js","./ordinal-Dk6d5Y-0.js","./init-D-V7N9g_.js","./isObjectLike-HLvQwJYx.js","./now-BN_Nj6nz.js","./isSymbol-BKUBGC2u.js","./target-navigation-intent-BDpwJe-x.js","./ActivityModeContent-
|
|
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,An as f,At as p,B as m,Bn as h,Bt as g,C as _,Cn as v,Ct as y,D as b,Dt as x,E as S,En as C,Et as w,Fn as T,Ft as E,Gn as D,Gt as O,H as k,Hn as A,Ht as j,In as M,It as N,J as P,Jn as F,Jt as I,K as L,Kn as R,Kt as z,Ln as B,Lt as V,M as H,Mn as U,Mt as W,Nn as G,Nt as K,On as q,Ot as J,P as ee,Pn as te,Pt as ne,Q as re,Qn as ie,Qt as ae,Rn as oe,Rt as se,Sn as ce,St as le,T as ue,Tn as de,Tt as fe,U as pe,Un as me,Ut as he,V as ge,Vn as _e,Vt as ve,W as ye,Wn as be,Wt as xe,X as Se,Xn as Ce,Xt as we,Y as Te,Yn as Ee,Yt as De,Z as Oe,Zn as ke,Zt as Ae,_n as je,_t as Me,a as Ne,at as Pe,bn as Fe,c 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,ft as Ke,g as qe,gn as Je,gt as Ye,h as Xe,hn as Ze,ht as Qe,i as $e,ir as et,it as tt,jn as nt,jt as rt,kn as it,kt as at,l as ot,lr as st,lt as ct,m as lt,mn as ut,mt as dt,n as ft,nn as pt,nr as mt,nt as ht,o as gt,or as _t,ot as vt,p as yt,pt as bt,q as xt,qn as St,qt as Ct,r as wt,rt as Tt,s as Et,sr as Dt,st as Ot,t as kt,tr as At,tt as jt,u as Mt,ur as Nt,ut as Pt,v as Ft,vn as It,vt as Lt,w as Rt,wn as zt,wt as Bt,xn as Vt,xt as Ht,y as Ut,yn as Wt,zn as Gt,zt as Kt}from"./DocumentContext-B5BGj6vR.js";import{A as qt,C as Jt,D as Yt,E as Xt,O as Zt,S as Qt,T as $t,_ as en,a as tn,b as nn,c as rn,d as an,f as on,g as sn,h as cn,i as ln,k as un,l as dn,m as fn,n as pn,o as mn,p as hn,r as gn,s as _n,t as vn,u as yn,v as bn,w as xn,x as Sn,y as Cn}from"./panel-BNBODYwB.js";import{$r as wn,A as Tn,Ar as En,At as Dn,B as On,C as kn,Ci as An,Cr as jn,Ct as Mn,D as Nn,Di as Pn,Dn as Fn,Dr as In,Dt as Ln,E as Rn,Ei as zn,En as Bn,Er as Vn,Fr as Hn,G as Un,Gn as Wn,Gr as Gn,H as Kn,Ir as qn,K as Jn,Kn as Yn,Kr as Xn,Ln as Zn,Lr as Qn,M as $n,Mn as er,Nn as tr,Nr as nr,O as rr,On as ir,Or as ar,Pn as or,Q as sr,Qt as cr,R as lr,Rr as ur,Rt as dr,Si as Y,St as fr,T as pr,Ti as mr,Tn as hr,Tt as gr,U as _r,Un as vr,V as yr,Vn as br,W as xr,Xr as Sr,Yt as Cr,Z as wr,Zr as Tr,_ as Er,_n as Dr,a as Or,ai as kr,an as Ar,c as jr,d as Mr,dn as Nr,et as Pr,f as Fr,gn as Ir,gr as Lr,ht as Rr,i as zr,ir as Br,it as Vr,j as Hr,jn as Ur,jt as Wr,k as Gr,kr as Kr,l as qr,mn as Jr,n as Yr,o as Xr,oi as Zr,p as Qr,q as $r,qr as ei,qt as ti,r as ni,ri,s as ii,si as ai,tr as oi,u as si,vn as ci,vt as li,w as ui,wi as di,wn as fi,wr as pi,wt as mi,y as hi,yn as gi,yt as _i,z as vi,zn as yi}from"./prop-types-CshEEa52.js";import{C as bi,S as X,d as xi,g as Si,l as Ci,m as wi,o as Ti,p as Ei,t as Di,w as Oi,x as ki}from"./button-DenIdY-r.js";import{a as Ai,c as ji,d as Mi,f as Ni,i as Pi,l as Fi,m as Ii,n as Li,o as Ri,p as zi,r as Bi,s as Vi,t as Hi,u as Ui}from"./agent-presence-DxGcS3q2.js";import{$ as Wi,A as Gi,At as Ki,B as qi,Bt as Ji,C as Yi,Ct as Xi,D as Zi,Dt as Qi,E as $i,Et as ea,F as ta,Ft as na,G as ra,H as ia,Ht as aa,I as oa,It as sa,J as ca,K as la,L as ua,Lt as da,M as fa,Mt as pa,N as ma,Nt as ha,O as ga,Ot as _a,P as va,Pt as ya,Q as ba,R as xa,Rt as Sa,S as Ca,St as wa,T as Ta,Tt as Ea,U as Da,Ut as Oa,V as ka,W as Aa,Wt as ja,X as Ma,Y as Na,Z as Pa,_ as Fa,_t as Ia,a as La,at as Ra,b as za,bt as Ba,ct as Va,dt as Ha,et as Ua,ft as Wa,g as Ga,gt as Ka,h as qa,ht as Ja,it as Ya,j as Xa,jt as Za,k as Qa,kt as $a,lt as eo,m as to,mt as no,nt as ro,o as io,ot as ao,p as oo,pt as so,q as co,r as lo,rt as uo,st as fo,t as po,tt as mo,u as ho,ut as go,v as _o,vt as vo,w as yo,wt as bo,x as xo,xt as So,y as Co,yt as wo,z as To,zt as Eo}from"./config-validation-events-B5h7RDNY.js";import{n as Do,r as Oo,s as ko,t as Ao}from"./toggle-group-DPMvPSnm.js";import{C as jo,S as Mo,a as No,b as Po,c as Fo,d as Io,f as Lo,h as Ro,i as zo,m as Bo,n as Vo,o as Ho,p as Uo,s as Wo,t as Go,u as Ko,x as qo}from"./dialog-C1dBa8-m.js";import{a as Jo,i as Yo,n as Xo,r as Zo,t as Qo}from"./collapsible-BhpeB6tu.js";import{t as $o}from"./checkbox-BSqPN8L7.js";import{t as es}from"./label-DCMZaJ38.js";import{i as ts,n as ns,r as rs}from"./project-paths-eyh51nmQ.js";import{n as is,t as as}from"./mcp-consent-store-19Boxoxe.js";import{$ as os,At as ss,Ct as cs,Dt as ls,Ft as us,I as ds,It as fs,J as ps,Mt as ms,Ot as hs,Pt as gs,Q as _s,Tt as vs,X as ys,Z as bs,at as xs,bt as Ss,c as Cs,jt as ws,k as Ts,w as Es}from"./dist-sw9fzKjM.js";import{n as Ds}from"./dist-DkR43q3h.js";import{n as Os,o as ks,r as As,t as js}from"./typing-burst-detector-OVZBfkMr.js";import{t as Ms}from"./target-navigation-intent-BDpwJe-x.js";import"./textarea-C_bHQrXh.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 Ns(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DPRMO_b_.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Ps(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{sn(e,()=>t.signal,()=>n=!0)},u=Cn(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?bn:en;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Is:Fs,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:Fs(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 Fs(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 Is(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ls=class extends on{#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||Rs(),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=hn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),cn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Rs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var zs=class extends qt{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 Ls({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=Bs(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=Bs(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=Bs(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=Bs(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){cn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Jt(t,e))}findAll(e={}){return this.getAll().filter(t=>Jt(e,t))}notify(e){cn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return cn.batch(()=>Promise.all(e.map(e=>e.continue().catch($t))))}};function Bs(e){return e.options.scope?.id}var Vs=class extends qt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Qt(r,t),a=this.get(i);return a||(a=new an({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){cn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>xn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>xn(e,t)):t}notify(e){cn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){cn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){cn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Hs=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Vs,this.#t=e.mutationCache||new zs,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=un.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=fn.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(Yt(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=nn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return cn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;cn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return cn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=cn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then($t).catch($t)}invalidateQueries(e,t={}){return cn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=cn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch($t)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then($t)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Yt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then($t).catch($t)}fetchInfiniteQuery(e){return e.behavior=Ps(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then($t).catch($t)}ensureInfiniteQueryData(e){return e.behavior=Ps(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return fn.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(Sn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Xt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Sn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Xt(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||=Qt(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===Zt&&(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()}},Us=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}}}})),Ws=t(((e,t)=>{t.exports=Us()})),Gs=t((e=>{var t=Ws(),n=r(),i=Oi();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 ee(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var te,ne;function re(e){if(te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);te=t&&t[1]||``,ne=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DPRMO_b_.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-RTxXUjwn.js","./compiler-runtime-Cs91PcD2.js","./button-DenIdY-r.js","./checkbox-BSqPN8L7.js","./dialog-C1dBa8-m.js","./collapsible-BhpeB6tu.js","./textarea-C_bHQrXh.js","./project-paths-eyh51nmQ.js","./McpConsentDialogBody-cnhKG6kN.js","./label-DCMZaJ38.js","./mcp-consent-store-19Boxoxe.js","./ActivityPanelDiffView-LNHry3BJ.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-DDRNPZvZ.js","./prop-types-CshEEa52.js","./w3c-keyname-B5t0fahT.js","./toggle-group-DPMvPSnm.js","./panel-BNBODYwB.js","./min-CHzARyU6.js","./src-Dz70a8sm.js","./colors-CuFmRbNJ.js","./ordinal-Dk6d5Y-0.js","./init-D-V7N9g_.js","./isObjectLike-HLvQwJYx.js","./now-BN_Nj6nz.js","./isSymbol-BKUBGC2u.js","./target-navigation-intent-BDpwJe-x.js","./ActivityModeContent-czEDk63C.js","./DocumentContext-BIMINsvD.js","./dist-Cwt7KtW7.js","./dist-sw9fzKjM.js","./dist-DkR43q3h.js","./dist-y5PvfJVO.js","./dist-CadHdAvi.js","./stex-DxnLy7rA.js","./DocumentContext-B0sQn39F.css","./agent-presence-DxGcS3q2.js","./SettingsDialogBody-D3JtwH7E.js","./config-validation-events-BU8q0wmb.js","./SourceEditor-BKUWyZoX.js","./typing-burst-detector-B70or2--.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,An as f,At as p,B as m,Bn as h,Bt as g,C as _,Cn as v,Ct as y,D as b,Dt as x,E as S,En as C,Et as w,Fn as T,Ft as E,Gn as D,Gt as O,H as k,Hn as A,Ht as j,In as M,It as N,J as P,Jn as F,Jt as I,K as L,Kn as R,Kt as z,Ln as B,Lt as V,M as H,Mn as U,Mt as W,Nn as G,Nt as K,On as q,Ot as J,P as ee,Pn as te,Pt as ne,Q as re,Qn as ie,Qt as ae,Rn as oe,Rt as se,Sn as ce,St as le,T as ue,Tn as de,Tt as fe,U as pe,Un as me,Ut as he,V as ge,Vn as _e,Vt as ve,W as ye,Wn as be,Wt as xe,X as Se,Xn as Ce,Xt as we,Y as Te,Yn as Ee,Yt as De,Z as Oe,Zn as ke,Zt as Ae,_n as je,_t as Me,a as Ne,at as Pe,bn as Fe,c 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,ft as Ke,g as qe,gn as Je,gt as Ye,h as Xe,hn as Ze,ht as Qe,i as $e,ir as et,it as tt,jn as nt,jt as rt,kn as it,kt as at,l as ot,lr as st,lt as ct,m as lt,mn as ut,mt as dt,n as ft,nn as pt,nr as mt,nt as ht,o as gt,or as _t,ot as vt,p as yt,pt as bt,q as xt,qn as St,qt as Ct,r as wt,rt as Tt,s as Et,sr as Dt,st as Ot,t as kt,tr as At,tt as jt,u as Mt,ur as Nt,ut as Pt,v as Ft,vn as It,vt as Lt,w as Rt,wn as zt,wt as Bt,xn as Vt,xt as Ht,y as Ut,yn as Wt,zn as Gt,zt as Kt}from"./DocumentContext-BIMINsvD.js";import{A as qt,C as Jt,D as Yt,E as Xt,O as Zt,S as Qt,T as $t,_ as en,a as tn,b as nn,c as rn,d as an,f as on,g as sn,h as cn,i as ln,k as un,l as dn,m as fn,n as pn,o as mn,p as hn,r as gn,s as _n,t as vn,u as yn,v as bn,w as xn,x as Sn,y as Cn}from"./panel-BNBODYwB.js";import{$r as wn,A as Tn,Ar as En,At as Dn,B as On,C as kn,Ci as An,Cr as jn,Ct as Mn,D as Nn,Di as Pn,Dn as Fn,Dr as In,Dt as Ln,E as Rn,Ei as zn,En as Bn,Er as Vn,Fr as Hn,G as Un,Gn as Wn,Gr as Gn,H as Kn,Ir as qn,K as Jn,Kn as Yn,Kr as Xn,Ln as Zn,Lr as Qn,M as $n,Mn as er,Nn as tr,Nr as nr,O as rr,On as ir,Or as ar,Pn as or,Q as sr,Qt as cr,R as lr,Rr as ur,Rt as dr,Si as Y,St as fr,T as pr,Ti as mr,Tn as hr,Tt as gr,U as _r,Un as vr,V as yr,Vn as br,W as xr,Xr as Sr,Yt as Cr,Z as wr,Zr as Tr,_ as Er,_n as Dr,a as Or,ai as kr,an as Ar,c as jr,d as Mr,dn as Nr,et as Pr,f as Fr,gn as Ir,gr as Lr,ht as Rr,i as zr,ir as Br,it as Vr,j as Hr,jn as Ur,jt as Wr,k as Gr,kr as Kr,l as qr,mn as Jr,n as Yr,o as Xr,oi as Zr,p as Qr,q as $r,qr as ei,qt as ti,r as ni,ri,s as ii,si as ai,tr as oi,u as si,vn as ci,vt as li,w as ui,wi as di,wn as fi,wr as pi,wt as mi,y as hi,yn as gi,yt as _i,z as vi,zn as yi}from"./prop-types-CshEEa52.js";import{C as bi,S as X,d as xi,g as Si,l as Ci,m as wi,o as Ti,p as Ei,t as Di,w as Oi,x as ki}from"./button-DenIdY-r.js";import{a as Ai,c as ji,d as Mi,f as Ni,i as Pi,l as Fi,m as Ii,n as Li,o as Ri,p as zi,r as Bi,s as Vi,t as Hi,u as Ui}from"./agent-presence-DxGcS3q2.js";import{$ as Wi,A as Gi,At as Ki,B as qi,Bt as Ji,C as Yi,Ct as Xi,D as Zi,Dt as Qi,E as $i,Et as ea,F as ta,Ft as na,G as ra,H as ia,Ht as aa,I as oa,It as sa,J as ca,K as la,L as ua,Lt as da,M as fa,Mt as pa,N as ma,Nt as ha,O as ga,Ot as _a,P as va,Pt as ya,Q as ba,R as xa,Rt as Sa,S as Ca,St as wa,T as Ta,Tt as Ea,U as Da,Ut as Oa,V as ka,W as Aa,Wt as ja,X as Ma,Y as Na,Z as Pa,_ as Fa,_t as Ia,a as La,at as Ra,b as za,bt as Ba,ct as Va,dt as Ha,et as Ua,ft as Wa,g as Ga,gt as Ka,h as qa,ht as Ja,it as Ya,j as Xa,jt as Za,k as Qa,kt as $a,lt as eo,m as to,mt as no,nt as ro,o as io,ot as ao,p as oo,pt as so,q as co,r as lo,rt as uo,st as fo,t as po,tt as mo,u as ho,ut as go,v as _o,vt as vo,w as yo,wt as bo,x as xo,xt as So,y as Co,yt as wo,z as To,zt as Eo}from"./config-validation-events-BU8q0wmb.js";import{n as Do,r as Oo,s as ko,t as Ao}from"./toggle-group-DPMvPSnm.js";import{C as jo,S as Mo,a as No,b as Po,c as Fo,d as Io,f as Lo,h as Ro,i as zo,m as Bo,n as Vo,o as Ho,p as Uo,s as Wo,t as Go,u as Ko,x as qo}from"./dialog-C1dBa8-m.js";import{a as Jo,i as Yo,n as Xo,r as Zo,t as Qo}from"./collapsible-BhpeB6tu.js";import{t as $o}from"./checkbox-BSqPN8L7.js";import{t as es}from"./label-DCMZaJ38.js";import{i as ts,n as ns,r as rs}from"./project-paths-eyh51nmQ.js";import{n as is,t as as}from"./mcp-consent-store-19Boxoxe.js";import{$ as os,At as ss,Ct as cs,Dt as ls,Ft as us,I as ds,It as fs,J as ps,Mt as ms,Ot as hs,Pt as gs,Q as _s,Tt as vs,X as ys,Z as bs,at as xs,bt as Ss,c as Cs,jt as ws,k as Ts,w as Es}from"./dist-sw9fzKjM.js";import{n as Ds}from"./dist-DkR43q3h.js";import{n as Os,o as ks,r as As,t as js}from"./typing-burst-detector-B70or2--.js";import{t as Ms}from"./target-navigation-intent-BDpwJe-x.js";import"./textarea-C_bHQrXh.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 Ns(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DPRMO_b_.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Ps(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{sn(e,()=>t.signal,()=>n=!0)},u=Cn(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?bn:en;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Is:Fs,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:Fs(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 Fs(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 Is(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ls=class extends on{#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||Rs(),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=hn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),cn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Rs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var zs=class extends qt{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 Ls({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=Bs(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=Bs(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=Bs(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=Bs(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){cn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Jt(t,e))}findAll(e={}){return this.getAll().filter(t=>Jt(e,t))}notify(e){cn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return cn.batch(()=>Promise.all(e.map(e=>e.continue().catch($t))))}};function Bs(e){return e.options.scope?.id}var Vs=class extends qt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Qt(r,t),a=this.get(i);return a||(a=new an({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){cn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>xn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>xn(e,t)):t}notify(e){cn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){cn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){cn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Hs=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Vs,this.#t=e.mutationCache||new zs,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=un.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=fn.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(Yt(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=nn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return cn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;cn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return cn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=cn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then($t).catch($t)}invalidateQueries(e,t={}){return cn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=cn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch($t)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then($t)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Yt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then($t).catch($t)}fetchInfiniteQuery(e){return e.behavior=Ps(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then($t).catch($t)}ensureInfiniteQueryData(e){return e.behavior=Ps(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return fn.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(Sn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Xt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Sn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Xt(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||=Qt(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===Zt&&(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()}},Us=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}}}})),Ws=t(((e,t)=>{t.exports=Us()})),Gs=t((e=>{var t=Ws(),n=r(),i=Oi();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 ee(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var te,ne;function re(e){if(te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);te=t&&t[1]||``,ne=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+te+e+ne}var ie=!1;function ae(e,t){if(!e||ie)return``;ie=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -20,7 +20,7 @@ Error generating stack: `+e.message+`
|
|
|
20
20
|
`}function Ng(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;jg(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Mg(e,o.headerOptions):void 0)}}))}else{let s=jg(e,t,n,r,i,a,o);return s?Mg(s,o?.headerOptions):void 0}}function Pg(e,t,n,r,i,a){return Ng(e,e,t,n,r,i,a)}function Fg(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 Ig(e,t){return`${e}\u0000${t}`}function Lg(e,t,n){let r=Kr(e).body,i=Kr(t).body;return r===i?``:Pg(n,r,i,``,``,{context:3})}function Rg(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ft(),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=Ig(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=Lg(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 zg=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-LNHry3BJ.js`),__vite__mapDeps([16,1,6,17]),import.meta.url)).ActivityPanelDiffView}));function Bg(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Y._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Y._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Y._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Y._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Y._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function Vg(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Hg(e){return e.slice(0,7)}function Ug(e){return e.type===`upstream`?Y._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?Y._({id:`B2DrPb`}):e.author}function Wg(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)(Mi,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(Ri,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Ai,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(Fi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Ui,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(Vi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(zi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function Gg(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)(Ee,{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=Yn(i),t[1]=i,t[2]=a);let o=a,s=r?sr[o]??wr[o]:wr[o],c;t[3]!==s||t[4]!==i?(c=s??fi(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)(Wg,{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)(Cc,{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)(qs,{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)(ul,{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)(zi,{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)(qs,{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)(ul,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Kg(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(qg),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(Dt,{className:`size-3`}):(0,Z.jsx)(Jo,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?Y._({id:`OKQe56`,values:{entryCount:p}}):Y._({id:`k9jDvw`,values:{entryCount:p}}),t[3]=p,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==d||t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[6]=d,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==a||t[12]!==s||t[13]!==n||t[14]!==d||t[15]!==c||t[16]!==i||t[17]!==u||t[18]!==l?(v=d&&n.map(e=>(0,Z.jsx)(a_,{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 qg(e){return!e}function Jg(e){return e.checkpoint?e.checkpoint.kind:`save`}function Yg(e){let t=Jg(e);if(t===`save`)return Y._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${Xg(n)})`:``;return t===`bridge-merge-loss`?Y._({id:`uZAG7T`,values:{sizeSuffix:r}}):Y._({id:`_4rAQI`,values:{sizeSuffix:r}})}function Xg(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function Zg(e){return e.type===`checkpoint`?Jg(e)===`save`?`version`:`auto-save`:`wip`}function Qg(e){let t=Zg(e);return t===`version`?Y._({id:`RFQ1Yx`}):t===`auto-save`?Y._({id:`9Uv1CD`}):Y._({id:`Yea-K5`})}function $g(e){let t=Zg(e);return t===`version`?Y._({id:`gg3Rpy`}):t===`auto-save`?Y._({id:`PXXeW8`}):Y._({id:`Pyp1NA`})}function e_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function t_(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(r_),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(n_)},children:[r?(0,Z.jsx)(Dt,{className:`size-3`}):(0,Z.jsx)(Jo,{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 n_(e){return!e}function r_(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 i_(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=Rg(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)(B,{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)(B,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(zg,{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 a_(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=Bg(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=Ug(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=Vg(n.timestamp),t[4]=n.timestamp,t[5]=y);let b=y,x;t[6]===n.sha?x=t[7]:(x=Hg(n.sha),t[6]=n.sha,t[7]=x);let S=x,C=n.contributors.flatMap(o_),w;t[8]===n?w=t[9]:(w=e_(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}),qo.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=ti.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}),qo.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,V;t[23]!==n||t[24]!==a||t[25]!==p?(V=p?(()=>{let e=Jg(n);return e===`bridge-merge-loss`?(0,Z.jsx)(An,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(mc,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(dc,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(Gg,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=V):V=t[26];let H=V,U=u?j:void 0,W=u?`bg-muted`:`hover:bg-muted/80`,G;t[27]===W?G=t[28]:(G=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,W],t[27]=W,t[28]=G);let K=G.join(` `),q;t[29]===F?q=t[30]:(q=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),F())},t[29]=F,t[30]=q);let J;t[31]===H?J=t[32]:(J=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:H}),t[31]=H,t[32]=J);let ee;t[33]!==v||t[34]!==n||t[35]!==p?(ee=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:Yg(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]=ee):ee=t[36];let te;t[37]!==n.timestamp||t[38]!==g?(te=(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]=te):te=t[39];let ne;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=ne):ne=t[40];let re;t[41]===n?re=t[42]:(re=Qg(n),t[41]=n,t[42]=re);let ie;t[43]===D?ie=t[44]:(ie=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=ie);let ae;t[45]===O?ae=t[46]:(ae=O?(0,Z.jsx)(B,{className:`size-3 animate-spin`}):(0,Z.jsx)(Ni,{className:`size-3`}),t[45]=O,t[46]=ae);let oe;t[47]!==O||t[48]!==re||t[49]!==ie||t[50]!==ae?(oe=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":re,disabled:O,onClick:ie,children:ae})}),t[47]=O,t[48]=re,t[49]=ie,t[50]=ae,t[51]=oe):oe=t[51];let se;t[52]===n?se=t[53]:(se=Qg(n),t[52]=n,t[53]=se);let ce;t[54]===se?ce=t[55]:(ce=(0,Z.jsx)(Tn,{side:`top`,children:se}),t[54]=se,t[55]=ce);let le;t[56]!==oe||t[57]!==ce?(le=(0,Z.jsxs)(Gr,{children:[oe,ce]}),t[56]=oe,t[57]=ce,t[58]=le):le=t[58];let ue;t[59]!==ee||t[60]!==te||t[61]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[ee,te,ne,le]}),t[59]=ee,t[60]=te,t[61]=le,t[62]=ue):ue=t[62];let de;t[63]===T?de=t[64]:(de=T.length>0&&(0,Z.jsx)(t_,{summaries:T}),t[63]=T,t[64]=de);let fe=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}),pe;t[65]!==ue||t[66]!==de||t[67]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ue,de,fe]}),t[65]=ue,t[66]=de,t[67]=fe,t[68]=pe):pe=t[68];let me;t[69]!==u||t[70]!==F||t[71]!==U||t[72]!==K||t[73]!==q||t[74]!==J||t[75]!==pe?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":U,"data-testid":`timeline-entry-expand`,className:K,onClick:F,onKeyDown:q,children:[J,pe]}),t[69]=u,t[70]=F,t[71]=U,t[72]=K,t[73]=q,t[74]=J,t[75]=pe,t[76]=me):me=t[76];let he;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(he=u&&(0,Z.jsx)(i_,{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]=he):he=t[83];let ge;t[84]!==me||t[85]!==he?(ge=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[me,he]}),t[84]=me,t[85]=he,t[86]=ge):ge=t[86];let _e;t[87]!==L||t[88]!==D?(_e=e=>{e?D(!0):L()},t[87]=L,t[88]=D,t[89]=_e):_e=t[89];let ve;t[90]===n?ve=t[91]:(ve=$g(n),t[90]=n,t[91]=ve);let ye;t[92]===ve?ye=t[93]:(ye=(0,Z.jsx)(Fo,{children:ve}),t[92]=ve,t[93]=ye);let be;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(be={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=be):be=t[98];let xe;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(xe={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=xe):xe=t[99];let Se;t[100]===be?Se=t[101]:(Se=(0,Z.jsx)(No,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:be,components:xe})}),t[100]=be,t[101]=Se);let Ce;t[102]!==ye||t[103]!==Se?(Ce=(0,Z.jsxs)(Wo,{children:[ye,Se]}),t[102]=ye,t[103]=Se,t[104]=Ce):Ce=t[104];let we;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=we):we=t[105];let Te;t[106]===L?Te=t[107]:(Te=(0,Z.jsx)(Di,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:L,children:we}),t[106]=L,t[107]=Te);let Ee;t[108]===z?Ee=t[109]:(Ee=()=>z(),t[108]=z,t[109]=Ee);let De;t[110]===O?De=t[111]:(De=O?(0,Z.jsx)(B,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=De);let Oe;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=Oe):Oe=t[112];let ke;t[113]!==O||t[114]!==Ee||t[115]!==De?(ke=(0,Z.jsxs)(Di,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:Ee,children:[De,Oe]}),t[113]=O,t[114]=Ee,t[115]=De,t[116]=ke):ke=t[116];let Ae;t[117]!==Te||t[118]!==ke?(Ae=(0,Z.jsxs)(Ho,{children:[Te,ke]}),t[117]=Te,t[118]=ke,t[119]=Ae):Ae=t[119];let je;t[120]!==Ce||t[121]!==Ae?(je=(0,Z.jsxs)(zo,{children:[Ce,Ae]}),t[120]=Ce,t[121]=Ae,t[122]=je):je=t[122];let Me;t[123]!==E||t[124]!==_e||t[125]!==je?(Me=(0,Z.jsx)(Go,{open:E,onOpenChange:_e,children:je}),t[123]=E,t[124]=_e,t[125]=je,t[126]=Me):Me=t[126];let Ne;return t[127]!==ge||t[128]!==Me?(Ne=(0,Z.jsxs)(Z.Fragment,{children:[ge,Me]}),t[127]=ge,t[128]=Me,t[129]=Ne):Ne=t[129],Ne}function o_(e){return e.docs}function s_(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=Pn(),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)(d_),[x,S]=(0,Q.useState)(u_),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(l_),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)(_n,{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)(Gr,{children:[(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsxs)(Ao,{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)(Do,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(qc,{className:`size-3.5`})}),(0,Z.jsx)(Do,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(sc,{className:`size-3.5`})})]})}),(0,Z.jsx)(Tn,{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)(B,{className:`size-4 animate-spin`}):(0,Z.jsx)(Jc,{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)($n,{asChild:!0,children:(0,Z.jsx)(Di,{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)(Tn,{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)(Gr,{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)(mn,{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(c_)}),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)(a_,{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)(a_,{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)(Kg,{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 V;return t[83]!==F||t[84]!==I||t[85]!==z?(V=(0,Z.jsxs)(`div`,{className:F,children:[I,z]}),t[83]=F,t[84]=I,t[85]=z,t[86]=V):V=t[86],V}function c_(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Ja,{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)(Ja,{className:`h-3 w-28`}),(0,Z.jsx)(Ja,{className:`h-3 w-40`})]})]},e)}function l_(e){return e.type===`checkpoint`}function u_(){return new Set}function d_(){return new Pi(32)}var f_=[{id:`outline`,icon:Ac},{id:`links`,icon:_e},{id:`graph`,icon:Nc},{id:`timeline`,icon:rc}];function p_(e){return e===`outline`?Y._({id:`dD7NPy`}):e===`links`?Y._({id:`Rj01Fz`}):e===`graph`?Y._({id:`x2fr_j`}):Y._({id:`cklVjM`})}function m_(){return n(()=>import(`./GraphPanel-DDRNPZvZ.js`),__vite__mapDeps([18,1,19,6,3,7,20,21,22,23,24,25,26,27,28,29,30,31]),import.meta.url)}var h_=(0,Q.lazy)(async()=>({default:(await m_()).GraphPanel})),g_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-cxebDRrV.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,41]),import.meta.url)).ActivityModeContent}));function __(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)(Ao,{type:`single`,variant:`outline`,value:a,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:f_.map(v_)})}):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)(As,{docName:n,isSourceMode:r}),a===`links`&&(0,Z.jsx)(cg,{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)(h_,{activeDocName:n})}),a===`timeline`&&(0,Z.jsx)(s_,{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)(g_,{})})}),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 v_(e){let{id:t,icon:n}=e,r=p_(t);return(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(Do,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)($n,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Tn,{side:`bottom`,children:r})]},t)}function y_(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function b_(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function x_(e){return e/100*window.innerHeight}function S_(e){return e/100*window.innerWidth}function C_(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 w_({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=C_(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=b_(t,i);break;case`em`:r=y_(t,i);break;case`vh`:r=x_(i);break;case`vw`:r=S_(i);break}return r}function T_(e){return parseFloat(e.toFixed(3))}function E_({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 D_(e){let{panels:t}=e,n=E_({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=T_(w_({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=T_(w_({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=T_(w_({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=T_(w_({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 O_(e,t=`Assertion error`){if(!e)throw Error(t)}function k_(e,t){return Array.from(t).sort(e===`horizontal`?A_:j_)}function A_(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function j_(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function M_(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function N_(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 P_({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}=N_(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return O_(i,`No rect found`),i}var F_;function I_(){return F_===void 0&&(F_=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),F_}function L_(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=k_(n,Array.from(t.children).filter(M_).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,P_({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=I_()?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:E_({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 R_=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)}}},z_=new Map,B_=new R_;function V_(e){z_=new Map(z_),z_.delete(e)}function H_(e,t){for(let[t]of z_)if(t.id===e)return t}function U_(e,t){for(let[t,n]of z_)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function W_(){return z_}function G_(e,t){return B_.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function K_(e,t){let n=z_.get(e);z_=new Map(z_),z_.set(e,t),B_.emit(`groupChange`,{group:e,prev:n,next:t})}function q_(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=N_(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 J_(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Y_(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:tv(e),b:tv(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();O_(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:ev($_(n.a)),b:ev($_(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 X_=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Z_(e){let t=getComputedStyle(nv(e)??e).display;return t===`flex`||t===`inline-flex`}function Q_(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Z_(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`||X_.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function $_(e){let t=e.length;for(;t--;){let n=e[t];if(O_(n,`Missing node`),Q_(n))return n}return null}function ev(e){return e&&Number(getComputedStyle(e).zIndex)||0}function tv(e){let t=[];for(;e;)t.push(e),e=nv(e);return t}function nv(e){let{parentNode:t}=e;return J_(t)?t.host:t}function rv(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 iv({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!M_(n)||n.contains(e)||e.contains(n))return!0;if(Y_(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(rv(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function av(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=L_(r),a=q_(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&iv({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function ov(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 sv(e,t,n=0){return Math.abs(T_(e)-T_(t))<=n}function cv(e,t){return sv(e,t)?0:e>t?1:-1}function lv({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(cv(r,c)<0)if(a){let e=(i+c)/2;r=cv(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=T_(r),r}function uv({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(sv(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;O_(u!=null,`Invalid first pivot index`),O_(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];O_(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(O_(n!=null,`Previous layout not found for panel index ${t}`),sv(n,i)){let t=o-n;cv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];O_(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(O_(n!=null,`Previous layout not found for panel index ${t}`),sv(n,o)){let t=n-i;cv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];O_(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&cv(i,c)<0)if(e>0){let t=c-o,n=t/2;cv(i+e,c)<0&&(e=cv(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;cv(i-e,c)<0&&(e=cv(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];O_(e!=null,`Previous layout not found for panel index ${r}`);let a=lv({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];O_(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=lv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!sv(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(ov(c,l))return i;{let t=e<0?d:u,r=s[t];O_(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=lv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!sv(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];O_(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=lv({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(sv(i,s)||(t-=s-i,l[r]=s),sv(t,0))break;e>0?r--:r++}}}if(!sv(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 dv(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||cv(e[n],t[n])!==0)return!1;return!0}function fv({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(!sv(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];O_(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];O_(i!=null,`No layout data found for index ${e}`);let o=r[e];O_(o!=null,`No layout data found for index ${e}`);let s=lv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!sv(a,0))for(let e=0;e<t.length;e++){let n=r[e];O_(n!=null,`No layout data found for index ${e}`);let i=n+a,o=lv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,sv(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function pv({groupId:e,panelId:t}){let n=()=>{let t=W_();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=fv({layout:uv({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});dv(l,p)||K_(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&&sv(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=E_({group:t});o(T_(w_({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function mv(e){e.defaultPrevented||av(e,W_()).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=pv({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function hv(e){let t=W_();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 gv({groupId:e}){let t=()=>{let t=W_();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=fv({layout:e,panelConstraints:r});return n?o:(dv(o,c)||K_(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function _v(e,t){let n=hv(e),r=U_(n.id,!0),i=n.separators.find(t=>t.element===e);O_(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);O_(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=gv({groupId:n.id}).getLayout(),c=fv({layout:uv({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});dv(s,c)||K_(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function vv(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=hv(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&_v(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&_v(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&_v(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&_v(t,-5);break;case`End`:e.preventDefault(),_v(t,100);break;case`Enter`:{e.preventDefault();let n=hv(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=U_(n.id,!0),o=n.separators.find(e=>e.element===t);O_(o,`Matching separator not found`);let s=a.get(o);O_(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(O_(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];_v(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=hv(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);O_(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(),_v(t,-100);break}}var yv={cursorFlags:0,state:`inactive`},bv=new R_;function xv(){return yv}function Sv(e){return bv.addListener(`change`,e)}function Cv(e){let t=yv,n={...yv};n.cursorFlags=e,yv=n,bv.emit(`change`,{prev:t,next:n})}function wv(e){let t=yv;yv=e,bv.emit(`change`,{prev:t,next:e})}function Tv(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=W_(),n=av(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)}),wv({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Ev=e=>e,Dv=()=>{},Ov=1,kv=2,Av=4,jv=8,Mv=3,Nv=12,Pv;function Fv(){return Pv===void 0&&(Pv=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Pv=!0)),Pv}function Iv({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&&Fv()){let t=(e&Ov)!==0,n=(e&kv)!==0,r=(e&Av)!==0,i=(e&jv)!==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 Fv()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Lv=new WeakMap;function Rv(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Lv.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=xv();switch(r.state){case`active`:case`hover`:{let e=Iv({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}Lv.set(e,{prevStyle:t,styleSheet:n})}function zv({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=uv({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(dv(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ov:kv;break;case`vertical`:s|=d<0?Av:jv;break}}else K_(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Mv:c|=s&Mv,t.movementY===0?c|=o&Nv:c|=s&Nv,Cv(c),Rv(e)}function Bv(e){let t=W_(),n=xv();switch(n.state){case`active`:zv({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Vv(e){if(e.defaultPrevented)return;let t=xv(),n=W_();switch(t.state){case`active`:if(e.buttons===0){wv({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=U_(e.group.id,!0);K_(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)}zv({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=av(e,n);r.length===0?t.state!==`inactive`&&wv({cursorFlags:0,state:`inactive`}):wv({cursorFlags:0,hitRegions:r,state:`hover`}),Rv(e.currentTarget);break}}}function Hv(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(xv().state){case`hover`:wv({cursorFlags:0,state:`inactive`})}}function Uv(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=xv();switch(t.state){case`active`:wv({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Rv(e.currentTarget),t.hitRegions.forEach(e=>{let t=U_(e.group.id,!0);K_(e.group,t)}),e.preventDefault())}}function Wv(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=T_(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=T_((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Gv(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=E_({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:T_(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Kv(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 qv({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=T_(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]=T_((r[e]??0)/a*l);else{let e=T_(l/c.length);for(let t of c)u[t]=e}return u}function Jv(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 Yv=new Map;function Xv(e){let t=!0;O_(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=E_({group:e});if(t===0)return;let n=U_(e.id);if(!n)return;let r=D_(e),i=n.defaultLayoutDeferred?Wv(r):n.layout,a=fv({layout:qv({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&dv(n.layout,a)&&Kv(n.derivedPanelConstraints,r)&&n.groupSize===t)return;K_(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Gv(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{O_(!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=E_({group:e}),s=D_(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Jv(e.panels,l)||(l=void 0));let u=fv({layout:e.mutableState.layouts[c]??l??Wv(s),panelConstraints:s}),d=e.element.ownerDocument;Yv.set(d,(Yv.get(d)??0)+1);let f=new Map;return L_(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),K_(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{O_(!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`,vv)}),Yv.get(d)===1&&(d.addEventListener(`dblclick`,mv,!0),d.addEventListener(`pointerdown`,Tv,!0),d.addEventListener(`pointerleave`,Bv),d.addEventListener(`pointermove`,Vv),d.addEventListener(`pointerout`,Hv),d.addEventListener(`pointerup`,Uv,!0)),function(){t=!1,Yv.set(d,Math.max(0,(Yv.get(d)??0)-1)),V_(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,vv)}),Yv.get(d)||(d.removeEventListener(`dblclick`,mv,!0),d.removeEventListener(`pointerdown`,Tv,!0),d.removeEventListener(`pointerleave`,Bv),d.removeEventListener(`pointermove`,Vv),d.removeEventListener(`pointerout`,Hv),d.removeEventListener(`pointerup`,Uv,!0)),a.disconnect()}}function Zv(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Qv(e){let t=(0,Q.useId)();return`${e??t}`}var $v=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function ey(e){let t=(0,Q.useRef)(e);return $v(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function ty(...e){return ey(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ny(e){let t=(0,Q.useRef)({...e});return $v(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var ry=(0,Q.createContext)(null);function iy(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Ev});(0,Q.useImperativeHandle)(t,()=>n.current,[]),$v(()=>{Object.assign(n.current,gv({groupId:e}))})}function ay({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=ey(e=>{dv(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=ey(e=>{dv(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Qv(s),v=(0,Q.useRef)(null),[y,b]=Zv(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=ty(v,a);iy(_,o);let C=ey((e,t)=>{let r=xv(),i=H_(e),a=U_(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=ny({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=k_(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=k_(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=H_(_),i=U_(_);r&&i&&K_(r,{...i,derivedPanelConstraints:D_(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 $v(()=>{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=Xv(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=U_(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=G_(_,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=sv(t.collapsedSize,i[t.panelId]),a=sv(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=xv().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)(ry.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})})}ay.displayName=`Group`;function oy(){let e=(0,Q.useContext)(ry);return O_(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function sy(e,t){let{id:n}=oy(),r=(0,Q.useRef)({collapse:Dv,expand:Dv,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Dv});(0,Q.useImperativeHandle)(t,()=>r.current,[]),$v(()=>{Object.assign(r.current,pv({groupId:n,panelId:e}))})}function cy({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=Qv(c),_=ny({disabled:a}),v=(0,Q.useRef)(null),y=ty(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=oy(),T=d!==null,E=ey((e,t,n)=>{d?.(e,c,n)});$v(()=>{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]),sy(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>G_(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:{...ly,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})})}cy.displayName=`Panel`;var ly={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function uy(){return(0,Q.useRef)(null)}function dy({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=fv({layout:uv({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=fv({layout:uv({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function fy({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Qv(a),l=ny({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=ty(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=oy(),x=v===`horizontal`?`vertical`:`horizontal`;$v(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Sv(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=G_(_,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(dy({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})}fy.displayName=`Separator`;var py={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:`#`}}},my=Rt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),hy=_({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function gy(e){switch(e.toLowerCase()){case`json`:return Ds().language;case`toml`:return Cs.define(py);default:return null}}function _y(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 vy(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}=Pn(),l=_y(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=gy(i),t=c===`dark`?my:hy,n=[js,...e?[e]:[],ys.editable.of(!1),ls.readOnly.of(!0),ys.lineWrapping,t],r=new ys({state:ls.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 yy(e){return En(`/api/asset?path=${encodeURIComponent(e)}`)}function by(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function xy(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=yy(n),t[0]=n,t[1]=o);let c=o,u;t[2]===n?u=t[3]:(u=n.split(`/`).pop()??n,t[2]=n,t[3]=u);let d=u,f,p,m;if(t[4]!==n||t[5]!==d||t[6]!==i||t[7]!==r||t[8]!==c){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=d.includes(`.`)?d.split(`.`).pop()??``:``;if(p=e.length>0?e.toUpperCase():`FILE`,f=i?`text`:r,f===`pdf`){let e;t[12]!==d||t[13]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(l,{src:c,title:d,fillContainer:!0})}),t[12]=d,t[13]=c,t[14]=e):e=t[14];let n;t[15]!==d||t[16]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":d,children:e}),t[15]=d,t[16]=e,t[17]=n):n=t[17],m=n;break bb0}if(f===`text`){let r;t[18]===n?r=t[19]:(r=by(n),t[18]=n,t[19]=r),m=(0,Z.jsx)(vy,{src:r,fileName:d,extension:e.toLowerCase()},n);break bb0}}t[4]=n,t[5]=d,t[6]=i,t[7]=r,t[8]=c,t[9]=f,t[10]=p,t[11]=m}else f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[20]!==f||t[21]!==p||t[22]!==d||t[23]!==c?(h=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:f===`image`?(0,Z.jsx)(jt,{src:c,alt:d,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):f===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):f===`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:p}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:d}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Di,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsx)(`a`,{href:c,children:(0,Z.jsx)(s,{id:`9npOH9`})})}),(0,Z.jsx)(Di,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:(0,Z.jsx)(s,{id:`Ruuu3v`})})]})]})}),t[20]=f,t[21]=p,t[22]=d,t[23]=c,t[24]=h):h=t[24];let g;return t[25]!==d||t[26]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":d,children:h}),t[25]=d,t[26]=h,t[27]=g):g=t[27],g}function Sy(){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)(Ja,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Ja,{className:`h-4 w-full`}),(0,Z.jsx)(Ja,{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 Cy={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function wy(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}=Pn(),s=Cy[r],c=s?(o===`dark`?sr[s]:void 0)??wr[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=X(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)(Mi,{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)(ji,{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)(Ri,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function Ty(e){let{installState:t}=e;return t.installed===null?Y._({id:`IA6JW2`}):t.installed===!1?Y._({id:`5SwVv1`}):null}function Ey(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:Y._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:Y._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:Y._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function Dy(e){return Ir(e)}function Oy(e){return Y._({id:`h_HYHD`,values:{displayName:e}})}var ky=`claude.ai`;async function Ay(e,t=Hm){(await t(Ir(e))).ok?qo.success(Oy(ky)):qo.error(Y._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:ky}}))}function jy(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??Hm,u=e.onWebFallbackSuccess??Ny,d=e.onWebFallbackError??My,{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=Ey({target:r,installState:a,isElectronHost:o}),i=Ty({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(Dy(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)(wy,{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)(la,{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)(wy,{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)(la,{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=Na;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(wy,{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)(Pa,{"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=Ma,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(co,{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)(ca,{}),t[55]=v):v=t[55],y=(0,Z.jsx)(la,{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)(la,{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 My(){}function Ny(){}function Py(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=_h(),{dispatch:a}=oh(),o=Ra(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=Jm({workspace:o});t[7]===n?s=t[8]:(s=X(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=hm.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(Fy,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{Xm(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 Fy(e){let t=(0,$.c)(22),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(wy,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===n.tagline?f=t[8]:(f=n.tagline?(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.tagline}):null,t[7]=n.tagline,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r===`missing`?(0,Z.jsx)(ko,{"aria-hidden":`true`,className:`size-3`}):null,t[12]=r,t[13]=m);let h;t[14]!==c||t[15]!==m?(h=(0,Z.jsxs)(`p`,{className:`mt-auto inline-flex items-center gap-1 pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==o||t[19]!==p||t[20]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[p,h]}),t[17]=s,t[18]=o,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}var Iy=3100,Ly=3;function Ry(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Ly;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var zy={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}},By=[`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 Vy(e,t={}){let n=t.rng??Math.random,r=t.colors??By,i=zy[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 Hy=1.8,Uy=90,Wy=16,Gy=380,Ky=.025,qy=.1,Jy=.18,Yy=400,Xy=9.2736,Zy=18.1799,Qy=14.5244,$y={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function eb(e,t){let{halfWidth:n,apexLift:r}=$y[t];return`M${e-n} ${Qy+.3} Q${e} ${Qy-r}, ${e+n} ${Qy+.3}`}function tb(e){let t=1.5,n=.3;return`M${e-t} ${Qy-n} Q${e} ${Qy+1.4}, ${e+t} ${Qy-n}`}var nb=15,rb=15;function ib(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 ab(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=Ry(g,t);_(n),y(lb),S(Vy(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Iy)},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(cb),S(Vy(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Iy))},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/Gy)),C=Math.max(-1,Math.min(1,b/Gy)),w=S*Wy,T=-C*Wy,E=0,D=0;if(x>=1){let e=Math.min(x/Uy,1)*Hy;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)*qy,i+=(w-i)*qy,u.style.transform=`perspective(${Yy}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*Jy,o+=(D-o)*Jy;let k=i*Ky,A=-r*Ky,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=X(`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=X(`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=X(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:Xy,cy:Qy,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=X(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=J);let ee;t[28]===J?ee=t[29]:(ee=(0,Z.jsx)(`ellipse`,{cx:Zy,cy:Qy,rx:1.2722,ry:1.9083,className:J}),t[28]=J,t[29]=ee);let te;t[30]===I?te=t[31]:(te=eb(Xy,I),t[30]=I,t[31]=te);let ne=(!F||T)&&`ok-blob-eye-hidden`,re;t[32]===ne?re=t[33]:(re=X(`ok-blob-happy-eye`,ne),t[32]=ne,t[33]=re);let ie;t[34]!==te||t[35]!==re?(ie=(0,Z.jsx)(`path`,{d:te,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:re}),t[34]=te,t[35]=re,t[36]=ie):ie=t[36];let ae;t[37]===I?ae=t[38]:(ae=eb(Zy,I),t[37]=I,t[38]=ae);let oe=(!F||T)&&`ok-blob-eye-hidden`,se;t[39]===oe?se=t[40]:(se=X(`ok-blob-happy-eye`,oe),t[39]=oe,t[40]=se);let ce;t[41]!==ae||t[42]!==se?(ce=(0,Z.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:se}),t[41]=ae,t[42]=se,t[43]=ce):ce=t[43];let le;t[44]===T?le=t[45]:(le=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:tb(Xy),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:tb(Zy),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=le);let ue;t[46]!==K||t[47]!==ee||t[48]!==ie||t[49]!==ce||t[50]!==le?(ue=(0,Z.jsxs)(`g`,{ref:p,children:[K,ee,ie,ce,le]}),t[46]=K,t[47]=ee,t[48]=ie,t[49]=ce,t[50]=le,t[51]=ue):ue=t[51];let de;t[52]!==B||t[53]!==H||t[54]!==ue?(de=(0,Z.jsxs)(`g`,{className:H,children:[U,ue]},B),t[52]=B,t[53]=H,t[54]=ue,t[55]=de):de=t[55];let fe;t[56]===T?fe=t[57]:(fe=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]=fe);let pe;t[58]!==v||t[59]!==x?(pe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(ob)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=pe):pe=t[60];let me;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==de||t[65]!==fe||t[66]!==pe?(me=(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:sb,children:[de,fe,pe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=de,t[65]=fe,t[66]=pe,t[67]=me):me=t[67];let he;return t[68]!==R||t[69]!==me?(he=(0,Z.jsx)(`span`,{ref:d,className:R,children:me}),t[68]=R,t[69]=me,t[70]=he):he=t[70],he}function ob(e){return(0,Z.jsx)(`circle`,{cx:nb+e.originDx,cy:rb+e.originDy,r:e.size,className:`ok-blob-firework`,style:ib(e)},e.id)}function sb(e){return e.preventDefault()}function cb(e){return e+1}function lb(e){return e+1}function ub(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(ab,{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 db(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=X(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`kbd`,{"data-slot":`kbd`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fb(){let e=(0,$.c)(2),t=Sr()?`⌘ K`:`Ctrl K`,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(db,{children:t}),e[0]=n):n=e[0];let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[n,` `,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A1taO8`})})]}),e[1]=r):r=e[1],r}var pb=`open-knowledge:create-top-level-file`;function mb(){window.dispatchEvent(new CustomEvent(pb))}function hb(e){let t=()=>e();return window.addEventListener(pb,t),()=>window.removeEventListener(pb,t)}function gb(){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(bb);if(e)return;let r=t.ok?Mn.safeParse(n):null;r?.success?(o(xb(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=hi(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(yb),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(vb);if(!e.ok)return;let n=Mn.safeParse(t);n.success&&o(xb(n.data.documents))}).catch(_b)},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)(Sb,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(Cb,{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)(lm,{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 _b(){}function vb(){return null}function yb(e){return e+1}function bb(){return null}function xb(e){return ui(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function Sb(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)(ub,{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)(nm,{onPackSelect:r}),t[8]=r,t[9]=u);let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Di,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:mb,children:(0,Z.jsx)(s,{id:`ensWZc`,components:{0:(0,Z.jsx)(ja,{"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 Cb(e){let t=(0,$.c)(19),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`8XS8nG`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`GjElCU`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(ub,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Py,{}),t[8]=u):u=t[8];let d,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(te,{"aria-hidden":`true`,className:`size-3`}),f=(0,Z.jsx)(s,{id:`IajAbS`}),t[9]=d,t[10]=f):(d=t[9],f=t[10]);let p;t[11]===r?p=t[12]:(p=(0,Z.jsxs)(Di,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[d,f]}),t[11]=r,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(fb,{}),t[13]=m):m=t[13];let h;t[14]===p?h=t[15]:(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[u,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[p,m]})]}),t[14]=p,t[15]=h);let g;return t[16]!==l||t[17]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function wb(e){let t=(0,$.c)(76),{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)(Eb,{}),(0,Z.jsx)(Ja,{className:`h-7 w-full`}),(0,Z.jsx)(Ja,{className:`h-7 w-full`}),(0,Z.jsx)(Ja,{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:`4UMKtb`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.folder.frontmatter_defaults?m=t[4]:(m=r.data.folder.frontmatter_defaults??{},t[3]=r.data.folder.frontmatter_defaults,t[4]=m);let h=m,g;t[5]===r.data.frontmatterLocal?g=t[6]:(g=r.data.frontmatterLocal??{},t[5]=r.data.frontmatterLocal,t[6]=g);let _=g,v=r.data.frontmatterSources,y;t[7]===r.data.folder.path?y=t[8]:(y=xo(r.data.folder.path),t[7]=r.data.folder.path,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,A,j,M,N;if(t[9]!==o||t[10]!==u||t[11]!==c||t[12]!==b||t[13]!==n||t[14]!==_||t[15]!==h||t[16]!==a||t[17]!==f||t[18]!==v){let e=Object.keys(h),r=async function(e,t){let r=await Yi(n,{[e]:t});if(!r.ok){let{error:e}=r;qo.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},i=async function(e){let t=await Yi(n,{[e]:null});if(!t.ok){let{error:e}=t;qo.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},m=function(e,t){let n=h[e];r(e,ga(n,t))},g;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[32]=g):g=t[32],C=g;let y;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Zi[e];return{...t,type:e,value:n,error:null}})},t[33]=y):y=t[33],T=y;let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d(t=>t&&{...t,value:e})},t[34]=P):P=t[34],E=P;let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){d(t=>t&&{...t,name:e,error:null})},t[35]=F):F=t[35],w=F;let I;t[36]!==o||t[37]!==u||t[38]!==n||t[39]!==h||t[40]!==a?(I=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`6lBXm5`,values:{trimmed:e}})});return}let t=await Yi(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[36]=o,t[37]=u,t[38]=n,t[39]=h,t[40]=a,t[41]=I):I=t[41],D=I;let L=function(e){p({key:e,draft:e,error:null})},R=function(e){p(t=>t&&{...t,draft:e,error:null})},z=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:`6lBXm5`,values:{trimmed:e}})});return}let t=h[f.key],r=await Yi(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},B=function(){p(null)};N=`rounded-lg border bg-card`,S=Qo,A=!c,t[42]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>l(!e),t[42]=j):j=t[42];let V=`size-3 transition-transform ${c?``:`rotate-90`}`,H;t[43]===V?H=t[44]:(H=(0,Z.jsx)(Jo,{className:V,"aria-hidden":!0}),t[43]=V,t[44]=H);let U;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`IX_qeH`})}),t[45]=U):U=t[45];let W;t[46]===H?W=t[47]:(W=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[H,U]}),t[46]=H,t[47]=W);let G;t[48]===b?G=t[49]:(G=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:Tb,children:b}),t[48]=b,t[49]=G),t[50]!==W||t[51]!==G?(M=(0,Z.jsxs)(Zo,{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:[W,G]}),t[50]=W,t[51]=G,t[52]=M):M=t[52],x=Xo,O=`px-2 py-2`,k=e.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`50Y3WA`})}):e.map(e=>{let t=h[e],n=Object.hasOwn(_,e);return(0,Z.jsx)(Ta,{keyName:e,value:t,declared:Qa(t,Br(t)),rename:n?{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:R,onCommit:z,onCancel:B}:void 0,badge:n?null:(0,Z.jsx)($i,{source:v[e]??``}),isInherited:!n,onCommit:t=>void r(e,t),onChangeType:t=>m(e,t),onRemove:n?()=>void i(e):void 0},e)}),t[9]=o,t[10]=u,t[11]=c,t[12]=b,t[13]=n,t[14]=_,t[15]=h,t[16]=a,t[17]=f,t[18]=v,t[19]=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,t[28]=A,t[29]=j,t[30]=M,t[31]=N}else 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],A=t[28],j=t[29],M=t[30],N=t[31];let P;t[53]!==u||t[54]!==C||t[55]!==w||t[56]!==T||t[57]!==E||t[58]!==D?(P=u?(0,Z.jsx)(yo,{draft:u,onChangeName:w,onChangeType:T,onChangeValue:E,onCommit:()=>void D(),onCancel:()=>d(null)}):(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:C,className:`mt-1 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)(te,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`F-NRCj`})})]}),t[53]=u,t[54]=C,t[55]=w,t[56]=T,t[57]=E,t[58]=D,t[59]=P):P=t[59];let F;t[60]!==P||t[61]!==O||t[62]!==k?(F=(0,Z.jsxs)(`div`,{className:O,children:[k,P]}),t[60]=P,t[61]=O,t[62]=k,t[63]=F):F=t[63];let I;t[64]!==x||t[65]!==F?(I=(0,Z.jsx)(x,{children:F}),t[64]=x,t[65]=F,t[66]=I):I=t[66];let L;t[67]!==S||t[68]!==I||t[69]!==A||t[70]!==j||t[71]!==M?(L=(0,Z.jsxs)(S,{open:A,onOpenChange:j,children:[M,I]}),t[67]=S,t[68]=I,t[69]=A,t[70]=j,t[71]=M,t[72]=L):L=t[72];let R;return t[73]!==L||t[74]!==N?(R=(0,Z.jsx)(`section`,{className:N,children:L}),t[73]=L,t[74]=N,t[75]=R):R=t[75],R}function Tb(e){return e.stopPropagation()}function Eb(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(yc,{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:`IX_qeH`})})]}),e[1]=n):n=e[1],n}function Db(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function Ob(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=Db(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function kb(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Ab(e,t){let n=`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:Ob(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:kb(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:Ob(e,t.pageTitles),children:a}}function jb(e){let t=(0,$.c)(54),{folderPath:n,state:r,onChange:a,folderConfigHandle:o}=e,{_:c}=i(),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(!1),y;t[0]!==c||t[1]!==a?(y=async function(e){g(!0);let t=await Ca(e.source_folder,e.name);if(g(!1),!t.ok){let{error:e}=t;qo.error(c({id:`yOGrCR`,values:{error:e}}));return}let{name:n}=e;qo.success(c({id:`I23A-U`,values:{name:n}})),f(null),a()},t[0]=c,t[1]=a,t[2]=y):y=t[2];let b=y;if(r.status===`idle`||r.status===`loading`){let e;return t[3]===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)(Ja,{className:`h-12 w-full`}),(0,Z.jsx)(Ja,{className:`h-12 w-full`})]}),t[3]=e):e=t[3],e}if(r.status===`error`){let{message:e}=r,n;return t[4]===e?n=t[5]:(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[4]=e,t[5]=n),n}let x;t[6]===r.data.folder.templates_available?x=t[7]:(x=r.data.folder.templates_available??[],t[6]=r.data.folder.templates_available,t[7]=x);let S=x,C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=(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[8]=C):C=t[8];let w;t[9]===S.length?w=t[10]:(w=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,(0,Z.jsx)(de,{className:`text-xs`,variant:`secondary`,children:S.length})]}),t[9]=S.length,t[10]=w);let T;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsxs)(Di,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>v(!0),children:[(0,Z.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[11]=T):T=t[11];let E;t[12]===w?E=t[13]:(E=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[w,T]}),t[12]=w,t[13]=E);let D;t[14]===S?D=t[15]:(D=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:S.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`BHW0EW`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:S.map(e=>(0,Z.jsx)(Nb,{template:e,onCreate:()=>m(e.name),onEdit:()=>u(e),onDelete:()=>f(e)},e.path))})}),t[14]=S,t[15]=D);let O;t[16]!==E||t[17]!==D?(O=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[E,D]}),t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{e||u(null)},t[19]=k):k=t[19];let A;t[20]!==l||t[21]!==n||t[22]!==a?(A=(0,Z.jsx)(_o,{folderPath:n,template:l,onOpenChange:k,onSaved:a}),t[20]=l,t[21]=n,t[22]=a,t[23]=A):A=t[23];let j=!!d,M;t[24]===h?M=t[25]:(M=e=>{!e&&!h&&f(null)},t[24]=h,t[25]=M);let N;t[26]!==c||t[27]!==d||t[28]!==h||t[29]!==b?(N=d&&(()=>{let{name:e,path:t,scope:n}=d,r=n===`inherited`?`\n\n${c({id:`LUbzI-`})}`:``;return(0,Z.jsx)(za,{itemName:c({id:`XfzqjK`,values:{name:e}}),isSubmitting:h,onDelete:()=>b(d),customDescription:`${c({id:`JVgg1-`,values:{path:t}})}${r}`})})(),t[26]=c,t[27]=d,t[28]=h,t[29]=b,t[30]=N):N=t[30];let P;t[31]!==j||t[32]!==M||t[33]!==N?(P=(0,Z.jsx)(Go,{open:j,onOpenChange:M,children:N}),t[31]=j,t[32]=M,t[33]=N,t[34]=P):P=t[34];let F;t[35]===S?F=t[36]:(F=new Set(S.map(Mb)),t[35]=S,t[36]=F);let I;t[37]!==n||t[38]!==_||t[39]!==a||t[40]!==F?(I=(0,Z.jsx)(Co,{folderPath:n,existingNames:F,open:_,onOpenChange:v,onCreated:a}),t[37]=n,t[38]=_,t[39]=a,t[40]=F,t[41]=I):I=t[41];let L=p!==null,R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||m(null)},t[42]=R):R=t[42];let z=p??void 0,B;t[43]!==o||t[44]!==n||t[45]!==L||t[46]!==z?(B=(0,Z.jsx)(zp,{open:L,onOpenChange:R,kind:`file`,initialDir:n,initialTemplate:z,folderConfig:o}),t[43]=o,t[44]=n,t[45]=L,t[46]=z,t[47]=B):B=t[47];let V;return t[48]!==A||t[49]!==P||t[50]!==I||t[51]!==B||t[52]!==O?(V=(0,Z.jsxs)(Z.Fragment,{children:[O,A,P,I,B]}),t[48]=A,t[49]=P,t[50]=I,t[51]=B,t[52]=O,t[53]=V):V=t[53],V}function Mb(e){return e.name}function Nb(e){let t=(0,$.c)(51),{template:n,onCreate:r,onEdit:a,onDelete:o}=e,{_:c}=i(),l=n.title&&n.title!==n.name,u=n.title??n.name,d;t[0]===u?d=t[1]:(d=(0,Z.jsx)(`span`,{className:`font-medium truncate`,children:u}),t[0]=u,t[1]=d);let f;t[2]!==l||t[3]!==n.name?(f=l?(0,Z.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground shrink-0`,children:n.name}):null,t[2]=l,t[3]=n.name,t[4]=f):f=t[4];let p;t[5]!==n.name||t[6]!==n.scope||t[7]!==n.source_folder?(p=n.scope===`inherited`?(0,Z.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,Z.jsx)($i,{source:n.source_folder,target:`templates/${n.name}.md`})}):null,t[5]=n.name,t[6]=n.scope,t[7]=n.source_folder,t[8]=p):p=t[8];let m;t[9]!==d||t[10]!==f||t[11]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[d,f,p]}),t[9]=d,t[10]=f,t[11]=p,t[12]=m):m=t[12];let h;t[13]===n.description?h=t[14]:(h=n.description?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground truncate mt-0.5`,children:n.description}):null,t[13]=n.description,t[14]=h);let g;t[15]!==a||t[16]!==m||t[17]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:a,className:`min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm`,children:[m,h]}),t[15]=a,t[16]=m,t[17]=h,t[18]=g):g=t[18];let _;t[19]!==c||t[20]!==u?(_=c({id:`5m2Eho`,values:{label:u}}),t[19]=c,t[20]=u,t[21]=_):_=t[21];let v,y;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(gc,{className:`size-3.5`,"aria-hidden":!0}),y=(0,Z.jsx)(s,{id:`hYgDIe`}),t[22]=v,t[23]=y):(v=t[22],y=t[23]);let b;t[24]!==r||t[25]!==_?(b=(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,size:`sm`,className:`font-mono uppercase shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:r,"aria-label":_,children:[v,y]}),t[24]=r,t[25]=_,t[26]=b):b=t[26];let x;t[27]!==c||t[28]!==u?(x=c({id:`Bx4EXG`,values:{label:u}}),t[27]=c,t[28]=u,t[29]=x):x=t[29];let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(aa,{className:`size-4`,"aria-hidden":!0}),t[30]=S):S=t[30];let C;t[31]===x?C=t[32]:(C=(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":x,children:S})}),t[31]=x,t[32]=C);let w,E;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(T,{"aria-hidden":!0}),E=(0,Z.jsx)(s,{id:`ePK91l`}),t[33]=w,t[34]=E):(w=t[33],E=t[34]);let D;t[35]===a?D=t[36]:(D=(0,Z.jsxs)(la,{onSelect:a,children:[w,E]}),t[35]=a,t[36]=D);let O,k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(q,{"aria-hidden":!0}),k=(0,Z.jsx)(s,{id:`cnGeoo`}),t[37]=O,t[38]=k):(O=t[37],k=t[38]);let A;t[39]===o?A=t[40]:(A=(0,Z.jsxs)(la,{variant:`destructive`,onSelect:o,children:[O,k]}),t[39]=o,t[40]=A);let j;t[41]!==D||t[42]!==A?(j=(0,Z.jsxs)(ra,{align:`end`,children:[D,A]}),t[41]=D,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==C||t[45]!==j?(M=(0,Z.jsxs)(Da,{children:[C,j]}),t[44]=C,t[45]=j,t[46]=M):M=t[46];let N;return t[47]!==b||t[48]!==M||t[49]!==g?(N=(0,Z.jsxs)(`li`,{className:`group flex items-center gap-2 rounded-md px-2 py-2 hover:bg-muted/50 text-sm`,children:[g,b,M]}),t[47]=b,t[48]=M,t[49]=g,t[50]=N):N=t[50],N}function Pb(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=X(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=X(`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 Fb(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=X(`[&_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 Ib(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=X(`[&_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 Lb(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=X(`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 Rb(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=X(`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 zb(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=X(`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 Bb(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Y._({id:`xOTzt5`});if(r<60)return Y._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Y._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Y._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Vb(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 Hb(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)(Nt,{className:`ml-1 size-3`}):(0,Z.jsx)(Be,{className:`ml-1 size-3`}):(0,Z.jsx)(Js,{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)(Di,{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 Ub(e){let t=(0,$.c)(92),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=si(),d=no(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)(Ja,{className:`size-5 rounded`}),(0,Z.jsx)(Ja,{className:`h-7 w-48`})]}),(0,Z.jsx)(Ja,{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)(Ja,{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)(Ja,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Kb)]})]}),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=Ab(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=Vb(e.children,g,v),o;t[28]===g?o=t[29]:(o=function(e){e===g?y(Gb):(_(e),y(`asc`))},t[28]=g,t[29]=o);let m=o;k=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Ce,{className:`size-5 text-muted-foreground`}),t[30]=A):A=t[30];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:e.title})]}),M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(Di,{onClick:()=>h(!0),children:[(0,Z.jsx)(te,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[31]=M):M=t[31],t[32]===j?E=t[33]:(E=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,M]})}),t[32]=j,t[33]=E),t[34]!==f||t[35]!==n||t[36]!==p?(D=(0,Z.jsx)(wb,{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)(jb,{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=Pb;let N=g===`name`?v===`asc`?`ascending`:`descending`:`none`,P;t[43]===r?P=t[44]:(P=r({id:`6YtxFj`}),t[43]=r,t[44]=P);let F;t[45]!==m||t[46]!==v||t[47]!==g||t[48]!==P?(F=(0,Z.jsx)(Hb,{label:P,sortKey:`name`,activeKey:g,activeDir:v,onSort:m}),t[45]=m,t[46]=v,t[47]=g,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==N||t[51]!==F?(I=(0,Z.jsx)(Rb,{"aria-sort":N,children:F}),t[50]=N,t[51]=F,t[52]=I):I=t[52];let L=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,R;t[53]===r?R=t[54]:(R=r({id:`tgWuMB`}),t[53]=r,t[54]=R);let z;t[55]!==m||t[56]!==v||t[57]!==g||t[58]!==R?(z=(0,Z.jsx)(Hb,{label:R,sortKey:`modified`,activeKey:g,activeDir:v,onSort:m}),t[55]=m,t[56]=v,t[57]=g,t[58]=R,t[59]=z):z=t[59];let B;t[60]!==L||t[61]!==z?(B=(0,Z.jsx)(Rb,{className:`w-32`,"aria-sort":L,children:z}),t[60]=L,t[61]=z,t[62]=B):B=t[62],t[63]!==I||t[64]!==B?(C=(0,Z.jsx)(Fb,{children:(0,Z.jsxs)(Lb,{children:[I,B]})}),t[63]=I,t[64]=B,t[65]=C):C=t[65],b=Ib,S=i.length?i.map(Wb):(0,Z.jsx)(Lb,{children:(0,Z.jsx)(zb,{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)(zp,{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 Wb(e){return(0,Z.jsxs)(Lb,{children:[(0,Z.jsx)(zb,{children:(0,Z.jsxs)(`a`,{href:ii(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)(xc,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(ke,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(zb,{className:`text-muted-foreground`,children:e.kind===`file`?Bb(e.modified):`—`})]},e.path)}function Gb(e){return e===`asc`?`desc`:`asc`}function Kb(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)(Ja,{className:`size-4 rounded`}),(0,Z.jsx)(Ja,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Ja,{className:`h-4 w-16`})})]},e)}function qb(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(Jb),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>J(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(){fe(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)(Di,{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 Jb(){return new Set}var Yb=(0,Q.createContext)(null);function Xb(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(Zb),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)(Yb,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function Zb(){return new Map}function Qb(){let e=(0,Q.use)(Yb);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function $b(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var ex=$b(()=>n(()=>import(`./SettingsDialogBody-DEFwKiJB.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([42,1,33,2,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,43,8,14,21,11]),import.meta.url));function tx(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)(Di,{variant:`default`,onClick:nx,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 nx(){return window.location.reload()}function rx(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(m,{fallbackRender:ax,onError:ix,children:n}),t[0]=n,t[1]=r),r}function ix(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function ax(e){return(0,Z.jsx)(tx,{...e})}function ox(e){let t=(0,$.c)(71),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=ft(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=Oe(),{desktopPresent:f}=Fa(),[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:`AeXO77`}),t[9]=a,t[10]=x);let S;t[11]===x?S=t[12]:(S={id:`account`,label:x},t[11]=x,t[12]=S);let C;t[13]!==b||t[14]!==S?(C=[b,S],t[13]=b,t[14]=S,t[15]=C):C=t[15];let w;t[16]!==v||t[17]!==C?(w={id:`user`,label:v,enabled:!0,items:C},t[16]=v,t[17]=C,t[18]=w):w=t[18];let T;t[19]===a?T=t[20]:(T=a({id:`ZWyHmq`}),t[19]=a,t[20]=T);let E;t[21]===a?E=t[22]:(E=a({id:`Nu4DdT`}),t[21]=a,t[22]=E);let D;t[23]===E?D=t[24]:(D={id:`sync`,label:E},t[23]=E,t[24]=D);let O;t[25]===a?O=t[26]:(O=a({id:`iTylMl`}),t[25]=a,t[26]=O);let k;t[27]===O?k=t[28]:(k={id:`project-templates`,label:O},t[27]=O,t[28]=k);let A;t[29]===a?A=t[30]:(A=a({id:`3zyg_A`}),t[29]=a,t[30]=A);let j;t[31]===A?j=t[32]:(j={id:`okignore`,label:A},t[31]=A,t[32]=j);let M;t[33]!==D||t[34]!==k||t[35]!==j?(M=[D,k,j],t[33]=D,t[34]=k,t[35]=j,t[36]=M):M=t[36];let N;t[37]!==_||t[38]!==T||t[39]!==M?(N={id:`project`,label:T,enabled:_,items:M},t[37]=_,t[38]=T,t[39]=M,t[40]=N):N=t[40];let P;t[41]===a?P=t[42]:(P=a({id:`nbfdhU`}),t[41]=a,t[42]=P);let F;t[43]!==a||t[44]!==f?(F=f?[{id:`claude-desktop`,label:a({id:`yvHDYG`})}]:[],t[43]=a,t[44]=f,t[45]=F):F=t[45];let I;t[46]!==P||t[47]!==F?(I={id:`integrations`,label:P,enabled:!0,items:F},t[46]=P,t[47]=F,t[48]=I):I=t[48];let L;t[49]!==N||t[50]!==I||t[51]!==w?(L=[w,N,I],t[49]=N,t[50]=I,t[51]=w,t[52]=L):L=t[52];let R=L,z;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Fo,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[53]=z):z=t[53];let B;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(No,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[54]=B):B=t[54];let V;t[55]!==p||t[56]!==R?(V=(0,Z.jsx)(sx,{groups:R,activeId:p,onSelect:m}),t[55]=p,t[56]=R,t[57]=V):V=t[57];let H;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(lx,{}),t[58]=H):H=t[58];let U=l?c:null,W;t[59]!==p||t[60]!==u||t[61]!==d||t[62]!==U?(W=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,children:(0,Z.jsx)(rx,{children:(0,Z.jsx)(Q.Suspense,{fallback:H,children:(0,Z.jsx)(ex,{activeId:p,userBinding:U,okignoreBinding:u,okignoreSynced:d})})})}),t[59]=p,t[60]=u,t[61]=d,t[62]=U,t[63]=W):W=t[63];let G;t[64]!==V||t[65]!==W?(G=(0,Z.jsxs)(zo,{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:[z,B,V,W]}),t[64]=V,t[65]=W,t[66]=G):G=t[66];let K;return t[67]!==r||t[68]!==n||t[69]!==G?(K=(0,Z.jsx)(Go,{open:n,onOpenChange:r,children:G}),t[67]=r,t[68]=n,t[69]=G,t[70]=K):K=t[70],K}function sx(e){let t=(0,$.c)(12),{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)(cx,{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;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`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}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function cx(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=X(`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:X(`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 lx(){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)(Ja,{className:`h-5 w-32`}),r=(0,Z.jsx)(Ja,{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)(Ja,{className:`h-9 w-full`}),(0,Z.jsx)(Ja,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function ux(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=X(`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)(ay,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dx(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)(cy,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function fx(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=X(`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)(fy,{"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 px(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)(Bo,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function mx(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)(Uo,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}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=X(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 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)(Lo,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gx(e){let t=(0,$.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c=a===void 0?`right`:a,l=o===void 0?!0:o,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(hx,{}),t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=X(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10 motion-reduce:transition-none motion-reduce:duration-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none`,r),t[7]=r,t[8]=d);let f;t[9]===l?f=t[10]:(f=l&&(0,Z.jsx)(Ko,{"data-slot":`sheet-close`,asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,Z.jsx)(Mo,{}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`yz7wBu`})})]})}),t[9]=l,t[10]=f);let p;return t[11]!==n||t[12]!==i||t[13]!==c||t[14]!==d||t[15]!==f?(p=(0,Z.jsxs)(mx,{children:[u,(0,Z.jsxs)(Io,{"data-slot":`sheet-content`,"data-side":c,className:d,...i,children:[n,f]})]}),t[11]=n,t[12]=i,t[13]=c,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function _x(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=X(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vx(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=X(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ro,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yx(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=X(`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 bx=ki(`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 xx(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=X(bx({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:Sx,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function Sx(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ki(`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 Cx(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=X(`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 wx(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`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)(Yo,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tx(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)(wx,{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)(ec,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Oo,{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)(Tn,{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)(Gr,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(dl,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Oo,{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)(Tn,{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)(Gr,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(xx,{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)(yx,{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 ee;t[54]===S?ee=t[55]:(ee=S({id:`oqB2ez`}),t[54]=S,t[55]=ee);let te=!w,ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(_t,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=ne):ne=t[56];let re;t[57]!==v||t[58]!==ee||t[59]!==te?(re=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:te,onClick:v,children:ne})}),t[57]=v,t[58]=ee,t[59]=te,t[60]=re):re=t[60];let ie;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=ie):ie=t[61];let ae;t[62]===re?ae=t[63]:(ae=(0,Z.jsxs)(Gr,{children:[re,ie]}),t[62]=re,t[63]=ae);let oe;t[64]===S?oe=t[65]:(oe=S({id:`SiUUCS`}),t[64]=S,t[65]=oe);let se=!w,ce;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(Dt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ce):ce=t[66];let le;t[67]!==_||t[68]!==oe||t[69]!==se?(le=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":oe,disabled:se,onClick:_,children:ce})}),t[67]=_,t[68]=oe,t[69]=se,t[70]=le):le=t[70];let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=ue):ue=t[71];let de;t[72]===le?de=t[73]:(de=(0,Z.jsxs)(Gr,{children:[le,ue]}),t[72]=le,t[73]=de);let fe=o?`secondary`:`ghost`,pe;t[74]!==S||t[75]!==o?(pe=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=pe):pe=t[76];let me=o?`ok-replace-input`:void 0,he;t[77]!==m||t[78]!==o?(he=()=>m(!o),t[77]=m,t[78]=o,t[79]=he):he=t[79];let ge;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Kc,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=ge):ge=t[80];let _e;t[81]!==o||t[82]!==fe||t[83]!==pe||t[84]!==me||t[85]!==he?(_e=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:fe,size:`icon-sm`,"aria-label":pe,"aria-expanded":o,"aria-controls":me,onClick:he,children:ge})}),t[81]=o,t[82]=fe,t[83]=pe,t[84]=me,t[85]=he,t[86]=_e):_e=t[86];let ve;t[87]===o?ve=t[88]:(ve=(0,Z.jsx)(Tn,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ve);let ye;t[89]!==_e||t[90]!==ve?(ye=(0,Z.jsxs)(Gr,{children:[_e,ve]}),t[89]=_e,t[90]=ve,t[91]=ye):ye=t[91];let be;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(be=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)(Yo,{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)(Gr,{children:[(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Kc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Gc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Tn,{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]=be):be=t[100];let xe;t[101]===S?xe=t[102]:(xe=S({id:`wJo9oS`}),t[101]=S,t[102]=xe);let Se;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Mo,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Se):Se=t[103];let Ce;t[104]!==x||t[105]!==xe?(Ce=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":xe,onClick:x,children:Se})}),t[104]=x,t[105]=xe,t[106]=Ce):Ce=t[106];let we;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=we):we=t[107];let Te;t[108]===Ce?Te=t[109]:(Te=(0,Z.jsxs)(Gr,{children:[Ce,we]}),t[108]=Ce,t[109]=Te);let Ee;return t[110]!==q||t[111]!==J||t[112]!==ae||t[113]!==de||t[114]!==j||t[115]!==ye||t[116]!==be||t[117]!==Te?(Ee=(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,ae,de,ye,be,Te]}),t[110]=q,t[111]=J,t[112]=ae,t[113]=de,t[114]=j,t[115]=ye,t[116]=be,t[117]=Te,t[118]=Ee):Ee=t[118],Ee}var Ex={current:0,total:0},Dx=120,Ox=100;function kx(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?W(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(ne,n,Ax)}function Ax(){return null}function jx(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 Ig(e,t){return`${e}\u0000${t}`}function Lg(e,t,n){let r=Kr(e).body,i=Kr(t).body;return r===i?``:Pg(n,r,i,``,``,{context:3})}function Rg(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ft(),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=Ig(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=Lg(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 zg=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-LNHry3BJ.js`),__vite__mapDeps([16,1,6,17]),import.meta.url)).ActivityPanelDiffView}));function Bg(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Y._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Y._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Y._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Y._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Y._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function Vg(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Hg(e){return e.slice(0,7)}function Ug(e){return e.type===`upstream`?Y._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?Y._({id:`B2DrPb`}):e.author}function Wg(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)(Mi,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(Ri,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Ai,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(Fi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Ui,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(Vi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(zi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function Gg(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)(Ee,{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=Yn(i),t[1]=i,t[2]=a);let o=a,s=r?sr[o]??wr[o]:wr[o],c;t[3]!==s||t[4]!==i?(c=s??fi(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)(Wg,{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)(Cc,{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)(qs,{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)(ul,{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)(zi,{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)(qs,{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)(ul,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Kg(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(qg),t[0]=m):m=t[0];let h;t[1]===d?h=t[2]:(h=d?(0,Z.jsx)(Dt,{className:`size-3`}):(0,Z.jsx)(Jo,{className:`size-3`}),t[1]=d,t[2]=h);let g;t[3]!==p||t[4]!==d?(g=d?Y._({id:`OKQe56`,values:{entryCount:p}}):Y._({id:`k9jDvw`,values:{entryCount:p}}),t[3]=p,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==d||t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[6]=d,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]!==o||t[11]!==a||t[12]!==s||t[13]!==n||t[14]!==d||t[15]!==c||t[16]!==i||t[17]!==u||t[18]!==l?(v=d&&n.map(e=>(0,Z.jsx)(a_,{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 qg(e){return!e}function Jg(e){return e.checkpoint?e.checkpoint.kind:`save`}function Yg(e){let t=Jg(e);if(t===`save`)return Y._({id:`gsePqm`});let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${Xg(n)})`:``;return t===`bridge-merge-loss`?Y._({id:`uZAG7T`,values:{sizeSuffix:r}}):Y._({id:`_4rAQI`,values:{sizeSuffix:r}})}function Xg(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function Zg(e){return e.type===`checkpoint`?Jg(e)===`save`?`version`:`auto-save`:`wip`}function Qg(e){let t=Zg(e);return t===`version`?Y._({id:`RFQ1Yx`}):t===`auto-save`?Y._({id:`9Uv1CD`}):Y._({id:`Yea-K5`})}function $g(e){let t=Zg(e);return t===`version`?Y._({id:`gg3Rpy`}):t===`auto-save`?Y._({id:`PXXeW8`}):Y._({id:`Pyp1NA`})}function e_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function t_(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(r_),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(n_)},children:[r?(0,Z.jsx)(Dt,{className:`size-3`}):(0,Z.jsx)(Jo,{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 n_(e){return!e}function r_(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 i_(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=Rg(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)(B,{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)(B,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(zg,{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 a_(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=Bg(n.timestamp),t[0]=n.timestamp,t[1]=h);let g=h,_;t[2]===n?_=t[3]:(_=Ug(n),t[2]=n,t[3]=_);let v=_,y;t[4]===n.timestamp?y=t[5]:(y=Vg(n.timestamp),t[4]=n.timestamp,t[5]=y);let b=y,x;t[6]===n.sha?x=t[7]:(x=Hg(n.sha),t[6]=n.sha,t[7]=x);let S=x,C=n.contributors.flatMap(o_),w;t[8]===n?w=t[9]:(w=e_(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}),qo.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=ti.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}),qo.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,V;t[23]!==n||t[24]!==a||t[25]!==p?(V=p?(()=>{let e=Jg(n);return e===`bridge-merge-loss`?(0,Z.jsx)(An,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(mc,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(dc,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(Gg,{entry:n,isDark:a}),t[23]=n,t[24]=a,t[25]=p,t[26]=V):V=t[26];let H=V,U=u?j:void 0,W=u?`bg-muted`:`hover:bg-muted/80`,G;t[27]===W?G=t[28]:(G=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,W],t[27]=W,t[28]=G);let K=G.join(` `),q;t[29]===F?q=t[30]:(q=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),F())},t[29]=F,t[30]=q);let J;t[31]===H?J=t[32]:(J=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:H}),t[31]=H,t[32]=J);let ee;t[33]!==v||t[34]!==n||t[35]!==p?(ee=p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:Yg(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]=ee):ee=t[36];let te;t[37]!==n.timestamp||t[38]!==g?(te=(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]=te):te=t[39];let ne;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[40]=ne):ne=t[40];let re;t[41]===n?re=t[42]:(re=Qg(n),t[41]=n,t[42]=re);let ie;t[43]===D?ie=t[44]:(ie=e=>{e.stopPropagation(),D(!0)},t[43]=D,t[44]=ie);let ae;t[45]===O?ae=t[46]:(ae=O?(0,Z.jsx)(B,{className:`size-3 animate-spin`}):(0,Z.jsx)(Ni,{className:`size-3`}),t[45]=O,t[46]=ae);let oe;t[47]!==O||t[48]!==re||t[49]!==ie||t[50]!==ae?(oe=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":re,disabled:O,onClick:ie,children:ae})}),t[47]=O,t[48]=re,t[49]=ie,t[50]=ae,t[51]=oe):oe=t[51];let se;t[52]===n?se=t[53]:(se=Qg(n),t[52]=n,t[53]=se);let ce;t[54]===se?ce=t[55]:(ce=(0,Z.jsx)(Tn,{side:`top`,children:se}),t[54]=se,t[55]=ce);let le;t[56]!==oe||t[57]!==ce?(le=(0,Z.jsxs)(Gr,{children:[oe,ce]}),t[56]=oe,t[57]=ce,t[58]=le):le=t[58];let ue;t[59]!==ee||t[60]!==te||t[61]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[ee,te,ne,le]}),t[59]=ee,t[60]=te,t[61]=le,t[62]=ue):ue=t[62];let de;t[63]===T?de=t[64]:(de=T.length>0&&(0,Z.jsx)(t_,{summaries:T}),t[63]=T,t[64]=de);let fe=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}),pe;t[65]!==ue||t[66]!==de||t[67]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ue,de,fe]}),t[65]=ue,t[66]=de,t[67]=fe,t[68]=pe):pe=t[68];let me;t[69]!==u||t[70]!==F||t[71]!==U||t[72]!==K||t[73]!==q||t[74]!==J||t[75]!==pe?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":u,"aria-controls":U,"data-testid":`timeline-entry-expand`,className:K,onClick:F,onKeyDown:q,children:[J,pe]}),t[69]=u,t[70]=F,t[71]=U,t[72]=K,t[73]=q,t[74]=J,t[75]=pe,t[76]=me):me=t[76];let he;t[77]!==c||t[78]!==o||t[79]!==j||t[80]!==l||t[81]!==n.sha||t[82]!==u?(he=u&&(0,Z.jsx)(i_,{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]=he):he=t[83];let ge;t[84]!==me||t[85]!==he?(ge=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[me,he]}),t[84]=me,t[85]=he,t[86]=ge):ge=t[86];let _e;t[87]!==L||t[88]!==D?(_e=e=>{e?D(!0):L()},t[87]=L,t[88]=D,t[89]=_e):_e=t[89];let ve;t[90]===n?ve=t[91]:(ve=$g(n),t[90]=n,t[91]=ve);let ye;t[92]===ve?ye=t[93]:(ye=(0,Z.jsx)(Fo,{children:ve}),t[92]=ve,t[93]=ye);let be;t[94]!==b||t[95]!==v||t[96]!==S||t[97]!==g?(be={relative:g,absoluteTime:b,entrySha:S,authorName:v},t[94]=b,t[95]=v,t[96]=S,t[97]=g,t[98]=be):be=t[98];let xe;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(xe={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[99]=xe):xe=t[99];let Se;t[100]===be?Se=t[101]:(Se=(0,Z.jsx)(No,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:be,components:xe})}),t[100]=be,t[101]=Se);let Ce;t[102]!==ye||t[103]!==Se?(Ce=(0,Z.jsxs)(Wo,{children:[ye,Se]}),t[102]=ye,t[103]=Se,t[104]=Ce):Ce=t[104];let we;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(s,{id:`dEgA5A`}),t[105]=we):we=t[105];let Te;t[106]===L?Te=t[107]:(Te=(0,Z.jsx)(Di,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:L,children:we}),t[106]=L,t[107]=Te);let Ee;t[108]===z?Ee=t[109]:(Ee=()=>z(),t[108]=z,t[109]=Ee);let De;t[110]===O?De=t[111]:(De=O?(0,Z.jsx)(B,{className:`mr-2 size-4 animate-spin`}):null,t[110]=O,t[111]=De);let Oe;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[112]=Oe):Oe=t[112];let ke;t[113]!==O||t[114]!==Ee||t[115]!==De?(ke=(0,Z.jsxs)(Di,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:O,onClick:Ee,children:[De,Oe]}),t[113]=O,t[114]=Ee,t[115]=De,t[116]=ke):ke=t[116];let Ae;t[117]!==Te||t[118]!==ke?(Ae=(0,Z.jsxs)(Ho,{children:[Te,ke]}),t[117]=Te,t[118]=ke,t[119]=Ae):Ae=t[119];let je;t[120]!==Ce||t[121]!==Ae?(je=(0,Z.jsxs)(zo,{children:[Ce,Ae]}),t[120]=Ce,t[121]=Ae,t[122]=je):je=t[122];let Me;t[123]!==E||t[124]!==_e||t[125]!==je?(Me=(0,Z.jsx)(Go,{open:E,onOpenChange:_e,children:je}),t[123]=E,t[124]=_e,t[125]=je,t[126]=Me):Me=t[126];let Ne;return t[127]!==ge||t[128]!==Me?(Ne=(0,Z.jsxs)(Z.Fragment,{children:[ge,Me]}),t[127]=ge,t[128]=Me,t[129]=Ne):Ne=t[129],Ne}function o_(e){return e.docs}function s_(e){let t=(0,$.c)(87),{docName:n,diffLayout:r,onDiffLayoutChange:a,onSaveVersion:o,saving:c}=e,{_:l}=i(),{resolvedTheme:u}=Pn(),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)(d_),[x,S]=(0,Q.useState)(u_),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(l_),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)(_n,{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)(Gr,{children:[(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsxs)(Ao,{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)(Do,{value:`unified`,"aria-label":l({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(qc,{className:`size-3.5`})}),(0,Z.jsx)(Do,{value:`split`,"aria-label":l({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(sc,{className:`size-3.5`})})]})}),(0,Z.jsx)(Tn,{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)(B,{className:`size-4 animate-spin`}):(0,Z.jsx)(Jc,{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)($n,{asChild:!0,children:(0,Z.jsx)(Di,{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)(Tn,{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)(Gr,{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)(mn,{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(c_)}),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)(a_,{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)(a_,{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)(Kg,{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 V;return t[83]!==F||t[84]!==I||t[85]!==z?(V=(0,Z.jsxs)(`div`,{className:F,children:[I,z]}),t[83]=F,t[84]=I,t[85]=z,t[86]=V):V=t[86],V}function c_(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Ja,{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)(Ja,{className:`h-3 w-28`}),(0,Z.jsx)(Ja,{className:`h-3 w-40`})]})]},e)}function l_(e){return e.type===`checkpoint`}function u_(){return new Set}function d_(){return new Pi(32)}var f_=[{id:`outline`,icon:Ac},{id:`links`,icon:_e},{id:`graph`,icon:Nc},{id:`timeline`,icon:rc}];function p_(e){return e===`outline`?Y._({id:`dD7NPy`}):e===`links`?Y._({id:`Rj01Fz`}):e===`graph`?Y._({id:`x2fr_j`}):Y._({id:`cklVjM`})}function m_(){return n(()=>import(`./GraphPanel-DDRNPZvZ.js`),__vite__mapDeps([18,1,19,6,3,7,20,21,22,23,24,25,26,27,28,29,30,31]),import.meta.url)}var h_=(0,Q.lazy)(async()=>({default:(await m_()).GraphPanel})),g_=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-czEDk63C.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,41]),import.meta.url)).ActivityModeContent}));function __(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)(Ao,{type:`single`,variant:`outline`,value:a,onValueChange:e=>{e&&o(e)},"aria-label":d({id:`SrOuyg`}),children:f_.map(v_)})}):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)(As,{docName:n,isSourceMode:r}),a===`links`&&(0,Z.jsx)(cg,{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)(h_,{activeDocName:n})}),a===`timeline`&&(0,Z.jsx)(s_,{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)(g_,{})})}),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 v_(e){let{id:t,icon:n}=e,r=p_(t);return(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(Do,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)($n,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Tn,{side:`bottom`,children:r})]},t)}function y_(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function b_(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function x_(e){return e/100*window.innerHeight}function S_(e){return e/100*window.innerWidth}function C_(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 w_({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=C_(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=b_(t,i);break;case`em`:r=y_(t,i);break;case`vh`:r=x_(i);break;case`vw`:r=S_(i);break}return r}function T_(e){return parseFloat(e.toFixed(3))}function E_({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 D_(e){let{panels:t}=e,n=E_({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=T_(w_({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=T_(w_({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=T_(w_({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=T_(w_({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 O_(e,t=`Assertion error`){if(!e)throw Error(t)}function k_(e,t){return Array.from(t).sort(e===`horizontal`?A_:j_)}function A_(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function j_(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function M_(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function N_(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 P_({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}=N_(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return O_(i,`No rect found`),i}var F_;function I_(){return F_===void 0&&(F_=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),F_}function L_(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=k_(n,Array.from(t.children).filter(M_).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,P_({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=I_()?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:E_({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 R_=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)}}},z_=new Map,B_=new R_;function V_(e){z_=new Map(z_),z_.delete(e)}function H_(e,t){for(let[t]of z_)if(t.id===e)return t}function U_(e,t){for(let[t,n]of z_)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function W_(){return z_}function G_(e,t){return B_.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function K_(e,t){let n=z_.get(e);z_=new Map(z_),z_.set(e,t),B_.emit(`groupChange`,{group:e,prev:n,next:t})}function q_(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=N_(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 J_(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Y_(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:tv(e),b:tv(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();O_(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:ev($_(n.a)),b:ev($_(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 X_=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Z_(e){let t=getComputedStyle(nv(e)??e).display;return t===`flex`||t===`inline-flex`}function Q_(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Z_(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`||X_.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function $_(e){let t=e.length;for(;t--;){let n=e[t];if(O_(n,`Missing node`),Q_(n))return n}return null}function ev(e){return e&&Number(getComputedStyle(e).zIndex)||0}function tv(e){let t=[];for(;e;)t.push(e),e=nv(e);return t}function nv(e){let{parentNode:t}=e;return J_(t)?t.host:t}function rv(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 iv({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!M_(n)||n.contains(e)||e.contains(n))return!0;if(Y_(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(rv(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function av(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=L_(r),a=q_(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&iv({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function ov(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 sv(e,t,n=0){return Math.abs(T_(e)-T_(t))<=n}function cv(e,t){return sv(e,t)?0:e>t?1:-1}function lv({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(cv(r,c)<0)if(a){let e=(i+c)/2;r=cv(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=T_(r),r}function uv({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(sv(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;O_(u!=null,`Invalid first pivot index`),O_(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];O_(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(O_(n!=null,`Previous layout not found for panel index ${t}`),sv(n,i)){let t=o-n;cv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];O_(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(O_(n!=null,`Previous layout not found for panel index ${t}`),sv(n,o)){let t=n-i;cv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];O_(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&cv(i,c)<0)if(e>0){let t=c-o,n=t/2;cv(i+e,c)<0&&(e=cv(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;cv(i-e,c)<0&&(e=cv(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];O_(e!=null,`Previous layout not found for panel index ${r}`);let a=lv({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];O_(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=lv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!sv(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(ov(c,l))return i;{let t=e<0?d:u,r=s[t];O_(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=lv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!sv(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];O_(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=lv({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(sv(i,s)||(t-=s-i,l[r]=s),sv(t,0))break;e>0?r--:r++}}}if(!sv(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 dv(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||cv(e[n],t[n])!==0)return!1;return!0}function fv({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(!sv(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];O_(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];O_(i!=null,`No layout data found for index ${e}`);let o=r[e];O_(o!=null,`No layout data found for index ${e}`);let s=lv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!sv(a,0))for(let e=0;e<t.length;e++){let n=r[e];O_(n!=null,`No layout data found for index ${e}`);let i=n+a,o=lv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,sv(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function pv({groupId:e,panelId:t}){let n=()=>{let t=W_();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=fv({layout:uv({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});dv(l,p)||K_(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&&sv(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=E_({group:t});o(T_(w_({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function mv(e){e.defaultPrevented||av(e,W_()).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=pv({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function hv(e){let t=W_();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 gv({groupId:e}){let t=()=>{let t=W_();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=fv({layout:e,panelConstraints:r});return n?o:(dv(o,c)||K_(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function _v(e,t){let n=hv(e),r=U_(n.id,!0),i=n.separators.find(t=>t.element===e);O_(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);O_(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=gv({groupId:n.id}).getLayout(),c=fv({layout:uv({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});dv(s,c)||K_(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function vv(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=hv(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&_v(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&_v(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&_v(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&_v(t,-5);break;case`End`:e.preventDefault(),_v(t,100);break;case`Enter`:{e.preventDefault();let n=hv(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=U_(n.id,!0),o=n.separators.find(e=>e.element===t);O_(o,`Matching separator not found`);let s=a.get(o);O_(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(O_(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];_v(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=hv(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);O_(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(),_v(t,-100);break}}var yv={cursorFlags:0,state:`inactive`},bv=new R_;function xv(){return yv}function Sv(e){return bv.addListener(`change`,e)}function Cv(e){let t=yv,n={...yv};n.cursorFlags=e,yv=n,bv.emit(`change`,{prev:t,next:n})}function wv(e){let t=yv;yv=e,bv.emit(`change`,{prev:t,next:e})}function Tv(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=W_(),n=av(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)}),wv({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Ev=e=>e,Dv=()=>{},Ov=1,kv=2,Av=4,jv=8,Mv=3,Nv=12,Pv;function Fv(){return Pv===void 0&&(Pv=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Pv=!0)),Pv}function Iv({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&&Fv()){let t=(e&Ov)!==0,n=(e&kv)!==0,r=(e&Av)!==0,i=(e&jv)!==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 Fv()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Lv=new WeakMap;function Rv(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Lv.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=xv();switch(r.state){case`active`:case`hover`:{let e=Iv({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}Lv.set(e,{prevStyle:t,styleSheet:n})}function zv({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=uv({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(dv(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ov:kv;break;case`vertical`:s|=d<0?Av:jv;break}}else K_(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Mv:c|=s&Mv,t.movementY===0?c|=o&Nv:c|=s&Nv,Cv(c),Rv(e)}function Bv(e){let t=W_(),n=xv();switch(n.state){case`active`:zv({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Vv(e){if(e.defaultPrevented)return;let t=xv(),n=W_();switch(t.state){case`active`:if(e.buttons===0){wv({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=U_(e.group.id,!0);K_(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)}zv({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=av(e,n);r.length===0?t.state!==`inactive`&&wv({cursorFlags:0,state:`inactive`}):wv({cursorFlags:0,hitRegions:r,state:`hover`}),Rv(e.currentTarget);break}}}function Hv(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(xv().state){case`hover`:wv({cursorFlags:0,state:`inactive`})}}function Uv(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=xv();switch(t.state){case`active`:wv({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Rv(e.currentTarget),t.hitRegions.forEach(e=>{let t=U_(e.group.id,!0);K_(e.group,t)}),e.preventDefault())}}function Wv(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=T_(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=T_((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Gv(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=E_({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:T_(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Kv(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 qv({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=T_(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]=T_((r[e]??0)/a*l);else{let e=T_(l/c.length);for(let t of c)u[t]=e}return u}function Jv(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 Yv=new Map;function Xv(e){let t=!0;O_(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=E_({group:e});if(t===0)return;let n=U_(e.id);if(!n)return;let r=D_(e),i=n.defaultLayoutDeferred?Wv(r):n.layout,a=fv({layout:qv({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&dv(n.layout,a)&&Kv(n.derivedPanelConstraints,r)&&n.groupSize===t)return;K_(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Gv(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{O_(!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=E_({group:e}),s=D_(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Jv(e.panels,l)||(l=void 0));let u=fv({layout:e.mutableState.layouts[c]??l??Wv(s),panelConstraints:s}),d=e.element.ownerDocument;Yv.set(d,(Yv.get(d)??0)+1);let f=new Map;return L_(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),K_(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{O_(!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`,vv)}),Yv.get(d)===1&&(d.addEventListener(`dblclick`,mv,!0),d.addEventListener(`pointerdown`,Tv,!0),d.addEventListener(`pointerleave`,Bv),d.addEventListener(`pointermove`,Vv),d.addEventListener(`pointerout`,Hv),d.addEventListener(`pointerup`,Uv,!0)),function(){t=!1,Yv.set(d,Math.max(0,(Yv.get(d)??0)-1)),V_(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,vv)}),Yv.get(d)||(d.removeEventListener(`dblclick`,mv,!0),d.removeEventListener(`pointerdown`,Tv,!0),d.removeEventListener(`pointerleave`,Bv),d.removeEventListener(`pointermove`,Vv),d.removeEventListener(`pointerout`,Hv),d.removeEventListener(`pointerup`,Uv,!0)),a.disconnect()}}function Zv(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Qv(e){let t=(0,Q.useId)();return`${e??t}`}var $v=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function ey(e){let t=(0,Q.useRef)(e);return $v(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function ty(...e){return ey(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ny(e){let t=(0,Q.useRef)({...e});return $v(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var ry=(0,Q.createContext)(null);function iy(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Ev});(0,Q.useImperativeHandle)(t,()=>n.current,[]),$v(()=>{Object.assign(n.current,gv({groupId:e}))})}function ay({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=ey(e=>{dv(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=ey(e=>{dv(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Qv(s),v=(0,Q.useRef)(null),[y,b]=Zv(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=ty(v,a);iy(_,o);let C=ey((e,t)=>{let r=xv(),i=H_(e),a=U_(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=ny({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=k_(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=k_(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=H_(_),i=U_(_);r&&i&&K_(r,{...i,derivedPanelConstraints:D_(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 $v(()=>{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=Xv(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=U_(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=G_(_,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=sv(t.collapsedSize,i[t.panelId]),a=sv(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=xv().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)(ry.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})})}ay.displayName=`Group`;function oy(){let e=(0,Q.useContext)(ry);return O_(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function sy(e,t){let{id:n}=oy(),r=(0,Q.useRef)({collapse:Dv,expand:Dv,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Dv});(0,Q.useImperativeHandle)(t,()=>r.current,[]),$v(()=>{Object.assign(r.current,pv({groupId:n,panelId:e}))})}function cy({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=Qv(c),_=ny({disabled:a}),v=(0,Q.useRef)(null),y=ty(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=oy(),T=d!==null,E=ey((e,t,n)=>{d?.(e,c,n)});$v(()=>{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]),sy(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>G_(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:{...ly,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})})}cy.displayName=`Panel`;var ly={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function uy(){return(0,Q.useRef)(null)}function dy({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=fv({layout:uv({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=fv({layout:uv({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function fy({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Qv(a),l=ny({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=ty(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=oy(),x=v===`horizontal`?`vertical`:`horizontal`;$v(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Sv(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=G_(_,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(dy({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})}fy.displayName=`Separator`;var py={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:`#`}}},my=Rt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),hy=_({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function gy(e){switch(e.toLowerCase()){case`json`:return Ds().language;case`toml`:return Cs.define(py);default:return null}}function _y(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 vy(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}=Pn(),l=_y(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=gy(i),t=c===`dark`?my:hy,n=[js,...e?[e]:[],ys.editable.of(!1),ls.readOnly.of(!0),ys.lineWrapping,t],r=new ys({state:ls.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 yy(e){return En(`/api/asset?path=${encodeURIComponent(e)}`)}function by(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function xy(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=yy(n),t[0]=n,t[1]=o);let c=o,u;t[2]===n?u=t[3]:(u=n.split(`/`).pop()??n,t[2]=n,t[3]=u);let d=u,f,p,m;if(t[4]!==n||t[5]!==d||t[6]!==i||t[7]!==r||t[8]!==c){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=d.includes(`.`)?d.split(`.`).pop()??``:``;if(p=e.length>0?e.toUpperCase():`FILE`,f=i?`text`:r,f===`pdf`){let e;t[12]!==d||t[13]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(l,{src:c,title:d,fillContainer:!0})}),t[12]=d,t[13]=c,t[14]=e):e=t[14];let n;t[15]!==d||t[16]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":d,children:e}),t[15]=d,t[16]=e,t[17]=n):n=t[17],m=n;break bb0}if(f===`text`){let r;t[18]===n?r=t[19]:(r=by(n),t[18]=n,t[19]=r),m=(0,Z.jsx)(vy,{src:r,fileName:d,extension:e.toLowerCase()},n);break bb0}}t[4]=n,t[5]=d,t[6]=i,t[7]=r,t[8]=c,t[9]=f,t[10]=p,t[11]=m}else f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[20]!==f||t[21]!==p||t[22]!==d||t[23]!==c?(h=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:f===`image`?(0,Z.jsx)(jt,{src:c,alt:d,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):f===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):f===`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:p}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:d}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Di,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsx)(`a`,{href:c,children:(0,Z.jsx)(s,{id:`9npOH9`})})}),(0,Z.jsx)(Di,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:(0,Z.jsx)(s,{id:`Ruuu3v`})})]})]})}),t[20]=f,t[21]=p,t[22]=d,t[23]=c,t[24]=h):h=t[24];let g;return t[25]!==d||t[26]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":d,children:h}),t[25]=d,t[26]=h,t[27]=g):g=t[27],g}function Sy(){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)(Ja,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Ja,{className:`h-4 w-full`}),(0,Z.jsx)(Ja,{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 Cy={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function wy(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}=Pn(),s=Cy[r],c=s?(o===`dark`?sr[s]:void 0)??wr[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=X(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)(Mi,{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)(ji,{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)(Ri,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function Ty(e){let{installState:t}=e;return t.installed===null?Y._({id:`IA6JW2`}):t.installed===!1?Y._({id:`5SwVv1`}):null}function Ey(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:Y._({id:`OJTOUj`,values:{brand:e}}),installAction:{label:Y._({id:`fG0X0e`,values:{brand:e}}),url:t.installUrl},...t.hasWebFallback?{webFallback:{label:Y._({id:`0S9PW_`}),url:``}}:{}}}}return{enabled:!0,tooltip:null}}function Dy(e){return Ir(e)}function Oy(e){return Y._({id:`h_HYHD`,values:{displayName:e}})}var ky=`claude.ai`;async function Ay(e,t=Hm){(await t(Ir(e))).ok?qo.success(Oy(ky)):qo.error(Y._({id:`9NC_MT`,values:{CLAUDE_WEB_FALLBACK_LABEL:ky}}))}function jy(e){let t=(0,$.c)(68),{_:n}=i(),{target:r,installState:a,isElectronHost:o,prompt:s,onSelect:c}=e,l=e.openExternal??Hm,u=e.onWebFallbackSuccess??Ny,d=e.onWebFallbackError??My,{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=Ey({target:r,installState:a,isElectronHost:o}),i=Ty({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(Dy(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)(wy,{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)(la,{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)(wy,{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)(la,{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=Na;let O=`open-in-agent-item-${r.id}`,k;t[43]===r.id?k=t[44]:(k=(0,Z.jsx)(wy,{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)(Pa,{"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=Ma,h=`min-w-[260px]`,g=`open-in-agent-submenu-${r.id}`,_=(0,Z.jsx)(co,{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)(ca,{}),t[55]=v):v=t[55],y=(0,Z.jsx)(la,{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)(la,{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 My(){}function Ny(){}function Py(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=_h(),{dispatch:a}=oh(),o=Ra(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=Jm({workspace:o});t[7]===n?s=t[8]:(s=X(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=hm.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(Fy,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{Xm(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 Fy(e){let t=(0,$.c)(22),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(wy,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===n.tagline?f=t[8]:(f=n.tagline?(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.tagline}):null,t[7]=n.tagline,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r===`missing`?(0,Z.jsx)(ko,{"aria-hidden":`true`,className:`size-3`}):null,t[12]=r,t[13]=m);let h;t[14]!==c||t[15]!==m?(h=(0,Z.jsxs)(`p`,{className:`mt-auto inline-flex items-center gap-1 pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==o||t[19]!==p||t[20]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[p,h]}),t[17]=s,t[18]=o,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}var Iy=3100,Ly=3;function Ry(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Ly;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var zy={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}},By=[`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 Vy(e,t={}){let n=t.rng??Math.random,r=t.colors??By,i=zy[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 Hy=1.8,Uy=90,Wy=16,Gy=380,Ky=.025,qy=.1,Jy=.18,Yy=400,Xy=9.2736,Zy=18.1799,Qy=14.5244,$y={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function eb(e,t){let{halfWidth:n,apexLift:r}=$y[t];return`M${e-n} ${Qy+.3} Q${e} ${Qy-r}, ${e+n} ${Qy+.3}`}function tb(e){let t=1.5,n=.3;return`M${e-t} ${Qy-n} Q${e} ${Qy+1.4}, ${e+t} ${Qy-n}`}var nb=15,rb=15;function ib(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 ab(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=Ry(g,t);_(n),y(lb),S(Vy(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Iy)},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(cb),S(Vy(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Iy))},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/Gy)),C=Math.max(-1,Math.min(1,b/Gy)),w=S*Wy,T=-C*Wy,E=0,D=0;if(x>=1){let e=Math.min(x/Uy,1)*Hy;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)*qy,i+=(w-i)*qy,u.style.transform=`perspective(${Yy}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*Jy,o+=(D-o)*Jy;let k=i*Ky,A=-r*Ky,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=X(`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=X(`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=X(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:Xy,cy:Qy,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=X(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=J);let ee;t[28]===J?ee=t[29]:(ee=(0,Z.jsx)(`ellipse`,{cx:Zy,cy:Qy,rx:1.2722,ry:1.9083,className:J}),t[28]=J,t[29]=ee);let te;t[30]===I?te=t[31]:(te=eb(Xy,I),t[30]=I,t[31]=te);let ne=(!F||T)&&`ok-blob-eye-hidden`,re;t[32]===ne?re=t[33]:(re=X(`ok-blob-happy-eye`,ne),t[32]=ne,t[33]=re);let ie;t[34]!==te||t[35]!==re?(ie=(0,Z.jsx)(`path`,{d:te,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:re}),t[34]=te,t[35]=re,t[36]=ie):ie=t[36];let ae;t[37]===I?ae=t[38]:(ae=eb(Zy,I),t[37]=I,t[38]=ae);let oe=(!F||T)&&`ok-blob-eye-hidden`,se;t[39]===oe?se=t[40]:(se=X(`ok-blob-happy-eye`,oe),t[39]=oe,t[40]=se);let ce;t[41]!==ae||t[42]!==se?(ce=(0,Z.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:se}),t[41]=ae,t[42]=se,t[43]=ce):ce=t[43];let le;t[44]===T?le=t[45]:(le=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:tb(Xy),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:tb(Zy),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=le);let ue;t[46]!==K||t[47]!==ee||t[48]!==ie||t[49]!==ce||t[50]!==le?(ue=(0,Z.jsxs)(`g`,{ref:p,children:[K,ee,ie,ce,le]}),t[46]=K,t[47]=ee,t[48]=ie,t[49]=ce,t[50]=le,t[51]=ue):ue=t[51];let de;t[52]!==B||t[53]!==H||t[54]!==ue?(de=(0,Z.jsxs)(`g`,{className:H,children:[U,ue]},B),t[52]=B,t[53]=H,t[54]=ue,t[55]=de):de=t[55];let fe;t[56]===T?fe=t[57]:(fe=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]=fe);let pe;t[58]!==v||t[59]!==x?(pe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(ob)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=pe):pe=t[60];let me;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==de||t[65]!==fe||t[66]!==pe?(me=(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:sb,children:[de,fe,pe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=de,t[65]=fe,t[66]=pe,t[67]=me):me=t[67];let he;return t[68]!==R||t[69]!==me?(he=(0,Z.jsx)(`span`,{ref:d,className:R,children:me}),t[68]=R,t[69]=me,t[70]=he):he=t[70],he}function ob(e){return(0,Z.jsx)(`circle`,{cx:nb+e.originDx,cy:rb+e.originDy,r:e.size,className:`ok-blob-firework`,style:ib(e)},e.id)}function sb(e){return e.preventDefault()}function cb(e){return e+1}function lb(e){return e+1}function ub(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(ab,{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 db(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=X(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`kbd`,{"data-slot":`kbd`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fb(){let e=(0,$.c)(2),t=Sr()?`⌘ K`:`Ctrl K`,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(db,{children:t}),e[0]=n):n=e[0];let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`p`,{className:`text-1sm text-muted-foreground`,children:[n,` `,(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A1taO8`})})]}),e[1]=r):r=e[1],r}var pb=`open-knowledge:create-top-level-file`;function mb(){window.dispatchEvent(new CustomEvent(pb))}function hb(e){let t=()=>e();return window.addEventListener(pb,t),()=>window.removeEventListener(pb,t)}function gb(){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(bb);if(e)return;let r=t.ok?Mn.safeParse(n):null;r?.success?(o(xb(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=hi(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(yb),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(vb);if(!e.ok)return;let n=Mn.safeParse(t);n.success&&o(xb(n.data.documents))}).catch(_b)},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)(Sb,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(Cb,{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)(lm,{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 _b(){}function vb(){return null}function yb(e){return e+1}function bb(){return null}function xb(e){return ui(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function Sb(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)(ub,{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)(nm,{onPackSelect:r}),t[8]=r,t[9]=u);let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Di,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:mb,children:(0,Z.jsx)(s,{id:`ensWZc`,components:{0:(0,Z.jsx)(ja,{"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 Cb(e){let t=(0,$.c)(19),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o;t[0]===a?o=t[1]:(o=a({id:`8XS8nG`}),t[0]=a,t[1]=o);let c;t[2]===a?c=t[3]:(c=a({id:`GjElCU`}),t[2]=a,t[3]=c);let l;t[4]!==n||t[5]!==o||t[6]!==c?(l=(0,Z.jsx)(ub,{title:o,subtitle:c,celebrateSignal:n}),t[4]=n,t[5]=o,t[6]=c,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Py,{}),t[8]=u):u=t[8];let d,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(te,{"aria-hidden":`true`,className:`size-3`}),f=(0,Z.jsx)(s,{id:`IajAbS`}),t[9]=d,t[10]=f):(d=t[9],f=t[10]);let p;t[11]===r?p=t[12]:(p=(0,Z.jsxs)(Di,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[d,f]}),t[11]=r,t[12]=p);let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(fb,{}),t[13]=m):m=t[13];let h;t[14]===p?h=t[15]:(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[u,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[p,m]})]}),t[14]=p,t[15]=h);let g;return t[16]!==l||t[17]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function wb(e){let t=(0,$.c)(76),{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)(Eb,{}),(0,Z.jsx)(Ja,{className:`h-7 w-full`}),(0,Z.jsx)(Ja,{className:`h-7 w-full`}),(0,Z.jsx)(Ja,{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:`4UMKtb`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.folder.frontmatter_defaults?m=t[4]:(m=r.data.folder.frontmatter_defaults??{},t[3]=r.data.folder.frontmatter_defaults,t[4]=m);let h=m,g;t[5]===r.data.frontmatterLocal?g=t[6]:(g=r.data.frontmatterLocal??{},t[5]=r.data.frontmatterLocal,t[6]=g);let _=g,v=r.data.frontmatterSources,y;t[7]===r.data.folder.path?y=t[8]:(y=xo(r.data.folder.path),t[7]=r.data.folder.path,t[8]=y);let b=y,x,S,C,w,T,E,D,O,k,A,j,M,N;if(t[9]!==o||t[10]!==u||t[11]!==c||t[12]!==b||t[13]!==n||t[14]!==_||t[15]!==h||t[16]!==a||t[17]!==f||t[18]!==v){let e=Object.keys(h),r=async function(e,t){let r=await Yi(n,{[e]:t});if(!r.ok){let{error:e}=r;qo.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},i=async function(e){let t=await Yi(n,{[e]:null});if(!t.ok){let{error:e}=t;qo.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},m=function(e,t){let n=h[e];r(e,ga(n,t))},g;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[32]=g):g=t[32],C=g;let y;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Zi[e];return{...t,type:e,value:n,error:null}})},t[33]=y):y=t[33],T=y;let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d(t=>t&&{...t,value:e})},t[34]=P):P=t[34],E=P;let F;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){d(t=>t&&{...t,name:e,error:null})},t[35]=F):F=t[35],w=F;let I;t[36]!==o||t[37]!==u||t[38]!==n||t[39]!==h||t[40]!==a?(I=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`6lBXm5`,values:{trimmed:e}})});return}let t=await Yi(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[36]=o,t[37]=u,t[38]=n,t[39]=h,t[40]=a,t[41]=I):I=t[41],D=I;let L=function(e){p({key:e,draft:e,error:null})},R=function(e){p(t=>t&&{...t,draft:e,error:null})},z=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:`6lBXm5`,values:{trimmed:e}})});return}let t=h[f.key],r=await Yi(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},B=function(){p(null)};N=`rounded-lg border bg-card`,S=Qo,A=!c,t[42]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>l(!e),t[42]=j):j=t[42];let V=`size-3 transition-transform ${c?``:`rotate-90`}`,H;t[43]===V?H=t[44]:(H=(0,Z.jsx)(Jo,{className:V,"aria-hidden":!0}),t[43]=V,t[44]=H);let U;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`IX_qeH`})}),t[45]=U):U=t[45];let W;t[46]===H?W=t[47]:(W=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[H,U]}),t[46]=H,t[47]=W);let G;t[48]===b?G=t[49]:(G=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:Tb,children:b}),t[48]=b,t[49]=G),t[50]!==W||t[51]!==G?(M=(0,Z.jsxs)(Zo,{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:[W,G]}),t[50]=W,t[51]=G,t[52]=M):M=t[52],x=Xo,O=`px-2 py-2`,k=e.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`50Y3WA`})}):e.map(e=>{let t=h[e],n=Object.hasOwn(_,e);return(0,Z.jsx)(Ta,{keyName:e,value:t,declared:Qa(t,Br(t)),rename:n?{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:R,onCommit:z,onCancel:B}:void 0,badge:n?null:(0,Z.jsx)($i,{source:v[e]??``}),isInherited:!n,onCommit:t=>void r(e,t),onChangeType:t=>m(e,t),onRemove:n?()=>void i(e):void 0},e)}),t[9]=o,t[10]=u,t[11]=c,t[12]=b,t[13]=n,t[14]=_,t[15]=h,t[16]=a,t[17]=f,t[18]=v,t[19]=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,t[28]=A,t[29]=j,t[30]=M,t[31]=N}else 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],A=t[28],j=t[29],M=t[30],N=t[31];let P;t[53]!==u||t[54]!==C||t[55]!==w||t[56]!==T||t[57]!==E||t[58]!==D?(P=u?(0,Z.jsx)(yo,{draft:u,onChangeName:w,onChangeType:T,onChangeValue:E,onCommit:()=>void D(),onCancel:()=>d(null)}):(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:C,className:`mt-1 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)(te,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`F-NRCj`})})]}),t[53]=u,t[54]=C,t[55]=w,t[56]=T,t[57]=E,t[58]=D,t[59]=P):P=t[59];let F;t[60]!==P||t[61]!==O||t[62]!==k?(F=(0,Z.jsxs)(`div`,{className:O,children:[k,P]}),t[60]=P,t[61]=O,t[62]=k,t[63]=F):F=t[63];let I;t[64]!==x||t[65]!==F?(I=(0,Z.jsx)(x,{children:F}),t[64]=x,t[65]=F,t[66]=I):I=t[66];let L;t[67]!==S||t[68]!==I||t[69]!==A||t[70]!==j||t[71]!==M?(L=(0,Z.jsxs)(S,{open:A,onOpenChange:j,children:[M,I]}),t[67]=S,t[68]=I,t[69]=A,t[70]=j,t[71]=M,t[72]=L):L=t[72];let R;return t[73]!==L||t[74]!==N?(R=(0,Z.jsx)(`section`,{className:N,children:L}),t[73]=L,t[74]=N,t[75]=R):R=t[75],R}function Tb(e){return e.stopPropagation()}function Eb(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(yc,{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:`IX_qeH`})})]}),e[1]=n):n=e[1],n}function Db(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function Ob(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=Db(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function kb(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Ab(e,t){let n=`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:Ob(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:kb(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:Ob(e,t.pageTitles),children:a}}function jb(e){let t=(0,$.c)(54),{folderPath:n,state:r,onChange:a,folderConfigHandle:o}=e,{_:c}=i(),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(!1),y;t[0]!==c||t[1]!==a?(y=async function(e){g(!0);let t=await Ca(e.source_folder,e.name);if(g(!1),!t.ok){let{error:e}=t;qo.error(c({id:`yOGrCR`,values:{error:e}}));return}let{name:n}=e;qo.success(c({id:`I23A-U`,values:{name:n}})),f(null),a()},t[0]=c,t[1]=a,t[2]=y):y=t[2];let b=y;if(r.status===`idle`||r.status===`loading`){let e;return t[3]===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)(Ja,{className:`h-12 w-full`}),(0,Z.jsx)(Ja,{className:`h-12 w-full`})]}),t[3]=e):e=t[3],e}if(r.status===`error`){let{message:e}=r,n;return t[4]===e?n=t[5]:(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[4]=e,t[5]=n),n}let x;t[6]===r.data.folder.templates_available?x=t[7]:(x=r.data.folder.templates_available??[],t[6]=r.data.folder.templates_available,t[7]=x);let S=x,C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=(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[8]=C):C=t[8];let w;t[9]===S.length?w=t[10]:(w=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,(0,Z.jsx)(de,{className:`text-xs`,variant:`secondary`,children:S.length})]}),t[9]=S.length,t[10]=w);let T;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsxs)(Di,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>v(!0),children:[(0,Z.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[11]=T):T=t[11];let E;t[12]===w?E=t[13]:(E=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[w,T]}),t[12]=w,t[13]=E);let D;t[14]===S?D=t[15]:(D=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:S.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`BHW0EW`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:S.map(e=>(0,Z.jsx)(Nb,{template:e,onCreate:()=>m(e.name),onEdit:()=>u(e),onDelete:()=>f(e)},e.path))})}),t[14]=S,t[15]=D);let O;t[16]!==E||t[17]!==D?(O=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[E,D]}),t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{e||u(null)},t[19]=k):k=t[19];let A;t[20]!==l||t[21]!==n||t[22]!==a?(A=(0,Z.jsx)(_o,{folderPath:n,template:l,onOpenChange:k,onSaved:a}),t[20]=l,t[21]=n,t[22]=a,t[23]=A):A=t[23];let j=!!d,M;t[24]===h?M=t[25]:(M=e=>{!e&&!h&&f(null)},t[24]=h,t[25]=M);let N;t[26]!==c||t[27]!==d||t[28]!==h||t[29]!==b?(N=d&&(()=>{let{name:e,path:t,scope:n}=d,r=n===`inherited`?`\n\n${c({id:`LUbzI-`})}`:``;return(0,Z.jsx)(za,{itemName:c({id:`XfzqjK`,values:{name:e}}),isSubmitting:h,onDelete:()=>b(d),customDescription:`${c({id:`JVgg1-`,values:{path:t}})}${r}`})})(),t[26]=c,t[27]=d,t[28]=h,t[29]=b,t[30]=N):N=t[30];let P;t[31]!==j||t[32]!==M||t[33]!==N?(P=(0,Z.jsx)(Go,{open:j,onOpenChange:M,children:N}),t[31]=j,t[32]=M,t[33]=N,t[34]=P):P=t[34];let F;t[35]===S?F=t[36]:(F=new Set(S.map(Mb)),t[35]=S,t[36]=F);let I;t[37]!==n||t[38]!==_||t[39]!==a||t[40]!==F?(I=(0,Z.jsx)(Co,{folderPath:n,existingNames:F,open:_,onOpenChange:v,onCreated:a}),t[37]=n,t[38]=_,t[39]=a,t[40]=F,t[41]=I):I=t[41];let L=p!==null,R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||m(null)},t[42]=R):R=t[42];let z=p??void 0,B;t[43]!==o||t[44]!==n||t[45]!==L||t[46]!==z?(B=(0,Z.jsx)(zp,{open:L,onOpenChange:R,kind:`file`,initialDir:n,initialTemplate:z,folderConfig:o}),t[43]=o,t[44]=n,t[45]=L,t[46]=z,t[47]=B):B=t[47];let V;return t[48]!==A||t[49]!==P||t[50]!==I||t[51]!==B||t[52]!==O?(V=(0,Z.jsxs)(Z.Fragment,{children:[O,A,P,I,B]}),t[48]=A,t[49]=P,t[50]=I,t[51]=B,t[52]=O,t[53]=V):V=t[53],V}function Mb(e){return e.name}function Nb(e){let t=(0,$.c)(51),{template:n,onCreate:r,onEdit:a,onDelete:o}=e,{_:c}=i(),l=n.title&&n.title!==n.name,u=n.title??n.name,d;t[0]===u?d=t[1]:(d=(0,Z.jsx)(`span`,{className:`font-medium truncate`,children:u}),t[0]=u,t[1]=d);let f;t[2]!==l||t[3]!==n.name?(f=l?(0,Z.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground shrink-0`,children:n.name}):null,t[2]=l,t[3]=n.name,t[4]=f):f=t[4];let p;t[5]!==n.name||t[6]!==n.scope||t[7]!==n.source_folder?(p=n.scope===`inherited`?(0,Z.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,Z.jsx)($i,{source:n.source_folder,target:`templates/${n.name}.md`})}):null,t[5]=n.name,t[6]=n.scope,t[7]=n.source_folder,t[8]=p):p=t[8];let m;t[9]!==d||t[10]!==f||t[11]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[d,f,p]}),t[9]=d,t[10]=f,t[11]=p,t[12]=m):m=t[12];let h;t[13]===n.description?h=t[14]:(h=n.description?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground truncate mt-0.5`,children:n.description}):null,t[13]=n.description,t[14]=h);let g;t[15]!==a||t[16]!==m||t[17]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:a,className:`min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm`,children:[m,h]}),t[15]=a,t[16]=m,t[17]=h,t[18]=g):g=t[18];let _;t[19]!==c||t[20]!==u?(_=c({id:`5m2Eho`,values:{label:u}}),t[19]=c,t[20]=u,t[21]=_):_=t[21];let v,y;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(gc,{className:`size-3.5`,"aria-hidden":!0}),y=(0,Z.jsx)(s,{id:`hYgDIe`}),t[22]=v,t[23]=y):(v=t[22],y=t[23]);let b;t[24]!==r||t[25]!==_?(b=(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,size:`sm`,className:`font-mono uppercase shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:r,"aria-label":_,children:[v,y]}),t[24]=r,t[25]=_,t[26]=b):b=t[26];let x;t[27]!==c||t[28]!==u?(x=c({id:`Bx4EXG`,values:{label:u}}),t[27]=c,t[28]=u,t[29]=x):x=t[29];let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(aa,{className:`size-4`,"aria-hidden":!0}),t[30]=S):S=t[30];let C;t[31]===x?C=t[32]:(C=(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":x,children:S})}),t[31]=x,t[32]=C);let w,E;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(T,{"aria-hidden":!0}),E=(0,Z.jsx)(s,{id:`ePK91l`}),t[33]=w,t[34]=E):(w=t[33],E=t[34]);let D;t[35]===a?D=t[36]:(D=(0,Z.jsxs)(la,{onSelect:a,children:[w,E]}),t[35]=a,t[36]=D);let O,k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(q,{"aria-hidden":!0}),k=(0,Z.jsx)(s,{id:`cnGeoo`}),t[37]=O,t[38]=k):(O=t[37],k=t[38]);let A;t[39]===o?A=t[40]:(A=(0,Z.jsxs)(la,{variant:`destructive`,onSelect:o,children:[O,k]}),t[39]=o,t[40]=A);let j;t[41]!==D||t[42]!==A?(j=(0,Z.jsxs)(ra,{align:`end`,children:[D,A]}),t[41]=D,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==C||t[45]!==j?(M=(0,Z.jsxs)(Da,{children:[C,j]}),t[44]=C,t[45]=j,t[46]=M):M=t[46];let N;return t[47]!==b||t[48]!==M||t[49]!==g?(N=(0,Z.jsxs)(`li`,{className:`group flex items-center gap-2 rounded-md px-2 py-2 hover:bg-muted/50 text-sm`,children:[g,b,M]}),t[47]=b,t[48]=M,t[49]=g,t[50]=N):N=t[50],N}function Pb(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=X(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=X(`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 Fb(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=X(`[&_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 Ib(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=X(`[&_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 Lb(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=X(`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 Rb(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=X(`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 zb(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=X(`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 Bb(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Y._({id:`xOTzt5`});if(r<60)return Y._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Y._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Y._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Vb(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 Hb(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)(Nt,{className:`ml-1 size-3`}):(0,Z.jsx)(Be,{className:`ml-1 size-3`}):(0,Z.jsx)(Js,{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)(Di,{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 Ub(e){let t=(0,$.c)(92),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=si(),d=no(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)(Ja,{className:`size-5 rounded`}),(0,Z.jsx)(Ja,{className:`h-7 w-48`})]}),(0,Z.jsx)(Ja,{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)(Ja,{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)(Ja,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Kb)]})]}),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=Ab(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=Vb(e.children,g,v),o;t[28]===g?o=t[29]:(o=function(e){e===g?y(Gb):(_(e),y(`asc`))},t[28]=g,t[29]=o);let m=o;k=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Ce,{className:`size-5 text-muted-foreground`}),t[30]=A):A=t[30];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:e.title})]}),M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(Di,{onClick:()=>h(!0),children:[(0,Z.jsx)(te,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[31]=M):M=t[31],t[32]===j?E=t[33]:(E=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,M]})}),t[32]=j,t[33]=E),t[34]!==f||t[35]!==n||t[36]!==p?(D=(0,Z.jsx)(wb,{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)(jb,{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=Pb;let N=g===`name`?v===`asc`?`ascending`:`descending`:`none`,P;t[43]===r?P=t[44]:(P=r({id:`6YtxFj`}),t[43]=r,t[44]=P);let F;t[45]!==m||t[46]!==v||t[47]!==g||t[48]!==P?(F=(0,Z.jsx)(Hb,{label:P,sortKey:`name`,activeKey:g,activeDir:v,onSort:m}),t[45]=m,t[46]=v,t[47]=g,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==N||t[51]!==F?(I=(0,Z.jsx)(Rb,{"aria-sort":N,children:F}),t[50]=N,t[51]=F,t[52]=I):I=t[52];let L=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,R;t[53]===r?R=t[54]:(R=r({id:`tgWuMB`}),t[53]=r,t[54]=R);let z;t[55]!==m||t[56]!==v||t[57]!==g||t[58]!==R?(z=(0,Z.jsx)(Hb,{label:R,sortKey:`modified`,activeKey:g,activeDir:v,onSort:m}),t[55]=m,t[56]=v,t[57]=g,t[58]=R,t[59]=z):z=t[59];let B;t[60]!==L||t[61]!==z?(B=(0,Z.jsx)(Rb,{className:`w-32`,"aria-sort":L,children:z}),t[60]=L,t[61]=z,t[62]=B):B=t[62],t[63]!==I||t[64]!==B?(C=(0,Z.jsx)(Fb,{children:(0,Z.jsxs)(Lb,{children:[I,B]})}),t[63]=I,t[64]=B,t[65]=C):C=t[65],b=Ib,S=i.length?i.map(Wb):(0,Z.jsx)(Lb,{children:(0,Z.jsx)(zb,{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)(zp,{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 Wb(e){return(0,Z.jsxs)(Lb,{children:[(0,Z.jsx)(zb,{children:(0,Z.jsxs)(`a`,{href:ii(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)(xc,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(ke,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(zb,{className:`text-muted-foreground`,children:e.kind===`file`?Bb(e.modified):`—`})]},e.path)}function Gb(e){return e===`asc`?`desc`:`asc`}function Kb(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)(Ja,{className:`size-4 rounded`}),(0,Z.jsx)(Ja,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Ja,{className:`h-4 w-16`})})]},e)}function qb(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(Jb),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>J(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(){fe(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)(Di,{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 Jb(){return new Set}var Yb=(0,Q.createContext)(null);function Xb(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(Zb),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)(Yb,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function Zb(){return new Map}function Qb(){let e=(0,Q.use)(Yb);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function $b(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var ex=$b(()=>n(()=>import(`./SettingsDialogBody-D3JtwH7E.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([42,1,33,2,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,43,8,14,21,11]),import.meta.url));function tx(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)(Di,{variant:`default`,onClick:nx,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 nx(){return window.location.reload()}function rx(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(m,{fallbackRender:ax,onError:ix,children:n}),t[0]=n,t[1]=r),r}function ix(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function ax(e){return(0,Z.jsx)(tx,{...e})}function ox(e){let t=(0,$.c)(71),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=ft(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=Oe(),{desktopPresent:f}=Fa(),[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:`AeXO77`}),t[9]=a,t[10]=x);let S;t[11]===x?S=t[12]:(S={id:`account`,label:x},t[11]=x,t[12]=S);let C;t[13]!==b||t[14]!==S?(C=[b,S],t[13]=b,t[14]=S,t[15]=C):C=t[15];let w;t[16]!==v||t[17]!==C?(w={id:`user`,label:v,enabled:!0,items:C},t[16]=v,t[17]=C,t[18]=w):w=t[18];let T;t[19]===a?T=t[20]:(T=a({id:`ZWyHmq`}),t[19]=a,t[20]=T);let E;t[21]===a?E=t[22]:(E=a({id:`Nu4DdT`}),t[21]=a,t[22]=E);let D;t[23]===E?D=t[24]:(D={id:`sync`,label:E},t[23]=E,t[24]=D);let O;t[25]===a?O=t[26]:(O=a({id:`iTylMl`}),t[25]=a,t[26]=O);let k;t[27]===O?k=t[28]:(k={id:`project-templates`,label:O},t[27]=O,t[28]=k);let A;t[29]===a?A=t[30]:(A=a({id:`3zyg_A`}),t[29]=a,t[30]=A);let j;t[31]===A?j=t[32]:(j={id:`okignore`,label:A},t[31]=A,t[32]=j);let M;t[33]!==D||t[34]!==k||t[35]!==j?(M=[D,k,j],t[33]=D,t[34]=k,t[35]=j,t[36]=M):M=t[36];let N;t[37]!==_||t[38]!==T||t[39]!==M?(N={id:`project`,label:T,enabled:_,items:M},t[37]=_,t[38]=T,t[39]=M,t[40]=N):N=t[40];let P;t[41]===a?P=t[42]:(P=a({id:`nbfdhU`}),t[41]=a,t[42]=P);let F;t[43]!==a||t[44]!==f?(F=f?[{id:`claude-desktop`,label:a({id:`yvHDYG`})}]:[],t[43]=a,t[44]=f,t[45]=F):F=t[45];let I;t[46]!==P||t[47]!==F?(I={id:`integrations`,label:P,enabled:!0,items:F},t[46]=P,t[47]=F,t[48]=I):I=t[48];let L;t[49]!==N||t[50]!==I||t[51]!==w?(L=[w,N,I],t[49]=N,t[50]=I,t[51]=w,t[52]=L):L=t[52];let R=L,z;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Fo,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[53]=z):z=t[53];let B;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(No,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[54]=B):B=t[54];let V;t[55]!==p||t[56]!==R?(V=(0,Z.jsx)(sx,{groups:R,activeId:p,onSelect:m}),t[55]=p,t[56]=R,t[57]=V):V=t[57];let H;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(lx,{}),t[58]=H):H=t[58];let U=l?c:null,W;t[59]!==p||t[60]!==u||t[61]!==d||t[62]!==U?(W=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,children:(0,Z.jsx)(rx,{children:(0,Z.jsx)(Q.Suspense,{fallback:H,children:(0,Z.jsx)(ex,{activeId:p,userBinding:U,okignoreBinding:u,okignoreSynced:d})})})}),t[59]=p,t[60]=u,t[61]=d,t[62]=U,t[63]=W):W=t[63];let G;t[64]!==V||t[65]!==W?(G=(0,Z.jsxs)(zo,{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:[z,B,V,W]}),t[64]=V,t[65]=W,t[66]=G):G=t[66];let K;return t[67]!==r||t[68]!==n||t[69]!==G?(K=(0,Z.jsx)(Go,{open:n,onOpenChange:r,children:G}),t[67]=r,t[68]=n,t[69]=G,t[70]=K):K=t[70],K}function sx(e){let t=(0,$.c)(12),{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)(cx,{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;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`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}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function cx(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=X(`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:X(`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 lx(){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)(Ja,{className:`h-5 w-32`}),r=(0,Z.jsx)(Ja,{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)(Ja,{className:`h-9 w-full`}),(0,Z.jsx)(Ja,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function ux(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=X(`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)(ay,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dx(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)(cy,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function fx(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=X(`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)(fy,{"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 px(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)(Bo,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function mx(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)(Uo,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}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=X(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 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)(Lo,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gx(e){let t=(0,$.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c=a===void 0?`right`:a,l=o===void 0?!0:o,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(hx,{}),t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=X(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10 motion-reduce:transition-none motion-reduce:duration-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none`,r),t[7]=r,t[8]=d);let f;t[9]===l?f=t[10]:(f=l&&(0,Z.jsx)(Ko,{"data-slot":`sheet-close`,asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,Z.jsx)(Mo,{}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`yz7wBu`})})]})}),t[9]=l,t[10]=f);let p;return t[11]!==n||t[12]!==i||t[13]!==c||t[14]!==d||t[15]!==f?(p=(0,Z.jsxs)(mx,{children:[u,(0,Z.jsxs)(Io,{"data-slot":`sheet-content`,"data-side":c,className:d,...i,children:[n,f]})]}),t[11]=n,t[12]=i,t[13]=c,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function _x(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=X(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vx(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=X(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ro,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yx(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=X(`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 bx=ki(`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 xx(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=X(bx({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:Sx,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function Sx(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ki(`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 Cx(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=X(`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 wx(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`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)(Yo,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tx(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)(wx,{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)(ec,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Oo,{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)(Tn,{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)(Gr,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(dl,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Oo,{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)(Tn,{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)(Gr,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(xx,{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)(yx,{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 ee;t[54]===S?ee=t[55]:(ee=S({id:`oqB2ez`}),t[54]=S,t[55]=ee);let te=!w,ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(_t,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=ne):ne=t[56];let re;t[57]!==v||t[58]!==ee||t[59]!==te?(re=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:te,onClick:v,children:ne})}),t[57]=v,t[58]=ee,t[59]=te,t[60]=re):re=t[60];let ie;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=ie):ie=t[61];let ae;t[62]===re?ae=t[63]:(ae=(0,Z.jsxs)(Gr,{children:[re,ie]}),t[62]=re,t[63]=ae);let oe;t[64]===S?oe=t[65]:(oe=S({id:`SiUUCS`}),t[64]=S,t[65]=oe);let se=!w,ce;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(Dt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ce):ce=t[66];let le;t[67]!==_||t[68]!==oe||t[69]!==se?(le=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":oe,disabled:se,onClick:_,children:ce})}),t[67]=_,t[68]=oe,t[69]=se,t[70]=le):le=t[70];let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=ue):ue=t[71];let de;t[72]===le?de=t[73]:(de=(0,Z.jsxs)(Gr,{children:[le,ue]}),t[72]=le,t[73]=de);let fe=o?`secondary`:`ghost`,pe;t[74]!==S||t[75]!==o?(pe=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=pe):pe=t[76];let me=o?`ok-replace-input`:void 0,he;t[77]!==m||t[78]!==o?(he=()=>m(!o),t[77]=m,t[78]=o,t[79]=he):he=t[79];let ge;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Kc,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=ge):ge=t[80];let _e;t[81]!==o||t[82]!==fe||t[83]!==pe||t[84]!==me||t[85]!==he?(_e=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:fe,size:`icon-sm`,"aria-label":pe,"aria-expanded":o,"aria-controls":me,onClick:he,children:ge})}),t[81]=o,t[82]=fe,t[83]=pe,t[84]=me,t[85]=he,t[86]=_e):_e=t[86];let ve;t[87]===o?ve=t[88]:(ve=(0,Z.jsx)(Tn,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ve);let ye;t[89]!==_e||t[90]!==ve?(ye=(0,Z.jsxs)(Gr,{children:[_e,ve]}),t[89]=_e,t[90]=ve,t[91]=ye):ye=t[91];let be;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(be=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)(Yo,{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)(Gr,{children:[(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Kc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Gc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Tn,{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]=be):be=t[100];let xe;t[101]===S?xe=t[102]:(xe=S({id:`wJo9oS`}),t[101]=S,t[102]=xe);let Se;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Mo,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Se):Se=t[103];let Ce;t[104]!==x||t[105]!==xe?(Ce=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":xe,onClick:x,children:Se})}),t[104]=x,t[105]=xe,t[106]=Ce):Ce=t[106];let we;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=we):we=t[107];let Te;t[108]===Ce?Te=t[109]:(Te=(0,Z.jsxs)(Gr,{children:[Ce,we]}),t[108]=Ce,t[109]=Te);let Ee;return t[110]!==q||t[111]!==J||t[112]!==ae||t[113]!==de||t[114]!==j||t[115]!==ye||t[116]!==be||t[117]!==Te?(Ee=(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,ae,de,ye,be,Te]}),t[110]=q,t[111]=J,t[112]=ae,t[113]=de,t[114]=j,t[115]=ye,t[116]=be,t[117]=Te,t[118]=Ee):Ee=t[118],Ee}var Ex={current:0,total:0},Dx=120,Ox=100;function kx(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?W(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(ne,n,Ax)}function Ax(){return null}function jx(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>Dx||i.includes(`
|
|
26
26
|
`)?null:i}function Mx(e,t){return(Sr()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&e.key.toLocaleLowerCase()===t}function Nx(e){let t=e.key.toLocaleLowerCase();return Sr()?e.metaKey&&e.altKey&&!e.ctrlKey&&t===`f`:e.ctrlKey&&!e.metaKey&&!e.altKey&&t===`h`}function Px(e){let t=Re(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function Fx(e,t){return e.current===t.current&&e.total===t.total}function Ix(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(Ex)}function Lx(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=ue(e);if(!t)return;let n=t.dom.querySelector(`.ok-find-match-active`);n instanceof HTMLElement&&n.scrollIntoView({block:`center`,inline:`nearest`,behavior:`auto`})})}function Rx(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=kx(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)(Ex),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(Bx))},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(zx)},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(Ex);return}if(!u.open||r){i.commands.clearFindMatches(),p(Ex);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=Px(i);p(t=>Fx(t,e)?t:e)},Ox);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=Re(i.state),t=Px(i);p(e=>Fx(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=jx(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(Mx(t,`f`)){t.preventDefault(),u.open?Ix(i,d,p):e(!1);return}if(Nx(t)){t.preventDefault(),e(!0);return}if(Mx(t,`g`)&&u.open){t.preventDefault(),(t.shiftKey?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&Lx(i);return}t.key===`Escape`&&u.open&&(t.preventDefault(),Ix(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=Re(i.state),t=Px(i);p(e=>Fx(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(){Ix(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()&&Lx(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()&&Lx(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)&&Lx(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)&&Lx(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,q,J;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),q=e=>d(t=>({...t,caseSensitive:e})),J=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=J):(W=t[63],G=t[64],K=t[65],q=t[66],J=t[67]);let ee;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(ee=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(Tx,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:q,onWholeWordChange:J,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=ee):ee=t[80],ee}function zx(e){return{...e,open:!1,activeIndex:0}}function Bx(e){return{...e,activeIndex:0}}var Vx=960,Hx=1024;function Ux(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Gx),[r,i]=(0,Q.useState)(Wx),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.matchMedia(`(max-width: ${Vx-1}px)`),t=window.matchMedia(`(max-width: ${Hx-1}px)`),r=()=>{let r=e.matches;n(r?`sheet`:`panel`),i(!r&&t.matches)};return e.addEventListener(`change`,r),t.addEventListener(`change`,r),()=>{e.removeEventListener(`change`,r),t.removeEventListener(`change`,r)}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o);let s;return e[2]!==r||e[3]!==t?(s={layout:t,autoCollapse:r},e[2]=r,e[3]=t,e[4]=s):s=e[4],s}function Wx(){return window.innerWidth>=Vx&&window.innerWidth<Hx}function Gx(){return window.innerWidth<Vx?`sheet`:`panel`}var Kx={words:0,chars:0,tokens:0},qx=/[ -〿-ゟ゠-ヿ㐀-䶿一-鿿豈---ក-]/,Jx=/[\p{L}\p{N}]/u,Yx=new Set([`text`,`inlineCode`,`code`,`tag`]),Xx=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),Zx=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Qx(e,t){if(!e)return;let n=e.type;if(!Xx.has(n)){if(Yx.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
|
|
@@ -28,7 +28,7 @@ Error generating stack: `+e.message+`
|
|
|
28
28
|
`)&&t.push(`
|
|
29
29
|
`)}}}}function $x(e){try{let t=We().parseToMdast(e),n=[];return Qx(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function eS(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))Jx.test(n)&&t++;return t}function tS(e){let t=globalThis.Intl.Segmenter;if(!t)return eS(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function nS(e){let t=qx.test(e)?1.5:4;return Math.ceil(e.length/t)}function rS(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=Kr(e);if(!t.trim())return{words:0,chars:0,tokens:0};let n=$x(t);return n?{words:qx.test(n)?tS(n):eS(n),chars:n.length,tokens:nS(n)}:{words:0,chars:0,tokens:0}}var iS=300;function aS(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Kx),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Kx);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(rS(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,iS)};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 oS(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function sS(e){let t=(0,$.c)(8),{poolEntries:n}=ft(),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=()=>oS(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(oS(i));let t=()=>s(oS(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 cS(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`?lS: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 lS(e){return e===`synced`?`synced`:`connected`}var uS=Hn;function dS(e,t={}){let n=re(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var fS=200,pS=`Outside any block`;function mS(e){let t=(0,$.c)(5),{editor:n}=e,r=Ut(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?hS(n,r):o.current?pS:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},fS),()=>{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 hS(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=dS(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=dS(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 gS(){let[e]=(0,Q.useState)(br);return e}function _S({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:yi(e.display_name),color:fi(e.id,Wr),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:fi(e.id,Wr),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function vS(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 yS=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&&Tr(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(Kn(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Jn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Un(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(lr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push($r(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(vi(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(_r(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(xr(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=wn(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof kr){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 qn){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():vS(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&yr(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()}},bS=e=>new Zr({key:typeof e.pluginKey==`string`?new ai(e.pluginKey):e.pluginKey,view:t=>new yS({view:t,...e})});ur.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[bS({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 xS=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 Xn(e,{textSerializers:ei(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Kn(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Jn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Un(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(lr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push($r(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(vi(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(_r(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(xr(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=wn(this.view,e.from,e.to);yr({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()}},SS=e=>new Zr({key:typeof e.pluginKey==`string`?new ai(e.pluginKey):e.pluginKey,view:t=>new xS({view:t,...e})});ur.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?[SS({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 CS(e,t){return e??new ai(t)}var wS=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,TS=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),ES=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(`.`)),DS=new Set([`children`,`className`,`style`]),OS=new Set([`tabIndex`]),kS=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),AS={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function jS(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function MS(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function NS(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||kS.has(e)}function PS(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function FS(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:AS[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function IS(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 LS(e){return OS.has(e)}function RS(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function zS(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 BS(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||ES.has(e)?String(t):`${t}px`}function VS(e,t){TS.has(t)||e.style.removeProperty(PS(t))}function HS(e,t,n){TS.has(t)||e.style.setProperty(PS(t),BS(t,n))}function US(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(DS.has(r)||!NS(r)||jS(r,t[r])||jS(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=MS(r);if(a==null||a===!1){LS(r)&&zS(e,r),e.removeAttribute(o);return}if(a===!0){LS(r)&&RS(e,r,!0),e.setAttribute(o,``);return}if(LS(r)){RS(e,r,a);return}e.setAttribute(o,String(a))})}function WS(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function GS(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){VS(e,t);return}HS(e,t,a)}})}function KS(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(!jS(t,n))return;let{eventName:i,options:a}=FS(t),o=t=>{n(IS(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function qS(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);wS(()=>{let i=n.current;return WS(e,i.className,t.className),GS(e,i.style,t.style),US(e,i,t),r.current=KS(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 JS=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)(CS(e,`bubbleMenu`)).current;qS(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Je(),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=bS({...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,Zs.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)(CS(e,`floatingMenu`)).current;qS(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Je(),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=SS({...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,Zs.createPortal)(s,u.current)});var YS=[{name:`paragraph`,label:`Text`,icon:Bc,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:St,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:R,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:D,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:oe,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:h,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Gt,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:G,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:$c,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function XS(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:ZS},t[0]=n,t[1]=r);let{current:i,activeStates:a}=je(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)(Dt,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsxs)(Di,{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=YS.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(la,{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)(ra,{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)(Da,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function ZS(e){let t=Object.fromEntries(YS.map(t=>[t.name,t.isActive(e.editor)]));return{current:YS.find(e=>t[e.name])??YS[0],activeStates:t}}function QS(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 $S(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:ht(typeof n.src==`string`?n.src:``)}function eC(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 tC(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:nC},t[0]=n,t[1]=a),je(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=QS(n);t&&eC(t,$S(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Oa,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{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)(Tn,{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)(Gr,{children:[u,d]})}),t[11]=u,t[12]=f),f}function nC(e){return QS(e.editor)}function rC(e){return QS(e)!==null}var iC=[{value:`left`,label:`Align left`,icon:it},{value:`center`,label:`Align center`,icon:nt},{value:`right`,label:`Align right`,icon:f}];function aC(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`img`&&n!==`CommonMarkImage`&&n!==`Embed`)return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function oC(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:sC},t[0]=n,t[1]=r);let i=je(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=iC.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{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(a!==`img`&&a!==`CommonMarkImage`&&a!==`Embed`||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(kr.create(u.doc,s)),Ft(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Tn,{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 sC(e){return aC(e.editor)}function cC(e){return aC(e)!==null}var lC=[{name:`bold`,icon:Xs,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘ B`},{name:`italic`,icon:Tc,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘ I`},{name:`underline`,icon:sl,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘ U`},{name:`strikethrough`,icon:rl,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘ ⇧ X`},{name:`code`,icon:oc,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘ E`},{name:`highlight`,icon:wc,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘ ⇧ H`}];function uC(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:dC},t[0]=n,t[1]=r);let i=je(r),a;t[2]!==i||t[3]!==n?(a=lC.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{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)(Tn,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(db,{children:Sr()?e.shortcut:e.shortcut.replace(`⌘`,`Ctrl`)})]})]},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 dC(e){return Object.fromEntries(lC.map(t=>[t.name,t.isActive(e.editor)]))}function fC(e){let t=(0,$.c)(60),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),d;t[0]===n?d=t[1]:(d=n.isActive(`link`),t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=n.getAttributes(`link`).href??``,t[2]=n,t[3]=p);let m=p,h,g;t[4]===n?(h=t[5],g=t[6]):(h=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},g=[n],t[4]=n,t[5]=h,t[6]=g),(0,Q.useEffect)(h,g);let _,v;t[7]!==m||t[8]!==a?(_=()=>{a&&(l(m),requestAnimationFrame(()=>u.current?.focus()))},v=[a,m],t[7]=m,t[8]=a,t[9]=_,t[10]=v):(_=t[9],v=t[10]),(0,Q.useEffect)(_,v);let y;t[11]!==n||t[12]!==f||t[13]!==c?(y=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():f&&n.chain().focus().unsetLink().run(),o(!1)},t[11]=n,t[12]=f,t[13]=c,t[14]=y):y=t[14];let b=y,x;t[15]===n?x=t[16]:(x=function(){n.chain().focus().unsetLink().run(),o(!1)},t[15]=n,t[16]=x);let S=x,C;t[17]!==b||t[18]!==n?(C=function(e){e.key===`Enter`&&(e.preventDefault(),b()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[17]=b,t[18]=n,t[19]=C):C=t[19];let w=C;if(a){let e;t[20]===r?e=t[21]:(e=r({id:`ZsGpr_`}),t[20]=r,t[21]=e);let n;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(n=e=>l(e.target.value),t[22]=n):n=t[22];let i;t[23]===r?i=t[24]:(i=r({id:`roAe2K`}),t[23]=r,t[24]=i);let a;t[25]!==w||t[26]!==e||t[27]!==i||t[28]!==c?(a=(0,Z.jsx)(`input`,{ref:u,type:`url`,placeholder:e,value:c,onChange:n,onKeyDown:w,"aria-label":i,className:`h-5 w-44 bg-transparent text-sm border-none outline-none placeholder:text-muted-foreground`}),t[25]=w,t[26]=e,t[27]=i,t[28]=c,t[29]=a):a=t[29];let o;t[30]===r?o=t[31]:(o=r({id:`tP5DDk`}),t[30]=r,t[31]=o);let d;t[32]===b?d=t[33]:(d=()=>{b()},t[32]=b,t[33]=d);let p;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(uc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[34]=p):p=t[34];let h;t[35]!==o||t[36]!==d?(h=(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-xs`,"aria-label":o,onClick:d,children:p}),t[35]=o,t[36]=d,t[37]=h):h=t[37];let g;t[38]!==a||t[39]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1`,children:[a,h]}),t[38]=a,t[39]=h,t[40]=g):g=t[40];let _;t[41]!==r||t[42]!==m||t[43]!==f||t[44]!==S?(_=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),k(m)},children:(0,Z.jsx)(ko,{className:`size-3.5`})})}),(0,Z.jsx)(Tn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),S()},children:(0,Z.jsx)(q,{className:`size-3.5`})})}),(0,Z.jsx)(Tn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[41]=r,t[42]=m,t[43]=f,t[44]=S,t[45]=_):_=t[45];let v;return t[46]!==g||t[47]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[g,_]}),t[46]=g,t[47]=_,t[48]=v):v=t[48],v}let T;t[49]===r?T=t[50]:(T=r({id:`p0Iq25`}),t[49]=r,t[50]=T);let E=f?`bg-accent text-primary`:`text-accent-foreground`,D,O;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e.preventDefault(),o(!0)},O=(0,Z.jsx)(Dc,{className:`size-3.5`}),t[51]=D,t[52]=O):(D=t[51],O=t[52]);let A;t[53]!==T||t[54]!==E?(A=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-xs`,"aria-label":T,className:E,onMouseDown:D,children:O})}),t[53]=T,t[54]=E,t[55]=A):A=t[55];let j;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(s,{id:`yzF66j`}),t[56]=j):j=t[56];let M;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(Tn,{side:`bottom`,sideOffset:8,children:[j,(0,Z.jsx)(db,{children:Sr()?`⌘ K`:`Ctrl K`})]}),t[57]=M):M=t[57];let N;return t[58]===A?N=t[59]:(N=(0,Z.jsxs)(Gr,{children:[A,M]}),t[58]=A,t[59]=N),N}function pC({editor:e}){if(Re(e.state).query||e.isActive(`codeBlock`))return!1;if(cC(e)||rC(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 mC(e){let t=(0,$.c)(22),{editor:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),s;t[0]===n?s=t[1]:(s={editor:n,selector:yC},t[0]=n,t[1]=s);let c=je(s),l;t[2]===n?l=t[3]:(l={editor:n,selector:vC},t[2]=n,t[3]=l);let u=je(l),d;t[4]!==n.state||t[5]!==n.view?(d=()=>{try{let{from:e,to:t}=n.state.selection;return wn(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=d):d=t[6];let f;if(t[7]!==n.view.dom||t[8]!==d){let e={getBoundingClientRect:d,contextElement:n.view.dom};f=()=>{let t=r.current;t&&(o.current?.(),o.current=On(e,t,()=>{yr(e,t,{placement:`top`,strategy:`fixed`,middleware:[Un(8),Kn(),Jn({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(_C)}))},t[7]=n.view.dom,t[8]=d,t[9]=f}else f=t[9];let p=f,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{o.current?.(),o.current=null,a(gC)},t[10]=m):m=t[10];let h=m,g;t[11]===p?g=t[12]:(g={onShow:p,onHide:h,strategy:`fixed`},t[11]=p,t[12]=g);let _;t[13]!==n||t[14]!==u||t[15]!==c||t[16]!==i?(_=c?(0,Z.jsx)(oC,{editor:n},`${i}-img-align`):u?(0,Z.jsx)(tC,{editor:n},`${i}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(XS,{editor:n}),(0,Z.jsx)(so,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(uC,{editor:n},i),(0,Z.jsx)(so,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(fC,{editor:n},`${i}-link`)]}),t[13]=n,t[14]=u,t[15]=c,t[16]=i,t[17]=_):_=t[17];let v;return t[18]!==n||t[19]!==g||t[20]!==_?(v=(0,Z.jsx)(JS,{ref:r,editor:n,"data-testid":`bubble-menu-bar`,appendTo:hC,shouldShow:pC,updateDelay:250,options:g,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:_}),t[18]=n,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function hC(){return document.body}function gC(e){return e+1}function _C(){}function vC(e){return rC(e.editor)}function yC(e){return cC(e.editor)}var bC=[{name:`addRowBefore`,icon:Nt,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:Be,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:q,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],xC=[{name:`addColumnBefore`,icon:Ii,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:ja,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:q,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],SC=[{name:`toggleHeaderRow`,icon:il,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:cc,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:Sc,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function CC({editor:e}){return Re(e.state).query?!1:e.isActive(`table`)}function wC(e){let t=(0,$.c)(14),{action:n,editor:r}=e,i=n.icon,a;t[0]!==n||t[1]!==r?(a=e=>{e.preventDefault(),n.command(r)},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(i,{className:`size-3.5`}),t[3]=i,t[4]=o);let s;t[5]!==n.label||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-xs`,"aria-label":n.label,className:`text-muted-foreground`,onMouseDown:a,children:o})}),t[5]=n.label,t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;t[9]===n.label?c=t[10]:(c=(0,Z.jsx)(Tn,{side:`bottom`,sideOffset:8,children:n.label}),t[9]=n.label,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,Z.jsxs)(Gr,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function TC(e){let t=(0,$.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=bC.map(e=>(0,Z.jsx)(wC,{action:e,editor:n},e.name)),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(so,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=xC.map(e=>(0,Z.jsx)(wC,{action:e,editor:n},e.name)),t[3]=n,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(so,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=SC.map(e=>(0,Z.jsx)(wC,{action:e,editor:n},e.name)),t[6]=n,t[7]=s);let c;return t[8]!==n||t[9]!==r||t[10]!==a||t[11]!==s?(c=(0,Z.jsxs)(JS,{editor:n,"data-testid":`table-controls-menu`,shouldShow:CC,updateDelay:100,className:`flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[r,i,a,o,s]}),t[8]=n,t[9]=r,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}var EC=new WeakMap;function DC(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=tr(e.color),n.textContent=e.name,t.append(n),t}var OC={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},kC=100,AC=100,jC=3,MC=250;function NC(){let e=new dr({extensions:ar});return{mdManager:e,text:xt({mdManager:e}),html:L({mdManager:e}),paste:Te({mdManager:e}),drop:P({mdManager:e})}}function PC(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...yt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e.name===`toggleHeadings`?e.configure({getDocName:()=>t.configuration.name??null}):e),uS.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),ye.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),ur.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[Pe]}}),ur.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[He(e,{cursorBuilder:DC})]}})]}function FC(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{EC.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=EC.get(e);if(EC.delete(e),r==null)return;let i=performance.now();Wt(`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:hf(PC(e))}}function IC(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=Gn(PC({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=d(t.document.getXmlFragment(`default`),a);return{...FC({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var LC=e=>{let t=(0,$.c)(21),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(OC),c=gS(),{principal:l,activeDocName:u}=ft(),d=n.configuration.name??``,[f]=(0,Q.useState)(NC),m;t[0]!==f||t[1]!==r||t[2]!==n?(m=()=>()=>({editor:new Qn(IC({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]=m):m=t[3];let[h]=(0,Q.useState)(m),g,_;if(t[4]!==h||t[5]!==d||t[6]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=p(d)??crypto.randomUUID();g=Q.use,_=x({docName:d,mountId:r,construct:h,sizeStats:e}),t[4]=h,t[5]=d,t[6]=n.document,t[7]=g,t[8]=_}else g=t[7],_=t[8];let v=g(_),y=v.editor,b,S;t[9]===v?(b=t[10],S=t[11]):(b=()=>()=>{Ht(v)},S=[v],t[9]=v,t[10]=b,t[11]=S),(0,Q.useEffect)(b,S);let C;return t[12]!==u||t[13]!==d||t[14]!==y||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==l||t[19]!==n?(C=(0,Z.jsx)(RC,{provider:n,isSourceMode:i,docName:d,activeDocName:u,identity:c,principal:l,editor:y,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[12]=u,t[13]=d,t[14]=y,t[15]=c,t[16]=i,t[17]=a,t[18]=l,t[19]=n,t[20]=C):C=t[20],C},RC=e=>{let t=(0,$.c)(85),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),p,m;t[0]===d?(p=t[1],m=t[2]):(p=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},m=[d],t[0]=d,t[1]=p,t[2]=m),(0,Q.useLayoutEffect)(p,m);let h;t[3]!==c||t[4]!==n.configuration.name?(h=()=>(Ot(c,n.configuration.name??null),()=>{Ot(c,null)}),t[3]=c,t[4]=n.configuration.name,t[5]=h):h=t[5];let g;t[6]!==c||t[7]!==n?(g=[c,n],t[6]=c,t[7]=n,t[8]=g):g=t[8],(0,Q.useEffect)(h,g);let _;t[9]!==c||t[10]!==n.configuration.name?(_=()=>{let e=n.configuration.name;if(e)return K(e,c),()=>E(e,c)},t[9]=c,t[10]=n.configuration.name,t[11]=_):_=t[11];let v;t[12]!==c||t[13]!==n?(v=[c,n],t[12]=c,t[13]=n,t[14]=v):v=t[14],(0,Q.useEffect)(_,v);let y;t[15]!==c||t[16]!==n.configuration.name?(y=()=>{},t[15]=c,t[16]=n.configuration.name,t[17]=y):y=t[17];let b;t[18]!==c||t[19]!==n?(b=[c,n],t[18]=c,t[19]=n,t[20]=b):b=t[20],(0,Q.useEffect)(y,b);let x,S;t[21]===c?(x=t[22],S=t[23]):(S=()=>{let e=zC,t=null,n=()=>{if(t||c.isDestroyed)return;let n=ue(c);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return ue(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},x=[c],t[21]=c,t[22]=x,t[23]=S),(0,Q.useEffect)(S,x);let C,w;t[24]!==i||t[25]!==c?(C=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!ue(c))return;e=!0;let t=le(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})),Wt(`ok/editor/selection-restore-failed`,{docName:i,message:n})}Lt(i)};if(ue(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},w=[c,i],t[24]=i,t[25]=c,t[26]=C,t[27]=w):(C=t[26],w=t[27]),(0,Q.useEffect)(C,w);let T,D;t[28]!==u||t[29]!==n.document||t[30]!==l?(T=()=>{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)},Ln)};c(OC);let f=()=>{if(or(e),!vr(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?vr(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},D=[n.document,u,l],t[28]=u,t[29]=n.document,t[30]=l,t[31]=T,t[32]=D):(T=t[31],D=t[32]),(0,Q.useEffect)(T,D);let O,k;t[33]!==a||t[34]!==i||t[35]!==c||t[36]!==n?(O=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<kC){e+=1,t=window.setTimeout(p,AC);return}r=null,o=null,e=0},u=function(e){let t=ue(c);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},d=function(e){let t=u(e);return t?(t.scrollIntoView({behavior:`smooth`,block:`start`}),!0):!1},f=function(e,n){let r=jC,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,MC)))};t=window.setTimeout(o,MC)};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=Yr(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},k=[n,c,i,a],t[33]=a,t[34]=i,t[35]=c,t[36]=n,t[37]=O,t[38]=k):(O=t[37],k=t[38]),(0,Q.useEffect)(O,k);let A,j;t[39]===c?(A=t[40],j=t[41]):(A=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=ue(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&r.scrollIntoView({behavior:`smooth`,block:`start`})};return window.addEventListener(Os,e),()=>window.removeEventListener(Os,e)},j=[c],t[39]=c,t[40]=A,t[41]=j),(0,Q.useEffect)(A,j);let M;t[42]!==a||t[43]!==i||t[44]!==o||t[45]!==r||t[46]!==s||t[47]!==n.awareness?(M=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:_S({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[42]=a,t[43]=i,t[44]=o,t[45]=r,t[46]=s,t[47]=n.awareness,t[48]=M):M=t[48];let N;t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==r||t[53]!==s||t[54]!==n?(N=[n,i,a,o,s,r],t[49]=a,t[50]=i,t[51]=o,t[52]=r,t[53]=s,t[54]=n,t[55]=N):N=t[55],(0,Q.useEffect)(M,N);let P,F;t[56]!==c||t[57]!==r?(P=()=>(Ae(c,r),()=>{Ae(c,!1)}),F=[c,r],t[56]=c,t[57]=r,t[58]=P,t[59]=F):(P=t[58],F=t[59]),(0,Q.useEffect)(P,F);let I;t[60]!==c||t[61]!==r?(I=!r&&(0,Z.jsx)(mC,{editor:c}),t[60]=c,t[61]=r,t[62]=I):I=t[62];let L;t[63]!==c||t[64]!==r?(L=!r&&(0,Z.jsx)(TC,{editor:c}),t[63]=c,t[64]=r,t[65]=L):L=t[65];let R;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[66]=R):R=t[66];let z;t[67]===c?z=t[68]:(z=(0,Z.jsx)(ut,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[67]=c,t[68]=z);let B;t[69]!==d||t[70]!==z?(B=(0,Zs.createPortal)(z,d),t[69]=d,t[70]=z,t[71]=B):B=t[71];let V;t[72]===c?V=t[73]:(V=(0,Z.jsx)(mS,{editor:c}),t[72]=c,t[73]=V);let H;t[74]===c?H=t[75]:(H=Tt(c),t[74]=c,t[75]=H);let U;t[76]===H.store?U=t[77]:(U=(0,Z.jsx)(tt,{store:H.store}),t[76]=H.store,t[77]=U);let W;return t[78]!==I||t[79]!==L||t[80]!==B||t[81]!==V||t[82]!==U||t[83]!==l?(W=(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:[I,L,R,B,V,U]}),t[78]=I,t[79]=L,t[80]=B,t[81]=V,t[82]=U,t[83]=l,t[84]=W):W=t[84],W};function zC(){return S()}async function BC(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:(console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:e.status})),{conflicts:[],error:`server`})}catch(e){return console.warn(JSON.stringify({event:`conflicts-fetch-failed`,status:null,detail:e instanceof Error?e.message:String(e)})),{conflicts:[],error:`network`}}}function VC(){let e=(0,$.c)(10),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(0),l;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=function(){let e=c.current+=1;BC().then(t=>{let{conflicts:n,error:i}=t;e===c.current&&(r(n),s(i??null),a(!1))})},e[1]=l):l=e[1];let u=l,d,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{u()},f=[],e[2]=d,e[3]=f):(d=e[2],f=e[3]),(0,Q.useEffect)(d,f);let p,m;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>hi(e=>{e.includes(`sync-status`)&&u()}),m=[],e[4]=p,e[5]=m):(p=e[4],m=e[5]),(0,Q.useEffect)(p,m);let h;return e[6]!==n||e[7]!==o||e[8]!==i?(h={conflicts:n,loading:i,error:o},e[6]=n,e[7]=o,e[8]=i,e[9]=h):h=e[9],h}var HC=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 UC(e,t,n,r,i,a){if(e==r)return[];let o=$C(e,t,n,r,i,a),s=ew(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 HC(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new HC(t,t+o,i,i),new HC(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 HC(t,t,i,i+o),new HC(n,n,i+o+c,a)]}if(c==1||l==1)return[new HC(t,n,i,a)];let u=nw(e,t,n,r,i,a);if(u){let[o,s,c]=u;return UC(e,t,o,r,i,s).concat(UC(e,o+c,n,r,s+c,a))}return qC(e,t,n,r,i,a)}var WC=1e9,GC=0,KC=!1;function qC(e,t,n,r,i,a){let o=n-t,s=a-i;if(WC<1e9&&Math.min(o,s)>WC*16||GC>0&&Date.now()>GC)return Math.min(o,s)>WC*64?[new HC(t,n,i,a)]:rw(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);YC.reset(c),XC.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:XC,f=d?null:YC;for(let p=0;p<c;p++){if(p>WC||GC>0&&!(p&63)&&Date.now()>GC)return rw(e,t,n,r,i,a);let m=YC.advance(p,o,s,c,d,!1,l)||XC.advance(p,o,s,c,f,!0,u);if(m)return ZC(e,t,n,t+m[0],r,i,a,i+m[1])}return[new HC(t,n,i,a)]}var JC=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}},YC=new JC,XC=new JC;function ZC(e,t,n,r,i,a,o,s){let c=!1;return!vw(e,r)&&++r==n&&(c=!0),!vw(i,s)&&++s==o&&(c=!0),c?[new HC(t,n,a,o)]:UC(e,t,r,i,a,s).concat(UC(e,r,n,i,s,o))}function QC(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function $C(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=QC(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-+!vw(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function ew(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=QC(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-+!vw(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function tw(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;;){vw(e,s)||s++;let u=s+o;if(vw(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=$C(e,u,n,r,i+f+d.length,a),c=ew(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 nw(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=nw(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:tw(e,t,n,r,i,a,Math.floor(o/4),-1)}function rw(e,t,n,r,i,a){KC=!0;let o=n-t,s=a-i,c;if(o<s){let s=tw(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=tw(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new HC(t,n,i,a)];let[l,u,d]=c;return UC(e,t,l,r,i,u).concat(UC(e,l+d,n,r,u+d,a))}function iw(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 HC(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function aw(e,t,n){for(;;){iw(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=$C(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new HC(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=ew(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new HC(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 HC(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 HC(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function ow(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=pw(t,a.fromA,l),f=fw(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 HC(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=fw(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new HC(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=pw(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new HC(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=hw(n,a.fromB,a.toB),r,o=t<0?-1:mw(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=hw(t,a.fromA,a.toA),r,o=n<0?-1:mw(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 iw(e,3),e}var sw;try{sw=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function cw(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function lw(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!cw(n):sw?!gw(n)||t==e.length-1?+!!sw.test(String.fromCharCode(n)):sw.test(e.slice(t,t+2))?2:0:0}function uw(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!cw(n):sw?!_w(n)||t==1?+!!sw.test(String.fromCharCode(n)):sw.test(e.slice(t-2,t))?2:0:0}var dw=8;function fw(e,t,n){if(t==e.length||!uw(e,t))return t;for(let r=t,i=t+n,a=0;a<dw;a++){let t=lw(e,r);if(!t||r+t>i)return r;r+=t}return t}function pw(e,t,n){if(!t||!lw(e,t))return t;for(let r=t,i=t-n,a=0;a<dw;a++){let t=uw(e,r);if(!t||r-t<i)return r;r-=t}return t}function mw(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function hw(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var gw=e=>e>=55296&&e<=56319,_w=e=>e>=56320&&e<=57343;function vw(e,t){return!t||t==e.length||!gw(e.charCodeAt(t-1))||!_w(e.charCodeAt(t))}function yw(e,t,n){let r=n?.override;return r?r(e,t):(WC=(n?.scanLimit??1e9)>>1,GC=n?.timeout?Date.now()+n.timeout:0,KC=!1,aw(e,t,UC(e,0,e.length,t,0,t.length)))}function bw(){return!KC}function xw(e,t,n){return ow(yw(e,t,n),e,t)}var Sw=hs.define({combine:e=>e[0]}),Cw=gs.define(),ww=hs.define(),Tw=us.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Cw)&&(e=n.value);for(let n of t.state.facet(ww))e=n(e,t);return e}});function Ew(e){let t=e.field(Tw,!1);if(!t)return null;let n=e.facet(Sw);return{chunks:t,side:n?n.side:null}}var Dw=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 Aw(xw(e.toString(),t.toString(),n),e,t,0,0,bw())}static updateA(e,t,n,r,i){return Pw(Nw(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return Pw(Nw(e,r,!1,t.length),e,t,n,i)}};function Ow(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 kw(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 Aw(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Ow(c.fromA+r,c.fromB+i,t,n),[d,f]=kw(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]=Ow(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]=kw(a.toA+r,a.toB+i,t,n),s++}o.push(new Dw(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var jw=1e3;function Mw(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 Nw(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>jw&&([l,d]=Mw(e,a-jw,n,!0)),o<t.length-jw&&([u,f]=Mw(e,o+jw,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 Pw(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=xw(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Aw(h,n,r,d,f,bw()))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 Fw={scanLimit:500},Iw=_s.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Kw(e))}update(e){(e.docChanged||e.viewportChanged||Rw(e.startState,e.state)||zw(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Kw(e.view))}},{decorations:e=>e.deco}),Lw=ss.low(xs({class:`cm-changeGutter`,markers:e=>e.plugin(Iw)?.gutter||ws.empty}));function Rw(e,t){return e.field(Tw,!1)!=t.field(Tw,!1)}function zw(e,t){return e.facet(Sw)!=t.facet(Sw)}var Bw=ps.line({class:`cm-changedLine`}),Vw=ps.mark({class:`cm-changedText`}),Hw=ps.mark({tagName:`ins`,class:`cm-insertedLine`}),Uw=ps.mark({tagName:`del`,class:`cm-deletedLine`}),Ww=new class extends bs{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Gw(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,Bw),i.add(o,s,n?Uw:Hw),a&&a.add(o,o,Ww);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,Bw),a&&a.add(u,u,Ww);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,Vw),s<t)c++;else break}u=t}}}function Kw(e){let t=e.state.field(Tw),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Sw),o=n==`a`,s=new ms,c=i?new ms: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))&&Gw(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var qw=class extends os{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}},Jw=gs.define({map:(e,t)=>e.map(t)}),Yw=us.define({create:()=>ps.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Jw))return e.value;return e.map(t.changes)},provide:e=>ys.decorations.from(e)}),Xw=.01;function Zw(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 Qw(e,t,n){let r=new ms,i=new ms,a=e.state.field(Yw).iter(),o=t.state.field(Yw).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<-Xw?(l-=n,r.add(s,s,ps.widget({widget:new qw(-n),block:!0,side:-1}))):n>Xw&&(u+=n,i.add(c,c,ps.widget({widget:new qw(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<Xw?r.add(e.state.doc.length,e.state.doc.length,ps.widget({widget:new qw(-p),block:!0,side:1})):p>Xw&&i.add(t.state.doc.length,t.state.doc.length,ps.widget({widget:new qw(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Zw(m,e.state.field(Yw))||e.dispatch({effects:Jw.of(m)}),Zw(h,t.state.field(Yw))||t.dispatch({effects:Jw.of(h)})}var $w=gs.define({map:(e,t)=>t.mapPos(e)}),eT=class extends os{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:$w.of(n)});let{side:r,sibling:i}=e.state.facet(Sw);i&&i().dispatch({effects:$w.of(tT(n,e.state.field(Tw),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function tT(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 nT=us.define({create(e){return ps.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is($w)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>ys.decorations.from(e)});function rT({margin:e=3,minSize:t=4}){return nT.init(n=>iT(n,e,t))}function iT(e,t,n){let r=new ms,i=e.facet(Sw).side==`a`,a=e.field(Tw),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,ps.replace({widget:new eT(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var aT=ys.styleModule.of(new Ss({".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`}})),oT=ys.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`}}),sT=new vs,cT=new vs,lT=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Fw;let t=[ss.low(Iw),oT,aT,Yw,ys.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Jw)))&&this.measure()})],n=[Sw.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Lw);let r=ls.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],ys.editorAttributes.of({class:`cm-merge-a`}),cT.of(n),t]}),i=[Sw.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Lw);let a=ls.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],ys.editorAttributes.of({class:`cm-merge-b`}),cT.of(i),t]});this.chunks=Dw.build(r.doc,a.doc,this.diffConf);let o=[Tw.init(()=>this.chunks),sT.of(e.collapseUnchanged?rT(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 ys({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new ys({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),cs.empty(e[0].startState.doc.length));this.chunks=t==this.a?Dw.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Dw.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Cw.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Cw.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(Sw),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(cT.reconfigure([Sw.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Lw:[]])),a.push(cT.reconfigure([Sw.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Lw:[]]))}if(r){let t=sT.reconfigure(e.collapseUnchanged?rT(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(){Qw(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=uT(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=uT(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 uT(e){let t=e.nextSibling;return e.remove(),t}var dT=new class extends bs{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},fT=ss.low(xs({class:`cm-changeGutter`,markers:e=>e.plugin(Iw)?.gutter||ws.empty,widgetMarker:(e,t)=>t instanceof _T?dT:null}));function pT(e){let t=typeof e.original==`string`?fs.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Fw;return[ss.low(Iw),ST,oT,ys.editorAttributes.of({class:`cm-merge-b`}),ww.of((e,t)=>{let r=t.effects.find(e=>e.is(mT));return r&&(e=Dw.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Dw.updateB(e,t.state.field(hT),t.newDoc,t.changes,n)),e}),Sw.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?OT:void 0,side:`b`}),hT.init(()=>t),e.gutter===!1?[]:fT,e.collapseUnchanged?rT(e.collapseUnchanged):[],Tw.init(e=>Dw.build(t,e.doc,n))]}var mT=gs.define(),hT=us.define({create:()=>fs.empty,update(e,t){for(let n of t.effects)n.is(mT)&&(e=n.value.doc);return e}}),gT=new WeakMap,_T=class extends os{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 vT(e,t,n){let r=gT.get(t.changes);if(r)return r;let i=ps.widget({block:!0,side:-1,widget:new _T(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Sw),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(),yT(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),bT(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(hT).sliceString(t.fromA,t.endA),u=a&&e.facet(Ts),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
|
|
30
30
|
`){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
|
|
31
|
-
`,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;ds(t,{style:t=>Es(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 gT.set(t.changes,i),i}function yT(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Tw).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(hT);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=cs.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:mT.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function bT(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Tw).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(hT).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 xT(e){let t=new ms;for(let n of e.field(Tw)){let r=e.facet(Sw).overrideChunk&&wT(e,n);t.add(n.fromB,n.fromB,vT(e,n,!!r))}return t.finish()}var ST=us.define({create:e=>xT(e),update(e,t){return t.state.field(Tw,!1)==t.startState.field(Tw,!1)?e:xT(t.state)},provide:e=>ys.decorations.from(e)}),CT=new WeakMap;function wT(e,t){let n=CT.get(t);if(n!==void 0)return n;n=null;let r=e.field(hT),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(ps.widget({widget:new TT(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Vw.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return CT.set(t,n),n}var TT=class extends os{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}},ET=new class extends bs{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},DT=ps.line({class:`cm-inlineChangedLine`});function OT(e,t,n,r){let i=wT(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,ET),n.add(o.from,o.from,DT);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 kT=Rt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),AT=_({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function jT(e){let t=(0,$.c)(24),{oldContent:n,newContent:r,layout:a,conflictMode:o,oursOverride:c,onResolve:l,onAbort:u}=e,{_:d}=i(),f=c??r,p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),{resolvedTheme:h}=Pn(),g=(0,Q.useRef)(l),_=(0,Q.useRef)(u),[v,y]=(0,Q.useState)(null),x;t[0]!==u||t[1]!==l?(x=()=>{g.current=l,_.current=u},t[0]=u,t[1]=l,t[2]=x):x=t[2],(0,Q.useEffect)(x);let S,C;t[3]!==o||t[4]!==f||t[5]!==a||t[6]!==n||t[7]!==h?(S=()=>{if(!p.current)return;let e=h===`dark`?kT:AT,t=[ys.editable.of(!1),ls.readOnly.of(!0)],r=[js,b(),...t,e,ys.lineWrapping];if(m.current&&=(m.current.destroy(),null),o){let t=new ys({doc:f,extensions:[js,b(),ys.editable.of(!1),e,ys.lineWrapping,pT({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),ys.updateListener.of(e=>{let t=Ew(e.state);y(t?t.chunks.length:0)})],parent:p.current});m.current=t;let r=Ew(t.state);y(r?r.chunks.length:0)}else a===`split`?m.current=new lT({a:{doc:n,extensions:r},b:{doc:f,extensions:r},parent:p.current,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):m.current=new ys({doc:f,extensions:[...r,pT({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:p.current});return()=>{m.current&&=(m.current.destroy(),null)}},C=[n,f,a,h,o],t[3]=o,t[4]=f,t[5]=a,t[6]=n,t[7]=h,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){let e=m.current;!e||!(e instanceof ys)||g.current?.(e.state.doc.toString())},t[10]=w):w=t[10];let T=w,E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=m.current;!e||!(e instanceof ys)||H(e)},t[11]=E):E=t[11];let D=E,O=v===0,k;t[12]!==d||t[13]!==v?(k=v===null?``:v===0?d({id:`lPzyrU`}):Y._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[12]=d,t[13]=v,t[14]=k):k=t[14];let A=k,j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`div`,{ref:p,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[15]=j):j=t[15];let M;t[16]!==O||t[17]!==o||t[18]!==A||t[19]!==u||t[20]!==l?(M=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 ${O?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:A}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&(0,Z.jsx)(Di,{variant:`ghost`,size:`sm`,onClick:u,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(Di,{variant:`outline`,size:`sm`,onClick:D,children:`Undo`}),l&&(0,Z.jsx)(Di,{variant:`default`,size:`sm`,disabled:!O,onClick:T,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[16]=O,t[17]=o,t[18]=A,t[19]=u,t[20]=l,t[21]=M):M=t[21];let N;return t[22]===M?N=t[23]:(N=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[j,M]}),t[22]=M,t[23]=N),N}async function MT(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 NT(e,t){return MT(e,`content`,t)}async function PT(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();return{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``}}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 FT(e){let t=(0,$.c)(24),{docName:n}=e,{conflicts:r,loading:i}=VC(),a;if(t[0]!==r||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Or(e.file)===n,t[3]=n,t[4]=e),a=r.find(e),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o=a,s=o?.file??`${n}.md`,[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),f,p;t[5]===n?(f=t[6],p=t[7]):(f=()=>(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}))}),p=[n],t[5]=n,t[6]=f,t[7]=p),(0,Q.useEffect)(f,p);let m=i||o===void 0,h,g;t[8]!==m||t[9]!==s?(h=()=>{if(m)return;let e=!1;return l(null),d(!1),PT(s).then(t=>{e||(t===null?d(!0):l(t))}),()=>{e=!0}},g=[s,m],t[8]=m,t[9]=s,t[10]=h,t[11]=g):(h=t[10],g=t[11]),(0,Q.useEffect)(h,g);let _;t[12]===s?_=t[13]:(_=async function(e){let t=await NT(s,e);t.ok||qo.error(`Failed to save resolution for ${s}`,{description:t.detail})},t[12]=s,t[13]=_);let v=_;if(u){let e;return t[14]===s?e=t[15]:(e=(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:[`Couldn't load conflict content for `,s,`. Try reloading the page.`]}),t[14]=s,t[15]=e),e}if(c===null){let e;return t[16]===s?e=t[17]:(e=(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:[`Loading conflict for `,s]}),t[16]=s,t[17]=e),e}let y;t[18]===v?y=t[19]:(y=e=>void v(e),t[18]=v,t[19]=y);let b;return t[20]!==c.ours||t[21]!==c.theirs||t[22]!==y?(b=(0,Z.jsx)(jT,{oldContent:c.theirs,newContent:c.ours,layout:`unified`,conflictMode:!0,onResolve:y}),t[20]=c.ours,t[21]=c.theirs,t[22]=y,t[23]=b):b=t[23],b}function IT(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Mt(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 LT=`__back-nav__`;function RT(e){return e instanceof Ie||e instanceof gt||e instanceof Ne||e instanceof $e||e instanceof Et||e instanceof Bt?e.docName:null}function zT(e){if(e instanceof Ie){let t=e.docName;return{title:Y._({id:`Jejur6`}),summary:Y._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof gt){let t=e.docName;return{title:Y._({id:`V7QxyT`}),summary:Y._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Ne){let t=e.docName;return{title:Y._({id:`1di5fu`}),summary:Y._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof $e){let t=e.docName;return{title:Y._({id:`wvbc1r`}),summary:Y._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Et)return{title:Y._({id:`Gfr4fu`}),summary:Y._({id:`j6LB7S`})};if(e instanceof Bt){let t=e.docName;return{title:Y._({id:`vv7kpg`}),summary:Y._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Y._({id:`W5A0Ly`});return{title:Y._({id:`29VNqC`}),summary:t}}function BT(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=zT(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)(ab,{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)(Di,{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)(Di,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(ot(RT(n)??i),o(a),r(LT))},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 VT(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)(BT,{...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]===LT){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}: ${zT(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)(m,{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 HT(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=pi(t);return{map:n,keys:jn(t),parseError:r}}function UT(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>HT(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=Jr(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=Xe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=lt(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)(WT,{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)(GT,{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 WT(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 GT(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 KT(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=pi(t);return{map:n,keys:jn(t),parseError:r}}function qT(e){let t=(0,$.c)(175),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>KT(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=Jr(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]===j?M=t[9]:(M=ZT(j),t[8]=j,t[9]=M);let N=M,P;t[10]===j?P=t[11]:(P=YT(j),t[10]=j,t[11]=P);let F=no(N?null:P),I;t[12]!==F||t[13]!==N?(I=!N&&F.state.status===`ready`?F.state.data.folder.frontmatter_defaults??{}:{},t[12]=F,t[13]=N,t[14]=I):I=t[14];let L=I,R;t[15]!==F||t[16]!==N?(R=!N&&F.state.status===`ready`?F.state.data.frontmatterSources:{},t[15]=F,t[16]=N,t[17]=R):R=t[17];let z=R,B;t[18]!==r||t[19]!==a?(B=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=Zn(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[18]=r,t[19]=a,t[20]=B):B=t[20];let V=B,H;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[21]=H):H=t[21];let U=H,W;t[22]===r?W=t[23]:(W=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[22]=r,t[23]=W);let G=W,K;t[24]!==V||t[25]!==G?(K=function(e,t){U(e),G(V({[e]:t}),[e])},t[24]=V,t[25]=G,t[26]=K):K=t[26];let q=K,J;t[27]!==V||t[28]!==G?(J=function(e){U(e),G(V({[e]:null}),[e])},t[27]=V,t[28]=G,t[29]=J):J=t[29];let ee=J,ne;t[30]!==r||t[31]!==a?(ne=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=Zn(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[30]=r,t[31]=a,t[32]=ne):ne=t[32];let re=ne,ie;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e,t){return`${e} ${t}`},t[33]=ie):ie=t[33];let ae=ie,oe;t[34]!==a||t[35]!==m?(oe=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)=>ae(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[34]=a,t[35]=m,t[36]=oe):oe=t[36];let se=oe,ce;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ce={activationConstraint:{distance:4}},t[37]=ce):ce=t[37];let le;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(le={coordinateGetter:ma},t[38]=le):le=t[38];let ue=ka(qi(xa,ce),qi(ua,le)),de;t[39]!==L||t[40]!==q||t[41]!==p?(de=function(e,t){let n=p[e]??QT(L[e]);if(n===void 0)return;b(n=>({...n,[e]:t}));let r=ga(n,t);(!Object.hasOwn(p,e)||!JT(n,r))&&q(e,r)},t[39]=L,t[40]=q,t[41]=p,t[42]=de):de=t[42];let fe=de,pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[43]=pe):pe=t[43];let me=pe,{addPropertySignal:he,clearAddProperty:ge}=Qb(),_e;t[44]!==he||t[45]!==j?(_e=he.get(j)??0,t[44]=he,t[45]=j,t[46]=_e):_e=t[46];let ve=_e,ye,be;t[47]===ve?(ye=t[48],be=t[49]):(ye=()=>{ve>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},be=[ve],t[47]=ve,t[48]=ye,t[49]=be),(0,Q.useEffect)(ye,be);let xe,Se;t[50]!==ge||t[51]!==j?(xe=()=>()=>ge(j),Se=[j,ge],t[50]=ge,t[51]=j,t[52]=xe,t[53]=Se):(xe=t[52],Se=t[53]),(0,Q.useEffect)(xe,Se);let Ce;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Zi[e];return{...t,type:e,value:n,error:null}})},t[54]=Ce):Ce=t[54];let we=Ce,Te;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){S(t=>t&&{...t,value:e})},t[55]=Te):Te=t[55];let Ee=Te,De;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(e){S(t=>t&&{...t,name:e,error:null})},t[56]=De):De=t[56];let Oe=De,ke;t[57]!==r||t[58]!==x||t[59]!==V||t[60]!==p?(ke=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=V({[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[57]=r,t[58]=x,t[59]=V,t[60]=p,t[61]=ke):ke=t[61];let Ae=ke,je;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(je=function(){S(null)},t[62]=je):je=t[62];let Me=je,Ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){w({key:e,draft:e,error:null})},t[63]=Ne):Ne=t[63];let Pe=Ne,Fe;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(e){w(t=>t&&{...t,draft:e,error:null})},t[64]=Fe):Fe=t[64];let Ie=Fe,Le;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Le=function(){w(null)},t[65]=Le):Le=t[65];let Re=Le,ze;t[66]!==r||t[67]!==p||t[68]!==re||t[69]!==C?(ze=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=re(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}),U(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[66]=r,t[67]=p,t[68]=re,t[69]=C,t[70]=ze):ze=t[70];let Be=ze,Ve;t[71]!==p||t[72]!==m?(Ve=m.length>0?m:Object.keys(p),t[71]=p,t[72]=m,t[73]=Ve):Ve=t[73];let He=Ve,Ue;if(t[74]!==He){Ue=new Map;for(let e of He)Ue.set(e,(Ue.get(e)??0)+1);t[74]=He,t[75]=Ue}else Ue=t[75];let We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt;if(t[76]!==x||t[77]!==L||t[78]!==z||t[79]!==g||t[80]!==q||t[81]!==Be||t[82]!==Ue||t[83]!==E||t[84]!==se||t[85]!==p||t[86]!==y||t[87]!==h||t[88]!==ee||t[89]!==C||t[90]!==He||t[91]!==k||t[92]!==ue||t[93]!==fe){tt=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(L).filter(e=>!Object.hasOwn(p,e)).sort();if(He.length===0&&e.length===0&&!x&&!h){tt=null;break bb0}$e=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,et=`property-panel`,Ge=Qo,Xe=!g,t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=e=>_(!e),t[106]=Ze):Ze=t[106];let n=!g,r;t[107]===n?r=t[108]:(r=(0,Z.jsx)(Jo,{"data-expanded":n,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[107]=n,t[108]=r);let i;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[109]=i):i=t[109],t[110]===r?Qe=t[111]:(Qe=(0,Z.jsx)(Zo,{asChild:!0,children:(0,Z.jsxs)(Di,{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:[r,i]})}),t[110]=r,t[111]=Qe),We=Xo,Ke=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[112]===h?qe=t[113]:(qe=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)(An,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`UG-Phk`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[112]=h,t[113]=qe);let a;if(t[114]!==He){let e;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>ae(e,t),t[116]=e):e=t[116],a=He.map(e),t[114]=He,t[115]=a}else a=t[115];let o;if(t[117]!==q||t[118]!==Be||t[119]!==Ue||t[120]!==E||t[121]!==p||t[122]!==y||t[123]!==ee||t[124]!==C||t[125]!==He||t[126]!==k||t[127]!==fe){let e;t[129]!==q||t[130]!==Be||t[131]!==Ue||t[132]!==E||t[133]!==p||t[134]!==y||t[135]!==ee||t[136]!==C||t[137]!==k||t[138]!==fe?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??Br(n),i=C?.key===e?C:null,a=(Ue.get(e)??0)>1;return(0,Z.jsx)(Ta,{sortableId:ae(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Pe(e),onChangeDraft:Ie,onCommit:Be,onCancel:Re},onCommit:t=>q(e,t),onChangeType:t=>fe(e,t),onRemove:()=>ee(e)},`${e}-${t}`)},t[129]=q,t[130]=Be,t[131]=Ue,t[132]=E,t[133]=p,t[134]=y,t[135]=ee,t[136]=C,t[137]=k,t[138]=fe,t[139]=e):e=t[139],o=He.map(e),t[117]=q,t[118]=Be,t[119]=Ue,t[120]=E,t[121]=p,t[122]=y,t[123]=ee,t[124]=C,t[125]=He,t[126]=k,t[127]=fe,t[128]=o}else o=t[128];let c;t[140]!==a||t[141]!==o?(c=(0,Z.jsx)(Gi,{items:a,strategy:ta,children:o}),t[140]=a,t[141]=o,t[142]=c):c=t[142],t[143]!==se||t[144]!==ue||t[145]!==c?(Je=(0,Z.jsx)(oa,{sensors:ue,collisionDetection:To,onDragEnd:se,children:c}),t[143]=se,t[144]=ue,t[145]=c,t[146]=Je):Je=t[146];let l;t[147]!==L||t[148]!==z||t[149]!==q||t[150]!==E||t[151]!==k||t[152]!==fe?(l=e=>{let t=L[e],n=QT(t),r=Br(n),i=z[e]??``;return(0,Z.jsx)(Ta,{keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isInherited:!0,badge:(0,Z.jsx)($i,{source:i}),onCommit:t=>q(e,t),onChangeType:t=>fe(e,t)},`inherited-${e}`)},t[147]=L,t[148]=z,t[149]=q,t[150]=E,t[151]=k,t[152]=fe,t[153]=l):l=t[153],Ye=e.map(l)}t[76]=x,t[77]=L,t[78]=z,t[79]=g,t[80]=q,t[81]=Be,t[82]=Ue,t[83]=E,t[84]=se,t[85]=p,t[86]=y,t[87]=h,t[88]=ee,t[89]=C,t[90]=He,t[91]=k,t[92]=ue,t[93]=fe,t[94]=We,t[95]=Ge,t[96]=Ke,t[97]=qe,t[98]=Je,t[99]=Ye,t[100]=Xe,t[101]=Ze,t[102]=Qe,t[103]=$e,t[104]=et,t[105]=tt}else We=t[94],Ge=t[95],Ke=t[96],qe=t[97],Je=t[98],Ye=t[99],Xe=t[100],Ze=t[101],Qe=t[102],$e=t[103],et=t[104],tt=t[105];if(tt!==Symbol.for(`react.early_return_sentinel`))return tt;let nt;t[154]!==r||t[155]!==x||t[156]!==Ae?(nt=x?(0,Z.jsx)(yo,{draft:x,onChangeName:Oe,onChangeType:we,onChangeValue:Ee,onCommit:Ae,onCancel:Me}):(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)(Di,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:me,"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)(te,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[154]=r,t[155]=x,t[156]=Ae,t[157]=nt):nt=t[157];let rt;t[158]!==We||t[159]!==Ke||t[160]!==qe||t[161]!==Je||t[162]!==Ye||t[163]!==nt?(rt=(0,Z.jsxs)(We,{className:Ke,children:[qe,Je,Ye,nt]}),t[158]=We,t[159]=Ke,t[160]=qe,t[161]=Je,t[162]=Ye,t[163]=nt,t[164]=rt):rt=t[164];let it;t[165]!==Ge||t[166]!==Xe||t[167]!==Ze||t[168]!==Qe||t[169]!==rt?(it=(0,Z.jsxs)(Ge,{open:Xe,onOpenChange:Ze,children:[Qe,rt]}),t[165]=Ge,t[166]=Xe,t[167]=Ze,t[168]=Qe,t[169]=rt,t[170]=it):it=t[170];let at;return t[171]!==$e||t[172]!==et||t[173]!==it?(at=(0,Z.jsx)(`div`,{className:$e,"data-testid":et,children:it}),t[171]=$e,t[172]=et,t[173]=it,t[174]=at):at=t[174],at}function JT(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function YT(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var XT=/(^|\/)\.ok\/templates\//;function ZT(e){return XT.test(e)}function QT(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}var $T=Fe(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function eE(e){let t=e.threshold??$T;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function tE(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var nE=Fe(`ACTIVITY_MOUNT_LIMIT`,3);function rE(){return n(()=>import(`./SourceEditor-ZzF4LdYG.js`),__vite__mapDeps([44,1,33,2,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,45,22]),import.meta.url)}var iE=(0,Q.lazy)(async()=>({default:(await rE()).SourceEditor}));function aE(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 oE(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Y._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Y._({id:`Sc1bKE`,values:{docName:e}}):Y._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Y._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Y._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Y._({id:`bmC18N`,values:{docName:e}}):Y._({id:`pAgkuZ`,values:{docName:e}})}:null}function sE(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(It,{name:`activity-pool`,children:(0,Z.jsx)(cE,{...e})}),t[0]=e,t[1]=n),n}function cE(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ft(),{pages:u,loading:d}=si(),f=aE(c,n,nE),p=(0,Q.useRef)(``),m=f.map(lE).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)at(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;rt(e,t&&t.length>0?t:crypto.randomUUID())}Wt(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,y(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(hE,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let b=f.map(v),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function lE(e){return e.docName}function uE(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&&Wt(`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&&(Wt(`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&&Wt(`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 dE(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)(Sy,{}),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)(iE,{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 fE(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)(Wc,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(B,{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)(Di,{type:`button`,onClick:pE,children:[(0,Z.jsx)(Wc,{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 pE(){return window.location.reload()}function mE(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 hE(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=oE(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,m=sS(n.docName)===`conflict`,h;t[3]===n.docName?h=t[4]:(h=()=>{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]=h);let[g]=(0,Q.useState)(h),_=n.provider.document.getText(`source`).length,[v,y]=(0,Q.useState)(i),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==v||t[7]!==b?(S=()=>{i&&!v?y(!0):!i&&!b&&x(!0)},C=[i,v,b],t[5]=i,t[6]=v,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=eE({ytextLength:_,isSourceMode:i,visitedSource:v,visitedVisual:b}),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]!==_?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&Wt(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:_,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,_,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]=_,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=()=>le(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]!==_?(P=()=>{tE({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(Wt(`ok/cold/first-toggle`,{docName:n.docName,mountId:p(n.docName),ytextLength:_,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,_,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]=_,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,z;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==m||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==g||t[41]!==s||t[42]!==f||t[43]!==j?(z=f?(0,Z.jsx)(fE,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(VT,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(mE,{html:j}):(0,Z.jsx)(Sy,{}),children:(0,Z.jsx)(IT,{docName:n.docName,provider:n.provider,children:m?(0,Z.jsx)(FT,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(UT,{provider:n.provider}),!i&&(0,Z.jsx)(qT,{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)(dE,{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)(LC,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:g},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=m,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=g,t[41]=s,t[42]=f,t[43]=j,t[44]=z):z=t[44];let B;t[45]!==r||t[46]!==R||t[47]!==z?(B=(0,Z.jsx)(uE,{isActive:r,initialScrollTop:R,children:z}),t[45]=r,t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;return t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:B}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52],V}function gE(e){let t=(0,$.c)(36),{stats:n}=e,{_:r}=i(),{words:a,chars:o,tokens:c}=n,l;t[0]===r?l=t[1]:(l=r({id:`L1ZE3M`}),t[0]=r,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[2]=u):u=t[2];let d;t[3]===n.words?d=t[4]:(d=n.words.toLocaleString(),t[3]=n.words,t[4]=d);let f;t[5]===d?f=t[6]:(f=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d}),t[5]=d,t[6]=f);let p;t[7]===a?p=t[8]:(p=(0,Z.jsx)(s,{id:`gljvbT`,values:{words:a}}),t[7]=a,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,` `,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.chars?h=t[13]:(h=n.chars.toLocaleString(),t[12]=n.chars,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:h}),t[14]=h,t[15]=g);let _;t[16]===o?_=t[17]:(_=(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:o}}),t[16]=o,t[17]=_);let v;t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`span`,{children:[g,` `,_]}),t[18]=g,t[19]=_,t[20]=v):v=t[20];let y=n.tokens>0?`~`:``,b;t[21]===n.tokens?b=t[22]:(b=n.tokens.toLocaleString(),t[21]=n.tokens,t[22]=b);let x;t[23]===b?x=t[24]:(x=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:b}),t[23]=b,t[24]=x);let S;t[25]===c?S=t[26]:(S=(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:c}}),t[25]=c,t[26]=S);let C;t[27]!==y||t[28]!==x||t[29]!==S?(C=(0,Z.jsxs)(`span`,{children:[y,x,` `,S]}),t[27]=y,t[28]=x,t[29]=S,t[30]=C):C=t[30];let w;return t[31]!==l||t[32]!==v||t[33]!==C||t[34]!==m?(w=(0,Z.jsxs)(`section`,{"aria-label":l,className:`relative flex h-6 shrink-0 items-center justify-end gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[u,m,v,C]}),t[31]=l,t[32]=v,t[33]=C,t[34]=m,t[35]=w):w=t[35],w}function _E(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=X(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 vE(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=X(`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 yE(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=X(`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 bE(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=X(`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 xE(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=X(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Jo,{}),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 SE=1,CE=2,wE=4;function TE(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}=Ye(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>wE?[...u.slice(0,SE).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(SE,-CE)},...u.slice(-CE).map((e,t)=>d(e,u.length-CE+t))]:u.map((e,t)=>d(e,t));a=_E,t[8]===r?c=t[9]:(c=X(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=vE,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(EE)}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 EE(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(xE,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(yE,{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)(pc,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(yE,{className:`min-w-0`,children:(0,Z.jsx)(bE,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var DE={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`},OE=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`,...DE,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},kE=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)(OE,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},AE=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)(OE,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function jE(e){let t=(0,$.c)(60),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===n?p=t[1]:(p=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(TE,{docName:n})}),t[0]=n,t[1]=p);let m=r?`source`:`wysiwyg`,h;t[2]===o?h=t[3]:(h=e=>{e&&o(e)},t[2]=o,t[3]=h);let g;t[4]===f?g=t[5]:(g=f({id:`n7aopT`}),t[4]=f,t[5]=g);let _;t[6]===f?_=t[7]:(_=f({id:`ur2XSb`}),t[6]=f,t[7]=_);let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)($n,{children:(0,Z.jsx)(AE,{className:`size-4`})}),t[8]=v):v=t[8];let y;t[9]===_?y=t[10]:(y=(0,Z.jsx)(Do,{value:`wysiwyg`,"aria-label":_,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:v}),t[9]=_,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[11]=b):b=t[11];let x;t[12]===y?x=t[13]:(x=(0,Z.jsxs)(Gr,{children:[y,b]}),t[12]=y,t[13]=x);let S;t[14]===f?S=t[15]:(S=f({id:`xbdtfY`}),t[14]=f,t[15]=S);let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(kE,{className:`size-4`}),t[16]=C):C=t[16];let w;t[17]!==a||t[18]!==S?(w=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Do,{value:`source`,"aria-label":S,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:C})})}),t[17]=a,t[18]=S,t[19]=w):w=t[19];let T;t[20]===a?T=t[21]:(T=(0,Z.jsx)(Tn,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[20]=a,t[21]=T);let E;t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(Gr,{children:[w,T]}),t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]!==E||t[26]!==m||t[27]!==h||t[28]!==g||t[29]!==x?(D=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(Ao,{type:`single`,value:m,onValueChange:h,"aria-label":g,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[x,E]})}),t[25]=E,t[26]=m,t[27]=h,t[28]=g,t[29]=x,t[30]=D):D=t[30];let O;t[31]!==p||t[32]!==D?(O=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[p,D]})}),t[31]=p,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==f||t[35]!==l||t[36]!==c?(k=c&&(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)($n,{children:(0,Z.jsx)(kc,{})})}),(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[34]=f,t[35]=l,t[36]=c,t[37]=k):k=t[37];let A=!u,j;t[38]!==f||t[39]!==u?(j=f(u?{id:`6iDEWA`}:{id:`170Js2`}),t[38]=f,t[39]=u,t[40]=j):j=t[40];let M;t[41]===u?M=t[42]:(M=(0,Z.jsx)($n,{children:u?(0,Z.jsx)(Rc,{}):(0,Z.jsx)(Lc,{})}),t[41]=u,t[42]=M);let N;t[43]!==d||t[44]!==A||t[45]!==j||t[46]!==M?(N=(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,onClick:d,"aria-expanded":A,"aria-label":j,asChild:!0,children:M}),t[43]=d,t[44]=A,t[45]=j,t[46]=M,t[47]=N):N=t[47];let P;t[48]===u?P=t[49]:(P=(0,Z.jsx)(Tn,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`6iDEWA`}):(0,Z.jsx)(s,{id:`170Js2`})}),t[48]=u,t[49]=P);let F;t[50]!==N||t[51]!==P?(F=(0,Z.jsxs)(Gr,{children:[N,P]}),t[50]=N,t[51]=P,t[52]=F):F=t[52];let I;t[53]!==k||t[54]!==F?(I=(0,Z.jsxs)(`div`,{className:`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,children:[k,F]}),t[53]=k,t[54]=F,t[55]=I):I=t[55];let L;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[56]=L):L=t[56];let R;return t[57]!==O||t[58]!==I?(R=(0,Z.jsxs)(`div`,{"data-testid":`editor-toolbar`,className:`pointer-events-none absolute inset-x-0 top-0 z-10`,children:[O,I,L]}),t[57]=O,t[58]=I,t[59]=R):R=t[59],R}function ME(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var NE=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-cxebDRrV.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,41]),import.meta.url)).ActivityModeContent}));function PE(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(IE,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(FE,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(It,{name:`editor-area`,children:(0,Z.jsxs)(Xb,{children:[n,r]})}),t[3]=n,t[4]=i),i}function FE(){let e=(0,$.c)(5),t=bm(),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)(ox,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function IE(e){let t=(0,$.c)(111),{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:_}=ft(),{openDocumentTransition:v}=wt(),{requestAddProperty:y}=Qb(),b=aS(f,d),x=cS(f),S=x===`connected`||x===`synced`,C=sS(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=uy(),[j,M]=(0,Q.useState)(!1),{layout:N,autoCollapse:P}=Ux(),F=N===`sheet`,[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),z,B;t[3]!==P||t[4]!==N||t[5]!==A?(z=()=>{if(N!==`panel`)return;let e=requestAnimationFrame(()=>{P?(R.current=!1,A.current?.collapse()):R.current||A.current?.expand()});return()=>cancelAnimationFrame(e)},B=[P,N,A],t[3]=P,t[4]=N,t[5]=A,t[6]=z,t[7]=B):(z=t[6],B=t[7]),(0,Q.useEffect)(z,B);let V,H;t[8]!==F||t[9]!==o||t[10]!==A?(V=()=>{let e=e=>{o(e),F?L(!0):(R.current=!1,A.current?.expand())},t=Tp();return t&&e(t),Dp(t=>{Tp(),e(t)})},H=[F,o,A],t[8]=F,t[9]=o,t[10]=A,t[11]=V,t[12]=H):(V=t[11],H=t[12]),(0,Q.useEffect)(V,H);let U,W;t[13]!==_||t[14]!==F||t[15]!==A?(U=()=>{_!==0&&(F?L(!0):(R.current=!1,A.current?.expand()))},W=[_,F,A],t[13]=_,t[14]=F,t[15]=A,t[16]=U,t[17]=W):(U=t[16],W=t[17]),(0,Q.useEffect)(U,W);let G=(0,Q.useRef)(null),[K,q]=(0,Q.useState)(null),J,ee;if(t[18]===d?(J=t[19],ee=t[20]):(J=()=>{if(d&&d!==G.current){let e=G.current;G.current=d,q(e)}},ee=[d],t[18]=d,t[19]=J,t[20]=ee),(0,Q.useEffect)(J,ee),p?.kind===`folder`){if(!(h===`agent`&&g!==null)){let e;return t[21]===p.folderPath?e=t[22]:(e=(0,Z.jsx)(Ub,{folderPath:p.folderPath}),t[21]=p.folderPath,t[22]=e),e}let e;t[23]===p.folderPath?e=t[24]:(e=(0,Z.jsx)(dx,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(Ub,{folderPath:p.folderPath})}),t[23]=p.folderPath,t[24]=e);let n;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(fx,{withHandle:!0}),t[25]=n):n=t[25];let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(dx,{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)(NE,{showBackButton:!1})})}),t[26]=r):r=t[26];let i;return t[27]===e?i=t[28]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(ux,{orientation:`horizontal`,children:[e,n,r]})}),t[27]=e,t[28]=i),i}if(p?.kind===`asset`){let e;return t[29]!==p.assetPath||t[30]!==p.mediaKind?(e=(0,Z.jsx)(xy,{assetPath:p.assetPath,mediaKind:p.mediaKind},p.assetPath),t[29]=p.assetPath,t[30]=p.mediaKind,t[31]=e):e=t[31],e}if(!f||!d){if((typeof window<`u`?zr(window.location.hash):null)!==null){let e;return t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Sy,{}),t[32]=e):e=t[32],e}let e;return t[33]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(gb,{}),t[33]=e):e=t[33],e}let te=n===`source`,ne=!S,re=F?!I:j,ie;t[34]!==d||t[35]!==y?(ie=function(){d&&y(d)},t[34]=d,t[35]=y,t[36]=ie):ie=t[36];let ae=ie,oe;t[37]!==j||t[38]!==F||t[39]!==A?(oe=function(){F?L(LE):j?(R.current=!1,A.current?.expand()):(R.current=!0,A.current?.collapse())},t[37]=j,t[38]=F,t[39]=A,t[40]=oe):oe=t[40];let se=oe,ce=T??d,le=K??void 0,ue;t[41]===v?ue=t[42]:(ue=e=>{let t=ii(e);window.location.hash===t?v(e):window.location.hash=t},t[41]=v,t[42]=ue);let de;t[43]!==k||t[44]!==te||t[45]!==m||t[46]!==ce||t[47]!==le||t[48]!==ue?(de=(0,Z.jsx)(sE,{activeDocName:ce,isSourceMode:te,editorPlaceholder:k,previousDocName:le,onNavigateBack:ue,onRecycle:m}),t[43]=k,t[44]=te,t[45]=m,t[46]=ce,t[47]=le,t[48]=ue,t[49]=de):de=t[49];let fe;t[50]!==d||t[51]!==te?(fe=(0,Z.jsx)(Rx,{activeDocName:d,isSourceMode:te}),t[50]=d,t[51]=te,t[52]=fe):fe=t[52];let pe;t[53]!==d||t[54]!==T?(pe=ME({activeDocName:d,deferredActiveDocName:T,mountResolved:d!==null&&w(d),syncResolved:d!==null&&ze(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Sy,{}),d===null?null:(0,Z.jsx)(qb,{docName:d})]}):null,t[53]=d,t[54]=T,t[55]=pe):pe=t[55];let me;t[56]!==de||t[57]!==fe||t[58]!==pe?(me=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[de,fe,pe]}),t[56]=de,t[57]=fe,t[58]=pe,t[59]=me):me=t[59];let he;t[60]!==d||t[61]!==C||t[62]!==re||t[63]!==te||t[64]!==r||t[65]!==ae||t[66]!==ne||t[67]!==se?(he=!C&&(0,Z.jsx)(jE,{activeDocName:d,isSourceMode:te,sourceDisabled:ne,onModeChange:r,showAddPropertyButton:!te,onAddProperty:ae,isPanelCollapsed:re,onTogglePanel:se}),t[60]=d,t[61]=C,t[62]=re,t[63]=te,t[64]=r,t[65]=ae,t[66]=ne,t[67]=se,t[68]=he):he=t[68];let ge;t[69]!==me||t[70]!==he?(ge=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[me,he]}),t[69]=me,t[70]=he,t[71]=ge):ge=t[71];let _e;t[72]!==D||t[73]!==b?(_e=D&&(0,Z.jsx)(gE,{stats:b}),t[72]=D,t[73]=b,t[74]=_e):_e=t[74];let ve;t[75]!==ge||t[76]!==_e?(ve=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[ge,_e]}),t[75]=ge,t[76]=_e,t[77]=ve):ve=t[77];let ye=ve,be=F?`100%`:`30%`,xe=F?`100%`:`75%`,Se;t[78]!==ye||t[79]!==be||t[80]!==xe?(Se=(0,Z.jsx)(dx,{minSize:be,defaultSize:xe,children:ye}),t[78]=ye,t[79]=be,t[80]=xe,t[81]=Se):Se=t[81];let Ce;t[82]===F?Ce=t[83]:(Ce=F?null:(0,Z.jsx)(fx,{withHandle:!0}),t[82]=F,t[83]=Ce);let we;t[84]!==d||t[85]!==a||t[86]!==h||t[87]!==F||t[88]!==te||t[89]!==o||t[90]!==c||t[91]!==A||t[92]!==l?(we=F?null:(0,Z.jsx)(dx,{panelRef:A,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:e=>M(e.asPercentage===0),className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(__,{docName:d,isSourceMode:te,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l})}),t[84]=d,t[85]=a,t[86]=h,t[87]=F,t[88]=te,t[89]=o,t[90]=c,t[91]=A,t[92]=l,t[93]=we):we=t[93];let Te;t[94]!==Se||t[95]!==Ce||t[96]!==we?(Te=(0,Z.jsxs)(ux,{orientation:`horizontal`,children:[Se,Ce,we]}),t[94]=Se,t[95]=Ce,t[96]=we,t[97]=Te):Te=t[97];let Ee;t[98]!==d||t[99]!==a||t[100]!==h||t[101]!==F||t[102]!==te||t[103]!==o||t[104]!==c||t[105]!==l||t[106]!==I?(Ee=F?(0,Z.jsx)(px,{open:I,onOpenChange:L,children:(0,Z.jsxs)(gx,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[(0,Z.jsx)(_x,{className:`sr-only`,children:(0,Z.jsx)(vx,{children:(0,Z.jsx)(s,{id:`5Q9-G-`})})}),(0,Z.jsx)(__,{docName:d,isSourceMode:te,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l})]})}):null,t[98]=d,t[99]=a,t[100]=h,t[101]=F,t[102]=te,t[103]=o,t[104]=c,t[105]=l,t[106]=I,t[107]=Ee):Ee=t[107];let De;return t[108]!==Te||t[109]!==Ee?(De=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[Te,Ee]}),t[108]=Te,t[109]=Ee,t[110]=De):De=t[110],De}function LE(e){return!e}var RE=1280;function zE(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(BE),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${RE-1}px)`),t=()=>{n(window.innerWidth<RE)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function BE(){return window.innerWidth<RE}function VE(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function HE(e){let{value:t,unit:n}=VE(e);return n===`rem`?t*16:t}function UE(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var WE=3600*24*7;function GE(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?KE:m,O=g===void 0?WE: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=HE(b),J;t[6]===x?J=t[7]:(J=HE(x),t[6]=x,t[7]=J);let ee=J,te;t[8]!==E||t[9]!==k?(te=function(e){P.current=!0,E&&(j.current=H.current?0:HE(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]=te):te=t[10];let ne=te,re,ie;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{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}=VE(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=UE(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(ee,u)),f=UE(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)}},ie=[i,a,D,q,ee,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=ie):(re=t[24],ie=t[25]),(0,Q.useEffect)(re,ie);let ae;return t[26]===ne?ae=t[27]:(ae={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ae),ae}function KE(){}var qE=`sidebar_state`,JE=3600*24*7,YE=`18rem`,XE=`3rem`,ZE=`\\`,QE=`app-file-sidebar`,$E=`14.625rem`,eD=`22rem`,tD=`sidebar_width`,nD=/^\d+(?:\.\d+)?(?:rem|px)$/,rD=Q.createContext(null);function iD(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${tD}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return nD.test(n)?n:e}function aD(){let e=Q.use(rD);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function oD(e){let t=(0,$.c)(53),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:l,...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,t[8]=l);let u=c===void 0?!0:c,d=l===void 0?YE:l,f=zE(),p;t[9]===d?p=t[10]:(p=()=>iD(d),t[9]=d,t[10]=p);let[m,h]=Q.useState(p),[g,_]=Q.useState(!1),v=Q.useRef(g),[y,b]=Q.useState(!1),[x,S]=Q.useState(!1),[C,w]=Q.useState(u),T=i??C,E;t[11]!==T||t[12]!==o?(E=e=>{let t=typeof e==`function`?e(T):e;o?o(t):w(t),document.cookie=`${qE}=${t}; path=/; max-age=${JE}`},t[11]=T,t[12]=o,t[13]=E):E=t[13];let D=E,O;t[14]===D?O=t[15]:(O=function(){return window.innerWidth<1280?_(cD):D(sD)},t[14]=D,t[15]=O);let k=O,A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){window.innerWidth>=1280||v.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||S(!0))},t[16]=A):A=t[16];let j=A,M;t[17]===g?M=t[18]:(M=()=>{v.current=g},t[17]=g,t[18]=M),Q.useLayoutEffect(M);let N,P;t[19]===k?(N=t[20],P=t[21]):(N=()=>{let e=e=>{e.key===ZE&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),k())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},P=[k],t[19]=k,t[20]=N,t[21]=P),Q.useEffect(N,P);let F,I;t[22]!==f||t[23]!==g?(F=()=>{if(!f||!g)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"]`)||_(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},I=[f,g],t[22]=f,t[23]=g,t[24]=F,t[25]=I):(F=t[24],I=t[25]),Q.useEffect(F,I);let L=Q.useRef(f),R,z;t[26]!==f||t[27]!==T?(R=()=>{!L.current&&f&&_(T),L.current=f},z=[f,T],t[26]=f,t[27]=T,t[28]=R,t[29]=z):(R=t[28],z=t[29]),Q.useEffect(R,z);let B=f?g?`expanded`:`collapsed`:T?`expanded`:`collapsed`,V;t[30]!==y||t[31]!==f||t[32]!==T||t[33]!==g||t[34]!==D||t[35]!==x||t[36]!==B||t[37]!==k||t[38]!==m?(V={state:B,open:T,setOpen:D,isMobile:f,openMobile:g,setOpenMobile:_,toggleSidebar:k,width:m,setWidth:h,isDraggingRail:y,setIsDraggingRail:b,showPushPulse:x,setShowPushPulse:S,notifySidebarFileSelected:j},t[30]=y,t[31]=f,t[32]=T,t[33]=g,t[34]=D,t[35]=x,t[36]=B,t[37]=k,t[38]=m,t[39]=V):V=t[39];let H;t[40]!==s||t[41]!==m?(H={"--sidebar-width":m,"--sidebar-width-icon":XE,...s},t[40]=s,t[41]=m,t[42]=H):H=t[42];let U=H,W;t[43]===r?W=t[44]:(W=X(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[43]=r,t[44]=W);let G;t[45]!==n||t[46]!==a||t[47]!==U||t[48]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[45]=n,t[46]=a,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;return t[50]!==V||t[51]!==G?(K=(0,Z.jsx)(rD.Provider,{value:V,children:G}),t[50]=V,t[51]=G,t[52]=K):K=t[52],K}function sD(e){return!e}function cD(e){return!e}function lD(e){let t=(0,$.c)(57),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(),{isMobile:p,state:m,openMobile:h,isDraggingRail:g}=aD();if(d===`none`){let e;t[7]===r?e=t[8]:(e=X(`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}if(p){let e=h?`expanded`:`collapsed`,i;t[14]===f?i=t[15]:(i=f({id:`07q4Qk`}),t[14]=f,t[15]=i);let o=u===`floating`||u===`inset`?`p-2`:``,s;t[16]!==r||t[17]!==o?(s=X(`fixed inset-y-0 z-30 flex h-svh w-(--sidebar-width)`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`data-[side=left]:left-0 data-[side=right]:right-0`,`group-data-[state=collapsed]:data-[side=left]:-translate-x-full`,`group-data-[state=collapsed]:data-[side=right]:translate-x-full`,o,r),t[16]=r,t[17]=o,t[18]=s):s=t[18];let c;t[19]===n?c=t[20]:(c=(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[19]=n,t[20]=c);let d;t[21]!==a||t[22]!==l||t[23]!==i||t[24]!==s||t[25]!==c?(d=(0,Z.jsx)(`nav`,{id:QE,"aria-label":i,"data-slot":`sidebar-container`,"data-side":l,className:s,...a,children:c}),t[21]=a,t[22]=l,t[23]=i,t[24]=s,t[25]=c,t[26]=d):d=t[26];let p;return t[27]!==e||t[28]!==l||t[29]!==d||t[30]!==u?(p=(0,Z.jsx)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":e,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-mobile":`true`,children:d}),t[27]=e,t[28]=l,t[29]=d,t[30]=u,t[31]=p):p=t[31],p}let _=m===`collapsed`?d:``,v=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,y;t[32]===v?y=t[33]:(y=X(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,v,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[32]=v,t[33]=y);let b;t[34]===y?b=t[35]:(b=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:y}),t[34]=y,t[35]=b);let x;t[36]===f?x=t[37]:(x=f({id:`07q4Qk`}),t[36]=f,t[37]=x);let S=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`,C;t[38]!==r||t[39]!==S?(C=X(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear 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)] md:flex`,S,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[38]=r,t[39]=S,t[40]=C):C=t[40];let w;t[41]===n?w=t[42]:(w=(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[41]=n,t[42]=w);let T;t[43]!==a||t[44]!==l||t[45]!==C||t[46]!==w||t[47]!==x?(T=(0,Z.jsx)(`nav`,{id:QE,"aria-label":x,"data-slot":`sidebar-container`,"data-side":l,className:C,...a,children:w}),t[43]=a,t[44]=l,t[45]=C,t[46]=w,t[47]=x,t[48]=T):T=t[48];let E;return t[49]!==g||t[50]!==l||t[51]!==m||t[52]!==T||t[53]!==_||t[54]!==b||t[55]!==u?(E=(0,Z.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":m,"data-collapsible":_,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":g,children:[b,T]}),t[49]=g,t[50]=l,t[51]=m,t[52]=T,t[53]=_,t[54]=b,t[55]=u,t[56]=E):E=t[56],E}function uD(e){let t=(0,$.c)(21),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}=aD(),l=c===`expanded`,u;t[4]!==o||t[5]!==c?(u=o(c===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[4]=o,t[5]=c,t[6]=u):u=t[6];let d;t[7]===n?d=t[8]:(d=X(n),t[7]=n,t[8]=d);let f;t[9]!==r||t[10]!==s?(f=e=>{r?.(e),s()},t[9]=r,t[10]=s,t[11]=f):f=t[11];let p;t[12]===c?p=t[13]:(p=c===`expanded`?(0,Z.jsx)(M,{}):(0,Z.jsx)(Ic,{}),t[12]=c,t[13]=p);let m;return t[14]!==a||t[15]!==l||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,Z.jsx)(Di,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":l,"aria-controls":QE,"aria-label":u,className:d,onClick:f,...a,children:p}),t[14]=a,t[15]=l,t[16]=u,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function dD(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}=aD(),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:$E,maxResizeWidth:eD,setIsDraggingRail:h,widthCookieName:tD,widthCookieMaxAge:JE},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}=GE(_),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=X(`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 fD(e){let t=(0,$.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onClick:i,onAnimationEnd:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{isMobile:o,openMobile:s,setOpenMobile:c,showPushPulse:l,setShowPushPulse:u}=aD(),d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==c?(d=e=>{i?.(e),!e.defaultPrevented&&(!o||!s||e.target?.closest(`[data-sidebar="trigger"]`)||c(!1))},t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=d):d=t[9];let f=d,p;t[10]!==r||t[11]!==u?(p=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&u(!1)},t[10]=r,t[11]=u,t[12]=p):p=t[12];let m=p,h=l?``:void 0,g;t[13]===n?g=t[14]:(g=X(`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`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`peer-data-[mobile=true]:peer-data-[state=expanded]:translate-x-(--sidebar-width)`,n),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==f||t[17]!==a||t[18]!==h||t[19]!==g?(_=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":h,onClick:f,onAnimationEnd:m,className:g,...a}),t[15]=m,t[16]=f,t[17]=a,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function pD(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=X(`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 mD(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=X(`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 hD(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=X(`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 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=X(`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 _D(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=X(`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 vD=ki(`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 yD(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?Si:`button`,{isMobile:m,state:h}=aD(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=X(vD({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,Z.jsx)($n,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,Z.jsx)(Tn,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,Z.jsxs)(Gr,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function bD(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 xD(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 SD=1e3,CD=!1;function wD(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function TD(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:Hi(i)?a=i:(a=void 0,CD||(CD=!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`&&(wD({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=xD(i),{current:c,crossDoc:l}=a?Li(a,n,Date.now()):{current:[],crossDoc:[]},u=ED,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>bD(e.current,p)&&bD(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,SD);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 ED(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var DD=`sync-status`;function OD(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,qo.warning(r({id:`HGNCsl`}),{id:DD,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,qo.success(r({id:`GhjUB_`}),{id:DD,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 kD=4,AD=3,jD={Bird:Ys,Cat:tc,Dog:fc,Fish:_c,Mouse:Uc,Rabbit:Hc,Shrimp:Zc,Snail:Qc,Squirrel:tl,Turtle:ol};Object.freeze(Object.keys(jD));function MD(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(jD,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var ND={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function PD(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=MD(n),c=s.kind===`animal`?jD[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=ir(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=tr(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)($n,{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)(Tn,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Gr,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function FD(e){let t=ND[e.icon];return e.displayName||t||Y._({id:`iEQQyu`})}function ID(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 LD(e){let t=(0,$.c)(34),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{presence:l,agentId:u}=n,d=FD(l),f=ID(l.mode),p=!r&&f,m=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,h=p&&!a?`ring-primary/40 animate-pulse`:``,g;t[0]!==m||t[1]!==h?(g=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2 cursor-pointer`,m,h].filter(Boolean),t[0]=m,t[1]=h,t[2]=g):g=t[2];let _=g.join(` `),v=r?`true`:void 0,y=a?`true`:void 0,b;t[3]!==l.mode||t[4]!==v||t[5]!==y?(b={"data-presence-badge":`agent`,"data-presence-mode":l.mode,"data-presence-crossdoc":v,"data-presence-scoped":y},t[3]=l.mode,t[4]=v,t[5]=y,t[6]=b):b=t[6];let x=b,S=l.currentDoc&&l.currentDoc!==`(connected)`?l.currentDoc:null,C=c(r&&S?{id:`b4AQFK`,values:{tooltipName:d,realCurrentDoc:S}}:{id:`RfHNf8`,values:{tooltipName:d}}),w;t[7]===l.color?w=t[8]:(w={backgroundColor:l.color},t[7]=l.color,t[8]=w);let T;t[9]!==u||t[10]!==o?(T=()=>o(u),t[9]=u,t[10]=o,t[11]=T):T=t[11];let E;t[12]===l.icon?E=t[13]:(E=(0,Z.jsx)(Bi,{icon:l.icon,width:16,height:16,className:`text-white`}),t[12]=l.icon,t[13]=E);let D;t[14]!==C||t[15]!==x||t[16]!==_||t[17]!==w||t[18]!==T||t[19]!==E?(D=(0,Z.jsx)(`button`,{type:`button`,...x,"aria-label":C,className:_,style:w,onClick:T,children:E}),t[14]=C,t[15]=x,t[16]=_,t[17]=w,t[18]=T,t[19]=E,t[20]=D):D=t[20];let O=D,k;t[21]===O?k=t[22]:(k=(0,Z.jsx)($n,{asChild:!0,children:O}),t[21]=O,t[22]=k);let A;t[23]===d?A=t[24]:(A=(0,Z.jsx)(`span`,{className:`font-medium`,children:d}),t[23]=d,t[24]=A);let j;t[25]!==r||t[26]!==S?(j=r&&S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:S}})}):null,t[25]=r,t[26]=S,t[27]=j):j=t[27];let M;t[28]!==A||t[29]!==j?(M=(0,Z.jsxs)(Tn,{className:`flex flex-col gap-0.5`,children:[A,j]}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;return t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(Gr,{children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33],N}function RD(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?Y._({id:`9euN0m`,values:{count:n}}):Y._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(zt,{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)(PD,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(LD,{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)(v,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(Vt,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function zD(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(PD,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(LD,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function BD(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ft(),{current:s,crossDoc:c}=TD(t,r,n);if(OD(cS(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,kD),n;e[6]===s?n=e[7]:(n=s.slice(kD),e[6]=s,e[7]=n);let r=n,u=c.slice(0,AD),d;e[8]===c?d=e[9]:(d=c.slice(AD),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=>zD(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)(RD,{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=>zD(e,p,!0,m)),f.length>0?(0,Z.jsx)(RD,{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 VD=`.md`,HD=/\.(md|mdx)$/i;function UD(e,t=VD){return`${e}${t}`}function WD(e){return cO(e).replace(HD,``)}function GD(e){return Nn(e)?JD(e.path):pr(e)?e.path:UD(e.docName,e.docExt)}function KD(e){let t=cO(e).match(HD);return t?`.${t[1].toLowerCase()}`:void 0}function qD(e){return cO(e)}function JD(e){let t=cO(e.trim());return t?`${t}/`:``}function YD(e){return e.endsWith(`/`)?qD(e):WD(e)}function XD(e){return e.map(GD)}function ZD(e){return[...e].sort().join(`\0`)}function QD(e){return ZD(XD(e))}function $D(e){let t=new Set;for(let n of e){if(Nn(n)){let e=JD(n.path);e&&t.add(e)}let e=(Nn(n)||pr(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Nn(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function eO(e){if(!e)return[];let t=cO(e.replace(HD,``)).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 tO(e){let t=e.kind===`directory`,n=t?qD(e.path):WD(e.path),r=t?void 0:KD(e.path);return{kind:t?`folder`:`file`,name:cO(sO(e.path)).replace(HD,``),path:n,treePath:rO(e.path,t),docExt:r}}function nO(e){return e.kind===`directory`?qD(e.path):e.path}function rO(e,t){return t?JD(e):HD.test(e)?e:`${e}${VD}`}function iO(e,t,n){let r=JD(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}${VD}`;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 aO(e,t){return e===`file`?rO(t,!1):`${qD(t)}/index${VD}`}function oO(e,t){return t.kind===`root`||t.directoryPath==null?sO(e):`${t.directoryPath}${sO(e)}`}function sO(e){let t=cO(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function cO(e){return e.endsWith(`/`)?e.slice(0,-1):e}function lO(e,t){return t.trim()}function uO(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function dO(e,t){let n=lO(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function fO(e,t,n=[]){if(t.length===0&&n.length===0)return e;let r=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>Rn(e)?{...e,docName:r.get(e.docName)??e.docName}:Nn(e)||pr(e)?{...e,path:vO(e.path,n)}:e)}function pO(e,t,n){if(t.length===0&&!n)return e;let r=new Set(t);return e.filter(e=>Rn(e)?!r.has(e.docName)&&!SO(e.docName,n):Nn(e)||pr(e)?!SO(e.path,n):!0)}function mO(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>yO(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Rn(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=>Nn(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(Rn(i)){let e=xO(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Nn(i)){let e=bO(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function hO(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function gO(e,t){return e.flatMap(e=>t===e.toDocName?[e.fromDocName]:[e.fromDocName,e.toDocName])}function _O(e,t){let n=e.kind===`folder`||e.docExt===void 0?e.path:UD(e.path,e.docExt);return Gm(t.contentDir,n,t.pathSeparator)}function vO(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 yO(e,t){return Rn(e)&&Rn(t)?e.docName===t.docName:Nn(e)&&Nn(t)||pr(e)&&pr(t)?e.path===t.path:!1}function bO(e,t,n){return e===t?n:xO(e,t,n)}function xO(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function SO(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function CO(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)(pu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function wO(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=X(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mu,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TO(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)(xu,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function EO(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=X(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(hu,{children:(0,Z.jsx)(gu,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function DO(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=X(`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)(_u,{"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 OO(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=X(`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)(Jo,{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)(Su,{"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 kO(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=X(`z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg 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)(Cu,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function AO(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=X(`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)(yu,{children:(0,Z.jsx)(jo,{})})}),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)(vu,{"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 jO(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=X(`-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)(bu,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var MO=[`.md`,`.mdx`],NO=`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`,PO=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,FO=X(PO,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),IO=`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`,LO=`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 RO(e){return X(LO,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 zO(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function BO(e){let t=ii(e);window.location.hash!==t&&(window.location.hash=t)}function VO(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function HO(e,t){let n=[t,...MO].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 UO(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}=va(s),m;t[9]===d?m=t[10]:(m=ia.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 WO(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=Ve(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=Ve(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)(wO,{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)(DO,{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)(DO,{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)(DO,{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)(jO,{}),(0,Z.jsx)(DO,{"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)(EO,{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)(CO,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function GO(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)(Vc,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(Di,{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)(Mo,{"aria-hidden":`true`}),t[16]=d):d=t[16];let f;return t[17]!==l||t[18]!==u?(f=(0,Z.jsx)(Di,{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 KO(e){let t=(0,$.c)(1),{docName:n}=e;if(sS(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(An,{"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 qO(){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,isNewTabActive:m,newTabIds:h,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=ft(),{_:T}=i(),{pageMeta:E}=si(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(``),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(!1),I=(0,Q.useRef)(null),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(t),V;e[0]!==n||e[1]!==t||e[2]!==a?(V=n??(a?Qe(a):t?Pt(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=V):V=e[3];let H=V,U;e[4]!==r||e[5]!==H||e[6]!==m||e[7]!==h||e[8]!==v?(U=m?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${h.join(`\0`)}`:H?`${H}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=H,e[6]=m,e[7]=h,e[8]=v,e[9]=U):U=e[9];let W=U,G,K;e[10]===t?(G=e[11],K=e[12]):(G=()=>{B.current=t},K=[t],e[10]=t,e[11]=G,e[12]=K),(0,Q.useEffect)(G,K);let q,J;e[13]===W?(q=e[14],J=e[15]):(q=()=>{W&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},J=[W],e[13]=W,e[14]=q,e[15]=J),(0,Q.useEffect)(q,J);let ee,ne;e[16]===O?(ee=e[17],ne=e[18]):(ee=()=>{O&&(I.current?.focus(),I.current?.select())},ne=[O],e[16]=O,e[17]=ee,e[18]=ne),(0,Q.useEffect)(ee,ne);let re,ie;e[19]!==v||e[20]!==O?(re=()=>{!O||v.includes(O.tabId)||(R.current=!0,z.current=null,k(null),j(``),N(null),F(!1))},ie=[v,O],e[19]=v,e[20]=O,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(`/`);R.current=!1,z.current=null,k({docName:t,tabId:e}),j(n[n.length-1]),N(null)},oe=function(){R.current=!0,z.current=null,k(null),j(``),N(null),F(!1)},se=async function(){if(R.current){R.current=!1;return}if(L.current)return;let e=O?.docName;if(!e){oe();return}let t=lO(`file`,HO(A,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){oe();return}if(t===z.current){I.current?.focus();return}if(!uO(t)){N(T({id:`P8yDjG`})),I.current?.focus();return}let i=dO({kind:`file`,path:e,name:r},t);L.current=!0,F(!0),N(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(R.current){F(!1),L.current=!1;return}let r=await Kt(n,`Server error (HTTP ${n.status})`);if(!r.ok){N(r.title),F(!1),L.current=!1,z.current=t,I.current?.focus();return}let a=g(Cr,r.body,`rename-path:tab`,{renamed:[]}).renamed,o=B.current,s=hO(o,a);Me(a);let c=!0;try{let e=gO(a,p());await Promise.all(e.map(e=>l(e))),x(a),Er([`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}),qo.error(T({id:`MUBR8r`}))}R.current=!0,k(null),j(``),N(null),F(!1),L.current=!1,z.current=null,c&&s&&s!==o&&BO(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),N(T({id:`HIb0vl`})),F(!1),L.current=!1,z.current=t,I.current?.focus()}},ce=typeof window<`u`&&window.okDesktop!=null,le;e[23]===h?le=e[24]:(le=new Set(h),e[23]=h,e[24]=le);let ue=le,de;e[25]!==u||e[26]!==f||e[27]!==ue?(de=function(e){let t=[],n=[];for(let r of e)ue.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]=ue,e[28]=de):de=e[28];let fe=de,pe;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(pe={activationConstraint:{distance:8}},e[29]=pe):pe=e[29];let me;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(me={coordinateGetter:ma},e[30]=me):me=e[30];let he=ka(qi(xa,pe),qi(ua,me)),ge;e[31]!==S||e[32]!==w?(ge=function(e){let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Xa([...w],r,i),t)},e[31]=S,e[32]=w,e[33]=ge):ge=e[33];let _e=ge,ve=ce?``:void 0,ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye=X(`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]`,ce&&`[-webkit-app-region:drag]`),e[34]=ye):ye=e[34];let be=VO,xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=X(`flex items-end gap-1`,ce&&`[-webkit-app-region:no-drag]`),e[35]=xe):xe=e[35];let Se=oa,Ce=To,we;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(we={container:typeof document<`u`?document.body:void 0},e[36]=we):we=e[36];let Te=Gi,Ee;e[37]===w?Ee=e[38]:(Ee=[...w],e[37]=w,e[38]=Ee);let De=fa,Oe=w.map(e=>{if(ue.has(e)){let t=e===r;return(0,Z.jsx)(WO,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:fe,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(UO,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:X(NO,t?PO:FO),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:IO,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":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:RO(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(Mo,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=bt(e),n=e===H,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Ye(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(WO,{tabId:e,openTabs:w,closeTab:d,closeTabs:fe,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(UO,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(NO,n?PO:FO),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:IO,onClick:()=>{o(e)},children:[s&&(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:X(`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)(GO,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Ye(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(WO,{tabId:e,openTabs:w,closeTab:d,closeTabs:fe,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(UO,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(NO,n?PO:FO),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:IO,onClick:()=>{o(e)},children:[s?(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:X(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(GO,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=Ye(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=O?.tabId===e,x=`editor-tab-rename-error-${zO(a)}`;return(0,Z.jsx)(WO,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:fe,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(UO,{tabId:e,disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(NO,n?PO:FO,v&&M&&`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)(yx,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(wx,{ref:I,value:A,disabled:P,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":M?!0:void 0,"aria-describedby":M?x:void 0,"aria-busy":P||void 0,title:M??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=>{j(HO(e.target.value,l)),N(null),z.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),se()):e.key===`Escape`&&(e.preventDefault(),oe())},onBlur:se}),(0,Z.jsx)(xx,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(Cx,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),M?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:M}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:IO,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),ae(e,a)},children:[(0,Z.jsx)(KO,{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)(GO,{accessibleLabel:g,closeTab:d,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),ke;e[39]!==Te||e[40]!==Ee||e[41]!==De||e[42]!==Oe?(ke=(0,Z.jsx)(Te,{items:Ee,strategy:De,children:Oe}),e[39]=Te,e[40]=Ee,e[41]=De,e[42]=Oe,e[43]=ke):ke=e[43];let Ae;e[44]!==Se||e[45]!==_e||e[46]!==he||e[47]!==Ce||e[48]!==we||e[49]!==ke?(Ae=(0,Z.jsx)(Se,{sensors:he,collisionDetection:Ce,onDragEnd:_e,accessibility:we,children:ke}),e[44]=Se,e[45]=_e,e[46]=he,e[47]=Ce,e[48]=we,e[49]=ke,e[50]=Ae):Ae=e[50];let je;e[51]===T?je=e[52]:(je=T({id:`3YvS-c`}),e[51]=T,e[52]=je);let Ne;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(te,{"aria-hidden":`true`}),e[53]=Ne):Ne=e[53];let Pe;e[54]!==_||e[55]!==je?(Pe=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":je,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ne})}),e[54]=_,e[55]=je,e[56]=Pe):Pe=e[56];let Fe;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,Z.jsx)(Tn,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[57]=Fe):Fe=e[57];let Ie;e[58]===Pe?Ie=e[59]:(Ie=(0,Z.jsxs)(Gr,{children:[Pe,Fe]}),e[58]=Pe,e[59]=Ie);let Le;e[60]!==xe||e[61]!==Ae||e[62]!==Ie?(Le=(0,Z.jsxs)(`div`,{className:xe,children:[Ae,Ie]}),e[60]=xe,e[61]=Ae,e[62]=Ie,e[63]=Le):Le=e[63];let Re;return e[64]!==ve||e[65]!==ye||e[66]!==be||e[67]!==Le?(Re=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":ve,className:ye,onWheel:be,children:Le}),e[64]=ve,e[65]=ye,e[66]=be,e[67]=Le,e[68]=Re):Re=e[68],Re}function JO(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 YO(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 XO=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:st},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:rd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:di},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:JO},{label:`Twitter`,href:`https://x.com/inkeep`,icon:YO}],ZO=()=>{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)(et,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(zt,{asChild:!0,children:(0,Z.jsxs)(Di,{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)(Gr,{children:[o,(0,Z.jsx)(Tn,{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=XO.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=>sa(e,r),onAuxClick:e=>sa(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 p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(v,{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]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(Vt,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function QO(e){let t=(0,$.c)(62),{input:n}=e,{_:r}=i(),{states:a,refresh:o}=_h(),{dispatch:c}=oh(),[l,u]=(0,Q.useState)(!1),d=typeof window<`u`&&window.okDesktop!=null,f;t[0]===o?f=t[1]:(f=e=>{u(e),e&&o()},t[0]=o,t[1]=f);let p=f,m=n===null,h;t[2]===n?h=t[3]:(h=n!==null&&n.docContext!==null?Bn(n.docContext.relativePath):``,t[2]=n,t[3]=h);let g=h,_;t[4]!==c||t[5]!==n?(_=e=>{n!==null&&c(e.id,n)},t[4]=c,t[5]=n,t[6]=_):_=t[6];let v=_,y,b,x,S,C,w,T,E,D,O,k,A;if(t[7]!==p||t[8]!==v||t[9]!==n||t[10]!==l||t[11]!==g||t[12]!==a||t[13]!==m){let e;t[26]===a?e=t[27]:(e=e=>a[e.id]?.installed===!0,t[26]=a,t[27]=e);let r=hm.filter(e);x=a[`claude-code`]?.installed===!0;let i;t[28]!==n||t[29]!==g?(i=()=>{n!==null&&Ay(g)},t[28]=n,t[29]=g,t[30]=i):i=t[30],S=i,b=Da,A=l,C=p;let o,c;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(zi,{className:`size-3.5`}),c=(0,Z.jsx)(s,{id:`xWEvuo`}),t[31]=o,t[32]=c):(o=t[31],c=t[32]);let u;t[33]===m?u=t[34]:(u=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,size:`sm`,disabled:m,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,children:[o,c]})})}),t[33]=m,t[34]=u);let f;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Tn,{children:(0,Z.jsx)(s,{id:`xWEvuo`})}),t[35]=f):f=t[35],t[36]===u?w=t[37]:(w=(0,Z.jsxs)(Gr,{children:[u,f]}),t[36]=u,t[37]=w),y=ra,T=`end`,E=`min-w-[220px]`,D=`open-in-agent-menu`,t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(co,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`O7_W_a`})}),t[38]=O):O=t[38];let h;t[39]!==v||t[40]!==g||t[41]!==a?(h=e=>{let t=a[e.id];return(0,Z.jsx)(jy,{target:e,installState:t,isElectronHost:d,prompt:g,onSelect:()=>v(e)},e.id)},t[39]=v,t[40]=g,t[41]=a,t[42]=h):h=t[42],k=r.map(h),t[7]=p,t[8]=v,t[9]=n,t[10]=l,t[11]=g,t[12]=a,t[13]=m,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A}else 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],k=t[24],A=t[25];let j;t[43]!==r||t[44]!==x||t[45]!==S||t[46]!==n?(j=x?null:(0,Z.jsxs)(la,{onSelect:S,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":r({id:`aA51jP`}),children:[(0,Z.jsx)(Ue,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}),t[43]=r,t[44]=x,t[45]=S,t[46]=n,t[47]=j):j=t[47];let M;t[48]!==y||t[49]!==j||t[50]!==T||t[51]!==E||t[52]!==D||t[53]!==O||t[54]!==k?(M=(0,Z.jsxs)(y,{align:T,className:E,"data-testid":D,children:[O,k,j]}),t[48]=y,t[49]=j,t[50]=T,t[51]=E,t[52]=D,t[53]=O,t[54]=k,t[55]=M):M=t[55];let N;return t[56]!==b||t[57]!==C||t[58]!==w||t[59]!==M||t[60]!==A?(N=(0,Z.jsxs)(b,{open:A,onOpenChange:C,children:[w,M]}),t[56]=b,t[57]=C,t[58]=w,t[59]=M,t[60]=A,t[61]=N):N=t[61],N}var $O=50,ek=()=>{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,ex.preload()},$O))},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=gm)},u=(0,Z.jsx)(Yc,{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)($n,{asChild:!0,children:(0,Z.jsxs)(Di,{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)(Gr,{children:[d,(0,Z.jsx)(Tn,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function tk(e){let t=(0,$.c)(17),{onClickWhenNoRemote:n}=e,{_:r}=i(),{activeDocName:a}=ft(),{status:o}=Ya(),[c,l]=(0,Q.useState)(!1);if(!a)return null;let u=o?.hasRemote===!0,d;t[0]!==r||t[1]!==a||t[2]!==c||t[3]!==u||t[4]!==n?(d=async function(){if(!c&&a){l(!0);try{await Ga({docName:a,hasRemote:u,onClickWhenNoRemote:n},{clipboardWrite:ak,toastSuccess:ik,toastError:rk,logEvent:nk})}catch{qo.error(r({id:`u3YnKw`}))}l(!1)}},t[0]=r,t[1]=a,t[2]=c,t[3]=u,t[4]=n,t[5]=d):d=t[5];let f=d,p;t[6]===r?p=t[7]:(p=r({id:`F4IYWe`}),t[6]=r,t[7]=p);let m,h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Xc,{className:`size-3.5`,"aria-hidden":!0}),h=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g;t[10]!==c||t[11]!==f||t[12]!==p?(g=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,size:`sm`,"aria-label":p,onClick:f,disabled:c,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[m,h]})}),t[10]=c,t[11]=f,t[12]=p,t[13]=g):g=t[13];let _;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Tn,{children:(0,Z.jsx)(s,{id:`Z8lGw6`})}),t[14]=_):_=t[14];let v;return t[15]===g?v=t[16]:(v=(0,Z.jsxs)(Gr,{children:[g,_]}),t[15]=g,t[16]=v),v}function nk(e){return console.log(e)}function rk(e){return qo.error(e)}function ik(e){return qo.success(e)}function ak(e){return navigator.clipboard.writeText(e)}function ok(e){if(!e)return Y._({id:`Zul8Ry`});let t=Date.now()-new Date(e).getTime();if(t<6e4)return Y._({id:`xOTzt5`});if(t<36e5){let e=Math.floor(t/6e4);return Y._({id:`LNum6A`,values:{minutes:e}})}if(t<864e5){let e=Math.floor(t/36e5);return Y._({id:`nYeBmY`,values:{hours:e}})}return new Date(e).toLocaleDateString()}async function sk(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}function ck(e){let t=(0,$.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ac,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Wc,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ac,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Wc,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(An,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ic,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Mc,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(An,{className:`size-3.5 text-amber-500`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ac,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function lk(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function uk(e){switch(e){case`dormant`:return Y._({id:`RmBY0A`});case`idle`:return Y._({id:`N2FcBE`});case`fetching`:return Y._({id:`Wgmlsw`});case`pulling`:return Y._({id:`4uNLmk`});case`pushing`:return Y._({id:`iycx_A`});case`conflict`:return Y._({id:`IInnZo`});case`offline`:return Y._({id:`6Aih4U`});case`auth-error`:return Y._({id:`mHVPm5`});case`disabled`:return Y._({id:`DrYM2Z`});default:return e}}function dk(e){switch(e){case`external-changes-pending`:return Y._({id:`W9_Bub`});case`dirty-tree`:return Y._({id:`a5Gha5`});case`detached-head`:return Y._({id:`uQNW00`});case`auth-error`:return Y._({id:`mHVPm5`});case`protected-branch`:return Y._({id:`8fc_3j`});default:return e}}function fk(e){if(!e.syncEnabled)return Y._({id:`kUn-CN`});if(e.state===`idle`){let{ahead:t,behind:n}=e;return t>0&&n>0?Y._({id:`5F5HYj`,values:{ahead:t,behind:n}}):t>0?Y._({id:`PdA9NZ`,values:{ahead:t}}):n>0?Y._({id:`9o1bIV`,values:{behind:n}}):Y._({id:`N2FcBE`})}if(e.state===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return Y._({id:`cUK8lW`,values:{conflictCount:t}})}return uk(e.state)}function pk(e){let t=(0,$.c)(88),{status:n,onSignIn:r,onSetIdentity:a}=e,{_:o}=i(),{ahead:c,behind:l,conflictCount:u}=n,{projectLocalConfig:d,projectLocalSynced:f}=Oe(),p=d?.autoSync?.enabled??!1,m;t[0]===n.lastSyncUtc?m=t[1]:(m=ok(n.lastSyncUtc),t[0]=n.lastSyncUtc,t[1]=m);let h=m,{confirmOpen:g,setConfirmOpen:_,onToggleRequest:v,onConfirm:y}=Wi(Ua()),{conflicts:b}=VC(),x=b[0]??null,S;t[2]===n?S=t[3]:(S=(0,Z.jsx)(ck,{status:n}),t[2]=n,t[3]=S);let C;t[4]===n.state?C=t[5]:(C=uk(n.state),t[4]=n.state,t[5]=C);let w;t[6]===C?w=t[7]:(w=(0,Z.jsx)(`span`,{className:`text-1sm font-medium truncate`,children:C}),t[6]=C,t[7]=w);let T;t[8]!==S||t[9]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[S,w]}),t[8]=S,t[9]=w,t[10]=T):T=t[10];let E=!f,D;t[11]!==o||t[12]!==p?(D=o(p?{id:`lIn9L9`}:{id:`wbwHYD`}),t[11]=o,t[12]=p,t[13]=D):D=t[13];let O;t[14]!==p||t[15]!==v||t[16]!==E||t[17]!==D?(O=(0,Z.jsx)(ee,{checked:p,disabled:E,onCheckedChange:v,"aria-label":D}),t[14]=p,t[15]=v,t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;t[19]!==T||t[20]!==O?(k=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[T,O]}),t[19]=T,t[20]=O,t[21]=k):k=t[21];let A;t[22]!==g||t[23]!==y||t[24]!==_?(A=(0,Z.jsx)(to,{open:g,onOpenChange:_,onConfirm:y}),t[22]=g,t[23]=y,t[24]=_,t[25]=A):A=t[25];let j;t[26]===n.error?j=t[27]:(j=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[26]=n.error,t[27]=j);let M;t[28]===n.pausedReason?M=t[29]:(M=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:dk(n.pausedReason)}),t[28]=n.pausedReason,t[29]=M);let N;t[30]===n.state?N=t[31]:(N=n.state===`conflict`&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(s,{id:`t2TkQ3`})}),t[30]=n.state,t[31]=N);let P;t[32]!==o||t[33]!==n.remote?(P=n.remote&&(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,Z.jsx)(s,{id:`IreQBq`})}),n.remote.webUrl?(0,Z.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-foreground hover:text-primary hover:underline`,"aria-label":o({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,Z.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,Z.jsx)(ko,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:n.remote.label})]}),t[32]=o,t[33]=n.remote,t[34]=P):P=t[34];let F;t[35]!==p||t[36]!==h||t[37]!==n.state?(F=p&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,Z.jsx)(s,{id:`uWx2ZP`})}),(0,Z.jsx)(`span`,{className:`text-foreground`,children:h})]}),t[35]=p,t[36]=h,t[37]=n.state,t[38]=F):F=t[38];let I;t[39]!==c||t[40]!==n.ahead?(I=n.ahead>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`iTlqm3`,values:{ahead:c}})}),t[39]=c,t[40]=n.ahead,t[41]=I):I=t[41];let L;t[42]!==l||t[43]!==n.behind?(L=n.behind>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`YsEYYS`,values:{behind:l}})}),t[42]=l,t[43]=n.behind,t[44]=L):L=t[44];let R;t[45]!==u||t[46]!==n.conflictCount?(R=n.conflictCount>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`B4_ipX`,values:{conflictCount:u}})}),t[45]=u,t[46]=n.conflictCount,t[47]=R):R=t[47];let z;t[48]===p?z=t[49]:(z=!p&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`Wt5W56`})}),t[48]=p,t[49]=z);let B;t[50]!==P||t[51]!==F||t[52]!==I||t[53]!==L||t[54]!==R||t[55]!==z?(B=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2`,children:[P,F,I,L,R,z]}),t[50]=P,t[51]=F,t[52]=I,t[53]=L,t[54]=R,t[55]=z,t[56]=B):B=t[56];let V;t[57]!==a||t[58]!==n.identityUnresolved?(V=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(ll,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:(0,Z.jsx)(s,{id:`nrGWJ7`})}),(0,Z.jsx)(Di,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,Z.jsx)(s,{id:`keNFEd`})})]})]}),t[57]=a,t[58]=n.identityUnresolved,t[59]=V):V=t[59];let H;t[60]!==p||t[61]!==n.state?(H=p&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(Di,{variant:`outline`,size:`xs`,onClick:hk,children:(0,Z.jsx)(s,{id:`lb_UU4`})}),t[60]=p,t[61]=n.state,t[62]=H):H=t[62];let U;t[63]!==p||t[64]!==r||t[65]!==n.state?(U=p&&n.state===`auth-error`&&(0,Z.jsx)(Di,{variant:`outline`,size:`xs`,onClick:r,children:(0,Z.jsx)(s,{id:`3jod3l`})}),t[63]=p,t[64]=r,t[65]=n.state,t[66]=U):U=t[66];let W;t[67]!==p||t[68]!==n.state?(W=p&&n.state===`offline`&&(0,Z.jsx)(Di,{variant:`outline`,size:`xs`,onClick:mk,children:(0,Z.jsx)(s,{id:`6gRgw8`})}),t[67]=p,t[68]=n.state,t[69]=W):W=t[69];let G;t[70]!==p||t[71]!==x||t[72]!==n.state?(G=p&&n.state===`conflict`&&x&&(0,Z.jsx)(Di,{variant:`outline`,size:`xs`,onClick:()=>{if(typeof window>`u`)return;let e=ii(Or(x.file));window.location.hash!==e&&(window.location.hash=e)},children:(0,Z.jsx)(s,{id:`0yL--g`})}),t[70]=p,t[71]=x,t[72]=n.state,t[73]=G):G=t[73];let K;t[74]!==H||t[75]!==U||t[76]!==W||t[77]!==G?(K=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[H,U,W,G]}),t[74]=H,t[75]=U,t[76]=W,t[77]=G,t[78]=K):K=t[78];let q;return t[79]!==A||t[80]!==j||t[81]!==M||t[82]!==N||t[83]!==B||t[84]!==V||t[85]!==K||t[86]!==k?(q=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[k,A,j,M,N,B,V,K]}),t[79]=A,t[80]=j,t[81]=M,t[82]=N,t[83]=B,t[84]=V,t[85]=K,t[86]=k,t[87]=q):q=t[87],q}function mk(){sk(`sync`)}function hk(){sk(`sync`)}function gk(e){let t=(0,$.c)(69),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onSetIdentity:a}=n,{_:o}=i(),{status:c,fetchError:l}=Ya();if(!c){if(l){let e;t[2]===o?e=t[3]:(e=o({id:`iqIDv4`}),t[2]=o,t[3]=e);let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(ic,{className:`size-3.5`}),t[4]=n):n=t[4];let r;t[5]===e?r=t[6]:(r=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[5]=e,t[6]=r);let i;t[7]===l?i=t[8]:(i=(0,Z.jsx)(Tn,{children:l===`network`?(0,Z.jsx)(s,{id:`I5AfhE`}):(0,Z.jsx)(s,{id:`uKRYiW`})}),t[7]=l,t[8]=i);let a;return t[9]!==r||t[10]!==i?(a=(0,Z.jsxs)(Gr,{children:[r,i]}),t[9]=r,t[10]=i,t[11]=a):a=t[11],a}return null}if(c.state===`dormant`&&!c.hasRemote||c.state===`disabled`&&!c.pausedReason)return null;let u;t[12]===c?u=t[13]:(u=lk(c),t[12]=c,t[13]=u);let d=u,f,p,m,h,g,_,y,b,x,S,C,w;if(t[14]!==o||t[15]!==c.identityUnresolved||t[16]!==c.state){let e=uk(c.state);_=!!c.identityUnresolved,g=Vt,h=Gr,m=$n,w=!0,p=zt,C=!0,f=Di,y=`ghost`,b=`icon-sm`,x=`text-muted-foreground relative`,S=o(_?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[14]=o,t[15]=c.identityUnresolved,t[16]=c.state,t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=g,t[22]=_,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=w}else f=t[17],p=t[18],m=t[19],h=t[20],g=t[21],_=t[22],y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],w=t[28];let T;t[29]===c?T=t[30]:(T=(0,Z.jsx)(ck,{status:c}),t[29]=c,t[30]=T);let E;t[31]===d?E=t[32]:(E=d&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:d}),t[31]=d,t[32]=E);let D;t[33]!==d||t[34]!==_?(D=!d&&_&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[33]=d,t[34]=_,t[35]=D):D=t[35];let O;t[36]!==f||t[37]!==E||t[38]!==D||t[39]!==y||t[40]!==b||t[41]!==x||t[42]!==S||t[43]!==T?(O=(0,Z.jsxs)(f,{variant:y,size:b,className:x,"aria-label":S,children:[T,E,D]}),t[36]=f,t[37]=E,t[38]=D,t[39]=y,t[40]=b,t[41]=x,t[42]=S,t[43]=T,t[44]=O):O=t[44];let k;t[45]!==p||t[46]!==O||t[47]!==C?(k=(0,Z.jsx)(p,{asChild:C,children:O}),t[45]=p,t[46]=O,t[47]=C,t[48]=k):k=t[48];let A;t[49]!==m||t[50]!==k||t[51]!==w?(A=(0,Z.jsx)(m,{asChild:w,children:k}),t[49]=m,t[50]=k,t[51]=w,t[52]=A):A=t[52];let j;t[53]===c?j=t[54]:(j=fk(c),t[53]=c,t[54]=j);let M;t[55]===j?M=t[56]:(M=(0,Z.jsx)(Tn,{children:j}),t[55]=j,t[56]=M);let N;t[57]!==h||t[58]!==A||t[59]!==M?(N=(0,Z.jsxs)(h,{children:[A,M]}),t[57]=h,t[58]=A,t[59]=M,t[60]=N):N=t[60];let P;t[61]!==a||t[62]!==r||t[63]!==c?(P=(0,Z.jsx)(v,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(pk,{status:c,onSignIn:r,onSetIdentity:a})}),t[61]=a,t[62]=r,t[63]=c,t[64]=P):P=t[64];let F;return t[65]!==g||t[66]!==N||t[67]!==P?(F=(0,Z.jsxs)(g,{children:[N,P]}),t[65]=g,t[66]=N,t[67]=P,t[68]=F):F=t[68],F}function _k(e){let t=(0,$.c)(39),{onSignIn:n,onSetIdentity:r}=e,{activeDocName:i,activeTarget:a}=ft(),{state:o}=aD(),c=Ra(),[l,u]=(0,Q.useState)(!1),d;bb0:{if(a===null){let e;t[0]===c?e=t[1]:(e=Jm({workspace:c}),t[0]=c,t[1]=e),d=e;break bb0}if(a.kind===`folder`){if(!c){d=null;break bb0}let e;t[2]!==a.folderPath||t[3]!==c?(e=Ym({folderRelativePath:a.folderPath,workspace:c}),t[2]=a.folderPath,t[3]=c,t[4]=e):e=t[4],d=e;break bb0}let e;t[5]!==i||t[6]!==c?(e=qm({docName:i,workspace:c}),t[5]=i,t[6]=c,t[7]=e):e=t[7],d=e}let f=d,p=typeof window<`u`&&window.okDesktop!=null,m=p&&o===`collapsed`&&`pl-[78px]`,h;t[8]===m?h=t[9]:(h=X(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,p&&`[-webkit-app-region:drag]`,m,p&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[8]=m,t[9]=h);let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(uD,{className:X(`-ml-1 shrink-0 text-muted-foreground`,p&&`[-webkit-app-region:no-drag]`)})}),t[10]=g):g=t[10];let _;t[11]===o?_=t[12]:(_=(0,Z.jsxs)(Gr,{children:[g,(0,Z.jsx)(Tn,{children:o===`expanded`?(0,Z.jsx)(s,{id:`w3vFfL`}):(0,Z.jsx)(s,{id:`e8zRrb`})})]}),t[11]=o,t[12]=_);let v,y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(so,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),y=(0,Z.jsx)(qO,{}),t[13]=v,t[14]=y):(v=t[13],y=t[14]);let b;t[15]===_?b=t[16]:(b=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[_,v,y]}),t[15]=_,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=X(`flex shrink-0 items-center justify-end gap-2 px-3`,p&&`[&>*]:[-webkit-app-region:no-drag]`),t[17]=x):x=t[17];let S;t[18]===f?S=t[19]:(S=(0,Z.jsx)(QO,{input:f}),t[18]=f,t[19]=S);let C;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(tk,{onClickWhenNoRemote:()=>u(!0)}),t[20]=C):C=t[20];let w;t[21]===l?w=t[22]:(w=(0,Z.jsx)(qa,{open:l,onOpenChange:u}),t[21]=l,t[22]=w);let T;t[23]!==r||t[24]!==n?(T=(0,Z.jsx)(gk,{onSignIn:n,onSetIdentity:r}),t[23]=r,t[24]=n,t[25]=T):T=t[25];let E,D,O,k,A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(BD,{}),D=(0,Z.jsx)(so,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),O=(0,Z.jsx)(Eu,{}),k=(0,Z.jsx)(ek,{}),A=(0,Z.jsx)(ZO,{}),t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A):(E=t[26],D=t[27],O=t[28],k=t[29],A=t[30]);let j;t[31]!==S||t[32]!==w||t[33]!==T?(j=(0,Z.jsxs)(`div`,{className:x,children:[S,C,w,T,E,D,O,k,A]}),t[31]=S,t[32]=w,t[33]=T,t[34]=j):j=t[34];let M;return t[35]!==j||t[36]!==h||t[37]!==b?(M=(0,Z.jsxs)(`header`,{"data-electron-drag":p?``:void 0,className:h,children:[b,j]}),t[35]=j,t[36]=h,t[37]=b,t[38]=M):M=t[38],M}function vk(){let e=(0,$.c)(26),{_:t}=i(),[n,r]=qh(),[a,o]=(0,Q.useState)(n),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(`auth`),[d,f]=(0,Q.useState)(f_[0].id),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_=uo(),{projectLocalConfig:v,projectLocalSynced:y}=Oe(),{activeDocName:b}=ft(),x=!h&&_?.hasRemote===!0&&y===!0&&v!==null&&v.autoSync?.enabled===null,S,C;e[0]===b?(S=e[1],C=e[2]):(S=()=>{let e=function(e){let t=e.detail;t&&b&&ks(b,{kind:`raw-mdx`,detail:t}),o(`source`)};return window.addEventListener(zh,e),()=>window.removeEventListener(zh,e)},C=[b],e[0]=b,e[1]=S,e[2]=C),(0,Q.useEffect)(S,C);let w;e[3]===r?w=e[4]:(w=function(e){o(e),r(e)},e[3]=r,e[4]=w);let T=w,E;e[5]===t?E=e[6]:(E=async function(){m(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?qo.success(t({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),qo.error(t({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),qo.error(t({id:`q7zsRM`}))}m(!1)},e[5]=t,e[6]=E);let D=E,O;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(_k,{onSignIn:()=>{u(`auth`),c(!0)},onSetIdentity:()=>{u(`identity`),c(!0)}}),e[7]=O):O=e[7];let k;e[8]!==d||e[9]!==a||e[10]!==T||e[11]!==D||e[12]!==p?(k=(0,Z.jsx)(PE,{editorMode:a,onModeChange:T,activeTab:d,onActiveTabChange:f,onSaveVersion:D,saving:p}),e[8]=d,e[9]=a,e[10]=T,e[11]=D,e[12]=p,e[13]=k):k=e[13];let A=l===`identity`,j;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{c(!1)},e[14]=j):j=e[14];let M;e[15]!==s||e[16]!==A?(M=(0,Z.jsx)(vo,{open:s,onOpenChange:c,identityPrompt:A,onSuccess:j}),e[15]=s,e[16]=A,e[17]=M):M=e[17];let N;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>g(!0),e[18]=N):N=e[18];let P;e[19]===x?P=e[20]:(P=(0,Z.jsx)(Jh,{open:x,onResolved:N}),e[19]=x,e[20]=P);let F;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Ih,{}),e[21]=F):F=e[21];let I;return e[22]!==P||e[23]!==k||e[24]!==M?(I=(0,Z.jsxs)(Z.Fragment,{children:[O,k,M,P,F]}),e[22]=P,e[23]=k,e[24]=M,e[25]=I):I=e[25],I}function yk(e){let t=ii(Or(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function bk(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=VC();if(n)return null;if(r!==null){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(An,{"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)(An,{"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(xk),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 xk(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Di,{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:()=>yk(e.file),children:[(0,Z.jsx)(An,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var Sk=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
31
|
+
`,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;ds(t,{style:t=>Es(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 gT.set(t.changes,i),i}function yT(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Tw).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(hT);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=cs.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:mT.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function bT(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Tw).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(hT).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 xT(e){let t=new ms;for(let n of e.field(Tw)){let r=e.facet(Sw).overrideChunk&&wT(e,n);t.add(n.fromB,n.fromB,vT(e,n,!!r))}return t.finish()}var ST=us.define({create:e=>xT(e),update(e,t){return t.state.field(Tw,!1)==t.startState.field(Tw,!1)?e:xT(t.state)},provide:e=>ys.decorations.from(e)}),CT=new WeakMap;function wT(e,t){let n=CT.get(t);if(n!==void 0)return n;n=null;let r=e.field(hT),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(ps.widget({widget:new TT(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Vw.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return CT.set(t,n),n}var TT=class extends os{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}},ET=new class extends bs{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},DT=ps.line({class:`cm-inlineChangedLine`});function OT(e,t,n,r){let i=wT(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,ET),n.add(o.from,o.from,DT);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 kT=Rt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),AT=_({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function jT(e){let t=(0,$.c)(24),{oldContent:n,newContent:r,layout:a,conflictMode:o,oursOverride:c,onResolve:l,onAbort:u}=e,{_:d}=i(),f=c??r,p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),{resolvedTheme:h}=Pn(),g=(0,Q.useRef)(l),_=(0,Q.useRef)(u),[v,y]=(0,Q.useState)(null),x;t[0]!==u||t[1]!==l?(x=()=>{g.current=l,_.current=u},t[0]=u,t[1]=l,t[2]=x):x=t[2],(0,Q.useEffect)(x);let S,C;t[3]!==o||t[4]!==f||t[5]!==a||t[6]!==n||t[7]!==h?(S=()=>{if(!p.current)return;let e=h===`dark`?kT:AT,t=[ys.editable.of(!1),ls.readOnly.of(!0)],r=[js,b(),...t,e,ys.lineWrapping];if(m.current&&=(m.current.destroy(),null),o){let t=new ys({doc:f,extensions:[js,b(),ys.editable.of(!1),e,ys.lineWrapping,pT({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),ys.updateListener.of(e=>{let t=Ew(e.state);y(t?t.chunks.length:0)})],parent:p.current});m.current=t;let r=Ew(t.state);y(r?r.chunks.length:0)}else a===`split`?m.current=new lT({a:{doc:n,extensions:r},b:{doc:f,extensions:r},parent:p.current,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):m.current=new ys({doc:f,extensions:[...r,pT({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:p.current});return()=>{m.current&&=(m.current.destroy(),null)}},C=[n,f,a,h,o],t[3]=o,t[4]=f,t[5]=a,t[6]=n,t[7]=h,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){let e=m.current;!e||!(e instanceof ys)||g.current?.(e.state.doc.toString())},t[10]=w):w=t[10];let T=w,E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=m.current;!e||!(e instanceof ys)||H(e)},t[11]=E):E=t[11];let D=E,O=v===0,k;t[12]!==d||t[13]!==v?(k=v===null?``:v===0?d({id:`lPzyrU`}):Y._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[12]=d,t[13]=v,t[14]=k):k=t[14];let A=k,j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`div`,{ref:p,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[15]=j):j=t[15];let M;t[16]!==O||t[17]!==o||t[18]!==A||t[19]!==u||t[20]!==l?(M=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 ${O?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:A}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&(0,Z.jsx)(Di,{variant:`ghost`,size:`sm`,onClick:u,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(Di,{variant:`outline`,size:`sm`,onClick:D,children:`Undo`}),l&&(0,Z.jsx)(Di,{variant:`default`,size:`sm`,disabled:!O,onClick:T,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[16]=O,t[17]=o,t[18]=A,t[19]=u,t[20]=l,t[21]=M):M=t[21];let N;return t[22]===M?N=t[23]:(N=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[j,M]}),t[22]=M,t[23]=N),N}async function MT(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 NT(e,t){return MT(e,`content`,t)}async function PT(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();return{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``}}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 FT(e){let t=(0,$.c)(24),{docName:n}=e,{conflicts:r,loading:i}=VC(),a;if(t[0]!==r||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Or(e.file)===n,t[3]=n,t[4]=e),a=r.find(e),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o=a,s=o?.file??`${n}.md`,[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),f,p;t[5]===n?(f=t[6],p=t[7]):(f=()=>(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}))}),p=[n],t[5]=n,t[6]=f,t[7]=p),(0,Q.useEffect)(f,p);let m=i||o===void 0,h,g;t[8]!==m||t[9]!==s?(h=()=>{if(m)return;let e=!1;return l(null),d(!1),PT(s).then(t=>{e||(t===null?d(!0):l(t))}),()=>{e=!0}},g=[s,m],t[8]=m,t[9]=s,t[10]=h,t[11]=g):(h=t[10],g=t[11]),(0,Q.useEffect)(h,g);let _;t[12]===s?_=t[13]:(_=async function(e){let t=await NT(s,e);t.ok||qo.error(`Failed to save resolution for ${s}`,{description:t.detail})},t[12]=s,t[13]=_);let v=_;if(u){let e;return t[14]===s?e=t[15]:(e=(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:[`Couldn't load conflict content for `,s,`. Try reloading the page.`]}),t[14]=s,t[15]=e),e}if(c===null){let e;return t[16]===s?e=t[17]:(e=(0,Z.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:[`Loading conflict for `,s]}),t[16]=s,t[17]=e),e}let y;t[18]===v?y=t[19]:(y=e=>void v(e),t[18]=v,t[19]=y);let b;return t[20]!==c.ours||t[21]!==c.theirs||t[22]!==y?(b=(0,Z.jsx)(jT,{oldContent:c.theirs,newContent:c.ours,layout:`unified`,conflictMode:!0,onResolve:y}),t[20]=c.ours,t[21]=c.theirs,t[22]=y,t[23]=b):b=t[23],b}function IT(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Mt(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 LT=`__back-nav__`;function RT(e){return e instanceof Ie||e instanceof gt||e instanceof Ne||e instanceof $e||e instanceof Et||e instanceof Bt?e.docName:null}function zT(e){if(e instanceof Ie){let t=e.docName;return{title:Y._({id:`Jejur6`}),summary:Y._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof gt){let t=e.docName;return{title:Y._({id:`V7QxyT`}),summary:Y._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Ne){let t=e.docName;return{title:Y._({id:`1di5fu`}),summary:Y._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof $e){let t=e.docName;return{title:Y._({id:`wvbc1r`}),summary:Y._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Et)return{title:Y._({id:`Gfr4fu`}),summary:Y._({id:`j6LB7S`})};if(e instanceof Bt){let t=e.docName;return{title:Y._({id:`vv7kpg`}),summary:Y._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Y._({id:`W5A0Ly`});return{title:Y._({id:`29VNqC`}),summary:t}}function BT(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=zT(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)(ab,{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)(Di,{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)(Di,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(ot(RT(n)??i),o(a),r(LT))},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 VT(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)(BT,{...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]===LT){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}: ${zT(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)(m,{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 HT(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=pi(t);return{map:n,keys:jn(t),parseError:r}}function UT(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>HT(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=Jr(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=Xe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=lt(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)(WT,{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)(GT,{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 WT(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 GT(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 KT(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=pi(t);return{map:n,keys:jn(t),parseError:r}}function qT(e){let t=(0,$.c)(175),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>KT(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=Jr(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]===j?M=t[9]:(M=ZT(j),t[8]=j,t[9]=M);let N=M,P;t[10]===j?P=t[11]:(P=YT(j),t[10]=j,t[11]=P);let F=no(N?null:P),I;t[12]!==F||t[13]!==N?(I=!N&&F.state.status===`ready`?F.state.data.folder.frontmatter_defaults??{}:{},t[12]=F,t[13]=N,t[14]=I):I=t[14];let L=I,R;t[15]!==F||t[16]!==N?(R=!N&&F.state.status===`ready`?F.state.data.frontmatterSources:{},t[15]=F,t[16]=N,t[17]=R):R=t[17];let z=R,B;t[18]!==r||t[19]!==a?(B=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=Zn(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[18]=r,t[19]=a,t[20]=B):B=t[20];let V=B,H;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[21]=H):H=t[21];let U=H,W;t[22]===r?W=t[23]:(W=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[22]=r,t[23]=W);let G=W,K;t[24]!==V||t[25]!==G?(K=function(e,t){U(e),G(V({[e]:t}),[e])},t[24]=V,t[25]=G,t[26]=K):K=t[26];let q=K,J;t[27]!==V||t[28]!==G?(J=function(e){U(e),G(V({[e]:null}),[e])},t[27]=V,t[28]=G,t[29]=J):J=t[29];let ee=J,ne;t[30]!==r||t[31]!==a?(ne=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=Zn(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[30]=r,t[31]=a,t[32]=ne):ne=t[32];let re=ne,ie;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e,t){return`${e} ${t}`},t[33]=ie):ie=t[33];let ae=ie,oe;t[34]!==a||t[35]!==m?(oe=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)=>ae(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[34]=a,t[35]=m,t[36]=oe):oe=t[36];let se=oe,ce;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ce={activationConstraint:{distance:4}},t[37]=ce):ce=t[37];let le;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(le={coordinateGetter:ma},t[38]=le):le=t[38];let ue=ka(qi(xa,ce),qi(ua,le)),de;t[39]!==L||t[40]!==q||t[41]!==p?(de=function(e,t){let n=p[e]??QT(L[e]);if(n===void 0)return;b(n=>({...n,[e]:t}));let r=ga(n,t);(!Object.hasOwn(p,e)||!JT(n,r))&&q(e,r)},t[39]=L,t[40]=q,t[41]=p,t[42]=de):de=t[42];let fe=de,pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[43]=pe):pe=t[43];let me=pe,{addPropertySignal:he,clearAddProperty:ge}=Qb(),_e;t[44]!==he||t[45]!==j?(_e=he.get(j)??0,t[44]=he,t[45]=j,t[46]=_e):_e=t[46];let ve=_e,ye,be;t[47]===ve?(ye=t[48],be=t[49]):(ye=()=>{ve>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},be=[ve],t[47]=ve,t[48]=ye,t[49]=be),(0,Q.useEffect)(ye,be);let xe,Se;t[50]!==ge||t[51]!==j?(xe=()=>()=>ge(j),Se=[j,ge],t[50]=ge,t[51]=j,t[52]=xe,t[53]=Se):(xe=t[52],Se=t[53]),(0,Q.useEffect)(xe,Se);let Ce;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Zi[e];return{...t,type:e,value:n,error:null}})},t[54]=Ce):Ce=t[54];let we=Ce,Te;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){S(t=>t&&{...t,value:e})},t[55]=Te):Te=t[55];let Ee=Te,De;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(e){S(t=>t&&{...t,name:e,error:null})},t[56]=De):De=t[56];let Oe=De,ke;t[57]!==r||t[58]!==x||t[59]!==V||t[60]!==p?(ke=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=V({[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[57]=r,t[58]=x,t[59]=V,t[60]=p,t[61]=ke):ke=t[61];let Ae=ke,je;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(je=function(){S(null)},t[62]=je):je=t[62];let Me=je,Ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){w({key:e,draft:e,error:null})},t[63]=Ne):Ne=t[63];let Pe=Ne,Fe;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(e){w(t=>t&&{...t,draft:e,error:null})},t[64]=Fe):Fe=t[64];let Ie=Fe,Le;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Le=function(){w(null)},t[65]=Le):Le=t[65];let Re=Le,ze;t[66]!==r||t[67]!==p||t[68]!==re||t[69]!==C?(ze=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=re(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}),U(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[66]=r,t[67]=p,t[68]=re,t[69]=C,t[70]=ze):ze=t[70];let Be=ze,Ve;t[71]!==p||t[72]!==m?(Ve=m.length>0?m:Object.keys(p),t[71]=p,t[72]=m,t[73]=Ve):Ve=t[73];let He=Ve,Ue;if(t[74]!==He){Ue=new Map;for(let e of He)Ue.set(e,(Ue.get(e)??0)+1);t[74]=He,t[75]=Ue}else Ue=t[75];let We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt;if(t[76]!==x||t[77]!==L||t[78]!==z||t[79]!==g||t[80]!==q||t[81]!==Be||t[82]!==Ue||t[83]!==E||t[84]!==se||t[85]!==p||t[86]!==y||t[87]!==h||t[88]!==ee||t[89]!==C||t[90]!==He||t[91]!==k||t[92]!==ue||t[93]!==fe){tt=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(L).filter(e=>!Object.hasOwn(p,e)).sort();if(He.length===0&&e.length===0&&!x&&!h){tt=null;break bb0}$e=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,et=`property-panel`,Ge=Qo,Xe=!g,t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=e=>_(!e),t[106]=Ze):Ze=t[106];let n=!g,r;t[107]===n?r=t[108]:(r=(0,Z.jsx)(Jo,{"data-expanded":n,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[107]=n,t[108]=r);let i;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[109]=i):i=t[109],t[110]===r?Qe=t[111]:(Qe=(0,Z.jsx)(Zo,{asChild:!0,children:(0,Z.jsxs)(Di,{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:[r,i]})}),t[110]=r,t[111]=Qe),We=Xo,Ke=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[112]===h?qe=t[113]:(qe=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)(An,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`UG-Phk`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[112]=h,t[113]=qe);let a;if(t[114]!==He){let e;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>ae(e,t),t[116]=e):e=t[116],a=He.map(e),t[114]=He,t[115]=a}else a=t[115];let o;if(t[117]!==q||t[118]!==Be||t[119]!==Ue||t[120]!==E||t[121]!==p||t[122]!==y||t[123]!==ee||t[124]!==C||t[125]!==He||t[126]!==k||t[127]!==fe){let e;t[129]!==q||t[130]!==Be||t[131]!==Ue||t[132]!==E||t[133]!==p||t[134]!==y||t[135]!==ee||t[136]!==C||t[137]!==k||t[138]!==fe?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??Br(n),i=C?.key===e?C:null,a=(Ue.get(e)??0)>1;return(0,Z.jsx)(Ta,{sortableId:ae(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Pe(e),onChangeDraft:Ie,onCommit:Be,onCancel:Re},onCommit:t=>q(e,t),onChangeType:t=>fe(e,t),onRemove:()=>ee(e)},`${e}-${t}`)},t[129]=q,t[130]=Be,t[131]=Ue,t[132]=E,t[133]=p,t[134]=y,t[135]=ee,t[136]=C,t[137]=k,t[138]=fe,t[139]=e):e=t[139],o=He.map(e),t[117]=q,t[118]=Be,t[119]=Ue,t[120]=E,t[121]=p,t[122]=y,t[123]=ee,t[124]=C,t[125]=He,t[126]=k,t[127]=fe,t[128]=o}else o=t[128];let c;t[140]!==a||t[141]!==o?(c=(0,Z.jsx)(Gi,{items:a,strategy:ta,children:o}),t[140]=a,t[141]=o,t[142]=c):c=t[142],t[143]!==se||t[144]!==ue||t[145]!==c?(Je=(0,Z.jsx)(oa,{sensors:ue,collisionDetection:To,onDragEnd:se,children:c}),t[143]=se,t[144]=ue,t[145]=c,t[146]=Je):Je=t[146];let l;t[147]!==L||t[148]!==z||t[149]!==q||t[150]!==E||t[151]!==k||t[152]!==fe?(l=e=>{let t=L[e],n=QT(t),r=Br(n),i=z[e]??``;return(0,Z.jsx)(Ta,{keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isInherited:!0,badge:(0,Z.jsx)($i,{source:i}),onCommit:t=>q(e,t),onChangeType:t=>fe(e,t)},`inherited-${e}`)},t[147]=L,t[148]=z,t[149]=q,t[150]=E,t[151]=k,t[152]=fe,t[153]=l):l=t[153],Ye=e.map(l)}t[76]=x,t[77]=L,t[78]=z,t[79]=g,t[80]=q,t[81]=Be,t[82]=Ue,t[83]=E,t[84]=se,t[85]=p,t[86]=y,t[87]=h,t[88]=ee,t[89]=C,t[90]=He,t[91]=k,t[92]=ue,t[93]=fe,t[94]=We,t[95]=Ge,t[96]=Ke,t[97]=qe,t[98]=Je,t[99]=Ye,t[100]=Xe,t[101]=Ze,t[102]=Qe,t[103]=$e,t[104]=et,t[105]=tt}else We=t[94],Ge=t[95],Ke=t[96],qe=t[97],Je=t[98],Ye=t[99],Xe=t[100],Ze=t[101],Qe=t[102],$e=t[103],et=t[104],tt=t[105];if(tt!==Symbol.for(`react.early_return_sentinel`))return tt;let nt;t[154]!==r||t[155]!==x||t[156]!==Ae?(nt=x?(0,Z.jsx)(yo,{draft:x,onChangeName:Oe,onChangeType:we,onChangeValue:Ee,onCommit:Ae,onCancel:Me}):(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)(Di,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:me,"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)(te,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[154]=r,t[155]=x,t[156]=Ae,t[157]=nt):nt=t[157];let rt;t[158]!==We||t[159]!==Ke||t[160]!==qe||t[161]!==Je||t[162]!==Ye||t[163]!==nt?(rt=(0,Z.jsxs)(We,{className:Ke,children:[qe,Je,Ye,nt]}),t[158]=We,t[159]=Ke,t[160]=qe,t[161]=Je,t[162]=Ye,t[163]=nt,t[164]=rt):rt=t[164];let it;t[165]!==Ge||t[166]!==Xe||t[167]!==Ze||t[168]!==Qe||t[169]!==rt?(it=(0,Z.jsxs)(Ge,{open:Xe,onOpenChange:Ze,children:[Qe,rt]}),t[165]=Ge,t[166]=Xe,t[167]=Ze,t[168]=Qe,t[169]=rt,t[170]=it):it=t[170];let at;return t[171]!==$e||t[172]!==et||t[173]!==it?(at=(0,Z.jsx)(`div`,{className:$e,"data-testid":et,children:it}),t[171]=$e,t[172]=et,t[173]=it,t[174]=at):at=t[174],at}function JT(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function YT(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var XT=/(^|\/)\.ok\/templates\//;function ZT(e){return XT.test(e)}function QT(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}var $T=Fe(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function eE(e){let t=e.threshold??$T;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function tE(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var nE=Fe(`ACTIVITY_MOUNT_LIMIT`,3);function rE(){return n(()=>import(`./SourceEditor-BKUWyZoX.js`),__vite__mapDeps([44,1,33,2,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,45,22]),import.meta.url)}var iE=(0,Q.lazy)(async()=>({default:(await rE()).SourceEditor}));function aE(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 oE(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Y._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Y._({id:`Sc1bKE`,values:{docName:e}}):Y._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Y._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Y._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Y._({id:`bmC18N`,values:{docName:e}}):Y._({id:`pAgkuZ`,values:{docName:e}})}:null}function sE(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(It,{name:`activity-pool`,children:(0,Z.jsx)(cE,{...e})}),t[0]=e,t[1]=n),n}function cE(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ft(),{pages:u,loading:d}=si(),f=aE(c,n,nE),p=(0,Q.useRef)(``),m=f.map(lE).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)at(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;rt(e,t&&t.length>0?t:crypto.randomUUID())}Wt(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,y(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(hE,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let b=f.map(v),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function lE(e){return e.docName}function uE(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&&Wt(`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&&(Wt(`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&&Wt(`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 dE(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)(Sy,{}),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)(iE,{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 fE(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)(Wc,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(B,{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)(Di,{type:`button`,onClick:pE,children:[(0,Z.jsx)(Wc,{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 pE(){return window.location.reload()}function mE(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 hE(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=oE(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,m=sS(n.docName)===`conflict`,h;t[3]===n.docName?h=t[4]:(h=()=>{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]=h);let[g]=(0,Q.useState)(h),_=n.provider.document.getText(`source`).length,[v,y]=(0,Q.useState)(i),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==v||t[7]!==b?(S=()=>{i&&!v?y(!0):!i&&!b&&x(!0)},C=[i,v,b],t[5]=i,t[6]=v,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=eE({ytextLength:_,isSourceMode:i,visitedSource:v,visitedVisual:b}),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]!==_?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&Wt(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:_,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,_,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]=_,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=()=>le(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]!==_?(P=()=>{tE({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(Wt(`ok/cold/first-toggle`,{docName:n.docName,mountId:p(n.docName),ytextLength:_,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,_,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]=_,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,z;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==m||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==g||t[41]!==s||t[42]!==f||t[43]!==j?(z=f?(0,Z.jsx)(fE,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(VT,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(mE,{html:j}):(0,Z.jsx)(Sy,{}),children:(0,Z.jsx)(IT,{docName:n.docName,provider:n.provider,children:m?(0,Z.jsx)(FT,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(UT,{provider:n.provider}),!i&&(0,Z.jsx)(qT,{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)(dE,{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)(LC,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:g},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=m,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=g,t[41]=s,t[42]=f,t[43]=j,t[44]=z):z=t[44];let B;t[45]!==r||t[46]!==R||t[47]!==z?(B=(0,Z.jsx)(uE,{isActive:r,initialScrollTop:R,children:z}),t[45]=r,t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;return t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:B}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52],V}function gE(e){let t=(0,$.c)(36),{stats:n}=e,{_:r}=i(),{words:a,chars:o,tokens:c}=n,l;t[0]===r?l=t[1]:(l=r({id:`L1ZE3M`}),t[0]=r,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[2]=u):u=t[2];let d;t[3]===n.words?d=t[4]:(d=n.words.toLocaleString(),t[3]=n.words,t[4]=d);let f;t[5]===d?f=t[6]:(f=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d}),t[5]=d,t[6]=f);let p;t[7]===a?p=t[8]:(p=(0,Z.jsx)(s,{id:`gljvbT`,values:{words:a}}),t[7]=a,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,` `,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.chars?h=t[13]:(h=n.chars.toLocaleString(),t[12]=n.chars,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:h}),t[14]=h,t[15]=g);let _;t[16]===o?_=t[17]:(_=(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:o}}),t[16]=o,t[17]=_);let v;t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`span`,{children:[g,` `,_]}),t[18]=g,t[19]=_,t[20]=v):v=t[20];let y=n.tokens>0?`~`:``,b;t[21]===n.tokens?b=t[22]:(b=n.tokens.toLocaleString(),t[21]=n.tokens,t[22]=b);let x;t[23]===b?x=t[24]:(x=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:b}),t[23]=b,t[24]=x);let S;t[25]===c?S=t[26]:(S=(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:c}}),t[25]=c,t[26]=S);let C;t[27]!==y||t[28]!==x||t[29]!==S?(C=(0,Z.jsxs)(`span`,{children:[y,x,` `,S]}),t[27]=y,t[28]=x,t[29]=S,t[30]=C):C=t[30];let w;return t[31]!==l||t[32]!==v||t[33]!==C||t[34]!==m?(w=(0,Z.jsxs)(`section`,{"aria-label":l,className:`relative flex h-6 shrink-0 items-center justify-end gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[u,m,v,C]}),t[31]=l,t[32]=v,t[33]=C,t[34]=m,t[35]=w):w=t[35],w}function _E(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=X(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 vE(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=X(`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 yE(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=X(`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 bE(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=X(`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 xE(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=X(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Jo,{}),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 SE=1,CE=2,wE=4;function TE(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}=Ye(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>wE?[...u.slice(0,SE).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(SE,-CE)},...u.slice(-CE).map((e,t)=>d(e,u.length-CE+t))]:u.map((e,t)=>d(e,t));a=_E,t[8]===r?c=t[9]:(c=X(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=vE,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(EE)}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 EE(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(xE,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(yE,{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)(pc,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(yE,{className:`min-w-0`,children:(0,Z.jsx)(bE,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var DE={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`},OE=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`,...DE,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},kE=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)(OE,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},AE=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)(OE,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function jE(e){let t=(0,$.c)(60),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===n?p=t[1]:(p=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(TE,{docName:n})}),t[0]=n,t[1]=p);let m=r?`source`:`wysiwyg`,h;t[2]===o?h=t[3]:(h=e=>{e&&o(e)},t[2]=o,t[3]=h);let g;t[4]===f?g=t[5]:(g=f({id:`n7aopT`}),t[4]=f,t[5]=g);let _;t[6]===f?_=t[7]:(_=f({id:`ur2XSb`}),t[6]=f,t[7]=_);let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)($n,{children:(0,Z.jsx)(AE,{className:`size-4`})}),t[8]=v):v=t[8];let y;t[9]===_?y=t[10]:(y=(0,Z.jsx)(Do,{value:`wysiwyg`,"aria-label":_,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:v}),t[9]=_,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[11]=b):b=t[11];let x;t[12]===y?x=t[13]:(x=(0,Z.jsxs)(Gr,{children:[y,b]}),t[12]=y,t[13]=x);let S;t[14]===f?S=t[15]:(S=f({id:`xbdtfY`}),t[14]=f,t[15]=S);let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(kE,{className:`size-4`}),t[16]=C):C=t[16];let w;t[17]!==a||t[18]!==S?(w=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Do,{value:`source`,"aria-label":S,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:C})})}),t[17]=a,t[18]=S,t[19]=w):w=t[19];let T;t[20]===a?T=t[21]:(T=(0,Z.jsx)(Tn,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[20]=a,t[21]=T);let E;t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(Gr,{children:[w,T]}),t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]!==E||t[26]!==m||t[27]!==h||t[28]!==g||t[29]!==x?(D=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(Ao,{type:`single`,value:m,onValueChange:h,"aria-label":g,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[x,E]})}),t[25]=E,t[26]=m,t[27]=h,t[28]=g,t[29]=x,t[30]=D):D=t[30];let O;t[31]!==p||t[32]!==D?(O=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[p,D]})}),t[31]=p,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==f||t[35]!==l||t[36]!==c?(k=c&&(0,Z.jsxs)(Gr,{children:[(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)($n,{children:(0,Z.jsx)(kc,{})})}),(0,Z.jsx)(Tn,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[34]=f,t[35]=l,t[36]=c,t[37]=k):k=t[37];let A=!u,j;t[38]!==f||t[39]!==u?(j=f(u?{id:`6iDEWA`}:{id:`170Js2`}),t[38]=f,t[39]=u,t[40]=j):j=t[40];let M;t[41]===u?M=t[42]:(M=(0,Z.jsx)($n,{children:u?(0,Z.jsx)(Rc,{}):(0,Z.jsx)(Lc,{})}),t[41]=u,t[42]=M);let N;t[43]!==d||t[44]!==A||t[45]!==j||t[46]!==M?(N=(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,onClick:d,"aria-expanded":A,"aria-label":j,asChild:!0,children:M}),t[43]=d,t[44]=A,t[45]=j,t[46]=M,t[47]=N):N=t[47];let P;t[48]===u?P=t[49]:(P=(0,Z.jsx)(Tn,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`6iDEWA`}):(0,Z.jsx)(s,{id:`170Js2`})}),t[48]=u,t[49]=P);let F;t[50]!==N||t[51]!==P?(F=(0,Z.jsxs)(Gr,{children:[N,P]}),t[50]=N,t[51]=P,t[52]=F):F=t[52];let I;t[53]!==k||t[54]!==F?(I=(0,Z.jsxs)(`div`,{className:`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,children:[k,F]}),t[53]=k,t[54]=F,t[55]=I):I=t[55];let L;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[56]=L):L=t[56];let R;return t[57]!==O||t[58]!==I?(R=(0,Z.jsxs)(`div`,{"data-testid":`editor-toolbar`,className:`pointer-events-none absolute inset-x-0 top-0 z-10`,children:[O,I,L]}),t[57]=O,t[58]=I,t[59]=R):R=t[59],R}function ME(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var NE=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-czEDk63C.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,6,3,7,4,10,9,40,41]),import.meta.url)).ActivityModeContent}));function PE(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(IE,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(FE,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(It,{name:`editor-area`,children:(0,Z.jsxs)(Xb,{children:[n,r]})}),t[3]=n,t[4]=i),i}function FE(){let e=(0,$.c)(5),t=bm(),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)(ox,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function IE(e){let t=(0,$.c)(111),{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:_}=ft(),{openDocumentTransition:v}=wt(),{requestAddProperty:y}=Qb(),b=aS(f,d),x=cS(f),S=x===`connected`||x===`synced`,C=sS(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=uy(),[j,M]=(0,Q.useState)(!1),{layout:N,autoCollapse:P}=Ux(),F=N===`sheet`,[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(!1),z,B;t[3]!==P||t[4]!==N||t[5]!==A?(z=()=>{if(N!==`panel`)return;let e=requestAnimationFrame(()=>{P?(R.current=!1,A.current?.collapse()):R.current||A.current?.expand()});return()=>cancelAnimationFrame(e)},B=[P,N,A],t[3]=P,t[4]=N,t[5]=A,t[6]=z,t[7]=B):(z=t[6],B=t[7]),(0,Q.useEffect)(z,B);let V,H;t[8]!==F||t[9]!==o||t[10]!==A?(V=()=>{let e=e=>{o(e),F?L(!0):(R.current=!1,A.current?.expand())},t=Tp();return t&&e(t),Dp(t=>{Tp(),e(t)})},H=[F,o,A],t[8]=F,t[9]=o,t[10]=A,t[11]=V,t[12]=H):(V=t[11],H=t[12]),(0,Q.useEffect)(V,H);let U,W;t[13]!==_||t[14]!==F||t[15]!==A?(U=()=>{_!==0&&(F?L(!0):(R.current=!1,A.current?.expand()))},W=[_,F,A],t[13]=_,t[14]=F,t[15]=A,t[16]=U,t[17]=W):(U=t[16],W=t[17]),(0,Q.useEffect)(U,W);let G=(0,Q.useRef)(null),[K,q]=(0,Q.useState)(null),J,ee;if(t[18]===d?(J=t[19],ee=t[20]):(J=()=>{if(d&&d!==G.current){let e=G.current;G.current=d,q(e)}},ee=[d],t[18]=d,t[19]=J,t[20]=ee),(0,Q.useEffect)(J,ee),p?.kind===`folder`){if(!(h===`agent`&&g!==null)){let e;return t[21]===p.folderPath?e=t[22]:(e=(0,Z.jsx)(Ub,{folderPath:p.folderPath}),t[21]=p.folderPath,t[22]=e),e}let e;t[23]===p.folderPath?e=t[24]:(e=(0,Z.jsx)(dx,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(Ub,{folderPath:p.folderPath})}),t[23]=p.folderPath,t[24]=e);let n;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(fx,{withHandle:!0}),t[25]=n):n=t[25];let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(dx,{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)(NE,{showBackButton:!1})})}),t[26]=r):r=t[26];let i;return t[27]===e?i=t[28]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(ux,{orientation:`horizontal`,children:[e,n,r]})}),t[27]=e,t[28]=i),i}if(p?.kind===`asset`){let e;return t[29]!==p.assetPath||t[30]!==p.mediaKind?(e=(0,Z.jsx)(xy,{assetPath:p.assetPath,mediaKind:p.mediaKind},p.assetPath),t[29]=p.assetPath,t[30]=p.mediaKind,t[31]=e):e=t[31],e}if(!f||!d){if((typeof window<`u`?zr(window.location.hash):null)!==null){let e;return t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Sy,{}),t[32]=e):e=t[32],e}let e;return t[33]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(gb,{}),t[33]=e):e=t[33],e}let te=n===`source`,ne=!S,re=F?!I:j,ie;t[34]!==d||t[35]!==y?(ie=function(){d&&y(d)},t[34]=d,t[35]=y,t[36]=ie):ie=t[36];let ae=ie,oe;t[37]!==j||t[38]!==F||t[39]!==A?(oe=function(){F?L(LE):j?(R.current=!1,A.current?.expand()):(R.current=!0,A.current?.collapse())},t[37]=j,t[38]=F,t[39]=A,t[40]=oe):oe=t[40];let se=oe,ce=T??d,le=K??void 0,ue;t[41]===v?ue=t[42]:(ue=e=>{let t=ii(e);window.location.hash===t?v(e):window.location.hash=t},t[41]=v,t[42]=ue);let de;t[43]!==k||t[44]!==te||t[45]!==m||t[46]!==ce||t[47]!==le||t[48]!==ue?(de=(0,Z.jsx)(sE,{activeDocName:ce,isSourceMode:te,editorPlaceholder:k,previousDocName:le,onNavigateBack:ue,onRecycle:m}),t[43]=k,t[44]=te,t[45]=m,t[46]=ce,t[47]=le,t[48]=ue,t[49]=de):de=t[49];let fe;t[50]!==d||t[51]!==te?(fe=(0,Z.jsx)(Rx,{activeDocName:d,isSourceMode:te}),t[50]=d,t[51]=te,t[52]=fe):fe=t[52];let pe;t[53]!==d||t[54]!==T?(pe=ME({activeDocName:d,deferredActiveDocName:T,mountResolved:d!==null&&w(d),syncResolved:d!==null&&ze(d)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Sy,{}),d===null?null:(0,Z.jsx)(qb,{docName:d})]}):null,t[53]=d,t[54]=T,t[55]=pe):pe=t[55];let me;t[56]!==de||t[57]!==fe||t[58]!==pe?(me=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[de,fe,pe]}),t[56]=de,t[57]=fe,t[58]=pe,t[59]=me):me=t[59];let he;t[60]!==d||t[61]!==C||t[62]!==re||t[63]!==te||t[64]!==r||t[65]!==ae||t[66]!==ne||t[67]!==se?(he=!C&&(0,Z.jsx)(jE,{activeDocName:d,isSourceMode:te,sourceDisabled:ne,onModeChange:r,showAddPropertyButton:!te,onAddProperty:ae,isPanelCollapsed:re,onTogglePanel:se}),t[60]=d,t[61]=C,t[62]=re,t[63]=te,t[64]=r,t[65]=ae,t[66]=ne,t[67]=se,t[68]=he):he=t[68];let ge;t[69]!==me||t[70]!==he?(ge=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[me,he]}),t[69]=me,t[70]=he,t[71]=ge):ge=t[71];let _e;t[72]!==D||t[73]!==b?(_e=D&&(0,Z.jsx)(gE,{stats:b}),t[72]=D,t[73]=b,t[74]=_e):_e=t[74];let ve;t[75]!==ge||t[76]!==_e?(ve=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[ge,_e]}),t[75]=ge,t[76]=_e,t[77]=ve):ve=t[77];let ye=ve,be=F?`100%`:`30%`,xe=F?`100%`:`75%`,Se;t[78]!==ye||t[79]!==be||t[80]!==xe?(Se=(0,Z.jsx)(dx,{minSize:be,defaultSize:xe,children:ye}),t[78]=ye,t[79]=be,t[80]=xe,t[81]=Se):Se=t[81];let Ce;t[82]===F?Ce=t[83]:(Ce=F?null:(0,Z.jsx)(fx,{withHandle:!0}),t[82]=F,t[83]=Ce);let we;t[84]!==d||t[85]!==a||t[86]!==h||t[87]!==F||t[88]!==te||t[89]!==o||t[90]!==c||t[91]!==A||t[92]!==l?(we=F?null:(0,Z.jsx)(dx,{panelRef:A,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:e=>M(e.asPercentage===0),className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(__,{docName:d,isSourceMode:te,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l})}),t[84]=d,t[85]=a,t[86]=h,t[87]=F,t[88]=te,t[89]=o,t[90]=c,t[91]=A,t[92]=l,t[93]=we):we=t[93];let Te;t[94]!==Se||t[95]!==Ce||t[96]!==we?(Te=(0,Z.jsxs)(ux,{orientation:`horizontal`,children:[Se,Ce,we]}),t[94]=Se,t[95]=Ce,t[96]=we,t[97]=Te):Te=t[97];let Ee;t[98]!==d||t[99]!==a||t[100]!==h||t[101]!==F||t[102]!==te||t[103]!==o||t[104]!==c||t[105]!==l||t[106]!==I?(Ee=F?(0,Z.jsx)(px,{open:I,onOpenChange:L,children:(0,Z.jsxs)(gx,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[(0,Z.jsx)(_x,{className:`sr-only`,children:(0,Z.jsx)(vx,{children:(0,Z.jsx)(s,{id:`5Q9-G-`})})}),(0,Z.jsx)(__,{docName:d,isSourceMode:te,activeTab:a,onActiveTabChange:o,mode:h,onSaveVersion:c,saving:l})]})}):null,t[98]=d,t[99]=a,t[100]=h,t[101]=F,t[102]=te,t[103]=o,t[104]=c,t[105]=l,t[106]=I,t[107]=Ee):Ee=t[107];let De;return t[108]!==Te||t[109]!==Ee?(De=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[Te,Ee]}),t[108]=Te,t[109]=Ee,t[110]=De):De=t[110],De}function LE(e){return!e}var RE=1280;function zE(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(BE),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${RE-1}px)`),t=()=>{n(window.innerWidth<RE)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function BE(){return window.innerWidth<RE}function VE(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function HE(e){let{value:t,unit:n}=VE(e);return n===`rem`?t*16:t}function UE(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var WE=3600*24*7;function GE(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?KE:m,O=g===void 0?WE: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=HE(b),J;t[6]===x?J=t[7]:(J=HE(x),t[6]=x,t[7]=J);let ee=J,te;t[8]!==E||t[9]!==k?(te=function(e){P.current=!0,E&&(j.current=H.current?0:HE(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]=te):te=t[10];let ne=te,re,ie;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{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}=VE(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=UE(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(ee,u)),f=UE(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)}},ie=[i,a,D,q,ee,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=ie):(re=t[24],ie=t[25]),(0,Q.useEffect)(re,ie);let ae;return t[26]===ne?ae=t[27]:(ae={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ae),ae}function KE(){}var qE=`sidebar_state`,JE=3600*24*7,YE=`18rem`,XE=`3rem`,ZE=`\\`,QE=`app-file-sidebar`,$E=`14.625rem`,eD=`22rem`,tD=`sidebar_width`,nD=/^\d+(?:\.\d+)?(?:rem|px)$/,rD=Q.createContext(null);function iD(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${tD}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return nD.test(n)?n:e}function aD(){let e=Q.use(rD);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function oD(e){let t=(0,$.c)(53),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:l,...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,t[8]=l);let u=c===void 0?!0:c,d=l===void 0?YE:l,f=zE(),p;t[9]===d?p=t[10]:(p=()=>iD(d),t[9]=d,t[10]=p);let[m,h]=Q.useState(p),[g,_]=Q.useState(!1),v=Q.useRef(g),[y,b]=Q.useState(!1),[x,S]=Q.useState(!1),[C,w]=Q.useState(u),T=i??C,E;t[11]!==T||t[12]!==o?(E=e=>{let t=typeof e==`function`?e(T):e;o?o(t):w(t),document.cookie=`${qE}=${t}; path=/; max-age=${JE}`},t[11]=T,t[12]=o,t[13]=E):E=t[13];let D=E,O;t[14]===D?O=t[15]:(O=function(){return window.innerWidth<1280?_(cD):D(sD)},t[14]=D,t[15]=O);let k=O,A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){window.innerWidth>=1280||v.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||S(!0))},t[16]=A):A=t[16];let j=A,M;t[17]===g?M=t[18]:(M=()=>{v.current=g},t[17]=g,t[18]=M),Q.useLayoutEffect(M);let N,P;t[19]===k?(N=t[20],P=t[21]):(N=()=>{let e=e=>{e.key===ZE&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),k())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},P=[k],t[19]=k,t[20]=N,t[21]=P),Q.useEffect(N,P);let F,I;t[22]!==f||t[23]!==g?(F=()=>{if(!f||!g)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"]`)||_(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},I=[f,g],t[22]=f,t[23]=g,t[24]=F,t[25]=I):(F=t[24],I=t[25]),Q.useEffect(F,I);let L=Q.useRef(f),R,z;t[26]!==f||t[27]!==T?(R=()=>{!L.current&&f&&_(T),L.current=f},z=[f,T],t[26]=f,t[27]=T,t[28]=R,t[29]=z):(R=t[28],z=t[29]),Q.useEffect(R,z);let B=f?g?`expanded`:`collapsed`:T?`expanded`:`collapsed`,V;t[30]!==y||t[31]!==f||t[32]!==T||t[33]!==g||t[34]!==D||t[35]!==x||t[36]!==B||t[37]!==k||t[38]!==m?(V={state:B,open:T,setOpen:D,isMobile:f,openMobile:g,setOpenMobile:_,toggleSidebar:k,width:m,setWidth:h,isDraggingRail:y,setIsDraggingRail:b,showPushPulse:x,setShowPushPulse:S,notifySidebarFileSelected:j},t[30]=y,t[31]=f,t[32]=T,t[33]=g,t[34]=D,t[35]=x,t[36]=B,t[37]=k,t[38]=m,t[39]=V):V=t[39];let H;t[40]!==s||t[41]!==m?(H={"--sidebar-width":m,"--sidebar-width-icon":XE,...s},t[40]=s,t[41]=m,t[42]=H):H=t[42];let U=H,W;t[43]===r?W=t[44]:(W=X(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[43]=r,t[44]=W);let G;t[45]!==n||t[46]!==a||t[47]!==U||t[48]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[45]=n,t[46]=a,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;return t[50]!==V||t[51]!==G?(K=(0,Z.jsx)(rD.Provider,{value:V,children:G}),t[50]=V,t[51]=G,t[52]=K):K=t[52],K}function sD(e){return!e}function cD(e){return!e}function lD(e){let t=(0,$.c)(57),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(),{isMobile:p,state:m,openMobile:h,isDraggingRail:g}=aD();if(d===`none`){let e;t[7]===r?e=t[8]:(e=X(`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}if(p){let e=h?`expanded`:`collapsed`,i;t[14]===f?i=t[15]:(i=f({id:`07q4Qk`}),t[14]=f,t[15]=i);let o=u===`floating`||u===`inset`?`p-2`:``,s;t[16]!==r||t[17]!==o?(s=X(`fixed inset-y-0 z-30 flex h-svh w-(--sidebar-width)`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`data-[side=left]:left-0 data-[side=right]:right-0`,`group-data-[state=collapsed]:data-[side=left]:-translate-x-full`,`group-data-[state=collapsed]:data-[side=right]:translate-x-full`,o,r),t[16]=r,t[17]=o,t[18]=s):s=t[18];let c;t[19]===n?c=t[20]:(c=(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[19]=n,t[20]=c);let d;t[21]!==a||t[22]!==l||t[23]!==i||t[24]!==s||t[25]!==c?(d=(0,Z.jsx)(`nav`,{id:QE,"aria-label":i,"data-slot":`sidebar-container`,"data-side":l,className:s,...a,children:c}),t[21]=a,t[22]=l,t[23]=i,t[24]=s,t[25]=c,t[26]=d):d=t[26];let p;return t[27]!==e||t[28]!==l||t[29]!==d||t[30]!==u?(p=(0,Z.jsx)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":e,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-mobile":`true`,children:d}),t[27]=e,t[28]=l,t[29]=d,t[30]=u,t[31]=p):p=t[31],p}let _=m===`collapsed`?d:``,v=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,y;t[32]===v?y=t[33]:(y=X(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,v,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[32]=v,t[33]=y);let b;t[34]===y?b=t[35]:(b=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:y}),t[34]=y,t[35]=b);let x;t[36]===f?x=t[37]:(x=f({id:`07q4Qk`}),t[36]=f,t[37]=x);let S=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`,C;t[38]!==r||t[39]!==S?(C=X(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear 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)] md:flex`,S,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[38]=r,t[39]=S,t[40]=C):C=t[40];let w;t[41]===n?w=t[42]:(w=(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[41]=n,t[42]=w);let T;t[43]!==a||t[44]!==l||t[45]!==C||t[46]!==w||t[47]!==x?(T=(0,Z.jsx)(`nav`,{id:QE,"aria-label":x,"data-slot":`sidebar-container`,"data-side":l,className:C,...a,children:w}),t[43]=a,t[44]=l,t[45]=C,t[46]=w,t[47]=x,t[48]=T):T=t[48];let E;return t[49]!==g||t[50]!==l||t[51]!==m||t[52]!==T||t[53]!==_||t[54]!==b||t[55]!==u?(E=(0,Z.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":m,"data-collapsible":_,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":g,children:[b,T]}),t[49]=g,t[50]=l,t[51]=m,t[52]=T,t[53]=_,t[54]=b,t[55]=u,t[56]=E):E=t[56],E}function uD(e){let t=(0,$.c)(21),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}=aD(),l=c===`expanded`,u;t[4]!==o||t[5]!==c?(u=o(c===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[4]=o,t[5]=c,t[6]=u):u=t[6];let d;t[7]===n?d=t[8]:(d=X(n),t[7]=n,t[8]=d);let f;t[9]!==r||t[10]!==s?(f=e=>{r?.(e),s()},t[9]=r,t[10]=s,t[11]=f):f=t[11];let p;t[12]===c?p=t[13]:(p=c===`expanded`?(0,Z.jsx)(M,{}):(0,Z.jsx)(Ic,{}),t[12]=c,t[13]=p);let m;return t[14]!==a||t[15]!==l||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,Z.jsx)(Di,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":l,"aria-controls":QE,"aria-label":u,className:d,onClick:f,...a,children:p}),t[14]=a,t[15]=l,t[16]=u,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function dD(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}=aD(),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:$E,maxResizeWidth:eD,setIsDraggingRail:h,widthCookieName:tD,widthCookieMaxAge:JE},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}=GE(_),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=X(`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 fD(e){let t=(0,$.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onClick:i,onAnimationEnd:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{isMobile:o,openMobile:s,setOpenMobile:c,showPushPulse:l,setShowPushPulse:u}=aD(),d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==c?(d=e=>{i?.(e),!e.defaultPrevented&&(!o||!s||e.target?.closest(`[data-sidebar="trigger"]`)||c(!1))},t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=d):d=t[9];let f=d,p;t[10]!==r||t[11]!==u?(p=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&u(!1)},t[10]=r,t[11]=u,t[12]=p):p=t[12];let m=p,h=l?``:void 0,g;t[13]===n?g=t[14]:(g=X(`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`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`peer-data-[mobile=true]:peer-data-[state=expanded]:translate-x-(--sidebar-width)`,n),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==f||t[17]!==a||t[18]!==h||t[19]!==g?(_=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":h,onClick:f,onAnimationEnd:m,className:g,...a}),t[15]=m,t[16]=f,t[17]=a,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function pD(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=X(`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 mD(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=X(`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 hD(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=X(`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 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=X(`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 _D(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=X(`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 vD=ki(`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 yD(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?Si:`button`,{isMobile:m,state:h}=aD(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=X(vD({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,Z.jsx)($n,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,Z.jsx)(Tn,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,Z.jsxs)(Gr,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function bD(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 xD(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 SD=1e3,CD=!1;function wD(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function TD(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:Hi(i)?a=i:(a=void 0,CD||(CD=!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`&&(wD({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=xD(i),{current:c,crossDoc:l}=a?Li(a,n,Date.now()):{current:[],crossDoc:[]},u=ED,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>bD(e.current,p)&&bD(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,SD);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 ED(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var DD=`sync-status`;function OD(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,qo.warning(r({id:`HGNCsl`}),{id:DD,duration:1/0})):o.current&&e===`synced`&&(o.current=!1,qo.success(r({id:`GhjUB_`}),{id:DD,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 kD=4,AD=3,jD={Bird:Ys,Cat:tc,Dog:fc,Fish:_c,Mouse:Uc,Rabbit:Hc,Shrimp:Zc,Snail:Qc,Squirrel:tl,Turtle:ol};Object.freeze(Object.keys(jD));function MD(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(jD,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var ND={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function PD(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=MD(n),c=s.kind===`animal`?jD[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=ir(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=tr(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)($n,{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)(Tn,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Gr,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function FD(e){let t=ND[e.icon];return e.displayName||t||Y._({id:`iEQQyu`})}function ID(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 LD(e){let t=(0,$.c)(34),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{presence:l,agentId:u}=n,d=FD(l),f=ID(l.mode),p=!r&&f,m=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,h=p&&!a?`ring-primary/40 animate-pulse`:``,g;t[0]!==m||t[1]!==h?(g=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2 cursor-pointer`,m,h].filter(Boolean),t[0]=m,t[1]=h,t[2]=g):g=t[2];let _=g.join(` `),v=r?`true`:void 0,y=a?`true`:void 0,b;t[3]!==l.mode||t[4]!==v||t[5]!==y?(b={"data-presence-badge":`agent`,"data-presence-mode":l.mode,"data-presence-crossdoc":v,"data-presence-scoped":y},t[3]=l.mode,t[4]=v,t[5]=y,t[6]=b):b=t[6];let x=b,S=l.currentDoc&&l.currentDoc!==`(connected)`?l.currentDoc:null,C=c(r&&S?{id:`b4AQFK`,values:{tooltipName:d,realCurrentDoc:S}}:{id:`RfHNf8`,values:{tooltipName:d}}),w;t[7]===l.color?w=t[8]:(w={backgroundColor:l.color},t[7]=l.color,t[8]=w);let T;t[9]!==u||t[10]!==o?(T=()=>o(u),t[9]=u,t[10]=o,t[11]=T):T=t[11];let E;t[12]===l.icon?E=t[13]:(E=(0,Z.jsx)(Bi,{icon:l.icon,width:16,height:16,className:`text-white`}),t[12]=l.icon,t[13]=E);let D;t[14]!==C||t[15]!==x||t[16]!==_||t[17]!==w||t[18]!==T||t[19]!==E?(D=(0,Z.jsx)(`button`,{type:`button`,...x,"aria-label":C,className:_,style:w,onClick:T,children:E}),t[14]=C,t[15]=x,t[16]=_,t[17]=w,t[18]=T,t[19]=E,t[20]=D):D=t[20];let O=D,k;t[21]===O?k=t[22]:(k=(0,Z.jsx)($n,{asChild:!0,children:O}),t[21]=O,t[22]=k);let A;t[23]===d?A=t[24]:(A=(0,Z.jsx)(`span`,{className:`font-medium`,children:d}),t[23]=d,t[24]=A);let j;t[25]!==r||t[26]!==S?(j=r&&S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:S}})}):null,t[25]=r,t[26]=S,t[27]=j):j=t[27];let M;t[28]!==A||t[29]!==j?(M=(0,Z.jsxs)(Tn,{className:`flex flex-col gap-0.5`,children:[A,j]}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;return t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(Gr,{children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33],N}function RD(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?Y._({id:`9euN0m`,values:{count:n}}):Y._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(zt,{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)(PD,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(LD,{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)(v,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(Vt,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function zD(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(PD,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(LD,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function BD(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ft(),{current:s,crossDoc:c}=TD(t,r,n);if(OD(cS(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,kD),n;e[6]===s?n=e[7]:(n=s.slice(kD),e[6]=s,e[7]=n);let r=n,u=c.slice(0,AD),d;e[8]===c?d=e[9]:(d=c.slice(AD),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=>zD(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)(RD,{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=>zD(e,p,!0,m)),f.length>0?(0,Z.jsx)(RD,{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 VD=`.md`,HD=/\.(md|mdx)$/i;function UD(e,t=VD){return`${e}${t}`}function WD(e){return cO(e).replace(HD,``)}function GD(e){return Nn(e)?JD(e.path):pr(e)?e.path:UD(e.docName,e.docExt)}function KD(e){let t=cO(e).match(HD);return t?`.${t[1].toLowerCase()}`:void 0}function qD(e){return cO(e)}function JD(e){let t=cO(e.trim());return t?`${t}/`:``}function YD(e){return e.endsWith(`/`)?qD(e):WD(e)}function XD(e){return e.map(GD)}function ZD(e){return[...e].sort().join(`\0`)}function QD(e){return ZD(XD(e))}function $D(e){let t=new Set;for(let n of e){if(Nn(n)){let e=JD(n.path);e&&t.add(e)}let e=(Nn(n)||pr(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Nn(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function eO(e){if(!e)return[];let t=cO(e.replace(HD,``)).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 tO(e){let t=e.kind===`directory`,n=t?qD(e.path):WD(e.path),r=t?void 0:KD(e.path);return{kind:t?`folder`:`file`,name:cO(sO(e.path)).replace(HD,``),path:n,treePath:rO(e.path,t),docExt:r}}function nO(e){return e.kind===`directory`?qD(e.path):e.path}function rO(e,t){return t?JD(e):HD.test(e)?e:`${e}${VD}`}function iO(e,t,n){let r=JD(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}${VD}`;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 aO(e,t){return e===`file`?rO(t,!1):`${qD(t)}/index${VD}`}function oO(e,t){return t.kind===`root`||t.directoryPath==null?sO(e):`${t.directoryPath}${sO(e)}`}function sO(e){let t=cO(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function cO(e){return e.endsWith(`/`)?e.slice(0,-1):e}function lO(e,t){return t.trim()}function uO(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function dO(e,t){let n=lO(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function fO(e,t,n=[]){if(t.length===0&&n.length===0)return e;let r=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>Rn(e)?{...e,docName:r.get(e.docName)??e.docName}:Nn(e)||pr(e)?{...e,path:vO(e.path,n)}:e)}function pO(e,t,n){if(t.length===0&&!n)return e;let r=new Set(t);return e.filter(e=>Rn(e)?!r.has(e.docName)&&!SO(e.docName,n):Nn(e)||pr(e)?!SO(e.path,n):!0)}function mO(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>yO(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Rn(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=>Nn(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(Rn(i)){let e=xO(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Nn(i)){let e=bO(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function hO(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function gO(e,t){return e.flatMap(e=>t===e.toDocName?[e.fromDocName]:[e.fromDocName,e.toDocName])}function _O(e,t){let n=e.kind===`folder`||e.docExt===void 0?e.path:UD(e.path,e.docExt);return Gm(t.contentDir,n,t.pathSeparator)}function vO(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 yO(e,t){return Rn(e)&&Rn(t)?e.docName===t.docName:Nn(e)&&Nn(t)||pr(e)&&pr(t)?e.path===t.path:!1}function bO(e,t,n){return e===t?n:xO(e,t,n)}function xO(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function SO(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function CO(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)(pu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function wO(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=X(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mu,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TO(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)(xu,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function EO(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=X(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(hu,{children:(0,Z.jsx)(gu,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function DO(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=X(`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)(_u,{"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 OO(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=X(`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)(Jo,{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)(Su,{"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 kO(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=X(`z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg 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)(Cu,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function AO(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=X(`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)(yu,{children:(0,Z.jsx)(jo,{})})}),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)(vu,{"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 jO(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=X(`-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)(bu,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var MO=[`.md`,`.mdx`],NO=`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`,PO=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,FO=X(PO,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),IO=`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`,LO=`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 RO(e){return X(LO,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 zO(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function BO(e){let t=ii(e);window.location.hash!==t&&(window.location.hash=t)}function VO(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function HO(e,t){let n=[t,...MO].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 UO(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}=va(s),m;t[9]===d?m=t[10]:(m=ia.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 WO(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=Ve(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=Ve(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)(wO,{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)(DO,{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)(DO,{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)(DO,{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)(jO,{}),(0,Z.jsx)(DO,{"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)(EO,{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)(CO,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function GO(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)(Vc,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(Di,{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)(Mo,{"aria-hidden":`true`}),t[16]=d):d=t[16];let f;return t[17]!==l||t[18]!==u?(f=(0,Z.jsx)(Di,{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 KO(e){let t=(0,$.c)(1),{docName:n}=e;if(sS(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(An,{"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 qO(){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,isNewTabActive:m,newTabIds:h,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=ft(),{_:T}=i(),{pageMeta:E}=si(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(``),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(!1),I=(0,Q.useRef)(null),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(t),V;e[0]!==n||e[1]!==t||e[2]!==a?(V=n??(a?Qe(a):t?Pt(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=V):V=e[3];let H=V,U;e[4]!==r||e[5]!==H||e[6]!==m||e[7]!==h||e[8]!==v?(U=m?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${h.join(`\0`)}`:H?`${H}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=H,e[6]=m,e[7]=h,e[8]=v,e[9]=U):U=e[9];let W=U,G,K;e[10]===t?(G=e[11],K=e[12]):(G=()=>{B.current=t},K=[t],e[10]=t,e[11]=G,e[12]=K),(0,Q.useEffect)(G,K);let q,J;e[13]===W?(q=e[14],J=e[15]):(q=()=>{W&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},J=[W],e[13]=W,e[14]=q,e[15]=J),(0,Q.useEffect)(q,J);let ee,ne;e[16]===O?(ee=e[17],ne=e[18]):(ee=()=>{O&&(I.current?.focus(),I.current?.select())},ne=[O],e[16]=O,e[17]=ee,e[18]=ne),(0,Q.useEffect)(ee,ne);let re,ie;e[19]!==v||e[20]!==O?(re=()=>{!O||v.includes(O.tabId)||(R.current=!0,z.current=null,k(null),j(``),N(null),F(!1))},ie=[v,O],e[19]=v,e[20]=O,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(`/`);R.current=!1,z.current=null,k({docName:t,tabId:e}),j(n[n.length-1]),N(null)},oe=function(){R.current=!0,z.current=null,k(null),j(``),N(null),F(!1)},se=async function(){if(R.current){R.current=!1;return}if(L.current)return;let e=O?.docName;if(!e){oe();return}let t=lO(`file`,HO(A,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){oe();return}if(t===z.current){I.current?.focus();return}if(!uO(t)){N(T({id:`P8yDjG`})),I.current?.focus();return}let i=dO({kind:`file`,path:e,name:r},t);L.current=!0,F(!0),N(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(R.current){F(!1),L.current=!1;return}let r=await Kt(n,`Server error (HTTP ${n.status})`);if(!r.ok){N(r.title),F(!1),L.current=!1,z.current=t,I.current?.focus();return}let a=g(Cr,r.body,`rename-path:tab`,{renamed:[]}).renamed,o=B.current,s=hO(o,a);Me(a);let c=!0;try{let e=gO(a,p());await Promise.all(e.map(e=>l(e))),x(a),Er([`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}),qo.error(T({id:`MUBR8r`}))}R.current=!0,k(null),j(``),N(null),F(!1),L.current=!1,z.current=null,c&&s&&s!==o&&BO(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),N(T({id:`HIb0vl`})),F(!1),L.current=!1,z.current=t,I.current?.focus()}},ce=typeof window<`u`&&window.okDesktop!=null,le;e[23]===h?le=e[24]:(le=new Set(h),e[23]=h,e[24]=le);let ue=le,de;e[25]!==u||e[26]!==f||e[27]!==ue?(de=function(e){let t=[],n=[];for(let r of e)ue.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]=ue,e[28]=de):de=e[28];let fe=de,pe;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(pe={activationConstraint:{distance:8}},e[29]=pe):pe=e[29];let me;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(me={coordinateGetter:ma},e[30]=me):me=e[30];let he=ka(qi(xa,pe),qi(ua,me)),ge;e[31]!==S||e[32]!==w?(ge=function(e){let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Xa([...w],r,i),t)},e[31]=S,e[32]=w,e[33]=ge):ge=e[33];let _e=ge,ve=ce?``:void 0,ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye=X(`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]`,ce&&`[-webkit-app-region:drag]`),e[34]=ye):ye=e[34];let be=VO,xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=X(`flex items-end gap-1`,ce&&`[-webkit-app-region:no-drag]`),e[35]=xe):xe=e[35];let Se=oa,Ce=To,we;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(we={container:typeof document<`u`?document.body:void 0},e[36]=we):we=e[36];let Te=Gi,Ee;e[37]===w?Ee=e[38]:(Ee=[...w],e[37]=w,e[38]=Ee);let De=fa,Oe=w.map(e=>{if(ue.has(e)){let t=e===r;return(0,Z.jsx)(WO,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:fe,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(UO,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:X(NO,t?PO:FO),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:IO,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":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:RO(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(Mo,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=bt(e),n=e===H,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Ye(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(WO,{tabId:e,openTabs:w,closeTab:d,closeTabs:fe,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(UO,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(NO,n?PO:FO),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:IO,onClick:()=>{o(e)},children:[s&&(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:X(`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)(GO,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Ye(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(WO,{tabId:e,openTabs:w,closeTab:d,closeTabs:fe,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(UO,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(NO,n?PO:FO),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:IO,onClick:()=>{o(e)},children:[s?(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:X(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(GO,{accessibleLabel:c,closeTab:d,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=Ye(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=O?.tabId===e,x=`editor-tab-rename-error-${zO(a)}`;return(0,Z.jsx)(WO,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:fe,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(UO,{tabId:e,disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(NO,n?PO:FO,v&&M&&`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)(yx,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(wx,{ref:I,value:A,disabled:P,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":M?!0:void 0,"aria-describedby":M?x:void 0,"aria-busy":P||void 0,title:M??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=>{j(HO(e.target.value,l)),N(null),z.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),se()):e.key===`Escape`&&(e.preventDefault(),oe())},onBlur:se}),(0,Z.jsx)(xx,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(Cx,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),M?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:M}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:IO,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),ae(e,a)},children:[(0,Z.jsx)(KO,{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)(GO,{accessibleLabel:g,closeTab:d,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),ke;e[39]!==Te||e[40]!==Ee||e[41]!==De||e[42]!==Oe?(ke=(0,Z.jsx)(Te,{items:Ee,strategy:De,children:Oe}),e[39]=Te,e[40]=Ee,e[41]=De,e[42]=Oe,e[43]=ke):ke=e[43];let Ae;e[44]!==Se||e[45]!==_e||e[46]!==he||e[47]!==Ce||e[48]!==we||e[49]!==ke?(Ae=(0,Z.jsx)(Se,{sensors:he,collisionDetection:Ce,onDragEnd:_e,accessibility:we,children:ke}),e[44]=Se,e[45]=_e,e[46]=he,e[47]=Ce,e[48]=we,e[49]=ke,e[50]=Ae):Ae=e[50];let je;e[51]===T?je=e[52]:(je=T({id:`3YvS-c`}),e[51]=T,e[52]=je);let Ne;e[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(te,{"aria-hidden":`true`}),e[53]=Ne):Ne=e[53];let Pe;e[54]!==_||e[55]!==je?(Pe=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":je,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ne})}),e[54]=_,e[55]=je,e[56]=Pe):Pe=e[56];let Fe;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,Z.jsx)(Tn,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[57]=Fe):Fe=e[57];let Ie;e[58]===Pe?Ie=e[59]:(Ie=(0,Z.jsxs)(Gr,{children:[Pe,Fe]}),e[58]=Pe,e[59]=Ie);let Le;e[60]!==xe||e[61]!==Ae||e[62]!==Ie?(Le=(0,Z.jsxs)(`div`,{className:xe,children:[Ae,Ie]}),e[60]=xe,e[61]=Ae,e[62]=Ie,e[63]=Le):Le=e[63];let Re;return e[64]!==ve||e[65]!==ye||e[66]!==be||e[67]!==Le?(Re=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":ve,className:ye,onWheel:be,children:Le}),e[64]=ve,e[65]=ye,e[66]=be,e[67]=Le,e[68]=Re):Re=e[68],Re}function JO(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 YO(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 XO=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:st},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:rd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:di},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:JO},{label:`Twitter`,href:`https://x.com/inkeep`,icon:YO}],ZO=()=>{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)(et,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(zt,{asChild:!0,children:(0,Z.jsxs)(Di,{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)(Gr,{children:[o,(0,Z.jsx)(Tn,{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=XO.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=>sa(e,r),onAuxClick:e=>sa(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 p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(v,{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]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(Vt,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function QO(e){let t=(0,$.c)(62),{input:n}=e,{_:r}=i(),{states:a,refresh:o}=_h(),{dispatch:c}=oh(),[l,u]=(0,Q.useState)(!1),d=typeof window<`u`&&window.okDesktop!=null,f;t[0]===o?f=t[1]:(f=e=>{u(e),e&&o()},t[0]=o,t[1]=f);let p=f,m=n===null,h;t[2]===n?h=t[3]:(h=n!==null&&n.docContext!==null?Bn(n.docContext.relativePath):``,t[2]=n,t[3]=h);let g=h,_;t[4]!==c||t[5]!==n?(_=e=>{n!==null&&c(e.id,n)},t[4]=c,t[5]=n,t[6]=_):_=t[6];let v=_,y,b,x,S,C,w,T,E,D,O,k,A;if(t[7]!==p||t[8]!==v||t[9]!==n||t[10]!==l||t[11]!==g||t[12]!==a||t[13]!==m){let e;t[26]===a?e=t[27]:(e=e=>a[e.id]?.installed===!0,t[26]=a,t[27]=e);let r=hm.filter(e);x=a[`claude-code`]?.installed===!0;let i;t[28]!==n||t[29]!==g?(i=()=>{n!==null&&Ay(g)},t[28]=n,t[29]=g,t[30]=i):i=t[30],S=i,b=Da,A=l,C=p;let o,c;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(zi,{className:`size-3.5`}),c=(0,Z.jsx)(s,{id:`xWEvuo`}),t[31]=o,t[32]=c):(o=t[31],c=t[32]);let u;t[33]===m?u=t[34]:(u=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,size:`sm`,disabled:m,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,children:[o,c]})})}),t[33]=m,t[34]=u);let f;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Tn,{children:(0,Z.jsx)(s,{id:`xWEvuo`})}),t[35]=f):f=t[35],t[36]===u?w=t[37]:(w=(0,Z.jsxs)(Gr,{children:[u,f]}),t[36]=u,t[37]=w),y=ra,T=`end`,E=`min-w-[220px]`,D=`open-in-agent-menu`,t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(co,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`O7_W_a`})}),t[38]=O):O=t[38];let h;t[39]!==v||t[40]!==g||t[41]!==a?(h=e=>{let t=a[e.id];return(0,Z.jsx)(jy,{target:e,installState:t,isElectronHost:d,prompt:g,onSelect:()=>v(e)},e.id)},t[39]=v,t[40]=g,t[41]=a,t[42]=h):h=t[42],k=r.map(h),t[7]=p,t[8]=v,t[9]=n,t[10]=l,t[11]=g,t[12]=a,t[13]=m,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A}else 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],k=t[24],A=t[25];let j;t[43]!==r||t[44]!==x||t[45]!==S||t[46]!==n?(j=x?null:(0,Z.jsxs)(la,{onSelect:S,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":r({id:`aA51jP`}),children:[(0,Z.jsx)(Ue,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}),t[43]=r,t[44]=x,t[45]=S,t[46]=n,t[47]=j):j=t[47];let M;t[48]!==y||t[49]!==j||t[50]!==T||t[51]!==E||t[52]!==D||t[53]!==O||t[54]!==k?(M=(0,Z.jsxs)(y,{align:T,className:E,"data-testid":D,children:[O,k,j]}),t[48]=y,t[49]=j,t[50]=T,t[51]=E,t[52]=D,t[53]=O,t[54]=k,t[55]=M):M=t[55];let N;return t[56]!==b||t[57]!==C||t[58]!==w||t[59]!==M||t[60]!==A?(N=(0,Z.jsxs)(b,{open:A,onOpenChange:C,children:[w,M]}),t[56]=b,t[57]=C,t[58]=w,t[59]=M,t[60]=A,t[61]=N):N=t[61],N}var $O=50,ek=()=>{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,ex.preload()},$O))},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=gm)},u=(0,Z.jsx)(Yc,{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)($n,{asChild:!0,children:(0,Z.jsxs)(Di,{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)(Gr,{children:[d,(0,Z.jsx)(Tn,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function tk(e){let t=(0,$.c)(17),{onClickWhenNoRemote:n}=e,{_:r}=i(),{activeDocName:a}=ft(),{status:o}=Ya(),[c,l]=(0,Q.useState)(!1);if(!a)return null;let u=o?.hasRemote===!0,d;t[0]!==r||t[1]!==a||t[2]!==c||t[3]!==u||t[4]!==n?(d=async function(){if(!c&&a){l(!0);try{await Ga({docName:a,hasRemote:u,onClickWhenNoRemote:n},{clipboardWrite:ak,toastSuccess:ik,toastError:rk,logEvent:nk})}catch{qo.error(r({id:`u3YnKw`}))}l(!1)}},t[0]=r,t[1]=a,t[2]=c,t[3]=u,t[4]=n,t[5]=d):d=t[5];let f=d,p;t[6]===r?p=t[7]:(p=r({id:`F4IYWe`}),t[6]=r,t[7]=p);let m,h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Xc,{className:`size-3.5`,"aria-hidden":!0}),h=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g;t[10]!==c||t[11]!==f||t[12]!==p?(g=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,size:`sm`,"aria-label":p,onClick:f,disabled:c,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[m,h]})}),t[10]=c,t[11]=f,t[12]=p,t[13]=g):g=t[13];let _;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Tn,{children:(0,Z.jsx)(s,{id:`Z8lGw6`})}),t[14]=_):_=t[14];let v;return t[15]===g?v=t[16]:(v=(0,Z.jsxs)(Gr,{children:[g,_]}),t[15]=g,t[16]=v),v}function nk(e){return console.log(e)}function rk(e){return qo.error(e)}function ik(e){return qo.success(e)}function ak(e){return navigator.clipboard.writeText(e)}function ok(e){if(!e)return Y._({id:`Zul8Ry`});let t=Date.now()-new Date(e).getTime();if(t<6e4)return Y._({id:`xOTzt5`});if(t<36e5){let e=Math.floor(t/6e4);return Y._({id:`LNum6A`,values:{minutes:e}})}if(t<864e5){let e=Math.floor(t/36e5);return Y._({id:`nYeBmY`,values:{hours:e}})}return new Date(e).toLocaleDateString()}async function sk(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}function ck(e){let t=(0,$.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ac,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Wc,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ac,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Wc,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(An,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ic,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Mc,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(An,{className:`size-3.5 text-amber-500`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ac,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function lk(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function uk(e){switch(e){case`dormant`:return Y._({id:`RmBY0A`});case`idle`:return Y._({id:`N2FcBE`});case`fetching`:return Y._({id:`Wgmlsw`});case`pulling`:return Y._({id:`4uNLmk`});case`pushing`:return Y._({id:`iycx_A`});case`conflict`:return Y._({id:`IInnZo`});case`offline`:return Y._({id:`6Aih4U`});case`auth-error`:return Y._({id:`mHVPm5`});case`disabled`:return Y._({id:`DrYM2Z`});default:return e}}function dk(e){switch(e){case`external-changes-pending`:return Y._({id:`W9_Bub`});case`dirty-tree`:return Y._({id:`a5Gha5`});case`detached-head`:return Y._({id:`uQNW00`});case`auth-error`:return Y._({id:`mHVPm5`});case`protected-branch`:return Y._({id:`8fc_3j`});default:return e}}function fk(e){if(!e.syncEnabled)return Y._({id:`kUn-CN`});if(e.state===`idle`){let{ahead:t,behind:n}=e;return t>0&&n>0?Y._({id:`5F5HYj`,values:{ahead:t,behind:n}}):t>0?Y._({id:`PdA9NZ`,values:{ahead:t}}):n>0?Y._({id:`9o1bIV`,values:{behind:n}}):Y._({id:`N2FcBE`})}if(e.state===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return Y._({id:`cUK8lW`,values:{conflictCount:t}})}return uk(e.state)}function pk(e){let t=(0,$.c)(88),{status:n,onSignIn:r,onSetIdentity:a}=e,{_:o}=i(),{ahead:c,behind:l,conflictCount:u}=n,{projectLocalConfig:d,projectLocalSynced:f}=Oe(),p=d?.autoSync?.enabled??!1,m;t[0]===n.lastSyncUtc?m=t[1]:(m=ok(n.lastSyncUtc),t[0]=n.lastSyncUtc,t[1]=m);let h=m,{confirmOpen:g,setConfirmOpen:_,onToggleRequest:v,onConfirm:y}=Wi(Ua()),{conflicts:b}=VC(),x=b[0]??null,S;t[2]===n?S=t[3]:(S=(0,Z.jsx)(ck,{status:n}),t[2]=n,t[3]=S);let C;t[4]===n.state?C=t[5]:(C=uk(n.state),t[4]=n.state,t[5]=C);let w;t[6]===C?w=t[7]:(w=(0,Z.jsx)(`span`,{className:`text-1sm font-medium truncate`,children:C}),t[6]=C,t[7]=w);let T;t[8]!==S||t[9]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[S,w]}),t[8]=S,t[9]=w,t[10]=T):T=t[10];let E=!f,D;t[11]!==o||t[12]!==p?(D=o(p?{id:`lIn9L9`}:{id:`wbwHYD`}),t[11]=o,t[12]=p,t[13]=D):D=t[13];let O;t[14]!==p||t[15]!==v||t[16]!==E||t[17]!==D?(O=(0,Z.jsx)(ee,{checked:p,disabled:E,onCheckedChange:v,"aria-label":D}),t[14]=p,t[15]=v,t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;t[19]!==T||t[20]!==O?(k=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[T,O]}),t[19]=T,t[20]=O,t[21]=k):k=t[21];let A;t[22]!==g||t[23]!==y||t[24]!==_?(A=(0,Z.jsx)(to,{open:g,onOpenChange:_,onConfirm:y}),t[22]=g,t[23]=y,t[24]=_,t[25]=A):A=t[25];let j;t[26]===n.error?j=t[27]:(j=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[26]=n.error,t[27]=j);let M;t[28]===n.pausedReason?M=t[29]:(M=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:dk(n.pausedReason)}),t[28]=n.pausedReason,t[29]=M);let N;t[30]===n.state?N=t[31]:(N=n.state===`conflict`&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(s,{id:`t2TkQ3`})}),t[30]=n.state,t[31]=N);let P;t[32]!==o||t[33]!==n.remote?(P=n.remote&&(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,Z.jsx)(s,{id:`IreQBq`})}),n.remote.webUrl?(0,Z.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-foreground hover:text-primary hover:underline`,"aria-label":o({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,Z.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,Z.jsx)(ko,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:n.remote.label})]}),t[32]=o,t[33]=n.remote,t[34]=P):P=t[34];let F;t[35]!==p||t[36]!==h||t[37]!==n.state?(F=p&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`span`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-2xs`,children:(0,Z.jsx)(s,{id:`uWx2ZP`})}),(0,Z.jsx)(`span`,{className:`text-foreground`,children:h})]}),t[35]=p,t[36]=h,t[37]=n.state,t[38]=F):F=t[38];let I;t[39]!==c||t[40]!==n.ahead?(I=n.ahead>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`iTlqm3`,values:{ahead:c}})}),t[39]=c,t[40]=n.ahead,t[41]=I):I=t[41];let L;t[42]!==l||t[43]!==n.behind?(L=n.behind>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`YsEYYS`,values:{behind:l}})}),t[42]=l,t[43]=n.behind,t[44]=L):L=t[44];let R;t[45]!==u||t[46]!==n.conflictCount?(R=n.conflictCount>0&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`B4_ipX`,values:{conflictCount:u}})}),t[45]=u,t[46]=n.conflictCount,t[47]=R):R=t[47];let z;t[48]===p?z=t[49]:(z=!p&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(s,{id:`Wt5W56`})}),t[48]=p,t[49]=z);let B;t[50]!==P||t[51]!==F||t[52]!==I||t[53]!==L||t[54]!==R||t[55]!==z?(B=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-2`,children:[P,F,I,L,R,z]}),t[50]=P,t[51]=F,t[52]=I,t[53]=L,t[54]=R,t[55]=z,t[56]=B):B=t[56];let V;t[57]!==a||t[58]!==n.identityUnresolved?(V=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(ll,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:(0,Z.jsx)(s,{id:`nrGWJ7`})}),(0,Z.jsx)(Di,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,Z.jsx)(s,{id:`keNFEd`})})]})]}),t[57]=a,t[58]=n.identityUnresolved,t[59]=V):V=t[59];let H;t[60]!==p||t[61]!==n.state?(H=p&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(Di,{variant:`outline`,size:`xs`,onClick:hk,children:(0,Z.jsx)(s,{id:`lb_UU4`})}),t[60]=p,t[61]=n.state,t[62]=H):H=t[62];let U;t[63]!==p||t[64]!==r||t[65]!==n.state?(U=p&&n.state===`auth-error`&&(0,Z.jsx)(Di,{variant:`outline`,size:`xs`,onClick:r,children:(0,Z.jsx)(s,{id:`3jod3l`})}),t[63]=p,t[64]=r,t[65]=n.state,t[66]=U):U=t[66];let W;t[67]!==p||t[68]!==n.state?(W=p&&n.state===`offline`&&(0,Z.jsx)(Di,{variant:`outline`,size:`xs`,onClick:mk,children:(0,Z.jsx)(s,{id:`6gRgw8`})}),t[67]=p,t[68]=n.state,t[69]=W):W=t[69];let G;t[70]!==p||t[71]!==x||t[72]!==n.state?(G=p&&n.state===`conflict`&&x&&(0,Z.jsx)(Di,{variant:`outline`,size:`xs`,onClick:()=>{if(typeof window>`u`)return;let e=ii(Or(x.file));window.location.hash!==e&&(window.location.hash=e)},children:(0,Z.jsx)(s,{id:`0yL--g`})}),t[70]=p,t[71]=x,t[72]=n.state,t[73]=G):G=t[73];let K;t[74]!==H||t[75]!==U||t[76]!==W||t[77]!==G?(K=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[H,U,W,G]}),t[74]=H,t[75]=U,t[76]=W,t[77]=G,t[78]=K):K=t[78];let q;return t[79]!==A||t[80]!==j||t[81]!==M||t[82]!==N||t[83]!==B||t[84]!==V||t[85]!==K||t[86]!==k?(q=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[k,A,j,M,N,B,V,K]}),t[79]=A,t[80]=j,t[81]=M,t[82]=N,t[83]=B,t[84]=V,t[85]=K,t[86]=k,t[87]=q):q=t[87],q}function mk(){sk(`sync`)}function hk(){sk(`sync`)}function gk(e){let t=(0,$.c)(69),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onSetIdentity:a}=n,{_:o}=i(),{status:c,fetchError:l}=Ya();if(!c){if(l){let e;t[2]===o?e=t[3]:(e=o({id:`iqIDv4`}),t[2]=o,t[3]=e);let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(ic,{className:`size-3.5`}),t[4]=n):n=t[4];let r;t[5]===e?r=t[6]:(r=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[5]=e,t[6]=r);let i;t[7]===l?i=t[8]:(i=(0,Z.jsx)(Tn,{children:l===`network`?(0,Z.jsx)(s,{id:`I5AfhE`}):(0,Z.jsx)(s,{id:`uKRYiW`})}),t[7]=l,t[8]=i);let a;return t[9]!==r||t[10]!==i?(a=(0,Z.jsxs)(Gr,{children:[r,i]}),t[9]=r,t[10]=i,t[11]=a):a=t[11],a}return null}if(c.state===`dormant`&&!c.hasRemote||c.state===`disabled`&&!c.pausedReason)return null;let u;t[12]===c?u=t[13]:(u=lk(c),t[12]=c,t[13]=u);let d=u,f,p,m,h,g,_,y,b,x,S,C,w;if(t[14]!==o||t[15]!==c.identityUnresolved||t[16]!==c.state){let e=uk(c.state);_=!!c.identityUnresolved,g=Vt,h=Gr,m=$n,w=!0,p=zt,C=!0,f=Di,y=`ghost`,b=`icon-sm`,x=`text-muted-foreground relative`,S=o(_?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[14]=o,t[15]=c.identityUnresolved,t[16]=c.state,t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=g,t[22]=_,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=w}else f=t[17],p=t[18],m=t[19],h=t[20],g=t[21],_=t[22],y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],w=t[28];let T;t[29]===c?T=t[30]:(T=(0,Z.jsx)(ck,{status:c}),t[29]=c,t[30]=T);let E;t[31]===d?E=t[32]:(E=d&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:d}),t[31]=d,t[32]=E);let D;t[33]!==d||t[34]!==_?(D=!d&&_&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[33]=d,t[34]=_,t[35]=D):D=t[35];let O;t[36]!==f||t[37]!==E||t[38]!==D||t[39]!==y||t[40]!==b||t[41]!==x||t[42]!==S||t[43]!==T?(O=(0,Z.jsxs)(f,{variant:y,size:b,className:x,"aria-label":S,children:[T,E,D]}),t[36]=f,t[37]=E,t[38]=D,t[39]=y,t[40]=b,t[41]=x,t[42]=S,t[43]=T,t[44]=O):O=t[44];let k;t[45]!==p||t[46]!==O||t[47]!==C?(k=(0,Z.jsx)(p,{asChild:C,children:O}),t[45]=p,t[46]=O,t[47]=C,t[48]=k):k=t[48];let A;t[49]!==m||t[50]!==k||t[51]!==w?(A=(0,Z.jsx)(m,{asChild:w,children:k}),t[49]=m,t[50]=k,t[51]=w,t[52]=A):A=t[52];let j;t[53]===c?j=t[54]:(j=fk(c),t[53]=c,t[54]=j);let M;t[55]===j?M=t[56]:(M=(0,Z.jsx)(Tn,{children:j}),t[55]=j,t[56]=M);let N;t[57]!==h||t[58]!==A||t[59]!==M?(N=(0,Z.jsxs)(h,{children:[A,M]}),t[57]=h,t[58]=A,t[59]=M,t[60]=N):N=t[60];let P;t[61]!==a||t[62]!==r||t[63]!==c?(P=(0,Z.jsx)(v,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(pk,{status:c,onSignIn:r,onSetIdentity:a})}),t[61]=a,t[62]=r,t[63]=c,t[64]=P):P=t[64];let F;return t[65]!==g||t[66]!==N||t[67]!==P?(F=(0,Z.jsxs)(g,{children:[N,P]}),t[65]=g,t[66]=N,t[67]=P,t[68]=F):F=t[68],F}function _k(e){let t=(0,$.c)(39),{onSignIn:n,onSetIdentity:r}=e,{activeDocName:i,activeTarget:a}=ft(),{state:o}=aD(),c=Ra(),[l,u]=(0,Q.useState)(!1),d;bb0:{if(a===null){let e;t[0]===c?e=t[1]:(e=Jm({workspace:c}),t[0]=c,t[1]=e),d=e;break bb0}if(a.kind===`folder`){if(!c){d=null;break bb0}let e;t[2]!==a.folderPath||t[3]!==c?(e=Ym({folderRelativePath:a.folderPath,workspace:c}),t[2]=a.folderPath,t[3]=c,t[4]=e):e=t[4],d=e;break bb0}let e;t[5]!==i||t[6]!==c?(e=qm({docName:i,workspace:c}),t[5]=i,t[6]=c,t[7]=e):e=t[7],d=e}let f=d,p=typeof window<`u`&&window.okDesktop!=null,m=p&&o===`collapsed`&&`pl-[78px]`,h;t[8]===m?h=t[9]:(h=X(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,p&&`[-webkit-app-region:drag]`,m,p&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[8]=m,t[9]=h);let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)($n,{asChild:!0,children:(0,Z.jsx)(uD,{className:X(`-ml-1 shrink-0 text-muted-foreground`,p&&`[-webkit-app-region:no-drag]`)})}),t[10]=g):g=t[10];let _;t[11]===o?_=t[12]:(_=(0,Z.jsxs)(Gr,{children:[g,(0,Z.jsx)(Tn,{children:o===`expanded`?(0,Z.jsx)(s,{id:`w3vFfL`}):(0,Z.jsx)(s,{id:`e8zRrb`})})]}),t[11]=o,t[12]=_);let v,y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(so,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),y=(0,Z.jsx)(qO,{}),t[13]=v,t[14]=y):(v=t[13],y=t[14]);let b;t[15]===_?b=t[16]:(b=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[_,v,y]}),t[15]=_,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=X(`flex shrink-0 items-center justify-end gap-2 px-3`,p&&`[&>*]:[-webkit-app-region:no-drag]`),t[17]=x):x=t[17];let S;t[18]===f?S=t[19]:(S=(0,Z.jsx)(QO,{input:f}),t[18]=f,t[19]=S);let C;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(tk,{onClickWhenNoRemote:()=>u(!0)}),t[20]=C):C=t[20];let w;t[21]===l?w=t[22]:(w=(0,Z.jsx)(qa,{open:l,onOpenChange:u}),t[21]=l,t[22]=w);let T;t[23]!==r||t[24]!==n?(T=(0,Z.jsx)(gk,{onSignIn:n,onSetIdentity:r}),t[23]=r,t[24]=n,t[25]=T):T=t[25];let E,D,O,k,A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(BD,{}),D=(0,Z.jsx)(so,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),O=(0,Z.jsx)(Eu,{}),k=(0,Z.jsx)(ek,{}),A=(0,Z.jsx)(ZO,{}),t[26]=E,t[27]=D,t[28]=O,t[29]=k,t[30]=A):(E=t[26],D=t[27],O=t[28],k=t[29],A=t[30]);let j;t[31]!==S||t[32]!==w||t[33]!==T?(j=(0,Z.jsxs)(`div`,{className:x,children:[S,C,w,T,E,D,O,k,A]}),t[31]=S,t[32]=w,t[33]=T,t[34]=j):j=t[34];let M;return t[35]!==j||t[36]!==h||t[37]!==b?(M=(0,Z.jsxs)(`header`,{"data-electron-drag":p?``:void 0,className:h,children:[b,j]}),t[35]=j,t[36]=h,t[37]=b,t[38]=M):M=t[38],M}function vk(){let e=(0,$.c)(26),{_:t}=i(),[n,r]=qh(),[a,o]=(0,Q.useState)(n),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(`auth`),[d,f]=(0,Q.useState)(f_[0].id),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_=uo(),{projectLocalConfig:v,projectLocalSynced:y}=Oe(),{activeDocName:b}=ft(),x=!h&&_?.hasRemote===!0&&y===!0&&v!==null&&v.autoSync?.enabled===null,S,C;e[0]===b?(S=e[1],C=e[2]):(S=()=>{let e=function(e){let t=e.detail;t&&b&&ks(b,{kind:`raw-mdx`,detail:t}),o(`source`)};return window.addEventListener(zh,e),()=>window.removeEventListener(zh,e)},C=[b],e[0]=b,e[1]=S,e[2]=C),(0,Q.useEffect)(S,C);let w;e[3]===r?w=e[4]:(w=function(e){o(e),r(e)},e[3]=r,e[4]=w);let T=w,E;e[5]===t?E=e[6]:(E=async function(){m(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?qo.success(t({id:`rdE6_3`})):(console.error(`[save-version] failed:`,await e.text()),qo.error(t({id:`q7zsRM`})))}catch(e){console.error(`[save-version] failed:`,e),qo.error(t({id:`q7zsRM`}))}m(!1)},e[5]=t,e[6]=E);let D=E,O;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(_k,{onSignIn:()=>{u(`auth`),c(!0)},onSetIdentity:()=>{u(`identity`),c(!0)}}),e[7]=O):O=e[7];let k;e[8]!==d||e[9]!==a||e[10]!==T||e[11]!==D||e[12]!==p?(k=(0,Z.jsx)(PE,{editorMode:a,onModeChange:T,activeTab:d,onActiveTabChange:f,onSaveVersion:D,saving:p}),e[8]=d,e[9]=a,e[10]=T,e[11]=D,e[12]=p,e[13]=k):k=e[13];let A=l===`identity`,j;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{c(!1)},e[14]=j):j=e[14];let M;e[15]!==s||e[16]!==A?(M=(0,Z.jsx)(vo,{open:s,onOpenChange:c,identityPrompt:A,onSuccess:j}),e[15]=s,e[16]=A,e[17]=M):M=e[17];let N;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>g(!0),e[18]=N):N=e[18];let P;e[19]===x?P=e[20]:(P=(0,Z.jsx)(Jh,{open:x,onResolved:N}),e[19]=x,e[20]=P);let F;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Ih,{}),e[21]=F):F=e[21];let I;return e[22]!==P||e[23]!==k||e[24]!==M?(I=(0,Z.jsxs)(Z.Fragment,{children:[O,k,M,P,F]}),e[22]=P,e[23]=k,e[24]=M,e[25]=I):I=e[25],I}function yk(e){let t=ii(Or(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function bk(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=VC();if(n)return null;if(r!==null){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(An,{"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)(An,{"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(xk),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 xk(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Di,{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:()=>yk(e.file),children:[(0,Z.jsx)(An,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var Sk=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
32
32
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
33
33
|
<path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06" fill="currentcolor"/>
|
|
34
34
|
</symbol>
|
|
@@ -1908,7 +1908,7 @@ Error generating stack: `+e.message+`
|
|
|
1908
1908
|
mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z'/></svg>") center / contain no-repeat;
|
|
1909
1909
|
pointer-events: none;
|
|
1910
1910
|
}
|
|
1911
|
-
`;function nB(e){aB(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-item-section="content"]`),r=t.closest(`[data-type="item"]`);if(!n||!r)return;let i=r.dataset.itemPath??``;if(i.endsWith(`/`))return;let a=Rz(i);a&&(oB(n,a),r.getAttribute(`data-ok-renaming`)!==a&&r.setAttribute(Xz,a),rB(a),!t.hasAttribute(Zz)&&(sB(t,a),t.setAttribute(Zz,``)))}function rB(e){Qz=e,$z!==null&&clearTimeout($z),$z=setTimeout(iB,eB)}function iB(){Qz=null,$z!==null&&(clearTimeout($z),$z=null)}function aB(e){let t=e.querySelectorAll(`[${Xz}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(Xz);if(!t){e.removeAttribute(Xz);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(Xz);continue}let r=Rz(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(Xz)}if(Qz===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||Rz(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==Qz&&e.setAttribute(Xz,Qz))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&iB()}function oB(e,t){let n=e.querySelector(`[${Yz}]`);n||(n=e.ownerDocument.createElement(`span`),n.setAttribute(Yz,``),n.setAttribute(`aria-hidden`,`true`),e.appendChild(n)),n.textContent!==t&&(n.textContent=t)}function sB(e,t){let n=e.value;if(!n.toLowerCase().endsWith(t.toLowerCase()))return;let r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;if(!r)return;let i=n.slice(0,-t.length);r.call(e,i),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.setSelectionRange(0,i.length)}function cB(e){let{focusedIndex:t,itemHeight:n,viewportHeight:r,currentScrollTop:i}=e;if(t<0)return null;let a=Math.max(0,e.topInset??0),o=t*n,s=o+n;if(o<i+a){let e=Math.max(0,o-a);return e===i?null:e}if(s>i+r){let e=s-r;return e===i?null:e}return null}function lB(e,t){let n=t.getFocusedIndex();if(n<0)return;let r=e?.querySelector(NA)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-scroll]`);if(!r)return;let i=t.getItemHeight(),a=cB({focusedIndex:n,itemHeight:i,viewportHeight:r.clientHeight,currentScrollTop:r.scrollTop,topInset:i});a!==null&&(r.scrollTop=a)}function uB(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function dB(e,t,n={}){if(!e)return uB(t);let r=Mr(e);if(t&&r!==t)return uB(t);switch(e.kind){case`doc`:return uB(t??e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?uB(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function fB(e,t){if(!e)return{kind:`none`};let n=t.find(t=>GD(t)===e);if(n&&pr(n))return{kind:`asset`,path:n.path,hash:Xr(n.path),mediaKind:n.mediaKind};let r=YD(e);return e.endsWith(`/`)?t.some(e=>Nn(e)?e.path===r||e.path.startsWith(`${r}/`):(pr(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Rn(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var pB=`You can restore this file from the Trash.`;function mB(e){let t=pB,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind===`file`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function hB(e,t){return e===`web`?null:mB(t)}function gB(e){return e.kind===`folder`?`${e.name}/`:e.docExt?`${e.name}${e.docExt}`:e.name}var _B=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function vB(e){return typeof e==`string`&&_B.includes(e)?e:`system-error`}function yB(e){switch(e){case`not-found`:return Y._({id:`v41fCm`});case`permission-denied`:return Y._({id:`sJK6pq`});case`system-error`:return Y._({id:`Jqqevv`});case`path-escape`:return Y._({id:`WL6puM`})}}function bB(e){let t=yB(e.reason),n=e.detail;return n?Y._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Y._({id:`dTaauv`,values:{reason:t}})}function xB(e){return e.kind===`folder`?`${e.name}/`:e.name}function SB(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?xB(l):``;d=c?Y._({id:`5qNxOe`,values:{count:u}}):l?`${Y._({id:`E_BHoD`,values:{targetName:e}})}\n${bB(l)}`:Y._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Fo,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(Wo,{children:[p,(0,Z.jsx)(No,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let h;t[7]!==n||t[8]!==c?(h=c?(0,Z.jsx)(Vo,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(CB)})}):null,t[7]=n,t[8]=c,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=g):g=t[10];let _;t[11]!==r||t[12]!==o?(_=(0,Z.jsx)(Di,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:g}),t[11]=r,t[12]=o,t[13]=_):_=t[13];let v;t[14]===r?v=t[15]:(v=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=v);let y;t[16]!==r||t[17]!==a||t[18]!==v?(y=(0,Z.jsx)(Di,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:v}),t[16]=r,t[17]=a,t[18]=v,t[19]=y):y=t[19];let b;t[20]===r?b=t[21]:(b=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=b);let x;t[22]!==r||t[23]!==i||t[24]!==b?(x=(0,Z.jsx)(Di,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:b}),t[22]=r,t[23]=i,t[24]=b,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==_||t[28]!==y?(S=(0,Z.jsxs)(Ho,{children:[_,y,x]}),t[26]=x,t[27]=_,t[28]=y,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h?(C=(0,Z.jsxs)(zo,{className:`sm:max-w-md`,children:[m,h,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=C):C=t[33],C}function CB(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:xB(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:bB(e)})]},e.path)}function wB(e){return e?.isDirectory()?e:null}function TB(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function EB(e,t,n,r){let i=(0,$.c)(6),a,o;i[0]!==n||i[1]!==t||i[2]!==e||i[3]!==r?(a=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=wB(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}TB(e,o),o.focus(),i()},o=[n,t,e,r],i[0]=n,i[1]=t,i[2]=e,i[3]=r,i[4]=a,i[5]=o):(a=i[4],o=i[5]),(0,Q.useEffect)(a,o)}async function DB(e,t){let n={"not-found":Y._({id:`vY54W_`}),"spawn-error":Y._({id:`ktATCe`}),timeout:Y._({id:`wrzAcD`}),"path-escape":Y._({id:`kDuh1E`}),"ipc-error":Y._({id:`jjmuxV`})},r;try{r=await e.shell.openInTerminal(t)}catch(e){console.warn(`[shell] openInTerminal IPC threw`,{dirAbsPath:t,err:e}),qo.error(Y._({id:`DYwdxG`}),{description:n[`ipc-error`]});return}r.ok||(console.warn(`[shell] openInTerminal failed`,{reason:r.reason,dirAbsPath:t}),qo.error(Y._({id:`DYwdxG`}),{description:n[r.reason]}))}var OB=`open-knowledge:file-tree-menu-action-delete`,kB=`open-knowledge:file-tree-menu-action-rename`,AB=`open-knowledge:file-tree-menu-action-duplicate`;function jB(e){window.dispatchEvent(new CustomEvent(OB,{detail:{target:e}}))}function MB(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(OB,t),()=>window.removeEventListener(OB,t)}function NB(e){window.dispatchEvent(new CustomEvent(kB,{detail:{target:e}}))}function PB(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(kB,t),()=>window.removeEventListener(kB,t)}function FB(e){window.dispatchEvent(new CustomEvent(AB,{detail:{target:e}}))}function IB(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(AB,t),()=>window.removeEventListener(AB,t)}function LB(e){let t=!1,n=!1,r=!1;async function i(){if(!r){t=!0;try{await e()}finally{t=!1,r?n=!1:n&&(n=!1,i())}}}return{request(){if(!r){if(t){n=!0;return}i()}},dispose(){r=!0,n=!1}}}function RB(e){return e?Y._({id:`wTcjov`}):null}function zB(e){let t=(0,$.c)(33),{_:n}=i(),{input:r,installStates:a,dispatch:o,webFallbackVisible:c}=e,l=c===void 0?!0:c,u=r===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==o||t[2]!==r||t[3]!==u||t[4]!==a){let e=RB(u),i;t[11]===a?i=t[12]:(i=e=>a[e.id]?.installed===!0,t[11]=a,t[12]=i);let c=hm.filter(i);p=a[`claude-code`]?.installed===!0;let l;t[13]===r?l=t[14]:(l=r!==null&&r.docContext!==null?Bn(r.docContext.relativePath):``,t[13]=r,t[14]=l);let _=l,v;t[15]!==r||t[16]!==_?(v=()=>{r!==null&&Ay(_)},t[15]=r,t[16]=_,t[17]=v):v=t[17],m=v,f=Na,t[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(Pa,{children:[(0,Z.jsx)(zi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[18]=g):g=t[18],d=Ma,h=c.map(t=>{let i=!u,{displayName:a}=t,s=n(e?{id:`1ZpfyB`,values:{displayName:a,hint:e}}:{id:`WqLq6M`,values:{displayName:a}});return(0,Z.jsxs)(la,{disabled:!i,onSelect:()=>{r&&o(t.id,r)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":s,children:[(0,Z.jsx)(wy,{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]=r,t[3]=u,t[4]=a,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g}else d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10];let _;t[19]!==n||t[20]!==p||t[21]!==m||t[22]!==u||t[23]!==l?(_=l&&!p?(0,Z.jsxs)(la,{onSelect:m,disabled:u,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(Ue,{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[19]=n,t[20]=p,t[21]=m,t[22]=u,t[23]=l,t[24]=_):_=t[24];let v;t[25]!==d||t[26]!==h||t[27]!==_?(v=(0,Z.jsxs)(d,{children:[h,_]}),t[25]=d,t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;return t[29]!==f||t[30]!==g||t[31]!==v?(y=(0,Z.jsxs)(f,{children:[g,v]}),t[29]=f,t[30]=g,t[31]=v,t[32]=y):y=t[32],y}var BB=Fe(`HOVER_INTENT_MS`,80),VB=3,HB=20,UB=new Map,WB=new Set,GB=[],KB=new Map;function qB(e){for(KB.delete(e),KB.set(e,!0);KB.size>HB;){let e=KB.keys().next().value;if(e===void 0)break;KB.delete(e)}}function JB(e){WB.delete(e),XB()}function YB(e,t){let n=Date.now();Wt(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),se(e,t,n)}function XB(){for(;WB.size<VB&&GB.length>0;){let e=GB.shift();if(!e)break;if(!KB.has(e.docName)){WB.add(e.docName),qB(e.docName);try{let t=e.prewarm(e.docName);t&&YB(e.docName,t)}catch(t){Wt(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{JB(e.docName)}}}}function ZB(e,t){if(Ge(e)||KB.has(e))return;let n=UB.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(UB.delete(e),WB.size>=VB){GB.push({docName:e,prewarm:t});return}qB(e),WB.add(e);try{let n=t(e);n&&YB(e,n)}catch(t){Wt(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{JB(e)}},BB);UB.set(e,{timer:r,prewarm:t})}function QB(e){let t=UB.get(e);t&&(clearTimeout(t.timer),UB.delete(e))}var $B=/\.(md|mdx)$/i,eV=5e3;function tV(e){if(window.location.hash===e)return;let{pathname:t,search:n}=window.location;window.history.replaceState(null,``,`${t}${n}${e}`)}function nV(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function rV(e){let t=e.match($B);return t?t[0]:null}async function iV(e,t){try{await navigator.clipboard.writeText(e),qo.success(t===`full`?Y._({id:`6_ZOw4`}):Y._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),qo.error(t===`full`?Y._({id:`vfRlCI`}):Y._({id:`5QGTaA`}))}}var aV=new Set([`agents`,`agent`,`claude`,`skill`]),oV=`ok-file-tree-link-decoration`,sV=`ok-file-tree-agent-decoration`;function cV(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function lV(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${cV(t)}</symbol>`}var uV=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1911
|
+
`;function nB(e){aB(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-item-section="content"]`),r=t.closest(`[data-type="item"]`);if(!n||!r)return;let i=r.dataset.itemPath??``;if(i.endsWith(`/`))return;let a=Rz(i);a&&(oB(n,a),r.getAttribute(`data-ok-renaming`)!==a&&r.setAttribute(Xz,a),rB(a),!t.hasAttribute(Zz)&&(sB(t,a),t.setAttribute(Zz,``)))}function rB(e){Qz=e,$z!==null&&clearTimeout($z),$z=setTimeout(iB,eB)}function iB(){Qz=null,$z!==null&&(clearTimeout($z),$z=null)}function aB(e){let t=e.querySelectorAll(`[${Xz}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(Xz);if(!t){e.removeAttribute(Xz);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(Xz);continue}let r=Rz(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(Xz)}if(Qz===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||Rz(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==Qz&&e.setAttribute(Xz,Qz))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&iB()}function oB(e,t){let n=e.querySelector(`[${Yz}]`);n||(n=e.ownerDocument.createElement(`span`),n.setAttribute(Yz,``),n.setAttribute(`aria-hidden`,`true`),e.appendChild(n)),n.textContent!==t&&(n.textContent=t)}function sB(e,t){let n=e.value;if(!n.toLowerCase().endsWith(t.toLowerCase()))return;let r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;if(!r)return;let i=n.slice(0,-t.length);r.call(e,i),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.setSelectionRange(0,i.length)}function cB(e){let{focusedIndex:t,itemHeight:n,viewportHeight:r,currentScrollTop:i}=e;if(t<0)return null;let a=Math.max(0,e.topInset??0),o=t*n,s=o+n;if(o<i+a){let e=Math.max(0,o-a);return e===i?null:e}if(s>i+r){let e=s-r;return e===i?null:e}return null}function lB(e,t){let n=t.getFocusedIndex();if(n<0)return;let r=e?.querySelector(NA)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-scroll]`);if(!r)return;let i=t.getItemHeight(),a=cB({focusedIndex:n,itemHeight:i,viewportHeight:r.clientHeight,currentScrollTop:r.scrollTop,topInset:i});a!==null&&(r.scrollTop=a)}function uB(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function dB(e,t,n={}){if(!e)return uB(t);let r=Mr(e);if(t&&r!==t)return uB(t);switch(e.kind){case`doc`:return uB(t??e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?uB(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function fB(e,t){if(!e)return{kind:`none`};let n=t.find(t=>GD(t)===e);if(n&&pr(n))return{kind:`asset`,path:n.path,hash:Xr(n.path),mediaKind:n.mediaKind};let r=YD(e);return e.endsWith(`/`)?t.some(e=>Nn(e)?e.path===r||e.path.startsWith(`${r}/`):(pr(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Rn(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var pB=`You can restore this file from the Trash.`;function mB(e){let t=pB,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind===`file`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function hB(e,t){return e===`web`?null:mB(t)}function gB(e){return e.kind===`folder`?`${e.name}/`:e.docExt?`${e.name}${e.docExt}`:e.name}var _B=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function vB(e){return typeof e==`string`&&_B.includes(e)?e:`system-error`}function yB(e){switch(e){case`not-found`:return Y._({id:`v41fCm`});case`permission-denied`:return Y._({id:`sJK6pq`});case`system-error`:return Y._({id:`Jqqevv`});case`path-escape`:return Y._({id:`WL6puM`})}}function bB(e){let t=yB(e.reason),n=e.detail;return n?Y._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):Y._({id:`dTaauv`,values:{reason:t}})}function xB(e){return e.kind===`folder`?`${e.name}/`:e.name}function SB(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?xB(l):``;d=c?Y._({id:`5qNxOe`,values:{count:u}}):l?`${Y._({id:`E_BHoD`,values:{targetName:e}})}\n${bB(l)}`:Y._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Fo,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(Wo,{children:[p,(0,Z.jsx)(No,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let h;t[7]!==n||t[8]!==c?(h=c?(0,Z.jsx)(Vo,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(CB)})}):null,t[7]=n,t[8]=c,t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=g):g=t[10];let _;t[11]!==r||t[12]!==o?(_=(0,Z.jsx)(Di,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:g}),t[11]=r,t[12]=o,t[13]=_):_=t[13];let v;t[14]===r?v=t[15]:(v=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=v);let y;t[16]!==r||t[17]!==a||t[18]!==v?(y=(0,Z.jsx)(Di,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:v}),t[16]=r,t[17]=a,t[18]=v,t[19]=y):y=t[19];let b;t[20]===r?b=t[21]:(b=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=b);let x;t[22]!==r||t[23]!==i||t[24]!==b?(x=(0,Z.jsx)(Di,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:b}),t[22]=r,t[23]=i,t[24]=b,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==_||t[28]!==y?(S=(0,Z.jsxs)(Ho,{children:[_,y,x]}),t[26]=x,t[27]=_,t[28]=y,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==m||t[32]!==h?(C=(0,Z.jsxs)(zo,{className:`sm:max-w-md`,children:[m,h,S]}),t[30]=S,t[31]=m,t[32]=h,t[33]=C):C=t[33],C}function CB(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:xB(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:bB(e)})]},e.path)}function wB(e){return e?.isDirectory()?e:null}function TB(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function EB(e,t,n,r){let i=(0,$.c)(6),a,o;i[0]!==n||i[1]!==t||i[2]!==e||i[3]!==r?(a=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=wB(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}TB(e,o),o.focus(),i()},o=[n,t,e,r],i[0]=n,i[1]=t,i[2]=e,i[3]=r,i[4]=a,i[5]=o):(a=i[4],o=i[5]),(0,Q.useEffect)(a,o)}async function DB(e,t){let n={"not-found":Y._({id:`vY54W_`}),"spawn-error":Y._({id:`ktATCe`}),timeout:Y._({id:`wrzAcD`}),"path-escape":Y._({id:`kDuh1E`}),"ipc-error":Y._({id:`jjmuxV`})},r;try{r=await e.shell.openInTerminal(t)}catch(e){console.warn(`[shell] openInTerminal IPC threw`,{dirAbsPath:t,err:e}),qo.error(Y._({id:`DYwdxG`}),{description:n[`ipc-error`]});return}r.ok||(console.warn(`[shell] openInTerminal failed`,{reason:r.reason,dirAbsPath:t}),qo.error(Y._({id:`DYwdxG`}),{description:n[r.reason]}))}var OB=`open-knowledge:file-tree-menu-action-delete`,kB=`open-knowledge:file-tree-menu-action-rename`,AB=`open-knowledge:file-tree-menu-action-duplicate`;function jB(e){window.dispatchEvent(new CustomEvent(OB,{detail:{target:e}}))}function MB(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(OB,t),()=>window.removeEventListener(OB,t)}function NB(e){window.dispatchEvent(new CustomEvent(kB,{detail:{target:e}}))}function PB(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(kB,t),()=>window.removeEventListener(kB,t)}function FB(e){window.dispatchEvent(new CustomEvent(AB,{detail:{target:e}}))}function IB(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(AB,t),()=>window.removeEventListener(AB,t)}function LB(e){let t=!1,n=!1,r=!1;async function i(){if(!r){t=!0;try{await e()}finally{t=!1,r?n=!1:n&&(n=!1,i())}}}return{request(){if(!r){if(t){n=!0;return}i()}},dispose(){r=!0,n=!1}}}function RB(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>GD(e))),a=[];for(let e of t){let t=GD(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function zB(e){return e?Y._({id:`wTcjov`}):null}function BB(e){let t=(0,$.c)(33),{_:n}=i(),{input:r,installStates:a,dispatch:o,webFallbackVisible:c}=e,l=c===void 0?!0:c,u=r===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==o||t[2]!==r||t[3]!==u||t[4]!==a){let e=zB(u),i;t[11]===a?i=t[12]:(i=e=>a[e.id]?.installed===!0,t[11]=a,t[12]=i);let c=hm.filter(i);p=a[`claude-code`]?.installed===!0;let l;t[13]===r?l=t[14]:(l=r!==null&&r.docContext!==null?Bn(r.docContext.relativePath):``,t[13]=r,t[14]=l);let _=l,v;t[15]!==r||t[16]!==_?(v=()=>{r!==null&&Ay(_)},t[15]=r,t[16]=_,t[17]=v):v=t[17],m=v,f=Na,t[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(Pa,{children:[(0,Z.jsx)(zi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[18]=g):g=t[18],d=Ma,h=c.map(t=>{let i=!u,{displayName:a}=t,s=n(e?{id:`1ZpfyB`,values:{displayName:a,hint:e}}:{id:`WqLq6M`,values:{displayName:a}});return(0,Z.jsxs)(la,{disabled:!i,onSelect:()=>{r&&o(t.id,r)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":s,children:[(0,Z.jsx)(wy,{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]=r,t[3]=u,t[4]=a,t[5]=d,t[6]=f,t[7]=p,t[8]=m,t[9]=h,t[10]=g}else d=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10];let _;t[19]!==n||t[20]!==p||t[21]!==m||t[22]!==u||t[23]!==l?(_=l&&!p?(0,Z.jsxs)(la,{onSelect:m,disabled:u,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(Ue,{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[19]=n,t[20]=p,t[21]=m,t[22]=u,t[23]=l,t[24]=_):_=t[24];let v;t[25]!==d||t[26]!==h||t[27]!==_?(v=(0,Z.jsxs)(d,{children:[h,_]}),t[25]=d,t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;return t[29]!==f||t[30]!==g||t[31]!==v?(y=(0,Z.jsxs)(f,{children:[g,v]}),t[29]=f,t[30]=g,t[31]=v,t[32]=y):y=t[32],y}var VB=Fe(`HOVER_INTENT_MS`,80),HB=3,UB=20,WB=new Map,GB=new Set,KB=[],qB=new Map;function JB(e){for(qB.delete(e),qB.set(e,!0);qB.size>UB;){let e=qB.keys().next().value;if(e===void 0)break;qB.delete(e)}}function YB(e){GB.delete(e),ZB()}function XB(e,t){let n=Date.now();Wt(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),se(e,t,n)}function ZB(){for(;GB.size<HB&&KB.length>0;){let e=KB.shift();if(!e)break;if(!qB.has(e.docName)){GB.add(e.docName),JB(e.docName);try{let t=e.prewarm(e.docName);t&&XB(e.docName,t)}catch(t){Wt(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{YB(e.docName)}}}}function QB(e,t){if(Ge(e)||qB.has(e))return;let n=WB.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(WB.delete(e),GB.size>=HB){KB.push({docName:e,prewarm:t});return}JB(e),GB.add(e);try{let n=t(e);n&&XB(e,n)}catch(t){Wt(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{YB(e)}},VB);WB.set(e,{timer:r,prewarm:t})}function $B(e){let t=WB.get(e);t&&(clearTimeout(t.timer),WB.delete(e))}var eV=/\.(md|mdx)$/i;function tV(e){if(window.location.hash===e)return;let{pathname:t,search:n}=window.location;window.history.replaceState(null,``,`${t}${n}${e}`)}function nV(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function rV(e){let t=e.match(eV);return t?t[0]:null}async function iV(e,t){try{await navigator.clipboard.writeText(e),qo.success(t===`full`?Y._({id:`6_ZOw4`}):Y._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),qo.error(t===`full`?Y._({id:`vfRlCI`}):Y._({id:`5QGTaA`}))}}var aV=new Set([`agents`,`agent`,`claude`,`skill`]),oV=`ok-file-tree-link-decoration`,sV=`ok-file-tree-agent-decoration`;function cV(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function lV(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${cV(t)}</symbol>`}var uV=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1912
1912
|
${lV(oV,A)}
|
|
1913
1913
|
${lV(sV,$s)}
|
|
1914
|
-
</svg>`,dV=`${Hz}\n${tB}`;function fV(e,t,n){if(n.size===0)return[...e];let r=new Set(e.map(e=>GD(e))),i=Date.now(),a=[];for(let e of t){let t=GD(e);if(r.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(i-o>eV){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function pV(e){return{...ej({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 mV(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&aV.has(t)}function hV(e){return e===`darwin`?Y._({id:`LtSYdi`}):e===`win32`?Y._({id:`qi1F96`}):Y._({id:`hz7n6T`})}function gV(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=hV(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=Gm(r.contentDir,nO(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)(Ce,{"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)(la,{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 _V(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=la,u=n===null,t[8]!==n||t[9]!==r?(d=()=>{n!==null&&(r(),DB(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)(al,{"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 vV(e){return tO({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e})}function yV(e,t){return e!==t&&e.startsWith(t)}function bV(e,t){let n=[...new Set(e)].filter(e=>!t(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>yV(e,t))).map(vV)}function xV(e,t){return e===t||e.startsWith(`${t}/`)}function SV(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 CV(e,t,n){let r=new Set,i=new Set;for(let a of e){if(a.kind===`file`){r.add(a.path);continue}i.add(a.path);for(let e of t)Rn(e)&&e.docName.startsWith(`${a.path}/`)&&r.add(e.docName);for(let e of n){let t=qD(e);xV(t,a.path)&&i.add(t)}}return{docNames:r,folderPaths:i}}function wV(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:xV(t.createdPath,e.path)}function TV(e){let t=(0,$.c)(83),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:d,projectLocalBinding:f,mergedConfig:p,onStartCreating:m,onStartCreatingFromTemplate:h,onDuplicate:g,onDelete:_,onExpandSubtree:v,onCollapseSubtree:y,folderTreePaths:b,isAsset:x,isAssetTreePath:S}=e,{_:C}=i(),w,E,D,O,k,A,j,M,N;if(t[0]!==C||t[1]!==x||t[2]!==S||t[3]!==n||t[4]!==p?.appearance?.sidebar?.showAllFiles||t[5]!==p?.appearance?.sidebar?.showHiddenFiles||t[6]!==l||t[7]!==d||t[8]!==f){N=tO(n),k=n.kind===`directory`,w=!x&&d!==null;let e;t[18]!==C||t[19]!==k?(e=C(k?{id:`5D3Ior`}:{id:`dbhUX1`}),t[18]=C,t[19]=k,t[20]=e):e=t[20],O=e,j=p?.appearance?.sidebar?.showHiddenFiles??!1,A=p?.appearance?.sidebar?.showAllFiles??!1,E=f!==null;let r=l.getSelectedPaths(),i=r.includes(N.treePath)?bV(r,S):[];D=i.length>1?i:[N];let a=D.length;M=Y._({id:`44_vJP`,values:{deleteCount:a}}),t[0]=C,t[1]=x,t[2]=S,t[3]=n,t[4]=p?.appearance?.sidebar?.showAllFiles,t[5]=p?.appearance?.sidebar?.showHiddenFiles,t[6]=l,t[7]=d,t[8]=f,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 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]!==k||t[22]!==n||t[23]!==o?(F=k&&o?Gm(o.contentDir,nO(n),o.pathSeparator):null,t[21]=k,t[22]=n,t[23]=o,t[24]=F):F=t[24];let I=F,L;if(t[25]!==k||t[26]!==n||t[27]!==o){bb0:{if(!o||k){L=null;break bb0}let e=nO(n),t=e.lastIndexOf(`/`);if(t===-1){L=o.contentDir;break bb0}L=Gm(o.contentDir,e.slice(0,t),o.pathSeparator)}t[25]=k,t[26]=n,t[27]=o,t[28]=L}else L=t[28];let R=L,z;t[29]!==x||t[30]!==k||t[31]!==n||t[32]!==o?(z=x?null:k?Ym({folderRelativePath:nO(n),workspace:o}):qm({docName:WD(n.path),workspace:o}),t[29]=x,t[30]=k,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]!==C||t[39]!==f?(G=e=>{if(f===null)return;let t=f.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,Wn(t.error)),qo.error(C({id:`P47EWZ`}),{description:Wn(t.error)}))},t[38]=C,t[39]=f,t[40]=G):G=t[40];let K=G,J;t[41]!==C||t[42]!==f?(J=e=>{if(f===null)return;let t=f.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,Wn(t.error)),qo.error(C({id:`P47EWZ`}),{description:Wn(t.error)}))},t[41]=C,t[42]=f,t[43]=J):J=t[43];let ee=J,te=0,ne=0;if(k){let e=JD(n.path);for(let t of b)(t===e||t.startsWith(e))&&(te++,wB(l.getItem(t))?.isExpanded()&&ne++)}let re=k&&ne<te,ie=k&&ne>0,ae;t[44]===W?ae=t[45]:(ae=e=>{e||W()},t[44]=W,t[45]=ae);let oe;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[46]=oe):oe=t[46];let se;t[47]!==C||t[48]!==a||t[49]!==w||t[50]!==E||t[51]!==W||t[52]!==H||t[53]!==P||t[54]!==D||t[55]!==I||t[56]!==ee||t[57]!==K||t[58]!==c||t[59]!==B||t[60]!==O||t[61]!==x||t[62]!==k||t[63]!==n||t[64]!==l||t[65]!==d||t[66]!==y||t[67]!==_||t[68]!==g||t[69]!==v||t[70]!==m||t[71]!==h||t[72]!==R||t[73]!==A||t[74]!==j||t[75]!==ie||t[76]!==re||t[77]!==N||t[78]!==o?(se=(0,Z.jsx)(ra,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:k?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(la,{disabled:a,onSelect:()=>{H(),m(`file`,qD(n.path))},children:[(0,Z.jsx)(el,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`MW64zN`})]}),(0,Z.jsxs)(la,{disabled:a,onSelect:()=>{H(),h(qD(n.path))},children:[(0,Z.jsx)(gc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsxs)(la,{disabled:a,onSelect:()=>{H(),m(`folder`,qD(n.path))},children:[(0,Z.jsx)(bc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`tX5yOZ`})]}),(0,Z.jsx)(ca,{}),(0,Z.jsx)(gV,{item:n,workspace:o,onClose:W}),(0,Z.jsx)(zB,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!1}),(0,Z.jsx)(_V,{dirAbsPath:I,onClose:W}),(0,Z.jsxs)(Na,{children:[(0,Z.jsxs)(Pa,{children:[(0,Z.jsx)(At,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(la,{disabled:!o,onSelect:()=>{o&&(W(),iV(Gm(o.contentDir,nO(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(la,{onSelect:()=>{W(),iV(nO(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(ca,{}),(0,Z.jsx)(Aa,{checked:j,onCheckedChange:K,disabled:!E,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`K_wz1u`})}),(0,Z.jsx)(Aa,{checked:A,onCheckedChange:ee,disabled:!E,"data-testid":`file-tree-menu-show-all-files`,children:(0,Z.jsx)(s,{id:`i8dKs-`})}),re||ie?(0,Z.jsx)(ca,{}):null,re?(0,Z.jsxs)(la,{onSelect:()=>{W(),v(n.path)},children:[(0,Z.jsx)(cl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}):null,ie?(0,Z.jsxs)(la,{onSelect:()=>{W(),y(n.path)},children:[(0,Z.jsx)(vc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]}):null,(0,Z.jsx)(ca,{}),(0,Z.jsxs)(la,{disabled:a,onSelect:()=>{W(),g(N)},children:[(0,Z.jsx)(mt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(la,{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)(la,{"data-testid":`file-tree-menu-hide`,disabled:!w,onSelect:()=>{if(!d)return;W();let e=Jz(N),t=ho(d.current()),n=io(t,e);if(n===t)return;d.patch(oo(n));let r=N.path.split(`/`).pop()||N.path;qo.success(C({id:`4xtLTl`,values:{basename:r}}),{description:C({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),O]}),(0,Z.jsxs)(la,{variant:`destructive`,disabled:a,onSelect:()=>{W(),_(D)},children:[(0,Z.jsx)(q,{"aria-hidden":`true`}),P]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(gV,{item:n,workspace:o,onClose:W}),!x&&(0,Z.jsx)(zB,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!0}),(0,Z.jsx)(_V,{dirAbsPath:R,onClose:W}),(0,Z.jsxs)(Na,{children:[(0,Z.jsxs)(Pa,{children:[(0,Z.jsx)(At,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(la,{disabled:!o,onSelect:()=>{o&&(W(),iV(Gm(o.contentDir,nO(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(la,{onSelect:()=>{W(),iV(nO(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),x?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ca,{}),(0,Z.jsxs)(la,{disabled:a,onSelect:()=>{W(),g(N)},children:[(0,Z.jsx)(mt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(la,{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)(la,{"data-testid":`file-tree-menu-hide`,disabled:!w,onSelect:()=>{if(!d)return;W();let e=Jz(N),t=ho(d.current()),n=io(t,e);if(n===t)return;d.patch(oo(n));let r=N.path.split(`/`).pop()||N.path;qo.success(C({id:`OD0FCX`,values:{basename:r}}),{description:C({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),O]}),(0,Z.jsxs)(la,{variant:`destructive`,disabled:a,onSelect:()=>{W(),_(D)},children:[(0,Z.jsx)(q,{"aria-hidden":`true`}),P]})]})]})}),t[47]=C,t[48]=a,t[49]=w,t[50]=E,t[51]=W,t[52]=H,t[53]=P,t[54]=D,t[55]=I,t[56]=ee,t[57]=K,t[58]=c,t[59]=B,t[60]=O,t[61]=x,t[62]=k,t[63]=n,t[64]=l,t[65]=d,t[66]=y,t[67]=_,t[68]=g,t[69]=v,t[70]=m,t[71]=h,t[72]=R,t[73]=A,t[74]=j,t[75]=ie,t[76]=re,t[77]=N,t[78]=o,t[79]=se):se=t[79];let ce;return t[80]!==se||t[81]!==ae?(ce=(0,Z.jsxs)(Da,{open:!0,modal:!1,onOpenChange:ae,children:[oe,se]}),t[80]=se,t[81]=ae,t[82]=ce):ce=t[82],ce}function EV(e){let t=(0,$.c)(265),{ref:n}=e,{_:r}=i(),{activeDocName:a,activeTarget:o,closeTabs:c,closeDocument:l,closeAndClearForRename:u,getPoolActiveDocName:d,isNewTabActive:f,openTarget:p,prewarm:m,remapTabsForRename:h}=ft(),{notifySidebarFileSelected:_}=aD(),{resolvedTheme:v}=Pn(),{addPage:y}=si(),b;t[0]!==_||t[1]!==p?(b=function(e){p({kind:`doc`,target:e,docName:e},{tabBehavior:`replace-active`}),tV(ii(e)),_()},t[0]=_,t[1]=p,t[2]=b):b=t[2];let x=b,S;t[3]!==_||t[4]!==p?(S=function(e){let t=jr(e);p({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),tV(t),_()},t[3]=_,t[4]=p,t[5]=S):S=t[5];let C=S,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[6]=w):w=t[6];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(!0),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),{conflicts:L}=VC(),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(null),H=(0,Q.useRef)(T),U;t[7]!==T||t[8]!==C||t[9]!==x||t[10]!==_||t[11]!==p?(U=function(e,t){let n=fB(e,t===void 0?T:t);if(n.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,YD(e));return}if(n.kind===`asset`){p({kind:`asset`,target:n.path,assetPath:n.path,mediaKind:n.mediaKind},{tabBehavior:`replace-active`}),tV(n.hash),_();return}if(n.kind===`folder`){C(n.path);return}x(n.path)},t[7]=T,t[8]=C,t[9]=x,t[10]=_,t[11]=p,t[12]=U):U=t[12];let W=U,G=(0,Q.useRef)(a),K;t[13]===T?K=t[14]:(K=new Set(T.filter(pr).map(qV)),t[13]=T,t[14]=K);let q=K,J=(0,Q.useRef)(q),ee;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(ee=[],t[15]=ee):ee=t[15];let te=(0,Q.useRef)(ee),ne=(0,Q.useRef)(null),re=(0,Q.useRef)(KV),ie=(0,Q.useRef)(null),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(!1),se=(0,Q.useRef)(null),ce;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ce=new Map,t[16]=ce):ce=t[16];let le=(0,Q.useRef)(ce),ue=(0,Q.useRef)(!1),de=(0,Q.useRef)(!1),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(GV),he=(0,Q.useRef)(WV),ge=(0,Q.useRef)(UV),_e=(0,Q.useRef)(HV),ve=(0,Q.useRef)(o),{selectedFilePath:ye,selectedFolderPath:be,navigationPath:xe}=dB(o,f?null:a),Se=ye?UD(ye,T.find(e=>Rn(e)&&e.docName===ye)?.docExt):be?JD(be):o?.kind===`asset`?o.assetPath:null,Ce=_h().states,{dispatch:we}=oh(),Te;t[17]!==we||t[18]!==Ce?(Te={installStates:Ce,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:we},t[17]=we,t[18]=Ce,t[19]=Te):Te=t[19];let Ee=Te,{okignoreBinding:De,projectLocalBinding:ke,merged:Ae}=Oe(),je=Ae?.appearance?.sidebar?.showHiddenFiles??!1,Ne=Ae?.appearance?.sidebar?.showAllFiles??!1,Pe;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=()=>se.current===null,t[20]=Pe):Pe=t[20];let Fe=Pe,Ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=[],t[21]=Ie):Ie=t[21];let Le;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Le={set:`complete`,spriteSheet:uV},t[22]=Le):Le=t[22];let Re;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Re={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[23]=Re):Re=t[23];let ze;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ze={canDrag:Fe,canDrop:Fe,onDropComplete:e=>_e.current(e),onDropError:VV},t[24]=ze):ze=t[24];let Be,Ve;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Be={canRename:Fe,onRename:e=>he.current(e),onError:e=>ge.current(e)},Ve=e=>me.current(e),t[25]=Be,t[26]=Ve):(Be=t[25],Ve=t[26]);let He;t[27]===r?He=t[28]:(He={paths:Ie,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:Le,unsafeCSS:dV,composition:Re,dragAndDrop:ze,renaming:Be,onSelectionChange:Ve,renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=H.current.find(e=>Rn(e)&&UD(e.docName,e.docExt)===t.path);if(n?.isSymlink){let e=n.targetPath;return{icon:oV,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return mV(t.path)?{icon:sV,title:r({id:`i9toLO`})}:null}},t[27]=r,t[28]=He);let{model:Ue}=Lz(He),We;t[29]===Ue?We=t[30]:(We=function(e){let t=Ue.getItem(e)??Ue.getItem(JD(e));return t?.isDirectory()?JD(qD(t.getPath())):e},t[29]=Ue,t[30]=We);let Ge=We,qe,Je;t[31]===T?(qe=t[32],Je=t[33]):(Je=XD(T),qe=ZD(Je),t[31]=T,t[32]=qe,t[33]=Je);let Ye=qe,Xe=(0,Q.useRef)(Je),Ze;t[34]===T?Ze=t[35]:(Ze=$D(T),t[34]=T,t[35]=Ze);let Qe=Ze,$e=(0,Q.useRef)(Qe),et=be?eO(JD(be)).slice(0,-1):eO(Se??xe),tt=et.join(`\0`),nt;if(t[36]!==Ue){let e=()=>{let e=new Set;for(let t of $e.current)wB(Ue.getItem(t))?.isExpanded()&&e.add(t);return e};nt=t=>{let n=new Set($D(t??H.current)),r=e();for(let e of te.current)r.add(e);return[...r].filter(e=>n.has(e))},t[36]=Ue,t[37]=nt}else nt=t[37];let rt=nt,it;t[38]!==rt||t[39]!==Ue?(it=e=>{let t=XD(e??H.current);Ue.resetPaths(t,{initialExpandedPaths:rt(e)})},t[38]=rt,t[39]=Ue,t[40]=it):it=t[40];let at=it,ot;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ot=e=>{ie.current=QD(e)},t[41]=ot):ot=t[41];let st=ot,ct;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>J.current.has(e),t[42]=ct):ct=t[42];let lt=ct,ut;t[43]!==r||t[44]!==y||t[45]!==C||t[46]!==x||t[47]!==at?(ut=async function(e){if(se.current!==null)return;let t=()=>{M(null),se.current=null};se.current=e.path,M(e.path),A(null);try{let n=await Kt(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){qo.error(n.title),at(),t();return}let i=g(mi,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});qo.error(e),A(e),Er([`files`,`backlinks`,`graph`]),at(),t();return}for(let e of i.duplicatedDocNames)y(e);E(t=>{let n=mO(t,e,i);return at(n),st(n),n}),Er([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?C(i.path):x(i.path)),qo.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),qo.error(r({id:`EBVbtP`}),{description:i}),at(),t()}},t[43]=r,t[44]=y,t[45]=C,t[46]=x,t[47]=at,t[48]=ut):ut=t[48];let pt=ut,mt=(0,Q.useRef)(pt),ht;t[49]===pt?ht=t[50]:(ht=()=>{mt.current=pt},t[49]=pt,t[50]=ht),(0,Q.useEffect)(ht);let gt=function(e){let t=nV(e);if(!t||rV(t))return!1;let n=Ue.getFocusedPath()??Ue.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||lt(n))return!1;let r=rV(n);if(!r)return!1;let i=JD(t);if(!$e.current.includes(i))return!1;let a=`${t}${r}`;return Xe.current.includes(a)?!1:(Ut({sourcePath:n,destinationPath:a,isFolder:!1}),Ue.move(n,a),!0)},_t;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(_t=e=>{let t=e??ne.current;!t||ne.current!==t||(t.disposeCommitListener(),ne.current=null)},t[51]=_t):_t=t[51];let vt=_t,yt;t[52]!==r||t[53]!==vt||t[54]!==l||t[55]!==c||t[56]!==at?(yt=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;vt(e),i&&M(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 Kt(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?qo.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(M(null),at());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;qo.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(M(null),at());return}i&&(e.kind===`file`?l(e.createdPath):c([Ke(e.createdPath)],{force:!0})),i&&E(t=>{let n=pO(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return st(n),n}),Er([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&M(null)},t[52]=r,t[53]=vt,t[54]=l,t[55]=c,t[56]=at,t[57]=yt):yt=t[57];let bt=yt,xt,St;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(xt=()=>()=>{let e=ne.current;e&&re.current(e,{restoreLocation:!1,updateUi:!1}).catch(BV)},St=[],t[58]=xt,t[59]=St):(xt=t[58],St=t[59]),(0,Q.useEffect)(xt,St);let Ct,wt;t[60]===r?(Ct=t[61],wt=t[62]):(Ct=()=>{let e=!0,t=LB(async function(){try{let t=de.current,n=await Kt(await fetch(t?`/api/documents?showAll=true`:`/api/documents`),r({id:`8RtNI0`}));if(!e)return;if(!n.ok)A(n.title);else{let e=Mn.safeParse(n.body);if(!e.success)A(r({id:`HlmZBk`}));else{let n=ue.current||t;E(fV(ui(e.data.documents,n),H.current,le.current)),A(null)}}}catch(t){let n=t;e&&A(r({id:`34qyH5`})),console.warn(`[FileTree] fetch failed:`,n)}e&&O(!1)});fe.current=()=>t.request(),t.request();let n=()=>{document.visibilityState===`visible`&&t.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let i=hi(e=>{e.includes(`files`)&&t.request()});return()=>{e=!1,fe.current=null,t.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),i()}},wt=[r],t[60]=r,t[61]=Ct,t[62]=wt),(0,Q.useEffect)(Ct,wt);let Tt=(0,Q.useRef)(!0),Et;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Et=()=>{if(Tt.current){Tt.current=!1;return}fe.current?.()},t[63]=Et):Et=t[63];let Dt;t[64]===je?Dt=t[65]:(Dt=[je],t[64]=je,t[65]=Dt),(0,Q.useEffect)(Et,Dt);let Ot=(0,Q.useRef)(!0),kt;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(kt=()=>{if(Ot.current){Ot.current=!1;return}fe.current?.()},t[66]=kt):kt=t[66];let At;t[67]===Ne?At=t[68]:(At=[Ne],t[67]=Ne,t[68]=At),(0,Q.useEffect)(kt,At);let jt,Mt;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=g(Nr,n,`workspace`,null);r&&V({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(zV),()=>{e=!1}},Mt=[],t[69]=jt,t[70]=Mt):(jt=t[69],Mt=t[70]),(0,Q.useEffect)(jt,Mt);let Nt;t[71]!==rt||t[72]!==Ue||t[73]!==Ye?(Nt=()=>{if(ie.current===Ye){ie.current=null;return}Ue.resetPaths(Xe.current,{initialExpandedPaths:rt()})},t[71]=rt,t[72]=Ue,t[73]=Ye,t[74]=Nt):Nt=t[74];let Pt;t[75]!==Ue||t[76]!==Ye?(Pt=[Ue,Ye],t[75]=Ue,t[76]=Ye,t[77]=Pt):Pt=t[77],(0,Q.useEffect)(Nt,Pt),EB(Ue,Se,tt,oe);let Ft;t[78]!==Se||t[79]!==D||t[80]!==Ue?(Ft=()=>{D||!Se||lB(pe.current,Ue)},t[78]=Se,t[79]=D,t[80]=Ue,t[81]=Ft):Ft=t[81];let It;t[82]!==tt||t[83]!==Se||t[84]!==D||t[85]!==Ue||t[86]!==Ye?(It=[Se,tt,Ye,D,Ue],t[82]=tt,t[83]=Se,t[84]=D,t[85]=Ue,t[86]=Ye,t[87]=It):It=t[87],(0,Q.useEffect)(Ft,It);let Lt,Rt;t[88]===Ue?(Lt=t[89],Rt=t[90]):(Lt=()=>Ue.subscribe(()=>{if(!Ue.isSearchOpen())for(let e of te.current){let t=wB(Ue.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Rt=[Ue],t[88]=Ue,t[89]=Lt,t[90]=Rt),(0,Q.useEffect)(Lt,Rt);let zt,Bt;t[91]===Ue?(zt=t[92],Bt=t[93]):(zt=()=>Ue.onMutation(`remove`,e=>{let t=ne.current;!t||e.path!==t.renamePath||re.current(t)}),Bt=[Ue],t[91]=Ue,t[92]=zt,t[93]=Bt),(0,Q.useEffect)(zt,Bt);let Vt;t[94]!==y||t[95]!==u||t[96]!==d||t[97]!==C||t[98]!==h?(Vt=async(e,t,n)=>{let r=t===void 0?[]:t,i=n?.docName??G.current,a=hO(i,e),o=n?.folderPath??(ve.current?.kind===`folder`?ve.current.folderPath:null),s=o?dt(o,r):null;Me(e);let c=gO(e,d());await Promise.all(c.map(e=>u(e)));for(let t of e)y(t.toDocName);h(e,r),E(t=>{let n=fO(t,e,r);return st(n),n}),o&&s&&s!==o?C(s):a&&a!==i&&(window.location.hash=ii(a)),Er([`files`,`backlinks`,`graph`])},t[94]=y,t[95]=u,t[96]=d,t[97]=C,t[98]=h,t[99]=Vt):Vt=t[99];let Ht=Vt;async function Ut(e){let t=rO(e.sourcePath,e.isFolder);M(t),A(null);try{if(!e.isFolder&<(t)){qo.error(r({id:`yXiaxB`})),queueMicrotask(()=>{at()}),vt(),M(null);return}let n=Bz(e.sourcePath,e.destinationPath,e.isFolder);if(n.kind===`block`){qo.error(r({id:`FaBZwp`})),queueMicrotask(()=>{at()}),vt(),M(null);return}let i=rO(n.destinationPath,e.isFolder),a=e.isFolder?{kind:`folder`,fromPath:qD(t),toPath:qD(i)}:{kind:`file`,fromPath:WD(t),toPath:WD(i)},o={docName:G.current,folderPath:ve.current?.kind===`folder`?ve.current.folderPath:null},s=await Kt(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),r({id:`gijbne`}));if(!s.ok){qo.error(s.title),at();let e=ne.current;e&&e.renamePath===t?await bt(e):vt(),M(null);return}let c=g(Cr,s.body,`rename-path`,{renamed:[]});try{await Ht(c.renamed,e.isFolder?[{fromPath:qD(t),toPath:qD(i)}]:[],o)}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:t,destinationTreePath:i,renamedCount:c.renamed.length}),qo.error(r({id:`dDpCOp`}))}vt(),M(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let n=r({id:`HIb0vl`});qo.error(n),A(n),at();let i=ne.current;i&&i.renamePath===t?await bt(i):vt(),M(null)}}let Wt;t[100]!==r||t[101]!==Ht||t[102]!==at?(Wt=async function(e){let t=e.draggedPaths.map(t=>{let n=oO(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(RV);if(t.length!==0){if(t.some(e=>lt(e.sourcePath))){qo.error(r({id:`ygLG1e`})),at();return}M(t[0]?.sourcePath??null),A(null);try{let e=[],n=[],i={docName:G.current,folderPath:ve.current?.kind===`folder`?ve.current.folderPath:null};for(let i of t){let t=i.sourcePath.endsWith(`/`),a=t?{kind:`folder`,fromPath:qD(i.sourcePath),toPath:qD(i.destinationTreePath)}:{kind:`file`,fromPath:WD(i.sourcePath),toPath:WD(i.destinationTreePath)},o=await Kt(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),r({id:`dOHMA0`}));if(!o.ok){qo.error(o.title),at(),M(null);return}let s=g(Cr,o.body,`rename-path:drop`,{renamed:[]});e=e.concat(s.renamed),t&&n.push({fromPath:qD(i.sourcePath),toPath:qD(i.destinationTreePath)})}try{await Ht(e,n,i)}catch(n){console.warn(`[FileTree] post-move reconciliation failed`,{err:n,operationCount:t.length,renamedCount:e.length}),qo.error(r({id:`8OxKZy`}))}M(null)}catch(e){console.warn(`[FileTree] move failed:`,e),qo.error(r({id:`HIb0vl`})),at(),M(null)}}},t[100]=r,t[101]=Ht,t[102]=at,t[103]=Wt):Wt=t[103];let Gt=Wt,qt;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(qt=function(e){z({parentDir:e})},t[104]=qt):qt=t[104];let Jt=qt,Yt;t[105]!==r||t[106]!==bt||t[107]!==vt||t[108]!==Ue||t[109]!==C||t[110]!==x||t[111]!==at||t[112]!==Je?(Yt=async function(e,t){if(se.current)return;let n=ne.current;n&&vt(n);try{let n=iO(e,t,[...Je,...$e.current]);M(n.renamePath),se.current=n.renamePath;let i=window.location.hash,a;if(e===`file`){let e=aO(`file`,n.addPath),t=await Kt(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`fJgQHX`}));if(!t.ok){qo.error(t.title),M(null),se.current=null;return}let i=WD(e),o=g(_i,t.body,`create-page`,{docName:i}).docName;a=o;let s={kind:`document`,docName:o,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};E(e=>{if(e.some(e=>Rn(e)&&e.docName===o))return e;let t=[...e,s];return st(t),le.current.set(GD(s),Date.now()),t}),Er([`files`,`backlinks`,`graph`]),x(o)}else{let e=qD(n.addPath),t=await Kt(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){qo.error(t.title),M(null),se.current=null;return}a=g(li,t.body,`create-folder`,{path:e}).path;let i={kind:`folder`,path:a,modified:new Date().toISOString(),size:0};E(e=>{if(e.some(e=>Nn(e)&&e.path===a))return e;let t=[...e,i];return st(t),le.current.set(GD(i),Date.now()),t}),Er([`files`]),C(a)}let o=!1,s=e=>{if(e.key!==`Enter`)return;let t=ne.current;!t||t.renamePath!==n.renamePath||queueMicrotask(()=>vt(t))};document.addEventListener(`keydown`,s,!0),ne.current={kind:e,renamePath:n.renamePath,createdPath:a,previousHash:i,disposeCommitListener:()=>{o||(o=!0,document.removeEventListener(`keydown`,s,!0))}},M(null),se.current=null,Ue.add(n.addPath),Ue.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),qo.error(r({id:`S6l5dv`}));let t=ne.current;t?await bt(t):vt(),M(null),se.current=null,at()}},t[105]=r,t[106]=bt,t[107]=vt,t[108]=Ue,t[109]=C,t[110]=x,t[111]=at,t[112]=Je,t[113]=Yt):Yt=t[113];let Xt=Yt,Zt;t[114]===Ue?Zt=t[115]:(Zt=function(e){let t=JD(e);(0,Q.startTransition)(()=>{for(let e of $e.current)if(e===t||e.startsWith(t)){let t=wB(Ue.getItem(e));t&&t.expand()}})},t[114]=Ue,t[115]=Zt);let Qt=Zt,$t;t[116]===Ue?$t=t[117]:($t=function(e){let t=JD(e),n=new Set(te.current);(0,Q.startTransition)(()=>{for(let e of[...$e.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=wB(Ue.getItem(e));t&&t.collapse()}})},t[116]=Ue,t[117]=$t);let en=$t,tn;t[118]!==W||t[119]!==et||t[120]!==a||t[121]!==o||t[122]!==q||t[123]!==j||t[124]!==bt||t[125]!==T||t[126]!==Qe||t[127]!==Gt||t[128]!==Ut||t[129]!==Ge||t[130]!==gt||t[131]!==Ne||t[132]!==je||t[133]!==Je?(tn=()=>{H.current=T,G.current=a,ve.current=o,J.current=q,se.current=j,ue.current=je,de.current=Ne,Xe.current=Je,$e.current=Qe,te.current=et,re.current=bt,me.current=e=>{if(oe.current||e.length!==1)return;let t=e[0];t&&W(Ge(t),T)},ge.current=e=>{gt(e)||qo.error(e)},he.current=Ut,_e.current=Gt},t[118]=W,t[119]=et,t[120]=a,t[121]=o,t[122]=q,t[123]=j,t[124]=bt,t[125]=T,t[126]=Qe,t[127]=Gt,t[128]=Ut,t[129]=Ge,t[130]=gt,t[131]=Ne,t[132]=je,t[133]=Je,t[134]=tn):tn=t[134],(0,Q.useLayoutEffect)(tn);let nn,rn;t[135]===Ue?(nn=t[136],rn=t[137]):(nn=()=>{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||SV(e.target))return;let a=pe.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=Ue.getFocusedPath()??Ue.getSelectedPaths()[0]??null;if(!t)return;let n=Ue.getItem(t)??Ue.getItem(JD(t)),r=n?.isDirectory()?JD(qD(n.getPath())):t;if(J.current.has(r))return;mt.current(vV(r)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...$e.current,...Xe.current]);oe.current=!0;for(let e of u)!e||J.current.has(e)||Ue.getItem(e)?.select();queueMicrotask(()=>{oe.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},rn=[Ue],t[135]=Ue,t[136]=nn,t[137]=rn),(0,Q.useEffect)(nn,rn);let an,on;t[138]!==T.length||t[139]!==D?(an=()=>{if(D||T.length===0)return;let e=pe.current?.querySelector(NA)?.shadowRoot;if(!e)return;let t=LV,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()},on=[D,T.length],t[138]=T.length,t[139]=D,t[140]=an,t[141]=on):(an=t[140],on=t[141]),(0,Q.useEffect)(an,on);let sn,cn;t[142]!==T.length||t[143]!==D?(sn=()=>{if(D||T.length===0)return;let e=pe.current?.querySelector(NA)?.shadowRoot;if(!e)return;let t=()=>Uz(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()},cn=[D,T.length],t[142]=T.length,t[143]=D,t[144]=sn,t[145]=cn):(sn=t[144],cn=t[145]),(0,Q.useEffect)(sn,cn);let ln,un;t[146]!==T.length||t[147]!==D?(ln=()=>{if(D||T.length===0)return;let e=pe.current?.querySelector(NA)?.shadowRoot;if(!e)return;let t=()=>nB(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},un=[D,T.length],t[146]=T.length,t[147]=D,t[148]=ln,t[149]=un):(ln=t[148],un=t[149]),(0,Q.useEffect)(ln,un);let dn;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(dn={folderCount:0,expandedCount:0},t[150]=dn):dn=t[150];let fn=(0,Q.useRef)(dn),pn=(0,Q.useRef)(Xt),mn=(0,Q.useRef)(Jt),hn;t[151]===Xt?hn=t[152]:(hn=()=>{pn.current=Xt,mn.current=Jt},t[151]=Xt,t[152]=hn),(0,Q.useEffect)(hn);let gn,_n;t[153]===Ue?(gn=t[154],_n=t[155]):(gn=()=>({startCreating(e,t){pn.current(e,t)},startCreatingFromTemplate(e){mn.current(e)},expandAll(){(0,Q.startTransition)(()=>{for(let e of $e.current){let t=wB(Ue.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(te.current);(0,Q.startTransition)(()=>{for(let t of[...$e.current].reverse()){if(e.has(t))continue;let n=wB(Ue.getItem(t));n&&n.collapse()}})},getFolderState(){let e=$e.current,t=0;for(let n of e)wB(Ue.getItem(n))?.isExpanded()&&t++;let n=e.length,r=fn.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return fn.current=i,i},subscribe(e){return Ue.subscribe(e)}}),_n=[Ue],t[153]=Ue,t[154]=gn,t[155]=_n),(0,Q.useImperativeHandle)(n,gn,_n);let vn;t[156]!==vt||t[157]!==u||t[158]!==c||t[159]!==Ue?(vn=async function(e,t,n){let r=CV(e,H.current,$e.current),i=ne.current;i&&e.some(e=>wV(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),vt(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]);c([...[...a].map(IV),...[...o].map(FV)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?JD(t.path):UD(t.path,t.docExt);Ue.getItem(e)&&Ue.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}E(e=>{let t=pO(e,[...a]);for(let e of o)t=pO(t,[],e);return st(t),t}),Er([`files`,`backlinks`,`graph`])},t[156]=vt,t[157]=u,t[158]=c,t[159]=Ue,t[160]=vn):vn=t[160];let yn=vn,bn;t[161]!==r||t[162]!==yn?(bn=async function(e){let t=[],n=[],i=[];for(let a of e){M(a.path);let e=await Kt(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:a.kind,path:a.path})}),r({id:`7JtSLi`}));if(!e.ok)return i.length>0&&await yn(i,t,n),qo.error(e.title),!1;let o=g(fr,e.body,`delete-path`,{deletedDocNames:[]});t.push(...o.deletedDocNames),a.kind===`folder`&&n.push(a.path),i.push(a)}return await yn(i,t,n),!0},t[161]=r,t[162]=yn,t[163]=bn):bn=t[163];let xn=bn,Sn;t[164]===Symbol.for(`react.memo_cache_sentinel`)?(Sn=async function(e,t,n){let r=[],i=[];for(let a of e){M(a.path);let e=_O(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:vB(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[164]=Sn):Sn=t[164];let Cn=Sn,wn;t[165]===r?wn=t[166]:(wn=async function(e){let t=[],n=[],i=[];for(let a of e)try{let e=await Kt(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:a.kind,path:a.path})}),r({id:`DVh_Tb`}));if(!e.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:e.title}),i.push({target:a,reason:e.title});continue}let o=g(Ar,e.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...o.deletedDocNames),a.kind===`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;qo.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[165]=r,t[166]=wn);let Tn=wn,En;t[167]!==r||t[168]!==L||t[169]!==yn||t[170]!==xn||t[171]!==Tn||t[172]!==at||t[173]!==B?(En=async function(e){let t=e[0];if(!t)return;let n=L.filter(t=>e.some(e=>{if(e.kind===`file`){let n=`${e.path}${e.docExt??`.md`}`;return t.file===n}return t.file.startsWith(`${e.path}/`)}));if(n.length>0){let e=n.slice(0,3).map(PV),t=n.length>e.length?`, +${n.length-e.length} more`:``;qo.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}M(t.path),P(null);let i=typeof window<`u`?window.okDesktop:void 0;try{if(i&&B){let{trashed:t,failed:n}=await Cn(e,i,B);if(t.length>0){let e=await Tn(t);e?await yn(t,e.deletedDocNames,e.deletedFolderPaths):await yn(t,t.filter(NV).map(MV),t.filter(jV).map(AV))}n.length>0&&I({failed:n,originalTargets:[...e]}),M(null)}else{let t=await xn(e);M(null),t||at()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),qo.error(r({id:`0eHrMb`}),{description:n}),M(null),at()}},t[167]=r,t[168]=L,t[169]=yn,t[170]=xn,t[171]=Tn,t[172]=at,t[173]=B,t[174]=En):En=t[174];let Dn=En,On;t[175]!==r||t[176]!==xn||t[177]!==at||t[178]!==F?(On=async function(){if(!F)return;let e=new Set(F.failed.map(kV)),t=F.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(I(null),t.length!==0){M(t[0]?.path??null);try{let e=await xn(t);M(null),e||at()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),qo.error(r({id:`0eHrMb`}),{description:n}),M(null),at()}}},t[175]=r,t[176]=xn,t[177]=at,t[178]=F,t[179]=On):On=t[179];let kn=On,An;t[180]!==Dn||t[181]!==F?(An=async function(){if(!F)return;let e=new Set(F.failed.map(OV)),t=F.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));I(null),await Dn(t)},t[180]=Dn,t[181]=F,t[182]=An):An=t[182];let jn=An,Fn=(0,Q.useRef)(Dn),In;t[183]===Dn?In=t[184]:(In=()=>{Fn.current=Dn},t[183]=Dn,t[184]=In),(0,Q.useEffect)(In);let Ln,zn;t[185]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=()=>MB(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=H.current.find(e=>Rn(e)&&e.docName===t);Fn.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Fn.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),zn=[],t[185]=Ln,t[186]=zn):(Ln=t[185],zn=t[186]),(0,Q.useEffect)(Ln,zn);let Bn,Vn;t[187]===Symbol.for(`react.memo_cache_sentinel`)?(Bn=()=>IB(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=H.current.find(e=>Rn(e)&&e.docName===t);mt.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){mt.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}))}),Vn=[],t[187]=Bn,t[188]=Vn):(Bn=t[187],Vn=t[188]),(0,Q.useEffect)(Bn,Vn);let Hn,Un;t[189]===Ue?(Hn=t[190],Un=t[191]):(Hn=()=>PB(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=UD(t,H.current.find(e=>Rn(e)&&e.docName===t)?.docExt);Ue.startRenaming(n);return}if(e.kind===`folder`){Ue.startRenaming(e.folderPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),Un=[Ue],t[189]=Ue,t[190]=Hn,t[191]=Un),(0,Q.useEffect)(Hn,Un);let Wn;t[192]===Symbol.for(`react.memo_cache_sentinel`)?(Wn=function(){let e=ae.current;e&&QB(e),ae.current=null},t[192]=Wn):Wn=t[192];let Gn=Wn,Kn;t[193]===m?Kn=t[194]:(Kn=function(e){let t=JV(e.nativeEvent);if(!t||t.endsWith(`/`)){Gn();return}let n=WD(t),r=H.current.find(e=>GD(e)===t);if(r&&pr(r)){Gn();return}ae.current!==n&&(Gn(),ae.current=n,ZB(n,e=>m(e)))},t[193]=m,t[194]=Kn);let qn=Kn,Jn;t[195]!==W||t[196]!==Ue||t[197]!==C?(Jn=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=YV(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?JD(n):n;if(Ue.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=qD(r);if(window.location.hash===jr(e))return;queueMicrotask(()=>C(e));return}let i=WD(r);window.location.hash!==ii(i)&&queueMicrotask(()=>W(r))},t[195]=W,t[196]=Ue,t[197]=C,t[198]=Jn):Jn=t[198];let Yn=Jn;if(D){let e;return t[199]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ZV,{}),t[199]=e):e=t[199],e}if(T.length===0){if(k){let e;return t[200]===k?e=t[201]:(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:k})}),t[200]=k,t[201]=e),e}let e;t[202]===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[202]=e):e=t[202];let n;t[203]===Xt?n=t[204]:(n=()=>Xt(`file`,``),t[203]=Xt,t[204]=n);let r;t[205]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(s,{id:`6ibbCg`}),t[205]=r):r=t[205];let i;return t[206]===n?i=t[207]:(i=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(Di,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:n,children:r})]}),t[206]=n,t[207]=i),i}let Xn=j!==null,Zn=N?.targets[0]??null,Qn;t[208]===k?Qn=t[209]:(Qn=k&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:k}),t[208]=k,t[209]=Qn);let $n;t[210]===v?$n=t[211]:($n=pV(v),t[210]=v,t[211]=$n);let er;t[212]!==Xn||t[213]!==q||t[214]!==en||t[215]!==Qt||t[216]!==Qe||t[217]!==pt||t[218]!==Ee||t[219]!==Ae||t[220]!==Ue||t[221]!==De||t[222]!==ke||t[223]!==Xt||t[224]!==B?(er=(e,t)=>(0,Z.jsx)(TV,{item:e,context:t,anyActionBusy:Xn,workspace:B,handoff:Ee,model:Ue,okignoreBinding:De,projectLocalBinding:ke,mergedConfig:Ae,onStartCreating:Xt,onStartCreatingFromTemplate:Jt,onDuplicate:pt,onDelete:e=>P({targets:e}),onExpandSubtree:Qt,onCollapseSubtree:en,folderTreePaths:Qe,isAsset:q.has(e.path),isAssetTreePath:lt}),t[212]=Xn,t[213]=q,t[214]=en,t[215]=Qt,t[216]=Qe,t[217]=pt,t[218]=Ee,t[219]=Ae,t[220]=Ue,t[221]=De,t[222]=ke,t[223]=Xt,t[224]=B,t[225]=er):er=t[225];let tr;t[226]!==Yn||t[227]!==qn||t[228]!==Ue||t[229]!==Qn||t[230]!==$n||t[231]!==er?(tr=(0,Z.jsx)(`div`,{ref:pe,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(Iz,{header:Qn,model:Ue,style:$n,onClickCapture:Yn,onMouseMove:qn,onMouseLeave:Gn,renderContextMenu:er})}),t[226]=Yn,t[227]=qn,t[228]=Ue,t[229]=Qn,t[230]=$n,t[231]=er,t[232]=tr):tr=t[232];let nr=!!N,rr;t[233]===j?rr=t[234]:(rr=e=>{!e&&!j&&P(null)},t[233]=j,t[234]=rr);let ir;t[235]!==r||t[236]!==j||t[237]!==N||t[238]!==Dn||t[239]!==Zn?(ir=N&&Zn&&(0,Z.jsx)(za,{...(()=>{let e=hB(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,N.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(DV)}):null};let t=N.targets.length,n=Zn.name;return{itemName:t===1?`${Zn.name}${Zn.kind===`file`?Zn.docExt??`.md`:`/`}`:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):Zn.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:j!==null,onDelete:()=>Dn(N.targets)}),t[235]=r,t[236]=j,t[237]=N,t[238]=Dn,t[239]=Zn,t[240]=ir):ir=t[240];let ar;t[241]!==nr||t[242]!==rr||t[243]!==ir?(ar=(0,Z.jsx)(Go,{open:nr,onOpenChange:rr,children:ir}),t[241]=nr,t[242]=rr,t[243]=ir,t[244]=ar):ar=t[244];let or=!!F,sr;t[245]===j?sr=t[246]:(sr=e=>{!e&&!j&&I(null)},t[245]=j,t[246]=sr);let cr;t[247]!==j||t[248]!==kn||t[249]!==jn||t[250]!==F?(cr=F&&(0,Z.jsx)(SB,{failedTargets:F.failed,isSubmitting:j!==null,onDeletePermanently:kn,onRetry:jn,onCancel:()=>I(null)}),t[247]=j,t[248]=kn,t[249]=jn,t[250]=F,t[251]=cr):cr=t[251];let lr;t[252]!==or||t[253]!==sr||t[254]!==cr?(lr=(0,Z.jsx)(Go,{open:or,onOpenChange:sr,children:cr}),t[252]=or,t[253]=sr,t[254]=cr,t[255]=lr):lr=t[255];let ur=R!==null,dr;t[256]===Symbol.for(`react.memo_cache_sentinel`)?(dr=e=>{e||z(null)},t[256]=dr):dr=t[256];let Y=R?.parentDir??``,mr;t[257]!==ur||t[258]!==Y?(mr=(0,Z.jsx)(zp,{open:ur,onOpenChange:dr,kind:`file`,initialDir:Y}),t[257]=ur,t[258]=Y,t[259]=mr):mr=t[259];let hr;return t[260]!==tr||t[261]!==ar||t[262]!==lr||t[263]!==mr?(hr=(0,Z.jsxs)(Z.Fragment,{children:[tr,ar,lr,mr]}),t[260]=tr,t[261]=ar,t[262]=lr,t[263]=mr,t[264]=hr):hr=t[264],hr}function DV(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:gB(e)},`${e.kind}:${e.path}`)}function OV(e){return`${e.kind}:${e.path}`}function kV(e){return`${e.kind}:${e.path}`}function AV(e){return e.path}function jV(e){return e.kind===`folder`}function MV(e){return e.path}function NV(e){return e.kind===`file`}function PV(e){return e.file}function FV(e){return Ke(e)}function IV(e){return Pt(e)}function LV(e){return e.endsWith(`/`)?e.slice(0,-1):e}function RV(e){return!!e}function zV(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function BV(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function VV(e){qo.error(e)}function HV(){}function UV(e){return qo.error(e)}function WV(){}function GV(){}async function KV(){}function qV(e){return GD(e)}function JV(e){return YV(e)?.dataset.itemPath??null}function YV(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var XV=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function ZV(){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=XV.map(QV),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 QV(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Ja,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Ja,{className:`h-3 ${e}`})]},t)}function $V(e){return e?Y._({id:`wTcjov`}):null}function eH(e){let t=(0,$.c)(35),{_:n}=i(),{input:r,installStates:a,dispatch:o,webFallbackVisible:c}=e,l=c===void 0?!0:c,u=r===null,d,f,p,m,h,g,_;if(t[0]!==n||t[1]!==o||t[2]!==r||t[3]!==u||t[4]!==a||t[5]!==l){_=Symbol.for(`react.early_return_sentinel`);bb0:{let e=$V(u),i;t[13]===a?i=t[14]:(i=e=>a[e.id]?.installed===!0,t[13]=a,t[14]=i);let c=hm.filter(i);p=a[`claude-code`]?.installed===!0;let v;t[15]===r?v=t[16]:(v=r!==null&&r.docContext!==null?Bn(r.docContext.relativePath):``,t[15]=r,t[16]=v);let y=v,b;t[17]!==r||t[18]!==y?(b=()=>{r!==null&&Ay(y)},t[17]=r,t[18]=y,t[19]=b):b=t[19],m=b;let x=l&&!p;if(c.length===0&&!x){_=null;break bb0}f=TO,t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(OO,{children:[(0,Z.jsx)(zi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[20]=g):g=t[20],d=kO,h=c.map(t=>{let i=!u,{displayName:a}=t,s=n(e?{id:`1ZpfyB`,values:{displayName:a,hint:e}}:{id:`WqLq6M`,values:{displayName:a}});return(0,Z.jsxs)(DO,{disabled:!i,onSelect:()=>{r&&o(t.id,r)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":s,children:[(0,Z.jsx)(wy,{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]=r,t[3]=u,t[4]=a,t[5]=l,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12];if(_!==Symbol.for(`react.early_return_sentinel`))return _;let v;t[21]!==n||t[22]!==p||t[23]!==m||t[24]!==u||t[25]!==l?(v=l&&!p?(0,Z.jsxs)(DO,{onSelect:m,disabled:u,"data-testid":`empty-space-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(Ue,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[21]=n,t[22]=p,t[23]=m,t[24]=u,t[25]=l,t[26]=v):v=t[26];let y;t[27]!==d||t[28]!==h||t[29]!==v?(y=(0,Z.jsxs)(d,{children:[h,v]}),t[27]=d,t[28]=h,t[29]=v,t[30]=y):y=t[30];let b;return t[31]!==f||t[32]!==g||t[33]!==y?(b=(0,Z.jsxs)(f,{children:[g,y]}),t[31]=f,t[32]=g,t[33]=y,t[34]=b):b=t[34],b}var tH=(e,t,n)=>ml(e,t,n,`ProjectSwitcher`);function nH(e){let t=(0,$.c)(79),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h;t[1]!==r||t[2]!==n.project||t[3]!==l?(h=()=>{if(!l)return;let e=!1;return tH(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[1]=r,t[2]=n.project,t[3]=l,t[4]=h):h=t[4];let g;t[5]!==r||t[6]!==n||t[7]!==l?(g=[l,n,r],t[5]=r,t[6]=n,t[7]=l,t[8]=g):g=t[8],(0,Q.useEffect)(h,g);let _;t[9]!==r||t[10]!==n.project?(_=e=>{u(!1),tH(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[9]=r,t[10]=n.project,t[11]=_):_=t[11];let v=_,y;t[12]!==r||t[13]!==n.dialog||t[14]!==n.project?(y=()=>{u(!1),tH(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[12]=r,t[13]=n.dialog,t[14]=n.project,t[15]=y):y=t[15];let b=y,x;t[16]!==r||t[17]!==n.navigator?(x=()=>{u(!1),tH(()=>n.navigator.open(),r({id:`jol95m`}))},t[16]=r,t[17]=n.navigator,t[18]=x):x=t[18];let S=x,C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{u(!1),m(!0)},t[19]=C):C=t[19];let w=C,T=n.config.projectPath,E,D,O,k,A,j,M,N,P,F;if(t[20]!==r||t[21]!==n.config.projectName||t[22]!==T||t[23]!==l||t[24]!==v||t[25]!==o||t[26]!==d){let e;t[37]===T?e=t[38]:(e=e=>e.path!==T,t[37]=T,t[38]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;D=Da,j=l,t[39]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{u(e),e||f(``)},t[39]=M):M=t[39];let p;t[40]===r?p=t[41]:(p=r({id:`zZ_I5K`}),t[40]=r,t[41]=p);let m;t[42]===n.config.projectName?m=t[43]:(m=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[42]=n.config.projectName,t[43]=m);let h;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(nc,{"aria-hidden":`true`,className:`opacity-60`}),t[44]=h):h=t[44],t[45]!==p||t[46]!==m?(N=(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsxs)(yD,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:p,children:[m,h]})}),t[45]=p,t[46]=m,t[47]=N):N=t[47],E=ra,P=`start`,F=`top`,O=`min-w-[260px]`,k=`project-switcher-menu`,A=i.length===0?(0,Z.jsx)(co,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(yx,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(wx,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:rH,"data-testid":`project-switcher-search`}),(0,Z.jsx)(xx,{children:(0,Z.jsx)(U,{"aria-hidden":`true`})})]}),(0,Z.jsx)(ca,{}),c.length===0?(0,Z.jsx)(co,{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)(la,{disabled:e.missing,onSelect:()=>v(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Z.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[20]=r,t[21]=n.config.projectName,t[22]=T,t[23]=l,t[24]=v,t[25]=o,t[26]=d,t[27]=E,t[28]=D,t[29]=O,t[30]=k,t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P,t[36]=F}else E=t[27],D=t[28],O=t[29],k=t[30],A=t[31],j=t[32],M=t[33],N=t[34],P=t[35],F=t[36];let I;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(ca,{}),t[48]=I):I=t[48];let L,R;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Ce,{"aria-hidden":`true`,className:`text-muted-foreground`}),R=(0,Z.jsx)(s,{id:`PVUn_c`}),t[49]=L,t[50]=R):(L=t[49],R=t[50]);let z;t[51]===b?z=t[52]:(z=(0,Z.jsxs)(la,{onSelect:b,"data-testid":`project-switcher-open-folder`,children:[L,R]}),t[51]=b,t[52]=z);let B,V;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(me,{"aria-hidden":`true`,className:`text-muted-foreground`}),V=(0,Z.jsx)(s,{id:`2Xs2jo`}),t[53]=B,t[54]=V):(B=t[53],V=t[54]);let H;t[55]===S?H=t[56]:(H=(0,Z.jsxs)(la,{onSelect:S,"data-testid":`project-switcher-switch-project`,children:[B,V]}),t[55]=S,t[56]=H);let W;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsxs)(la,{onSelect:w,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(te,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[57]=W):W=t[57];let G;t[58]!==E||t[59]!==O||t[60]!==k||t[61]!==A||t[62]!==z||t[63]!==H||t[64]!==P||t[65]!==F?(G=(0,Z.jsxs)(E,{align:P,side:F,className:O,"data-testid":k,children:[A,I,z,H,W]}),t[58]=E,t[59]=O,t[60]=k,t[61]=A,t[62]=z,t[63]=H,t[64]=P,t[65]=F,t[66]=G):G=t[66];let K;t[67]!==D||t[68]!==j||t[69]!==M||t[70]!==N||t[71]!==G?(K=(0,Z.jsxs)(D,{open:j,onOpenChange:M,children:[N,G]}),t[67]=D,t[68]=j,t[69]=M,t[70]=N,t[71]=G,t[72]=K):K=t[72];let q;t[73]!==n||t[74]!==p?(q=(0,Z.jsx)(Ju,{open:p,onOpenChange:m,bridge:n}),t[73]=n,t[74]=p,t[75]=q):q=t[75];let J;return t[76]!==K||t[77]!==q?(J=(0,Z.jsxs)(Z.Fragment,{children:[K,q]}),t[76]=K,t[77]=q,t[78]=J):J=t[78],J}function rH(e){return e.stopPropagation()}function iH(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})),oi(`sidebarSearchPill`)}function aH(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=X(`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)(U,{"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)(db,{className:`text-foreground/70`,children:Sr()?`⌘ K`:`Ctrl K`}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(Di,{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 oH(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)(Mo,{"aria-hidden":`true`,className:`size-3`}),t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==s?(l=(0,Z.jsx)(Di,{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 sH(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 cH(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Uf,Hf,Hf),n;e[0]===t?n=e[1]:(n=sH(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{Vf(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(oH,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function lH(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Gm(n.contentDir,Km(t),n.pathSeparator):e?.kind===`folder`?Gm(n.contentDir,e.folderPath,n.pathSeparator):n.contentDir}function uH(e,t,n){if((e?.kind===`doc`||e?.kind===`folder-index`)&&t){let e=t.lastIndexOf(`/`);return e<0?n.contentDir:Gm(n.contentDir,t.slice(0,e),n.pathSeparator)}return e?.kind===`folder`?Gm(n.contentDir,e.folderPath,n.pathSeparator):n.contentDir}function dH(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Km(t):e?.kind===`folder`?e.folderPath:``}function fH(e,t,n){return e===null?Jm({workspace:n}):e.kind===`folder`?n?Ym({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?qm({docName:t,workspace:n}):null}var pH={folderCount:0,expandedCount:0},mH=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function hH(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(mH)!==null}function gH(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(It,{name:`file-sidebar`,children:(0,Z.jsx)(vH,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var _H=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)($n,{asChild:!0,children:(0,Z.jsx)(Di,{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)(Tn,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Gr,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function vH(e){let t=(0,$.c)(190),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=ft(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:kn(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}=aD(),h=p===`expanded`,g=f&&p===`collapsed`,[_,v]=(0,Q.useState)(pH),y,b;t[3]===a?(y=t[4],b=t[5]):(y=()=>{if(a!==null)return v(a.getFolderState()),a.subscribe(()=>{v(a.getFolderState())})},b=[a],t[3]=a,t[4]=y,t[5]=b),(0,Q.useEffect)(y,b);let x,S;t[6]===a?(x=t[7],S=t[8]):(x=()=>{if(a!==null)return hb(()=>{a.startCreating(`file`,``)})},S=[a],t[6]=a,t[7]=x,t[8]=S),(0,Q.useEffect)(x,S);let C=_.folderCount>0,w=C&&_.expandedCount===_.folderCount,T=_.expandedCount===0,E=no(``),D=E.state.status===`ready`?(E.state.data.folder.templates_available?.length??0)>0:!0,O=typeof window<`u`?window.okDesktop:void 0,k=Ra(),A=_h().states,{dispatch:j}=oh(),M;t[9]===k?M=t[10]:(M=Jm({workspace:k}),t[9]=k,t[10]=M);let N=M,{projectLocalBinding:P,merged:F}=Oe(),I=F?.appearance?.sidebar?.showHiddenFiles??!1,L=F?.appearance?.sidebar?.showAllFiles??!1,R=C&&!w,z=C&&!T,B=R||z,V=bH,H;t[11]!==a||t[12]!==k?(H=()=>{k&&a?.startCreating(`file`,``)},t[11]=a,t[12]=k,t[13]=H):H=t[13];let U=H,W;t[14]!==a||t[15]!==k?(W=()=>{k&&a?.startCreatingFromTemplate(``)},t[14]=a,t[15]=k,t[16]=W):W=t[16];let G=W,K;t[17]!==a||t[18]!==k?(K=()=>{k&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=k,t[19]=K):K=t[19];let q=K,J;t[20]===k?J=t[21]:(J=()=>{!k||!O||O.shell.showItemInFolder(k.contentDir)},t[20]=k,t[21]=J);let ee=J,te;t[22]===k?te=t[23]:(te=()=>{!k||!O||DB(O,k.contentDir)},t[22]=k,t[23]=te);let ne=te,re;t[24]!==r||t[25]!==k?(re=async()=>{if(k)try{await navigator.clipboard.writeText(k.contentDir),qo.success(r({id:`6_ZOw4`}),{description:k.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),qo.error(r({id:`vfRlCI`}))}},t[24]=r,t[25]=k,t[26]=re):re=t[26];let ie=re,ae;t[27]!==r||t[28]!==P?(ae=e=>{if(P===null)return;let t=P.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,Wn(t.error)),qo.error(r({id:`P47EWZ`}),{description:Wn(t.error)}))},t[27]=r,t[28]=P,t[29]=ae):ae=t[29];let oe=ae,se;t[30]!==r||t[31]!==P?(se=e=>{if(P===null)return;let t=P.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,Wn(t.error)),qo.error(r({id:`P47EWZ`}),{description:Wn(t.error)}))},t[30]=r,t[31]=P,t[32]=se):se=t[32];let ce=se,le;t[33]===a?le=t[34]:(le=()=>{a?.expandAll()},t[33]=a,t[34]=le);let ue=le,de;t[35]===a?de=t[36]:(de=()=>{a?.collapseAll()},t[35]=a,t[36]=de);let fe=de,pe,me;t[37]!==L||t[38]!==z||t[39]!==R||t[40]!==I?(pe=()=>{O&&O.editor.notifyViewMenuStateChanged({showHiddenFiles:I,showAllFiles:L,canExpandAll:R,canCollapseAll:z})},me=[O,I,L,R,z],t[37]=L,t[38]=z,t[39]=R,t[40]=I,t[41]=pe,t[42]=me):(pe=t[41],me=t[42]),(0,Q.useEffect)(pe,me);let he,ge;t[43]!==r||t[44]!==c||t[45]!==l||t[46]!==j||t[47]!==A||t[48]!==d||t[49]!==P||t[50]!==L||t[51]!==I||t[52]!==a||t[53]!==k?(he=()=>{if(O)return O.onMenuAction(e=>{switch(e){case`new-doc`:if(!k||!a)return;a.startCreating(`file`,d);return;case`new-folder`:if(!k||!a)return;a.startCreating(`folder`,d);return;case`new-from-template`:if(!k||!a)return;a.startCreatingFromTemplate(d);return;case`rename`:if(!l)return;NB(l);return;case`duplicate`:if(!l)return;FB(l);return;case`move-to-trash`:if(!l)return;jB(l);return;case`reveal-in-finder`:{if(!O||!k)return;let e=lH(l,c,k);O.shell.showItemInFolder(e);return}case`open-in-terminal`:if(!O||!k)return;DB(O,uH(l,c,k));return;case`send-to-ai`:{let e=hm.filter(e=>A[e.id]?.installed===!0);if(e.length===0){qo.error(r({id:`LKOLNn`}));return}let t=fH(l,c,k);if(!t)return;let[n]=e;if(!n)return;j(n.id,t);return}case`copy-full-path`:{if(!k)return;let e=lH(l,c,k);navigator.clipboard.writeText(e).then(()=>qo.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),qo.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=dH(l,c);if(e===``){qo.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>qo.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),qo.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(P===null)return;let e=P.patch({appearance:{sidebar:{showHiddenFiles:!I}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,Wn(e.error)),qo.error(r({id:`P47EWZ`}),{description:Wn(e.error)}));return}case`toggle-show-all-files`:{if(P===null)return;let e=P.patch({appearance:{sidebar:{showAllFiles:!L}}});e.ok||(console.warn(`[FileSidebar] toggle-show-all-files rejected:`,Wn(e.error)),qo.error(r({id:`P47EWZ`}),{description:Wn(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`delete`:case`toggle-sidebar`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:return}})},ge=[O,a,k,l,c,d,P,I,L,A,j,r],t[43]=r,t[44]=c,t[45]=l,t[46]=j,t[47]=A,t[48]=d,t[49]=P,t[50]=L,t[51]=I,t[52]=a,t[53]=k,t[54]=he,t[55]=ge):(he=t[54],ge=t[55]),(0,Q.useEffect)(he,ge);let _e=g&&`opacity-0`,ve;t[56]===_e?ve=t[57]:(ve=X(`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`,_e,f&&`[-webkit-app-region:drag]`),t[56]=_e,t[57]=ve);let ye;t[58]===h?ye=t[59]:(ye=h&&!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[58]=h,t[59]=ye);let be;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(be=X(`flex items-center gap-1`,f&&`[&>*]:[-webkit-app-region:no-drag]`),t[60]=be):be=t[60];let xe;t[61]!==r||t[62]!==w||t[63]!==C||t[64]!==T||t[65]!==a?(xe=C?(0,Z.jsxs)(Da,{children:[(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsx)(_H,{icon:Oc,label:r({id:`Lu_dOh`})})}),(0,Z.jsxs)(ra,{align:`end`,children:[w?null:(0,Z.jsxs)(la,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(cl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}),T?null:(0,Z.jsxs)(la,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(vc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]})]})]}):null,t[61]=r,t[62]=w,t[63]=C,t[64]=T,t[65]=a,t[66]=xe):xe=t[66];let Se;t[67]===r?Se=t[68]:(Se=r({id:`MW64zN`}),t[67]=r,t[68]=Se);let we;t[69]!==d||t[70]!==a?(we=()=>a?.startCreating(`file`,d),t[69]=d,t[70]=a,t[71]=we):we=t[71];let Te;t[72]!==Se||t[73]!==we?(Te=(0,Z.jsx)(_H,{icon:el,label:Se,onClick:we}),t[72]=Se,t[73]=we,t[74]=Te):Te=t[74];let Ee;t[75]!==r||t[76]!==D||t[77]!==d||t[78]!==a?(Ee=D?(0,Z.jsx)(_H,{icon:gc,label:r({id:`Uuj_R4`}),onClick:()=>a?.startCreatingFromTemplate(d)}):null,t[75]=r,t[76]=D,t[77]=d,t[78]=a,t[79]=Ee):Ee=t[79];let De;t[80]===r?De=t[81]:(De=r({id:`tX5yOZ`}),t[80]=r,t[81]=De);let ke;t[82]!==d||t[83]!==a?(ke=()=>a?.startCreating(`folder`,d),t[82]=d,t[83]=a,t[84]=ke):ke=t[84];let Ae;t[85]!==De||t[86]!==ke?(Ae=(0,Z.jsx)(_H,{icon:bc,label:De,onClick:ke}),t[85]=De,t[86]=ke,t[87]=Ae):Ae=t[87];let je;t[88]!==xe||t[89]!==Te||t[90]!==Ee||t[91]!==Ae?(je=(0,Z.jsxs)(`div`,{className:be,children:[xe,Te,Ee,Ae]}),t[88]=xe,t[89]=Te,t[90]=Ee,t[91]=Ae,t[92]=je):je=t[92];let Me;t[93]!==ve||t[94]!==ye||t[95]!==je?(Me=(0,Z.jsxs)(pD,{"data-electron-drag":f?``:void 0,className:ve,children:[ye,je]}),t[93]=ve,t[94]=ye,t[95]=je,t[96]=Me):Me=t[96];let Ne=g&&`opacity-0`,Pe;t[97]===Ne?Pe=t[98]:(Pe=X(`px-2 pb-2`,f&&`[-webkit-app-region:no-drag]`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ne),t[97]=Ne,t[98]=Pe);let Fe;t[99]===p?Fe=t[100]:(Fe=[p],t[99]=p,t[100]=Fe);let Ie;t[101]===n?Ie=t[102]:(Ie=(0,Z.jsx)(aH,{onClick:n}),t[101]=n,t[102]=Ie);let Le;t[103]!==Fe||t[104]!==Ie?(Le=(0,Z.jsx)(m,{fallbackRender:yH,onError:iH,resetKeys:Fe,children:Ie}),t[103]=Fe,t[104]=Ie,t[105]=Le):Le=t[105];let Re;t[106]!==Pe||t[107]!==Le?(Re=(0,Z.jsx)(`div`,{className:Pe,children:Le}),t[106]=Pe,t[107]=Le,t[108]=Re):Re=t[108];let ze;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsxs)(hD,{children:[(0,Z.jsx)(bk,{}),(0,Z.jsx)(EV,{ref:o})]}),t[109]=ze):ze=t[109];let Be,Ve;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsxs)(mD,{className:`px-0`,children:[(0,Z.jsx)(cH,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(gD,{children:(0,Z.jsx)(_D,{children:(0,Z.jsx)(nH,{bridge:window.okDesktop})})}):null]}),Ve=(0,Z.jsx)(dD,{enableToggle:!1}),t[110]=Be,t[111]=Ve):(Be=t[110],Ve=t[111]);let He;t[112]!==Me||t[113]!==Re?(He=(0,Z.jsx)(wO,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:V,children:[Me,Re,ze,Be,Ve]})}),t[112]=Me,t[113]=Re,t[114]=He):He=t[114];let Ue=!k,We,Ge;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(el,{"aria-hidden":`true`}),Ge=(0,Z.jsx)(s,{id:`MW64zN`}),t[115]=We,t[116]=Ge):(We=t[115],Ge=t[116]);let Ke;t[117]!==U||t[118]!==Ue?(Ke=(0,Z.jsxs)(DO,{disabled:Ue,onSelect:U,"data-testid":`empty-space-menu-new-file`,children:[We,Ge]}),t[117]=U,t[118]=Ue,t[119]=Ke):Ke=t[119];let qe=!k||!D,Je,Ye;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(gc,{"aria-hidden":`true`}),Ye=(0,Z.jsx)(s,{id:`Uuj_R4`}),t[120]=Je,t[121]=Ye):(Je=t[120],Ye=t[121]);let Xe;t[122]!==G||t[123]!==qe?(Xe=(0,Z.jsxs)(DO,{disabled:qe,onSelect:G,"data-testid":`empty-space-menu-new-from-template`,children:[Je,Ye]}),t[122]=G,t[123]=qe,t[124]=Xe):Xe=t[124];let Ze=!k,Qe,$e;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(bc,{"aria-hidden":`true`}),$e=(0,Z.jsx)(s,{id:`tX5yOZ`}),t[125]=Qe,t[126]=$e):(Qe=t[125],$e=t[126]);let et;t[127]!==q||t[128]!==Ze?(et=(0,Z.jsxs)(DO,{disabled:Ze,onSelect:q,"data-testid":`empty-space-menu-new-folder`,children:[Qe,$e]}),t[127]=q,t[128]=Ze,t[129]=et):et=t[129];let tt;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(jO,{}),t[130]=tt):tt=t[130];let nt;t[131]!==r||t[132]!==ee||t[133]!==k?(nt=O?(0,Z.jsxs)(DO,{disabled:!k,onSelect:ee,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(k?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(Ce,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),k?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[131]=r,t[132]=ee,t[133]=k,t[134]=nt):nt=t[134];let rt;t[135]!==j||t[136]!==N||t[137]!==A?(rt=(0,Z.jsx)(eH,{input:N,installStates:A,dispatch:j,webFallbackVisible:!1}),t[135]=j,t[136]=N,t[137]=A,t[138]=rt):rt=t[138];let it;t[139]!==r||t[140]!==ne||t[141]!==k?(it=O?(0,Z.jsxs)(DO,{disabled:!k,onSelect:ne,"data-testid":`empty-space-menu-open-in-terminal`,"aria-label":r(k?{id:`BJpGCq`}:{id:`_6IEmc`}),children:[(0,Z.jsx)(al,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`BJpGCq`})}),k?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[139]=r,t[140]=ne,t[141]=k,t[142]=it):it=t[142];let at=!k,ot;t[143]!==r||t[144]!==k?(ot=r(k?{id:`Up2_7p`}:{id:`U8CD-l`}),t[143]=r,t[144]=k,t[145]=ot):ot=t[145];let st;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(At,{"aria-hidden":`true`}),t[146]=st):st=t[146];let ct;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[147]=ct):ct=t[147];let lt;t[148]===k?lt=t[149]:(lt=k?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[148]=k,t[149]=lt);let ut;t[150]!==ie||t[151]!==at||t[152]!==ot||t[153]!==lt?(ut=(0,Z.jsxs)(DO,{disabled:at,onSelect:ie,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":ot,children:[st,ct,lt]}),t[150]=ie,t[151]=at,t[152]=ot,t[153]=lt,t[154]=ut):ut=t[154];let dt;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,Z.jsx)(jO,{}),t[155]=dt):dt=t[155];let pt=P===null,mt;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(s,{id:`K_wz1u`}),t[156]=mt):mt=t[156];let ht;t[157]!==oe||t[158]!==I||t[159]!==pt?(ht=(0,Z.jsx)(AO,{checked:I,onCheckedChange:oe,disabled:pt,"data-testid":`empty-space-menu-show-hidden-files`,children:mt}),t[157]=oe,t[158]=I,t[159]=pt,t[160]=ht):ht=t[160];let gt=P===null,_t;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(s,{id:`i8dKs-`}),t[161]=_t):_t=t[161];let vt;t[162]!==ce||t[163]!==L||t[164]!==gt?(vt=(0,Z.jsx)(AO,{checked:L,onCheckedChange:ce,disabled:gt,"data-testid":`empty-space-menu-show-all-files`,children:_t}),t[162]=ce,t[163]=L,t[164]=gt,t[165]=vt):vt=t[165];let yt;t[166]===B?yt=t[167]:(yt=B?(0,Z.jsx)(jO,{}):null,t[166]=B,t[167]=yt);let bt;t[168]!==ue||t[169]!==R?(bt=R?(0,Z.jsxs)(DO,{onSelect:ue,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(cl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[168]=ue,t[169]=R,t[170]=bt):bt=t[170];let xt;t[171]!==fe||t[172]!==z?(xt=z?(0,Z.jsxs)(DO,{onSelect:fe,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(vc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[171]=fe,t[172]=z,t[173]=xt):xt=t[173];let St;t[174]!==Ke||t[175]!==Xe||t[176]!==et||t[177]!==nt||t[178]!==rt||t[179]!==it||t[180]!==ut||t[181]!==ht||t[182]!==vt||t[183]!==yt||t[184]!==bt||t[185]!==xt?(St=(0,Z.jsxs)(EO,{children:[Ke,Xe,et,tt,nt,rt,it,ut,dt,ht,vt,yt,bt,xt]}),t[174]=Ke,t[175]=Xe,t[176]=et,t[177]=nt,t[178]=rt,t[179]=it,t[180]=ut,t[181]=ht,t[182]=vt,t[183]=yt,t[184]=bt,t[185]=xt,t[186]=St):St=t[186];let Ct;return t[187]!==He||t[188]!==St?(Ct=(0,Z.jsx)(lD,{variant:`inset`,children:(0,Z.jsxs)(CO,{children:[He,St]})}),t[187]=He,t[188]=St,t[189]=Ct):Ct=t[189],Ct}function yH(){return null}function bH(e){hH(e.target)&&(e.preventDefault(),e.stopPropagation())}function xH(){let e=(0,$.c)(17),t=yn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=ft(),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 pt,i=new ct({url:n,name:cr,document:e,onStateless:e=>{let{payload:t}=e;N(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:DH,onConfigValidationRejected:EH,onConfigIgnoreNestedError:TH,onUnknown:wH})},onClose:CH,onDisconnect:SH}),a=hi(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=V(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Er([`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 SH(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function CH(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function wH(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function TH(e){lo(e)}function EH(e){po(e)}function DH(e){Er([e.ch])}var OH=`#install-claude-desktop`;function kH(e){return e===`#settings`||e===OH}function AH(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function jH(){let e=(0,$.c)(20),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=ft(),{openTargetTransition:i}=wt(),{assetPaths:a,folderPaths:o,loading:s,pages:c}=si(),l=(0,Q.useRef)(null),u;e[0]!==a||e[1]!==o||e[2]!==c?(u=AH(c,o,a),e[0]=a,e[1]=o,e[2]=c,e[3]=u):u=e[3];let d=u,f,p;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==n||e[9]!==r||e[10]!==d?(f=()=>{s||!r||l.current===d||(l.current=d,n({pages:c,folderPaths:o,assetPaths:a}))},p=[a,o,s,c,n,r,d],e[4]=a,e[5]=o,e[6]=s,e[7]=c,e[8]=n,e[9]=r,e[10]=d,e[11]=f,e[12]=p):(f=e[11],p=e[12]),(0,Q.useEffect)(f,p);let m,h;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c?(m=()=>{e();function e(){if(kH(window.location.hash))return;let e=ni(window.location.hash);if(e){let t=Lr(e.split(`.`).pop()??``);Wt(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=zr(window.location.hash);if(!n){Wt(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){Wt(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=Qr(n,{pages:c,folderPaths:o});if(r.kind===`missing`&&/\/+$/.test(n.trim())){Wt(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=Fr(r);Wt(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},h=[t,o,s,i,c],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=m,e[19]=h):(m=e[18],h=e[19]),(0,Q.useEffect)(m,h),null}function MH(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(typeof window<`u`&&window.location.hash===OH),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===OH&&n(!0)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e){if(n(e),!e&&window.location.hash===OH){let{pathname:e,search:t}=window.location;window.history.replaceState(null,``,`${e}${t}`)}},e[2]=a):a=e[2];let o=a,s;return e[3]===t?s=e[4]:(s=(0,Z.jsx)(La,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function NH(){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)(PH,t),null}function PH(){let e=function(e){let t=e.target;_m({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=gm))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function FH(){let e=(0,$.c)(4),{activeTarget:t}=ft(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath: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 IH(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=ft(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:kn(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;Lp({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)(zp,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function LH(){let e=(0,$.c)(21),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=t?El({bridge:t,authQueryTransport:Eo(),cloneTransport:Dl(),openSignIn:()=>new Promise(e=>{c(()=>e),o(!0)})}):null,e[0]=l):l=e[0];let u=l,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ph,{}),e[1]=d):d=e[1];let f,p,m,h,g,_,v,y;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(xH,{}),p=(0,Z.jsx)(jH,{}),m=(0,Z.jsx)(FH,{}),h=(0,Z.jsx)(IH,{}),g=(0,Z.jsx)(NH,{}),_=(0,Z.jsx)(MH,{}),v=(0,Z.jsx)(od,{}),y=t&&u?(0,Z.jsx)(yd,{bridge:t,cloneController:u}):null,e[2]=f,e[3]=p,e[4]=m,e[5]=h,e[6]=g,e[7]=_,e[8]=v,e[9]=y):(f=e[2],p=e[3],m=e[4],h=e[5],g=e[6],_=e[7],v=e[8],y=e[9]);let b;e[10]!==a||e[11]!==s?(b=t?(0,Z.jsx)(vo,{open:a,onOpenChange:e=>{e||(o(!1),s?.(null),c(null))},onSuccess:e=>{s?.({authenticated:!0,host:`github.com`,login:e.login}),c(null)}}):null,e[10]=a,e[11]=s,e[12]=b):b=e[12];let x;e[13]===r?x=e[14]:(x=(0,Z.jsx)(Dh,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=x);let S;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=S):S=e[15];let C;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(gH,{onOpenSearch:()=>i(!0)}),e[16]=C):C=e[16];let w;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(oD,{className:`h-screen overflow-hidden`,children:[C,(0,Z.jsx)(fD,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(vk,{})})]}),e[17]=w):w=e[17];let T;return e[18]!==b||e[19]!==x?(T=(0,Z.jsx)(It,{name:`app`,children:(0,Z.jsx)(kt,{children:(0,Z.jsxs)(Se,{children:[d,(0,Z.jsxs)(qr,{children:[f,p,m,h,g,_,v,y,b,x,S,w]})]})})}),e[18]=b,e[19]=x,e[20]=T):T=e[20],T}Ns(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&Hd({apiOrigin:window.okDesktop.config.apiOrigin}),uf()&&gf(),Wf(),typeof window<`u`&&qd({bridge:window.okDesktop}),typeof window<`u`&&as({bridge:window.okDesktop}),typeof window<`u`&&ts({bridge:window.okDesktop}),typeof window<`u`&&Xd({bridge:window.okDesktop}),typeof window<`u`&&vd({bridge:window.okDesktop});var RH=new Hs({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),zH=document.getElementById(`root`);if(!zH)throw Error(`Root element not found`);var BH=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Qs.createRoot)(zH).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:Y,children:(0,Z.jsx)(dn,{client:RH,children:(0,Z.jsxs)(zn,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Hr,{children:BH&&window.okDesktop?(0,Z.jsx)(Ld,{bridge:window.okDesktop}):(0,Z.jsx)(LH,{})}),(0,Z.jsx)(Vd,{richColors:!0,closeButton:!0})]})})})}));
|
|
1914
|
+
</svg>`,dV=`${Hz}\n${tB}`;function fV(e){return{...ej({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 pV(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&aV.has(t)}function mV(e){return e===`darwin`?Y._({id:`LtSYdi`}):e===`win32`?Y._({id:`qi1F96`}):Y._({id:`hz7n6T`})}function hV(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=mV(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=Gm(r.contentDir,nO(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)(Ce,{"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)(la,{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 gV(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=la,u=n===null,t[8]!==n||t[9]!==r?(d=()=>{n!==null&&(r(),DB(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)(al,{"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 _V(e){return tO({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e})}function vV(e,t){return e!==t&&e.startsWith(t)}function yV(e,t){let n=[...new Set(e)].filter(e=>!t(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>vV(e,t))).map(_V)}function bV(e,t){return e===t||e.startsWith(`${t}/`)}function xV(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 SV(e,t,n){let r=new Set,i=new Set;for(let a of e){if(a.kind===`file`){r.add(a.path);continue}i.add(a.path);for(let e of t)Rn(e)&&e.docName.startsWith(`${a.path}/`)&&r.add(e.docName);for(let e of n){let t=qD(e);bV(t,a.path)&&i.add(t)}}return{docNames:r,folderPaths:i}}function CV(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:bV(t.createdPath,e.path)}function wV(e){let t=(0,$.c)(83),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:d,projectLocalBinding:f,mergedConfig:p,onStartCreating:m,onStartCreatingFromTemplate:h,onDuplicate:g,onDelete:_,onExpandSubtree:v,onCollapseSubtree:y,folderTreePaths:b,isAsset:x,isAssetTreePath:S}=e,{_:C}=i(),w,E,D,O,k,A,j,M,N;if(t[0]!==C||t[1]!==x||t[2]!==S||t[3]!==n||t[4]!==p?.appearance?.sidebar?.showAllFiles||t[5]!==p?.appearance?.sidebar?.showHiddenFiles||t[6]!==l||t[7]!==d||t[8]!==f){N=tO(n),k=n.kind===`directory`,w=!x&&d!==null;let e;t[18]!==C||t[19]!==k?(e=C(k?{id:`5D3Ior`}:{id:`dbhUX1`}),t[18]=C,t[19]=k,t[20]=e):e=t[20],O=e,j=p?.appearance?.sidebar?.showHiddenFiles??!1,A=p?.appearance?.sidebar?.showAllFiles??!1,E=f!==null;let r=l.getSelectedPaths(),i=r.includes(N.treePath)?yV(r,S):[];D=i.length>1?i:[N];let a=D.length;M=Y._({id:`44_vJP`,values:{deleteCount:a}}),t[0]=C,t[1]=x,t[2]=S,t[3]=n,t[4]=p?.appearance?.sidebar?.showAllFiles,t[5]=p?.appearance?.sidebar?.showHiddenFiles,t[6]=l,t[7]=d,t[8]=f,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 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]!==k||t[22]!==n||t[23]!==o?(F=k&&o?Gm(o.contentDir,nO(n),o.pathSeparator):null,t[21]=k,t[22]=n,t[23]=o,t[24]=F):F=t[24];let I=F,L;if(t[25]!==k||t[26]!==n||t[27]!==o){bb0:{if(!o||k){L=null;break bb0}let e=nO(n),t=e.lastIndexOf(`/`);if(t===-1){L=o.contentDir;break bb0}L=Gm(o.contentDir,e.slice(0,t),o.pathSeparator)}t[25]=k,t[26]=n,t[27]=o,t[28]=L}else L=t[28];let R=L,z;t[29]!==x||t[30]!==k||t[31]!==n||t[32]!==o?(z=x?null:k?Ym({folderRelativePath:nO(n),workspace:o}):qm({docName:WD(n.path),workspace:o}),t[29]=x,t[30]=k,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]!==C||t[39]!==f?(G=e=>{if(f===null)return;let t=f.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,Wn(t.error)),qo.error(C({id:`P47EWZ`}),{description:Wn(t.error)}))},t[38]=C,t[39]=f,t[40]=G):G=t[40];let K=G,J;t[41]!==C||t[42]!==f?(J=e=>{if(f===null)return;let t=f.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,Wn(t.error)),qo.error(C({id:`P47EWZ`}),{description:Wn(t.error)}))},t[41]=C,t[42]=f,t[43]=J):J=t[43];let ee=J,te=0,ne=0;if(k){let e=JD(n.path);for(let t of b)(t===e||t.startsWith(e))&&(te++,wB(l.getItem(t))?.isExpanded()&&ne++)}let re=k&&ne<te,ie=k&&ne>0,ae;t[44]===W?ae=t[45]:(ae=e=>{e||W()},t[44]=W,t[45]=ae);let oe;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[46]=oe):oe=t[46];let se;t[47]!==C||t[48]!==a||t[49]!==w||t[50]!==E||t[51]!==W||t[52]!==H||t[53]!==P||t[54]!==D||t[55]!==I||t[56]!==ee||t[57]!==K||t[58]!==c||t[59]!==B||t[60]!==O||t[61]!==x||t[62]!==k||t[63]!==n||t[64]!==l||t[65]!==d||t[66]!==y||t[67]!==_||t[68]!==g||t[69]!==v||t[70]!==m||t[71]!==h||t[72]!==R||t[73]!==A||t[74]!==j||t[75]!==ie||t[76]!==re||t[77]!==N||t[78]!==o?(se=(0,Z.jsx)(ra,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:k?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(la,{disabled:a,onSelect:()=>{H(),m(`file`,qD(n.path))},children:[(0,Z.jsx)(el,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`MW64zN`})]}),(0,Z.jsxs)(la,{disabled:a,onSelect:()=>{H(),h(qD(n.path))},children:[(0,Z.jsx)(gc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsxs)(la,{disabled:a,onSelect:()=>{H(),m(`folder`,qD(n.path))},children:[(0,Z.jsx)(bc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`tX5yOZ`})]}),(0,Z.jsx)(ca,{}),(0,Z.jsx)(hV,{item:n,workspace:o,onClose:W}),(0,Z.jsx)(BB,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!1}),(0,Z.jsx)(gV,{dirAbsPath:I,onClose:W}),(0,Z.jsxs)(Na,{children:[(0,Z.jsxs)(Pa,{children:[(0,Z.jsx)(At,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(la,{disabled:!o,onSelect:()=>{o&&(W(),iV(Gm(o.contentDir,nO(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(la,{onSelect:()=>{W(),iV(nO(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),(0,Z.jsx)(ca,{}),(0,Z.jsx)(Aa,{checked:j,onCheckedChange:K,disabled:!E,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`K_wz1u`})}),(0,Z.jsx)(Aa,{checked:A,onCheckedChange:ee,disabled:!E,"data-testid":`file-tree-menu-show-all-files`,children:(0,Z.jsx)(s,{id:`i8dKs-`})}),re||ie?(0,Z.jsx)(ca,{}):null,re?(0,Z.jsxs)(la,{onSelect:()=>{W(),v(n.path)},children:[(0,Z.jsx)(cl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}):null,ie?(0,Z.jsxs)(la,{onSelect:()=>{W(),y(n.path)},children:[(0,Z.jsx)(vc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]}):null,(0,Z.jsx)(ca,{}),(0,Z.jsxs)(la,{disabled:a,onSelect:()=>{W(),g(N)},children:[(0,Z.jsx)(mt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(la,{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)(la,{"data-testid":`file-tree-menu-hide`,disabled:!w,onSelect:()=>{if(!d)return;W();let e=Jz(N),t=ho(d.current()),n=io(t,e);if(n===t)return;d.patch(oo(n));let r=N.path.split(`/`).pop()||N.path;qo.success(C({id:`4xtLTl`,values:{basename:r}}),{description:C({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),O]}),(0,Z.jsxs)(la,{variant:`destructive`,disabled:a,onSelect:()=>{W(),_(D)},children:[(0,Z.jsx)(q,{"aria-hidden":`true`}),P]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(hV,{item:n,workspace:o,onClose:W}),!x&&(0,Z.jsx)(BB,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch,webFallbackVisible:!0}),(0,Z.jsx)(gV,{dirAbsPath:R,onClose:W}),(0,Z.jsxs)(Na,{children:[(0,Z.jsxs)(Pa,{children:[(0,Z.jsx)(At,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`zd00pH`})]}),(0,Z.jsxs)(Ma,{children:[(0,Z.jsx)(la,{disabled:!o,onSelect:()=>{o&&(W(),iV(Gm(o.contentDir,nO(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`z2funE`})}),(0,Z.jsx)(la,{onSelect:()=>{W(),iV(nO(n),`relative`)},children:(0,Z.jsx)(s,{id:`xloBjn`})})]})]}),x?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ca,{}),(0,Z.jsxs)(la,{disabled:a,onSelect:()=>{W(),g(N)},children:[(0,Z.jsx)(mt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(la,{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)(la,{"data-testid":`file-tree-menu-hide`,disabled:!w,onSelect:()=>{if(!d)return;W();let e=Jz(N),t=ho(d.current()),n=io(t,e);if(n===t)return;d.patch(oo(n));let r=N.path.split(`/`).pop()||N.path;qo.success(C({id:`OD0FCX`,values:{basename:r}}),{description:C({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(u,{"aria-hidden":`true`}),O]}),(0,Z.jsxs)(la,{variant:`destructive`,disabled:a,onSelect:()=>{W(),_(D)},children:[(0,Z.jsx)(q,{"aria-hidden":`true`}),P]})]})]})}),t[47]=C,t[48]=a,t[49]=w,t[50]=E,t[51]=W,t[52]=H,t[53]=P,t[54]=D,t[55]=I,t[56]=ee,t[57]=K,t[58]=c,t[59]=B,t[60]=O,t[61]=x,t[62]=k,t[63]=n,t[64]=l,t[65]=d,t[66]=y,t[67]=_,t[68]=g,t[69]=v,t[70]=m,t[71]=h,t[72]=R,t[73]=A,t[74]=j,t[75]=ie,t[76]=re,t[77]=N,t[78]=o,t[79]=se):se=t[79];let ce;return t[80]!==se||t[81]!==ae?(ce=(0,Z.jsxs)(Da,{open:!0,modal:!1,onOpenChange:ae,children:[oe,se]}),t[80]=se,t[81]=ae,t[82]=ce):ce=t[82],ce}function TV(e){let t=(0,$.c)(265),{ref:n}=e,{_:r}=i(),{activeDocName:a,activeTarget:o,closeTabs:c,closeDocument:l,closeAndClearForRename:u,getPoolActiveDocName:d,isNewTabActive:f,openTarget:p,prewarm:m,remapTabsForRename:h}=ft(),{notifySidebarFileSelected:_}=aD(),{resolvedTheme:v}=Pn(),{addPage:y}=si(),b;t[0]!==_||t[1]!==p?(b=function(e){p({kind:`doc`,target:e,docName:e},{tabBehavior:`replace-active`}),tV(ii(e)),_()},t[0]=_,t[1]=p,t[2]=b):b=t[2];let x=b,S;t[3]!==_||t[4]!==p?(S=function(e){let t=jr(e);p({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),tV(t),_()},t[3]=_,t[4]=p,t[5]=S):S=t[5];let C=S,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[6]=w):w=t[6];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(!0),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),{conflicts:L}=VC(),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(null),H=(0,Q.useRef)(T),U;t[7]!==T||t[8]!==C||t[9]!==x||t[10]!==_||t[11]!==p?(U=function(e,t){let n=fB(e,t===void 0?T:t);if(n.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,YD(e));return}if(n.kind===`asset`){p({kind:`asset`,target:n.path,assetPath:n.path,mediaKind:n.mediaKind},{tabBehavior:`replace-active`}),tV(n.hash),_();return}if(n.kind===`folder`){C(n.path);return}x(n.path)},t[7]=T,t[8]=C,t[9]=x,t[10]=_,t[11]=p,t[12]=U):U=t[12];let W=U,G=(0,Q.useRef)(a),K;t[13]===T?K=t[14]:(K=new Set(T.filter(pr).map(KV)),t[13]=T,t[14]=K);let q=K,J=(0,Q.useRef)(q),ee;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(ee=[],t[15]=ee):ee=t[15];let te=(0,Q.useRef)(ee),ne=(0,Q.useRef)(null),re=(0,Q.useRef)(GV),ie=(0,Q.useRef)(null),ae=(0,Q.useRef)(null),oe=(0,Q.useRef)(!1),se=(0,Q.useRef)(null),ce;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ce=new Map,t[16]=ce):ce=t[16];let le=(0,Q.useRef)(ce),ue=(0,Q.useRef)(!1),de=(0,Q.useRef)(!1),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(WV),he=(0,Q.useRef)(UV),ge=(0,Q.useRef)(HV),_e=(0,Q.useRef)(VV),ve=(0,Q.useRef)(o),{selectedFilePath:ye,selectedFolderPath:be,navigationPath:xe}=dB(o,f?null:a),Se=ye?UD(ye,T.find(e=>Rn(e)&&e.docName===ye)?.docExt):be?JD(be):o?.kind===`asset`?o.assetPath:null,Ce=_h().states,{dispatch:we}=oh(),Te;t[17]!==we||t[18]!==Ce?(Te={installStates:Ce,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:we},t[17]=we,t[18]=Ce,t[19]=Te):Te=t[19];let Ee=Te,{okignoreBinding:De,projectLocalBinding:ke,merged:Ae}=Oe(),je=Ae?.appearance?.sidebar?.showHiddenFiles??!1,Ne=Ae?.appearance?.sidebar?.showAllFiles??!1,Pe;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=()=>se.current===null,t[20]=Pe):Pe=t[20];let Fe=Pe,Ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=[],t[21]=Ie):Ie=t[21];let Le;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Le={set:`complete`,spriteSheet:uV},t[22]=Le):Le=t[22];let Re;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Re={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[23]=Re):Re=t[23];let ze;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ze={canDrag:Fe,canDrop:Fe,onDropComplete:e=>_e.current(e),onDropError:BV},t[24]=ze):ze=t[24];let Be,Ve;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Be={canRename:Fe,onRename:e=>he.current(e),onError:e=>ge.current(e)},Ve=e=>me.current(e),t[25]=Be,t[26]=Ve):(Be=t[25],Ve=t[26]);let He;t[27]===r?He=t[28]:(He={paths:Ie,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:Le,unsafeCSS:dV,composition:Re,dragAndDrop:ze,renaming:Be,onSelectionChange:Ve,renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=H.current.find(e=>Rn(e)&&UD(e.docName,e.docExt)===t.path);if(n?.isSymlink){let e=n.targetPath;return{icon:oV,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return pV(t.path)?{icon:sV,title:r({id:`i9toLO`})}:null}},t[27]=r,t[28]=He);let{model:Ue}=Lz(He),We;t[29]===Ue?We=t[30]:(We=function(e){let t=Ue.getItem(e)??Ue.getItem(JD(e));return t?.isDirectory()?JD(qD(t.getPath())):e},t[29]=Ue,t[30]=We);let Ge=We,qe,Je;t[31]===T?(qe=t[32],Je=t[33]):(Je=XD(T),qe=ZD(Je),t[31]=T,t[32]=qe,t[33]=Je);let Ye=qe,Xe=(0,Q.useRef)(Je),Ze;t[34]===T?Ze=t[35]:(Ze=$D(T),t[34]=T,t[35]=Ze);let Qe=Ze,$e=(0,Q.useRef)(Qe),et=be?eO(JD(be)).slice(0,-1):eO(Se??xe),tt=et.join(`\0`),nt;if(t[36]!==Ue){let e=()=>{let e=new Set;for(let t of $e.current)wB(Ue.getItem(t))?.isExpanded()&&e.add(t);return e};nt=t=>{let n=new Set($D(t??H.current)),r=e();for(let e of te.current)r.add(e);return[...r].filter(e=>n.has(e))},t[36]=Ue,t[37]=nt}else nt=t[37];let rt=nt,it;t[38]!==rt||t[39]!==Ue?(it=e=>{let t=XD(e??H.current);Ue.resetPaths(t,{initialExpandedPaths:rt(e)})},t[38]=rt,t[39]=Ue,t[40]=it):it=t[40];let at=it,ot;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ot=e=>{ie.current=QD(e)},t[41]=ot):ot=t[41];let st=ot,ct;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>J.current.has(e),t[42]=ct):ct=t[42];let lt=ct,ut;t[43]!==r||t[44]!==y||t[45]!==C||t[46]!==x||t[47]!==at?(ut=async function(e){if(se.current!==null)return;let t=()=>{M(null),se.current=null};se.current=e.path,M(e.path),A(null);try{let n=await Kt(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){qo.error(n.title),at(),t();return}let i=g(mi,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});qo.error(e),A(e),Er([`files`,`backlinks`,`graph`]),at(),t();return}for(let e of i.duplicatedDocNames)y(e);E(t=>{let n=mO(t,e,i);return at(n),st(n),n}),Er([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?C(i.path):x(i.path)),qo.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),qo.error(r({id:`EBVbtP`}),{description:i}),at(),t()}},t[43]=r,t[44]=y,t[45]=C,t[46]=x,t[47]=at,t[48]=ut):ut=t[48];let pt=ut,mt=(0,Q.useRef)(pt),ht;t[49]===pt?ht=t[50]:(ht=()=>{mt.current=pt},t[49]=pt,t[50]=ht),(0,Q.useEffect)(ht);let gt=function(e){let t=nV(e);if(!t||rV(t))return!1;let n=Ue.getFocusedPath()??Ue.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||lt(n))return!1;let r=rV(n);if(!r)return!1;let i=JD(t);if(!$e.current.includes(i))return!1;let a=`${t}${r}`;return Xe.current.includes(a)?!1:(Ut({sourcePath:n,destinationPath:a,isFolder:!1}),Ue.move(n,a),!0)},_t;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(_t=e=>{let t=e??ne.current;!t||ne.current!==t||(t.disposeCommitListener(),ne.current=null)},t[51]=_t):_t=t[51];let vt=_t,yt;t[52]!==r||t[53]!==vt||t[54]!==l||t[55]!==c||t[56]!==at?(yt=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;vt(e),i&&M(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 Kt(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?qo.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(M(null),at());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;qo.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(M(null),at());return}i&&(e.kind===`file`?l(e.createdPath):c([Ke(e.createdPath)],{force:!0})),i&&E(t=>{let n=pO(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return st(n),n}),Er([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&M(null)},t[52]=r,t[53]=vt,t[54]=l,t[55]=c,t[56]=at,t[57]=yt):yt=t[57];let bt=yt,xt,St;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(xt=()=>()=>{let e=ne.current;e&&re.current(e,{restoreLocation:!1,updateUi:!1}).catch(zV)},St=[],t[58]=xt,t[59]=St):(xt=t[58],St=t[59]),(0,Q.useEffect)(xt,St);let Ct,wt;t[60]===r?(Ct=t[61],wt=t[62]):(Ct=()=>{let e=!0,t=LB(async function(){try{let t=de.current,n=await Kt(await fetch(t?`/api/documents?showAll=true`:`/api/documents`),r({id:`8RtNI0`}));if(!e)return;if(!n.ok)A(n.title);else{let e=Mn.safeParse(n.body);if(!e.success)A(r({id:`HlmZBk`}));else{let n=ue.current||t;E(RB(ui(e.data.documents,n),H.current,le.current)),A(null)}}}catch(t){let n=t;e&&A(r({id:`34qyH5`})),console.warn(`[FileTree] fetch failed:`,n)}e&&O(!1)});fe.current=()=>t.request(),t.request();let n=()=>{document.visibilityState===`visible`&&t.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let i=hi(e=>{e.includes(`files`)&&t.request()});return()=>{e=!1,fe.current=null,t.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),i()}},wt=[r],t[60]=r,t[61]=Ct,t[62]=wt),(0,Q.useEffect)(Ct,wt);let Tt=(0,Q.useRef)(!0),Et;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Et=()=>{if(Tt.current){Tt.current=!1;return}fe.current?.()},t[63]=Et):Et=t[63];let Dt;t[64]===je?Dt=t[65]:(Dt=[je],t[64]=je,t[65]=Dt),(0,Q.useEffect)(Et,Dt);let Ot=(0,Q.useRef)(!0),kt;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(kt=()=>{if(Ot.current){Ot.current=!1;return}fe.current?.()},t[66]=kt):kt=t[66];let At;t[67]===Ne?At=t[68]:(At=[Ne],t[67]=Ne,t[68]=At),(0,Q.useEffect)(kt,At);let jt,Mt;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=g(Nr,n,`workspace`,null);r&&V({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(RV),()=>{e=!1}},Mt=[],t[69]=jt,t[70]=Mt):(jt=t[69],Mt=t[70]),(0,Q.useEffect)(jt,Mt);let Nt;t[71]!==rt||t[72]!==Ue||t[73]!==Ye?(Nt=()=>{if(ie.current===Ye){ie.current=null;return}Ue.resetPaths(Xe.current,{initialExpandedPaths:rt()})},t[71]=rt,t[72]=Ue,t[73]=Ye,t[74]=Nt):Nt=t[74];let Pt;t[75]!==Ue||t[76]!==Ye?(Pt=[Ue,Ye],t[75]=Ue,t[76]=Ye,t[77]=Pt):Pt=t[77],(0,Q.useEffect)(Nt,Pt),EB(Ue,Se,tt,oe);let Ft;t[78]!==Se||t[79]!==D||t[80]!==Ue?(Ft=()=>{D||!Se||lB(pe.current,Ue)},t[78]=Se,t[79]=D,t[80]=Ue,t[81]=Ft):Ft=t[81];let It;t[82]!==tt||t[83]!==Se||t[84]!==D||t[85]!==Ue||t[86]!==Ye?(It=[Se,tt,Ye,D,Ue],t[82]=tt,t[83]=Se,t[84]=D,t[85]=Ue,t[86]=Ye,t[87]=It):It=t[87],(0,Q.useEffect)(Ft,It);let Lt,Rt;t[88]===Ue?(Lt=t[89],Rt=t[90]):(Lt=()=>Ue.subscribe(()=>{if(!Ue.isSearchOpen())for(let e of te.current){let t=wB(Ue.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Rt=[Ue],t[88]=Ue,t[89]=Lt,t[90]=Rt),(0,Q.useEffect)(Lt,Rt);let zt,Bt;t[91]===Ue?(zt=t[92],Bt=t[93]):(zt=()=>Ue.onMutation(`remove`,e=>{let t=ne.current;!t||e.path!==t.renamePath||re.current(t)}),Bt=[Ue],t[91]=Ue,t[92]=zt,t[93]=Bt),(0,Q.useEffect)(zt,Bt);let Vt;t[94]!==y||t[95]!==u||t[96]!==d||t[97]!==C||t[98]!==h?(Vt=async(e,t,n)=>{let r=t===void 0?[]:t,i=n?.docName??G.current,a=hO(i,e),o=n?.folderPath??(ve.current?.kind===`folder`?ve.current.folderPath:null),s=o?dt(o,r):null;Me(e);let c=gO(e,d());await Promise.all(c.map(e=>u(e)));for(let t of e)y(t.toDocName);h(e,r),E(t=>{let n=fO(t,e,r);return st(n),n}),o&&s&&s!==o?C(s):a&&a!==i&&(window.location.hash=ii(a)),Er([`files`,`backlinks`,`graph`])},t[94]=y,t[95]=u,t[96]=d,t[97]=C,t[98]=h,t[99]=Vt):Vt=t[99];let Ht=Vt;async function Ut(e){let t=rO(e.sourcePath,e.isFolder);M(t),A(null);try{if(!e.isFolder&<(t)){qo.error(r({id:`yXiaxB`})),queueMicrotask(()=>{at()}),vt(),M(null);return}let n=Bz(e.sourcePath,e.destinationPath,e.isFolder);if(n.kind===`block`){qo.error(r({id:`FaBZwp`})),queueMicrotask(()=>{at()}),vt(),M(null);return}let i=rO(n.destinationPath,e.isFolder),a=e.isFolder?{kind:`folder`,fromPath:qD(t),toPath:qD(i)}:{kind:`file`,fromPath:WD(t),toPath:WD(i)},o={docName:G.current,folderPath:ve.current?.kind===`folder`?ve.current.folderPath:null},s=await Kt(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),r({id:`gijbne`}));if(!s.ok){qo.error(s.title),at();let e=ne.current;e&&e.renamePath===t?await bt(e):vt(),M(null);return}let c=g(Cr,s.body,`rename-path`,{renamed:[]});try{await Ht(c.renamed,e.isFolder?[{fromPath:qD(t),toPath:qD(i)}]:[],o)}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:t,destinationTreePath:i,renamedCount:c.renamed.length}),qo.error(r({id:`dDpCOp`}))}vt(),M(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let n=r({id:`HIb0vl`});qo.error(n),A(n),at();let i=ne.current;i&&i.renamePath===t?await bt(i):vt(),M(null)}}let Wt;t[100]!==r||t[101]!==Ht||t[102]!==at?(Wt=async function(e){let t=e.draggedPaths.map(t=>{let n=oO(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(LV);if(t.length!==0){if(t.some(e=>lt(e.sourcePath))){qo.error(r({id:`ygLG1e`})),at();return}M(t[0]?.sourcePath??null),A(null);try{let e=[],n=[],i={docName:G.current,folderPath:ve.current?.kind===`folder`?ve.current.folderPath:null};for(let i of t){let t=i.sourcePath.endsWith(`/`),a=t?{kind:`folder`,fromPath:qD(i.sourcePath),toPath:qD(i.destinationTreePath)}:{kind:`file`,fromPath:WD(i.sourcePath),toPath:WD(i.destinationTreePath)},o=await Kt(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),r({id:`dOHMA0`}));if(!o.ok){qo.error(o.title),at(),M(null);return}let s=g(Cr,o.body,`rename-path:drop`,{renamed:[]});e=e.concat(s.renamed),t&&n.push({fromPath:qD(i.sourcePath),toPath:qD(i.destinationTreePath)})}try{await Ht(e,n,i)}catch(n){console.warn(`[FileTree] post-move reconciliation failed`,{err:n,operationCount:t.length,renamedCount:e.length}),qo.error(r({id:`8OxKZy`}))}M(null)}catch(e){console.warn(`[FileTree] move failed:`,e),qo.error(r({id:`HIb0vl`})),at(),M(null)}}},t[100]=r,t[101]=Ht,t[102]=at,t[103]=Wt):Wt=t[103];let Gt=Wt,qt;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(qt=function(e){z({parentDir:e})},t[104]=qt):qt=t[104];let Jt=qt,Yt;t[105]!==r||t[106]!==bt||t[107]!==vt||t[108]!==Ue||t[109]!==C||t[110]!==x||t[111]!==at||t[112]!==Je?(Yt=async function(e,t){if(se.current)return;let n=ne.current;n&&vt(n);try{let n=iO(e,t,[...Je,...$e.current]);M(n.renamePath),se.current=n.renamePath;let i=window.location.hash,a;if(e===`file`){let e=aO(`file`,n.addPath),t=await Kt(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`fJgQHX`}));if(!t.ok){qo.error(t.title),M(null),se.current=null;return}let i=WD(e),o=g(_i,t.body,`create-page`,{docName:i}).docName;a=o;let s={kind:`document`,docName:o,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};E(e=>{if(e.some(e=>Rn(e)&&e.docName===o))return e;let t=[...e,s];return st(t),le.current.set(GD(s),Date.now()),t}),Er([`files`,`backlinks`,`graph`]),x(o)}else{let e=qD(n.addPath),t=await Kt(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){qo.error(t.title),M(null),se.current=null;return}a=g(li,t.body,`create-folder`,{path:e}).path;let i={kind:`folder`,path:a,modified:new Date().toISOString(),size:0};E(e=>{if(e.some(e=>Nn(e)&&e.path===a))return e;let t=[...e,i];return st(t),le.current.set(GD(i),Date.now()),t}),Er([`files`]),C(a)}let o=!1,s=e=>{if(e.key!==`Enter`)return;let t=ne.current;!t||t.renamePath!==n.renamePath||queueMicrotask(()=>vt(t))};document.addEventListener(`keydown`,s,!0),ne.current={kind:e,renamePath:n.renamePath,createdPath:a,previousHash:i,disposeCommitListener:()=>{o||(o=!0,document.removeEventListener(`keydown`,s,!0))}},M(null),se.current=null,Ue.add(n.addPath),Ue.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),qo.error(r({id:`S6l5dv`}));let t=ne.current;t?await bt(t):vt(),M(null),se.current=null,at()}},t[105]=r,t[106]=bt,t[107]=vt,t[108]=Ue,t[109]=C,t[110]=x,t[111]=at,t[112]=Je,t[113]=Yt):Yt=t[113];let Xt=Yt,Zt;t[114]===Ue?Zt=t[115]:(Zt=function(e){let t=JD(e);(0,Q.startTransition)(()=>{for(let e of $e.current)if(e===t||e.startsWith(t)){let t=wB(Ue.getItem(e));t&&t.expand()}})},t[114]=Ue,t[115]=Zt);let Qt=Zt,$t;t[116]===Ue?$t=t[117]:($t=function(e){let t=JD(e),n=new Set(te.current);(0,Q.startTransition)(()=>{for(let e of[...$e.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=wB(Ue.getItem(e));t&&t.collapse()}})},t[116]=Ue,t[117]=$t);let en=$t,tn;t[118]!==W||t[119]!==et||t[120]!==a||t[121]!==o||t[122]!==q||t[123]!==j||t[124]!==bt||t[125]!==T||t[126]!==Qe||t[127]!==Gt||t[128]!==Ut||t[129]!==Ge||t[130]!==gt||t[131]!==Ne||t[132]!==je||t[133]!==Je?(tn=()=>{H.current=T,G.current=a,ve.current=o,J.current=q,se.current=j,ue.current=je,de.current=Ne,Xe.current=Je,$e.current=Qe,te.current=et,re.current=bt,me.current=e=>{if(oe.current||e.length!==1)return;let t=e[0];t&&W(Ge(t),T)},ge.current=e=>{gt(e)||qo.error(e)},he.current=Ut,_e.current=Gt},t[118]=W,t[119]=et,t[120]=a,t[121]=o,t[122]=q,t[123]=j,t[124]=bt,t[125]=T,t[126]=Qe,t[127]=Gt,t[128]=Ut,t[129]=Ge,t[130]=gt,t[131]=Ne,t[132]=je,t[133]=Je,t[134]=tn):tn=t[134],(0,Q.useLayoutEffect)(tn);let nn,rn;t[135]===Ue?(nn=t[136],rn=t[137]):(nn=()=>{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||xV(e.target))return;let a=pe.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=Ue.getFocusedPath()??Ue.getSelectedPaths()[0]??null;if(!t)return;let n=Ue.getItem(t)??Ue.getItem(JD(t)),r=n?.isDirectory()?JD(qD(n.getPath())):t;if(J.current.has(r))return;mt.current(_V(r)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...$e.current,...Xe.current]);oe.current=!0;for(let e of u)!e||J.current.has(e)||Ue.getItem(e)?.select();queueMicrotask(()=>{oe.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},rn=[Ue],t[135]=Ue,t[136]=nn,t[137]=rn),(0,Q.useEffect)(nn,rn);let an,on;t[138]!==T.length||t[139]!==D?(an=()=>{if(D||T.length===0)return;let e=pe.current?.querySelector(NA)?.shadowRoot;if(!e)return;let t=IV,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()},on=[D,T.length],t[138]=T.length,t[139]=D,t[140]=an,t[141]=on):(an=t[140],on=t[141]),(0,Q.useEffect)(an,on);let sn,cn;t[142]!==T.length||t[143]!==D?(sn=()=>{if(D||T.length===0)return;let e=pe.current?.querySelector(NA)?.shadowRoot;if(!e)return;let t=()=>Uz(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()},cn=[D,T.length],t[142]=T.length,t[143]=D,t[144]=sn,t[145]=cn):(sn=t[144],cn=t[145]),(0,Q.useEffect)(sn,cn);let ln,un;t[146]!==T.length||t[147]!==D?(ln=()=>{if(D||T.length===0)return;let e=pe.current?.querySelector(NA)?.shadowRoot;if(!e)return;let t=()=>nB(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},un=[D,T.length],t[146]=T.length,t[147]=D,t[148]=ln,t[149]=un):(ln=t[148],un=t[149]),(0,Q.useEffect)(ln,un);let dn;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(dn={folderCount:0,expandedCount:0},t[150]=dn):dn=t[150];let fn=(0,Q.useRef)(dn),pn=(0,Q.useRef)(Xt),mn=(0,Q.useRef)(Jt),hn;t[151]===Xt?hn=t[152]:(hn=()=>{pn.current=Xt,mn.current=Jt},t[151]=Xt,t[152]=hn),(0,Q.useEffect)(hn);let gn,_n;t[153]===Ue?(gn=t[154],_n=t[155]):(gn=()=>({startCreating(e,t){pn.current(e,t)},startCreatingFromTemplate(e){mn.current(e)},expandAll(){(0,Q.startTransition)(()=>{for(let e of $e.current){let t=wB(Ue.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(te.current);(0,Q.startTransition)(()=>{for(let t of[...$e.current].reverse()){if(e.has(t))continue;let n=wB(Ue.getItem(t));n&&n.collapse()}})},getFolderState(){let e=$e.current,t=0;for(let n of e)wB(Ue.getItem(n))?.isExpanded()&&t++;let n=e.length,r=fn.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return fn.current=i,i},subscribe(e){return Ue.subscribe(e)}}),_n=[Ue],t[153]=Ue,t[154]=gn,t[155]=_n),(0,Q.useImperativeHandle)(n,gn,_n);let vn;t[156]!==vt||t[157]!==u||t[158]!==c||t[159]!==Ue?(vn=async function(e,t,n){let r=SV(e,H.current,$e.current),i=ne.current;i&&e.some(e=>CV(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),vt(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]);c([...[...a].map(FV),...[...o].map(PV)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?JD(t.path):UD(t.path,t.docExt);Ue.getItem(e)&&Ue.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}E(e=>{let t=pO(e,[...a]);for(let e of o)t=pO(t,[],e);return st(t),t}),Er([`files`,`backlinks`,`graph`])},t[156]=vt,t[157]=u,t[158]=c,t[159]=Ue,t[160]=vn):vn=t[160];let yn=vn,bn;t[161]!==r||t[162]!==yn?(bn=async function(e){let t=[],n=[],i=[];for(let a of e){M(a.path);let e=await Kt(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:a.kind,path:a.path})}),r({id:`7JtSLi`}));if(!e.ok)return i.length>0&&await yn(i,t,n),qo.error(e.title),!1;let o=g(fr,e.body,`delete-path`,{deletedDocNames:[]});t.push(...o.deletedDocNames),a.kind===`folder`&&n.push(a.path),i.push(a)}return await yn(i,t,n),!0},t[161]=r,t[162]=yn,t[163]=bn):bn=t[163];let xn=bn,Sn;t[164]===Symbol.for(`react.memo_cache_sentinel`)?(Sn=async function(e,t,n){let r=[],i=[];for(let a of e){M(a.path);let e=_O(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:vB(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[164]=Sn):Sn=t[164];let Cn=Sn,wn;t[165]===r?wn=t[166]:(wn=async function(e){let t=[],n=[],i=[];for(let a of e)try{let e=await Kt(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:a.kind,path:a.path})}),r({id:`DVh_Tb`}));if(!e.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:e.title}),i.push({target:a,reason:e.title});continue}let o=g(Ar,e.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...o.deletedDocNames),a.kind===`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;qo.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[165]=r,t[166]=wn);let Tn=wn,En;t[167]!==r||t[168]!==L||t[169]!==yn||t[170]!==xn||t[171]!==Tn||t[172]!==at||t[173]!==B?(En=async function(e){let t=e[0];if(!t)return;let n=L.filter(t=>e.some(e=>{if(e.kind===`file`){let n=`${e.path}${e.docExt??`.md`}`;return t.file===n}return t.file.startsWith(`${e.path}/`)}));if(n.length>0){let e=n.slice(0,3).map(NV),t=n.length>e.length?`, +${n.length-e.length} more`:``;qo.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}M(t.path),P(null);let i=typeof window<`u`?window.okDesktop:void 0;try{if(i&&B){let{trashed:t,failed:n}=await Cn(e,i,B);if(t.length>0){let e=await Tn(t);e?await yn(t,e.deletedDocNames,e.deletedFolderPaths):await yn(t,t.filter(MV).map(jV),t.filter(AV).map(kV))}n.length>0&&I({failed:n,originalTargets:[...e]}),M(null)}else{let t=await xn(e);M(null),t||at()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),qo.error(r({id:`0eHrMb`}),{description:n}),M(null),at()}},t[167]=r,t[168]=L,t[169]=yn,t[170]=xn,t[171]=Tn,t[172]=at,t[173]=B,t[174]=En):En=t[174];let Dn=En,On;t[175]!==r||t[176]!==xn||t[177]!==at||t[178]!==F?(On=async function(){if(!F)return;let e=new Set(F.failed.map(OV)),t=F.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(I(null),t.length!==0){M(t[0]?.path??null);try{let e=await xn(t);M(null),e||at()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),qo.error(r({id:`0eHrMb`}),{description:n}),M(null),at()}}},t[175]=r,t[176]=xn,t[177]=at,t[178]=F,t[179]=On):On=t[179];let kn=On,An;t[180]!==Dn||t[181]!==F?(An=async function(){if(!F)return;let e=new Set(F.failed.map(DV)),t=F.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));I(null),await Dn(t)},t[180]=Dn,t[181]=F,t[182]=An):An=t[182];let jn=An,Fn=(0,Q.useRef)(Dn),In;t[183]===Dn?In=t[184]:(In=()=>{Fn.current=Dn},t[183]=Dn,t[184]=In),(0,Q.useEffect)(In);let Ln,zn;t[185]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=()=>MB(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=H.current.find(e=>Rn(e)&&e.docName===t);Fn.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Fn.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),zn=[],t[185]=Ln,t[186]=zn):(Ln=t[185],zn=t[186]),(0,Q.useEffect)(Ln,zn);let Bn,Vn;t[187]===Symbol.for(`react.memo_cache_sentinel`)?(Bn=()=>IB(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=H.current.find(e=>Rn(e)&&e.docName===t);mt.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){mt.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}))}),Vn=[],t[187]=Bn,t[188]=Vn):(Bn=t[187],Vn=t[188]),(0,Q.useEffect)(Bn,Vn);let Hn,Un;t[189]===Ue?(Hn=t[190],Un=t[191]):(Hn=()=>PB(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=UD(t,H.current.find(e=>Rn(e)&&e.docName===t)?.docExt);Ue.startRenaming(n);return}if(e.kind===`folder`){Ue.startRenaming(e.folderPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),Un=[Ue],t[189]=Ue,t[190]=Hn,t[191]=Un),(0,Q.useEffect)(Hn,Un);let Wn;t[192]===Symbol.for(`react.memo_cache_sentinel`)?(Wn=function(){let e=ae.current;e&&$B(e),ae.current=null},t[192]=Wn):Wn=t[192];let Gn=Wn,Kn;t[193]===m?Kn=t[194]:(Kn=function(e){let t=qV(e.nativeEvent);if(!t||t.endsWith(`/`)){Gn();return}let n=WD(t),r=H.current.find(e=>GD(e)===t);if(r&&pr(r)){Gn();return}ae.current!==n&&(Gn(),ae.current=n,QB(n,e=>m(e)))},t[193]=m,t[194]=Kn);let qn=Kn,Jn;t[195]!==W||t[196]!==Ue||t[197]!==C?(Jn=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=JV(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?JD(n):n;if(Ue.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=qD(r);if(window.location.hash===jr(e))return;queueMicrotask(()=>C(e));return}let i=WD(r);window.location.hash!==ii(i)&&queueMicrotask(()=>W(r))},t[195]=W,t[196]=Ue,t[197]=C,t[198]=Jn):Jn=t[198];let Yn=Jn;if(D){let e;return t[199]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XV,{}),t[199]=e):e=t[199],e}if(T.length===0){if(k){let e;return t[200]===k?e=t[201]:(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:k})}),t[200]=k,t[201]=e),e}let e;t[202]===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[202]=e):e=t[202];let n;t[203]===Xt?n=t[204]:(n=()=>Xt(`file`,``),t[203]=Xt,t[204]=n);let r;t[205]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(s,{id:`6ibbCg`}),t[205]=r):r=t[205];let i;return t[206]===n?i=t[207]:(i=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(Di,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:n,children:r})]}),t[206]=n,t[207]=i),i}let Xn=j!==null,Zn=N?.targets[0]??null,Qn;t[208]===k?Qn=t[209]:(Qn=k&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:k}),t[208]=k,t[209]=Qn);let $n;t[210]===v?$n=t[211]:($n=fV(v),t[210]=v,t[211]=$n);let er;t[212]!==Xn||t[213]!==q||t[214]!==en||t[215]!==Qt||t[216]!==Qe||t[217]!==pt||t[218]!==Ee||t[219]!==Ae||t[220]!==Ue||t[221]!==De||t[222]!==ke||t[223]!==Xt||t[224]!==B?(er=(e,t)=>(0,Z.jsx)(wV,{item:e,context:t,anyActionBusy:Xn,workspace:B,handoff:Ee,model:Ue,okignoreBinding:De,projectLocalBinding:ke,mergedConfig:Ae,onStartCreating:Xt,onStartCreatingFromTemplate:Jt,onDuplicate:pt,onDelete:e=>P({targets:e}),onExpandSubtree:Qt,onCollapseSubtree:en,folderTreePaths:Qe,isAsset:q.has(e.path),isAssetTreePath:lt}),t[212]=Xn,t[213]=q,t[214]=en,t[215]=Qt,t[216]=Qe,t[217]=pt,t[218]=Ee,t[219]=Ae,t[220]=Ue,t[221]=De,t[222]=ke,t[223]=Xt,t[224]=B,t[225]=er):er=t[225];let tr;t[226]!==Yn||t[227]!==qn||t[228]!==Ue||t[229]!==Qn||t[230]!==$n||t[231]!==er?(tr=(0,Z.jsx)(`div`,{ref:pe,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(Iz,{header:Qn,model:Ue,style:$n,onClickCapture:Yn,onMouseMove:qn,onMouseLeave:Gn,renderContextMenu:er})}),t[226]=Yn,t[227]=qn,t[228]=Ue,t[229]=Qn,t[230]=$n,t[231]=er,t[232]=tr):tr=t[232];let nr=!!N,rr;t[233]===j?rr=t[234]:(rr=e=>{!e&&!j&&P(null)},t[233]=j,t[234]=rr);let ir;t[235]!==r||t[236]!==j||t[237]!==N||t[238]!==Dn||t[239]!==Zn?(ir=N&&Zn&&(0,Z.jsx)(za,{...(()=>{let e=hB(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,N.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(EV)}):null};let t=N.targets.length,n=Zn.name;return{itemName:t===1?`${Zn.name}${Zn.kind===`file`?Zn.docExt??`.md`:`/`}`:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):Zn.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:j!==null,onDelete:()=>Dn(N.targets)}),t[235]=r,t[236]=j,t[237]=N,t[238]=Dn,t[239]=Zn,t[240]=ir):ir=t[240];let ar;t[241]!==nr||t[242]!==rr||t[243]!==ir?(ar=(0,Z.jsx)(Go,{open:nr,onOpenChange:rr,children:ir}),t[241]=nr,t[242]=rr,t[243]=ir,t[244]=ar):ar=t[244];let or=!!F,sr;t[245]===j?sr=t[246]:(sr=e=>{!e&&!j&&I(null)},t[245]=j,t[246]=sr);let cr;t[247]!==j||t[248]!==kn||t[249]!==jn||t[250]!==F?(cr=F&&(0,Z.jsx)(SB,{failedTargets:F.failed,isSubmitting:j!==null,onDeletePermanently:kn,onRetry:jn,onCancel:()=>I(null)}),t[247]=j,t[248]=kn,t[249]=jn,t[250]=F,t[251]=cr):cr=t[251];let lr;t[252]!==or||t[253]!==sr||t[254]!==cr?(lr=(0,Z.jsx)(Go,{open:or,onOpenChange:sr,children:cr}),t[252]=or,t[253]=sr,t[254]=cr,t[255]=lr):lr=t[255];let ur=R!==null,dr;t[256]===Symbol.for(`react.memo_cache_sentinel`)?(dr=e=>{e||z(null)},t[256]=dr):dr=t[256];let Y=R?.parentDir??``,mr;t[257]!==ur||t[258]!==Y?(mr=(0,Z.jsx)(zp,{open:ur,onOpenChange:dr,kind:`file`,initialDir:Y}),t[257]=ur,t[258]=Y,t[259]=mr):mr=t[259];let hr;return t[260]!==tr||t[261]!==ar||t[262]!==lr||t[263]!==mr?(hr=(0,Z.jsxs)(Z.Fragment,{children:[tr,ar,lr,mr]}),t[260]=tr,t[261]=ar,t[262]=lr,t[263]=mr,t[264]=hr):hr=t[264],hr}function EV(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:gB(e)},`${e.kind}:${e.path}`)}function DV(e){return`${e.kind}:${e.path}`}function OV(e){return`${e.kind}:${e.path}`}function kV(e){return e.path}function AV(e){return e.kind===`folder`}function jV(e){return e.path}function MV(e){return e.kind===`file`}function NV(e){return e.file}function PV(e){return Ke(e)}function FV(e){return Pt(e)}function IV(e){return e.endsWith(`/`)?e.slice(0,-1):e}function LV(e){return!!e}function RV(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function zV(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function BV(e){qo.error(e)}function VV(){}function HV(e){return qo.error(e)}function UV(){}function WV(){}async function GV(){}function KV(e){return GD(e)}function qV(e){return JV(e)?.dataset.itemPath??null}function JV(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var YV=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function XV(){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=YV.map(ZV),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 ZV(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Ja,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Ja,{className:`h-3 ${e}`})]},t)}function QV(e){return e?Y._({id:`wTcjov`}):null}function $V(e){let t=(0,$.c)(35),{_:n}=i(),{input:r,installStates:a,dispatch:o,webFallbackVisible:c}=e,l=c===void 0?!0:c,u=r===null,d,f,p,m,h,g,_;if(t[0]!==n||t[1]!==o||t[2]!==r||t[3]!==u||t[4]!==a||t[5]!==l){_=Symbol.for(`react.early_return_sentinel`);bb0:{let e=QV(u),i;t[13]===a?i=t[14]:(i=e=>a[e.id]?.installed===!0,t[13]=a,t[14]=i);let c=hm.filter(i);p=a[`claude-code`]?.installed===!0;let v;t[15]===r?v=t[16]:(v=r!==null&&r.docContext!==null?Bn(r.docContext.relativePath):``,t[15]=r,t[16]=v);let y=v,b;t[17]!==r||t[18]!==y?(b=()=>{r!==null&&Ay(y)},t[17]=r,t[18]=y,t[19]=b):b=t[19],m=b;let x=l&&!p;if(c.length===0&&!x){_=null;break bb0}f=TO,t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(OO,{children:[(0,Z.jsx)(zi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[20]=g):g=t[20],d=kO,h=c.map(t=>{let i=!u,{displayName:a}=t,s=n(e?{id:`1ZpfyB`,values:{displayName:a,hint:e}}:{id:`WqLq6M`,values:{displayName:a}});return(0,Z.jsxs)(DO,{disabled:!i,onSelect:()=>{r&&o(t.id,r)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":s,children:[(0,Z.jsx)(wy,{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]=r,t[3]=u,t[4]=a,t[5]=l,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12];if(_!==Symbol.for(`react.early_return_sentinel`))return _;let v;t[21]!==n||t[22]!==p||t[23]!==m||t[24]!==u||t[25]!==l?(v=l&&!p?(0,Z.jsxs)(DO,{onSelect:m,disabled:u,"data-testid":`empty-space-open-in-claude-web-fallback`,"aria-label":n({id:`aA51jP`}),children:[(0,Z.jsx)(Ue,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`0S9PW_`})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`pcfY8r`})})]}):null,t[21]=n,t[22]=p,t[23]=m,t[24]=u,t[25]=l,t[26]=v):v=t[26];let y;t[27]!==d||t[28]!==h||t[29]!==v?(y=(0,Z.jsxs)(d,{children:[h,v]}),t[27]=d,t[28]=h,t[29]=v,t[30]=y):y=t[30];let b;return t[31]!==f||t[32]!==g||t[33]!==y?(b=(0,Z.jsxs)(f,{children:[g,y]}),t[31]=f,t[32]=g,t[33]=y,t[34]=b):b=t[34],b}var eH=(e,t,n)=>ml(e,t,n,`ProjectSwitcher`);function tH(e){let t=(0,$.c)(79),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h;t[1]!==r||t[2]!==n.project||t[3]!==l?(h=()=>{if(!l)return;let e=!1;return eH(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[1]=r,t[2]=n.project,t[3]=l,t[4]=h):h=t[4];let g;t[5]!==r||t[6]!==n||t[7]!==l?(g=[l,n,r],t[5]=r,t[6]=n,t[7]=l,t[8]=g):g=t[8],(0,Q.useEffect)(h,g);let _;t[9]!==r||t[10]!==n.project?(_=e=>{u(!1),eH(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[9]=r,t[10]=n.project,t[11]=_):_=t[11];let v=_,y;t[12]!==r||t[13]!==n.dialog||t[14]!==n.project?(y=()=>{u(!1),eH(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[12]=r,t[13]=n.dialog,t[14]=n.project,t[15]=y):y=t[15];let b=y,x;t[16]!==r||t[17]!==n.navigator?(x=()=>{u(!1),eH(()=>n.navigator.open(),r({id:`jol95m`}))},t[16]=r,t[17]=n.navigator,t[18]=x):x=t[18];let S=x,C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{u(!1),m(!0)},t[19]=C):C=t[19];let w=C,T=n.config.projectPath,E,D,O,k,A,j,M,N,P,F;if(t[20]!==r||t[21]!==n.config.projectName||t[22]!==T||t[23]!==l||t[24]!==v||t[25]!==o||t[26]!==d){let e;t[37]===T?e=t[38]:(e=e=>e.path!==T,t[37]=T,t[38]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;D=Da,j=l,t[39]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>{u(e),e||f(``)},t[39]=M):M=t[39];let p;t[40]===r?p=t[41]:(p=r({id:`zZ_I5K`}),t[40]=r,t[41]=p);let m;t[42]===n.config.projectName?m=t[43]:(m=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[42]=n.config.projectName,t[43]=m);let h;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(nc,{"aria-hidden":`true`,className:`opacity-60`}),t[44]=h):h=t[44],t[45]!==p||t[46]!==m?(N=(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsxs)(yD,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:p,children:[m,h]})}),t[45]=p,t[46]=m,t[47]=N):N=t[47],E=ra,P=`start`,F=`top`,O=`min-w-[260px]`,k=`project-switcher-menu`,A=i.length===0?(0,Z.jsx)(co,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(yx,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(wx,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:nH,"data-testid":`project-switcher-search`}),(0,Z.jsx)(xx,{children:(0,Z.jsx)(U,{"aria-hidden":`true`})})]}),(0,Z.jsx)(ca,{}),c.length===0?(0,Z.jsx)(co,{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)(la,{disabled:e.missing,onSelect:()=>v(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Z.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[20]=r,t[21]=n.config.projectName,t[22]=T,t[23]=l,t[24]=v,t[25]=o,t[26]=d,t[27]=E,t[28]=D,t[29]=O,t[30]=k,t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P,t[36]=F}else E=t[27],D=t[28],O=t[29],k=t[30],A=t[31],j=t[32],M=t[33],N=t[34],P=t[35],F=t[36];let I;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(ca,{}),t[48]=I):I=t[48];let L,R;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Ce,{"aria-hidden":`true`,className:`text-muted-foreground`}),R=(0,Z.jsx)(s,{id:`PVUn_c`}),t[49]=L,t[50]=R):(L=t[49],R=t[50]);let z;t[51]===b?z=t[52]:(z=(0,Z.jsxs)(la,{onSelect:b,"data-testid":`project-switcher-open-folder`,children:[L,R]}),t[51]=b,t[52]=z);let B,V;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(me,{"aria-hidden":`true`,className:`text-muted-foreground`}),V=(0,Z.jsx)(s,{id:`2Xs2jo`}),t[53]=B,t[54]=V):(B=t[53],V=t[54]);let H;t[55]===S?H=t[56]:(H=(0,Z.jsxs)(la,{onSelect:S,"data-testid":`project-switcher-switch-project`,children:[B,V]}),t[55]=S,t[56]=H);let W;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsxs)(la,{onSelect:w,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(te,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[57]=W):W=t[57];let G;t[58]!==E||t[59]!==O||t[60]!==k||t[61]!==A||t[62]!==z||t[63]!==H||t[64]!==P||t[65]!==F?(G=(0,Z.jsxs)(E,{align:P,side:F,className:O,"data-testid":k,children:[A,I,z,H,W]}),t[58]=E,t[59]=O,t[60]=k,t[61]=A,t[62]=z,t[63]=H,t[64]=P,t[65]=F,t[66]=G):G=t[66];let K;t[67]!==D||t[68]!==j||t[69]!==M||t[70]!==N||t[71]!==G?(K=(0,Z.jsxs)(D,{open:j,onOpenChange:M,children:[N,G]}),t[67]=D,t[68]=j,t[69]=M,t[70]=N,t[71]=G,t[72]=K):K=t[72];let q;t[73]!==n||t[74]!==p?(q=(0,Z.jsx)(Ju,{open:p,onOpenChange:m,bridge:n}),t[73]=n,t[74]=p,t[75]=q):q=t[75];let J;return t[76]!==K||t[77]!==q?(J=(0,Z.jsxs)(Z.Fragment,{children:[K,q]}),t[76]=K,t[77]=q,t[78]=J):J=t[78],J}function nH(e){return e.stopPropagation()}function rH(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})),oi(`sidebarSearchPill`)}function iH(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=X(`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)(U,{"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)(db,{className:`text-foreground/70`,children:Sr()?`⌘ K`:`Ctrl K`}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(Di,{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 aH(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)(Mo,{"aria-hidden":`true`,className:`size-3`}),t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==s?(l=(0,Z.jsx)(Di,{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 oH(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 sH(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Uf,Hf,Hf),n;e[0]===t?n=e[1]:(n=oH(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{Vf(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(aH,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function cH(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Gm(n.contentDir,Km(t),n.pathSeparator):e?.kind===`folder`?Gm(n.contentDir,e.folderPath,n.pathSeparator):n.contentDir}function lH(e,t,n){if((e?.kind===`doc`||e?.kind===`folder-index`)&&t){let e=t.lastIndexOf(`/`);return e<0?n.contentDir:Gm(n.contentDir,t.slice(0,e),n.pathSeparator)}return e?.kind===`folder`?Gm(n.contentDir,e.folderPath,n.pathSeparator):n.contentDir}function uH(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Km(t):e?.kind===`folder`?e.folderPath:``}function dH(e,t,n){return e===null?Jm({workspace:n}):e.kind===`folder`?n?Ym({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?qm({docName:t,workspace:n}):null}var fH={folderCount:0,expandedCount:0},pH=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function mH(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(pH)!==null}function hH(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(It,{name:`file-sidebar`,children:(0,Z.jsx)(_H,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var gH=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)($n,{asChild:!0,children:(0,Z.jsx)(Di,{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)(Tn,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Gr,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function _H(e){let t=(0,$.c)(190),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=ft(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:kn(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}=aD(),h=p===`expanded`,g=f&&p===`collapsed`,[_,v]=(0,Q.useState)(fH),y,b;t[3]===a?(y=t[4],b=t[5]):(y=()=>{if(a!==null)return v(a.getFolderState()),a.subscribe(()=>{v(a.getFolderState())})},b=[a],t[3]=a,t[4]=y,t[5]=b),(0,Q.useEffect)(y,b);let x,S;t[6]===a?(x=t[7],S=t[8]):(x=()=>{if(a!==null)return hb(()=>{a.startCreating(`file`,``)})},S=[a],t[6]=a,t[7]=x,t[8]=S),(0,Q.useEffect)(x,S);let C=_.folderCount>0,w=C&&_.expandedCount===_.folderCount,T=_.expandedCount===0,E=no(``),D=E.state.status===`ready`?(E.state.data.folder.templates_available?.length??0)>0:!0,O=typeof window<`u`?window.okDesktop:void 0,k=Ra(),A=_h().states,{dispatch:j}=oh(),M;t[9]===k?M=t[10]:(M=Jm({workspace:k}),t[9]=k,t[10]=M);let N=M,{projectLocalBinding:P,merged:F}=Oe(),I=F?.appearance?.sidebar?.showHiddenFiles??!1,L=F?.appearance?.sidebar?.showAllFiles??!1,R=C&&!w,z=C&&!T,B=R||z,V=yH,H;t[11]!==a||t[12]!==k?(H=()=>{k&&a?.startCreating(`file`,``)},t[11]=a,t[12]=k,t[13]=H):H=t[13];let U=H,W;t[14]!==a||t[15]!==k?(W=()=>{k&&a?.startCreatingFromTemplate(``)},t[14]=a,t[15]=k,t[16]=W):W=t[16];let G=W,K;t[17]!==a||t[18]!==k?(K=()=>{k&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=k,t[19]=K):K=t[19];let q=K,J;t[20]===k?J=t[21]:(J=()=>{!k||!O||O.shell.showItemInFolder(k.contentDir)},t[20]=k,t[21]=J);let ee=J,te;t[22]===k?te=t[23]:(te=()=>{!k||!O||DB(O,k.contentDir)},t[22]=k,t[23]=te);let ne=te,re;t[24]!==r||t[25]!==k?(re=async()=>{if(k)try{await navigator.clipboard.writeText(k.contentDir),qo.success(r({id:`6_ZOw4`}),{description:k.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),qo.error(r({id:`vfRlCI`}))}},t[24]=r,t[25]=k,t[26]=re):re=t[26];let ie=re,ae;t[27]!==r||t[28]!==P?(ae=e=>{if(P===null)return;let t=P.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,Wn(t.error)),qo.error(r({id:`P47EWZ`}),{description:Wn(t.error)}))},t[27]=r,t[28]=P,t[29]=ae):ae=t[29];let oe=ae,se;t[30]!==r||t[31]!==P?(se=e=>{if(P===null)return;let t=P.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,Wn(t.error)),qo.error(r({id:`P47EWZ`}),{description:Wn(t.error)}))},t[30]=r,t[31]=P,t[32]=se):se=t[32];let ce=se,le;t[33]===a?le=t[34]:(le=()=>{a?.expandAll()},t[33]=a,t[34]=le);let ue=le,de;t[35]===a?de=t[36]:(de=()=>{a?.collapseAll()},t[35]=a,t[36]=de);let fe=de,pe,me;t[37]!==L||t[38]!==z||t[39]!==R||t[40]!==I?(pe=()=>{O&&O.editor.notifyViewMenuStateChanged({showHiddenFiles:I,showAllFiles:L,canExpandAll:R,canCollapseAll:z})},me=[O,I,L,R,z],t[37]=L,t[38]=z,t[39]=R,t[40]=I,t[41]=pe,t[42]=me):(pe=t[41],me=t[42]),(0,Q.useEffect)(pe,me);let he,ge;t[43]!==r||t[44]!==c||t[45]!==l||t[46]!==j||t[47]!==A||t[48]!==d||t[49]!==P||t[50]!==L||t[51]!==I||t[52]!==a||t[53]!==k?(he=()=>{if(O)return O.onMenuAction(e=>{switch(e){case`new-doc`:if(!k||!a)return;a.startCreating(`file`,d);return;case`new-folder`:if(!k||!a)return;a.startCreating(`folder`,d);return;case`new-from-template`:if(!k||!a)return;a.startCreatingFromTemplate(d);return;case`rename`:if(!l)return;NB(l);return;case`duplicate`:if(!l)return;FB(l);return;case`move-to-trash`:if(!l)return;jB(l);return;case`reveal-in-finder`:{if(!O||!k)return;let e=cH(l,c,k);O.shell.showItemInFolder(e);return}case`open-in-terminal`:if(!O||!k)return;DB(O,lH(l,c,k));return;case`send-to-ai`:{let e=hm.filter(e=>A[e.id]?.installed===!0);if(e.length===0){qo.error(r({id:`LKOLNn`}));return}let t=dH(l,c,k);if(!t)return;let[n]=e;if(!n)return;j(n.id,t);return}case`copy-full-path`:{if(!k)return;let e=cH(l,c,k);navigator.clipboard.writeText(e).then(()=>qo.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),qo.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=uH(l,c);if(e===``){qo.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>qo.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),qo.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(P===null)return;let e=P.patch({appearance:{sidebar:{showHiddenFiles:!I}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,Wn(e.error)),qo.error(r({id:`P47EWZ`}),{description:Wn(e.error)}));return}case`toggle-show-all-files`:{if(P===null)return;let e=P.patch({appearance:{sidebar:{showAllFiles:!L}}});e.ok||(console.warn(`[FileSidebar] toggle-show-all-files rejected:`,Wn(e.error)),qo.error(r({id:`P47EWZ`}),{description:Wn(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`delete`:case`toggle-sidebar`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:return}})},ge=[O,a,k,l,c,d,P,I,L,A,j,r],t[43]=r,t[44]=c,t[45]=l,t[46]=j,t[47]=A,t[48]=d,t[49]=P,t[50]=L,t[51]=I,t[52]=a,t[53]=k,t[54]=he,t[55]=ge):(he=t[54],ge=t[55]),(0,Q.useEffect)(he,ge);let _e=g&&`opacity-0`,ve;t[56]===_e?ve=t[57]:(ve=X(`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`,_e,f&&`[-webkit-app-region:drag]`),t[56]=_e,t[57]=ve);let ye;t[58]===h?ye=t[59]:(ye=h&&!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[58]=h,t[59]=ye);let be;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(be=X(`flex items-center gap-1`,f&&`[&>*]:[-webkit-app-region:no-drag]`),t[60]=be):be=t[60];let xe;t[61]!==r||t[62]!==w||t[63]!==C||t[64]!==T||t[65]!==a?(xe=C?(0,Z.jsxs)(Da,{children:[(0,Z.jsx)(ba,{asChild:!0,children:(0,Z.jsx)(gH,{icon:Oc,label:r({id:`Lu_dOh`})})}),(0,Z.jsxs)(ra,{align:`end`,children:[w?null:(0,Z.jsxs)(la,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(cl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`b392Dr`})]}),T?null:(0,Z.jsxs)(la,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(vc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`BBtVak`})]})]})]}):null,t[61]=r,t[62]=w,t[63]=C,t[64]=T,t[65]=a,t[66]=xe):xe=t[66];let Se;t[67]===r?Se=t[68]:(Se=r({id:`MW64zN`}),t[67]=r,t[68]=Se);let we;t[69]!==d||t[70]!==a?(we=()=>a?.startCreating(`file`,d),t[69]=d,t[70]=a,t[71]=we):we=t[71];let Te;t[72]!==Se||t[73]!==we?(Te=(0,Z.jsx)(gH,{icon:el,label:Se,onClick:we}),t[72]=Se,t[73]=we,t[74]=Te):Te=t[74];let Ee;t[75]!==r||t[76]!==D||t[77]!==d||t[78]!==a?(Ee=D?(0,Z.jsx)(gH,{icon:gc,label:r({id:`Uuj_R4`}),onClick:()=>a?.startCreatingFromTemplate(d)}):null,t[75]=r,t[76]=D,t[77]=d,t[78]=a,t[79]=Ee):Ee=t[79];let De;t[80]===r?De=t[81]:(De=r({id:`tX5yOZ`}),t[80]=r,t[81]=De);let ke;t[82]!==d||t[83]!==a?(ke=()=>a?.startCreating(`folder`,d),t[82]=d,t[83]=a,t[84]=ke):ke=t[84];let Ae;t[85]!==De||t[86]!==ke?(Ae=(0,Z.jsx)(gH,{icon:bc,label:De,onClick:ke}),t[85]=De,t[86]=ke,t[87]=Ae):Ae=t[87];let je;t[88]!==xe||t[89]!==Te||t[90]!==Ee||t[91]!==Ae?(je=(0,Z.jsxs)(`div`,{className:be,children:[xe,Te,Ee,Ae]}),t[88]=xe,t[89]=Te,t[90]=Ee,t[91]=Ae,t[92]=je):je=t[92];let Me;t[93]!==ve||t[94]!==ye||t[95]!==je?(Me=(0,Z.jsxs)(pD,{"data-electron-drag":f?``:void 0,className:ve,children:[ye,je]}),t[93]=ve,t[94]=ye,t[95]=je,t[96]=Me):Me=t[96];let Ne=g&&`opacity-0`,Pe;t[97]===Ne?Pe=t[98]:(Pe=X(`px-2 pb-2`,f&&`[-webkit-app-region:no-drag]`,f&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ne),t[97]=Ne,t[98]=Pe);let Fe;t[99]===p?Fe=t[100]:(Fe=[p],t[99]=p,t[100]=Fe);let Ie;t[101]===n?Ie=t[102]:(Ie=(0,Z.jsx)(iH,{onClick:n}),t[101]=n,t[102]=Ie);let Le;t[103]!==Fe||t[104]!==Ie?(Le=(0,Z.jsx)(m,{fallbackRender:vH,onError:rH,resetKeys:Fe,children:Ie}),t[103]=Fe,t[104]=Ie,t[105]=Le):Le=t[105];let Re;t[106]!==Pe||t[107]!==Le?(Re=(0,Z.jsx)(`div`,{className:Pe,children:Le}),t[106]=Pe,t[107]=Le,t[108]=Re):Re=t[108];let ze;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsxs)(hD,{children:[(0,Z.jsx)(bk,{}),(0,Z.jsx)(TV,{ref:o})]}),t[109]=ze):ze=t[109];let Be,Ve;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsxs)(mD,{className:`px-0`,children:[(0,Z.jsx)(sH,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(gD,{children:(0,Z.jsx)(_D,{children:(0,Z.jsx)(tH,{bridge:window.okDesktop})})}):null]}),Ve=(0,Z.jsx)(dD,{enableToggle:!1}),t[110]=Be,t[111]=Ve):(Be=t[110],Ve=t[111]);let He;t[112]!==Me||t[113]!==Re?(He=(0,Z.jsx)(wO,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:V,children:[Me,Re,ze,Be,Ve]})}),t[112]=Me,t[113]=Re,t[114]=He):He=t[114];let Ue=!k,We,Ge;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(el,{"aria-hidden":`true`}),Ge=(0,Z.jsx)(s,{id:`MW64zN`}),t[115]=We,t[116]=Ge):(We=t[115],Ge=t[116]);let Ke;t[117]!==U||t[118]!==Ue?(Ke=(0,Z.jsxs)(DO,{disabled:Ue,onSelect:U,"data-testid":`empty-space-menu-new-file`,children:[We,Ge]}),t[117]=U,t[118]=Ue,t[119]=Ke):Ke=t[119];let qe=!k||!D,Je,Ye;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(gc,{"aria-hidden":`true`}),Ye=(0,Z.jsx)(s,{id:`Uuj_R4`}),t[120]=Je,t[121]=Ye):(Je=t[120],Ye=t[121]);let Xe;t[122]!==G||t[123]!==qe?(Xe=(0,Z.jsxs)(DO,{disabled:qe,onSelect:G,"data-testid":`empty-space-menu-new-from-template`,children:[Je,Ye]}),t[122]=G,t[123]=qe,t[124]=Xe):Xe=t[124];let Ze=!k,Qe,$e;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(bc,{"aria-hidden":`true`}),$e=(0,Z.jsx)(s,{id:`tX5yOZ`}),t[125]=Qe,t[126]=$e):(Qe=t[125],$e=t[126]);let et;t[127]!==q||t[128]!==Ze?(et=(0,Z.jsxs)(DO,{disabled:Ze,onSelect:q,"data-testid":`empty-space-menu-new-folder`,children:[Qe,$e]}),t[127]=q,t[128]=Ze,t[129]=et):et=t[129];let tt;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(jO,{}),t[130]=tt):tt=t[130];let nt;t[131]!==r||t[132]!==ee||t[133]!==k?(nt=O?(0,Z.jsxs)(DO,{disabled:!k,onSelect:ee,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(k?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(Ce,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),k?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[131]=r,t[132]=ee,t[133]=k,t[134]=nt):nt=t[134];let rt;t[135]!==j||t[136]!==N||t[137]!==A?(rt=(0,Z.jsx)($V,{input:N,installStates:A,dispatch:j,webFallbackVisible:!1}),t[135]=j,t[136]=N,t[137]=A,t[138]=rt):rt=t[138];let it;t[139]!==r||t[140]!==ne||t[141]!==k?(it=O?(0,Z.jsxs)(DO,{disabled:!k,onSelect:ne,"data-testid":`empty-space-menu-open-in-terminal`,"aria-label":r(k?{id:`BJpGCq`}:{id:`_6IEmc`}),children:[(0,Z.jsx)(al,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`BJpGCq`})}),k?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[139]=r,t[140]=ne,t[141]=k,t[142]=it):it=t[142];let at=!k,ot;t[143]!==r||t[144]!==k?(ot=r(k?{id:`Up2_7p`}:{id:`U8CD-l`}),t[143]=r,t[144]=k,t[145]=ot):ot=t[145];let st;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(At,{"aria-hidden":`true`}),t[146]=st):st=t[146];let ct;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[147]=ct):ct=t[147];let lt;t[148]===k?lt=t[149]:(lt=k?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[148]=k,t[149]=lt);let ut;t[150]!==ie||t[151]!==at||t[152]!==ot||t[153]!==lt?(ut=(0,Z.jsxs)(DO,{disabled:at,onSelect:ie,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":ot,children:[st,ct,lt]}),t[150]=ie,t[151]=at,t[152]=ot,t[153]=lt,t[154]=ut):ut=t[154];let dt;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,Z.jsx)(jO,{}),t[155]=dt):dt=t[155];let pt=P===null,mt;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(s,{id:`K_wz1u`}),t[156]=mt):mt=t[156];let ht;t[157]!==oe||t[158]!==I||t[159]!==pt?(ht=(0,Z.jsx)(AO,{checked:I,onCheckedChange:oe,disabled:pt,"data-testid":`empty-space-menu-show-hidden-files`,children:mt}),t[157]=oe,t[158]=I,t[159]=pt,t[160]=ht):ht=t[160];let gt=P===null,_t;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Z.jsx)(s,{id:`i8dKs-`}),t[161]=_t):_t=t[161];let vt;t[162]!==ce||t[163]!==L||t[164]!==gt?(vt=(0,Z.jsx)(AO,{checked:L,onCheckedChange:ce,disabled:gt,"data-testid":`empty-space-menu-show-all-files`,children:_t}),t[162]=ce,t[163]=L,t[164]=gt,t[165]=vt):vt=t[165];let yt;t[166]===B?yt=t[167]:(yt=B?(0,Z.jsx)(jO,{}):null,t[166]=B,t[167]=yt);let bt;t[168]!==ue||t[169]!==R?(bt=R?(0,Z.jsxs)(DO,{onSelect:ue,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(cl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[168]=ue,t[169]=R,t[170]=bt):bt=t[170];let xt;t[171]!==fe||t[172]!==z?(xt=z?(0,Z.jsxs)(DO,{onSelect:fe,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(vc,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[171]=fe,t[172]=z,t[173]=xt):xt=t[173];let St;t[174]!==Ke||t[175]!==Xe||t[176]!==et||t[177]!==nt||t[178]!==rt||t[179]!==it||t[180]!==ut||t[181]!==ht||t[182]!==vt||t[183]!==yt||t[184]!==bt||t[185]!==xt?(St=(0,Z.jsxs)(EO,{children:[Ke,Xe,et,tt,nt,rt,it,ut,dt,ht,vt,yt,bt,xt]}),t[174]=Ke,t[175]=Xe,t[176]=et,t[177]=nt,t[178]=rt,t[179]=it,t[180]=ut,t[181]=ht,t[182]=vt,t[183]=yt,t[184]=bt,t[185]=xt,t[186]=St):St=t[186];let Ct;return t[187]!==He||t[188]!==St?(Ct=(0,Z.jsx)(lD,{variant:`inset`,children:(0,Z.jsxs)(CO,{children:[He,St]})}),t[187]=He,t[188]=St,t[189]=Ct):Ct=t[189],Ct}function vH(){return null}function yH(e){mH(e.target)&&(e.preventDefault(),e.stopPropagation())}function bH(){let e=(0,$.c)(17),t=yn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=ft(),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 pt,i=new ct({url:n,name:cr,document:e,onStateless:e=>{let{payload:t}=e;N(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:EH,onConfigValidationRejected:TH,onConfigIgnoreNestedError:wH,onUnknown:CH})},onClose:SH,onDisconnect:xH}),a=hi(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=V(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Er([`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 xH(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function SH(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function CH(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function wH(e){lo(e)}function TH(e){po(e)}function EH(e){Er([e.ch])}var DH=`#install-claude-desktop`;function OH(e){return e===`#settings`||e===DH}function kH(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function AH(){let e=(0,$.c)(20),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=ft(),{openTargetTransition:i}=wt(),{assetPaths:a,folderPaths:o,loading:s,pages:c}=si(),l=(0,Q.useRef)(null),u;e[0]!==a||e[1]!==o||e[2]!==c?(u=kH(c,o,a),e[0]=a,e[1]=o,e[2]=c,e[3]=u):u=e[3];let d=u,f,p;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==n||e[9]!==r||e[10]!==d?(f=()=>{s||!r||l.current===d||(l.current=d,n({pages:c,folderPaths:o,assetPaths:a}))},p=[a,o,s,c,n,r,d],e[4]=a,e[5]=o,e[6]=s,e[7]=c,e[8]=n,e[9]=r,e[10]=d,e[11]=f,e[12]=p):(f=e[11],p=e[12]),(0,Q.useEffect)(f,p);let m,h;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c?(m=()=>{e();function e(){if(OH(window.location.hash))return;let e=ni(window.location.hash);if(e){let t=Lr(e.split(`.`).pop()??``);Wt(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=zr(window.location.hash);if(!n){Wt(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){Wt(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=Qr(n,{pages:c,folderPaths:o});if(r.kind===`missing`&&/\/+$/.test(n.trim())){Wt(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=Fr(r);Wt(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},h=[t,o,s,i,c],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=m,e[19]=h):(m=e[18],h=e[19]),(0,Q.useEffect)(m,h),null}function jH(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(typeof window<`u`&&window.location.hash===DH),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===DH&&n(!0)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e){if(n(e),!e&&window.location.hash===DH){let{pathname:e,search:t}=window.location;window.history.replaceState(null,``,`${e}${t}`)}},e[2]=a):a=e[2];let o=a,s;return e[3]===t?s=e[4]:(s=(0,Z.jsx)(La,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function MH(){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)(NH,t),null}function NH(){let e=function(e){let t=e.target;_m({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=gm))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function PH(){let e=(0,$.c)(4),{activeTarget:t}=ft(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath: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 FH(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=ft(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:kn(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;Lp({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)(zp,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function IH(){let e=(0,$.c)(21),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=t?El({bridge:t,authQueryTransport:Eo(),cloneTransport:Dl(),openSignIn:()=>new Promise(e=>{c(()=>e),o(!0)})}):null,e[0]=l):l=e[0];let u=l,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ph,{}),e[1]=d):d=e[1];let f,p,m,h,g,_,v,y;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(bH,{}),p=(0,Z.jsx)(AH,{}),m=(0,Z.jsx)(PH,{}),h=(0,Z.jsx)(FH,{}),g=(0,Z.jsx)(MH,{}),_=(0,Z.jsx)(jH,{}),v=(0,Z.jsx)(od,{}),y=t&&u?(0,Z.jsx)(yd,{bridge:t,cloneController:u}):null,e[2]=f,e[3]=p,e[4]=m,e[5]=h,e[6]=g,e[7]=_,e[8]=v,e[9]=y):(f=e[2],p=e[3],m=e[4],h=e[5],g=e[6],_=e[7],v=e[8],y=e[9]);let b;e[10]!==a||e[11]!==s?(b=t?(0,Z.jsx)(vo,{open:a,onOpenChange:e=>{e||(o(!1),s?.(null),c(null))},onSuccess:e=>{s?.({authenticated:!0,host:`github.com`,login:e.login}),c(null)}}):null,e[10]=a,e[11]=s,e[12]=b):b=e[12];let x;e[13]===r?x=e[14]:(x=(0,Z.jsx)(Dh,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=x);let S;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=S):S=e[15];let C;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(hH,{onOpenSearch:()=>i(!0)}),e[16]=C):C=e[16];let w;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(oD,{className:`h-screen overflow-hidden`,children:[C,(0,Z.jsx)(fD,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(vk,{})})]}),e[17]=w):w=e[17];let T;return e[18]!==b||e[19]!==x?(T=(0,Z.jsx)(It,{name:`app`,children:(0,Z.jsx)(kt,{children:(0,Z.jsxs)(Se,{children:[d,(0,Z.jsxs)(qr,{children:[f,p,m,h,g,_,v,y,b,x,S,w]})]})})}),e[18]=b,e[19]=x,e[20]=T):T=e[20],T}Ns(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&Hd({apiOrigin:window.okDesktop.config.apiOrigin}),uf()&&gf(),Wf(),typeof window<`u`&&qd({bridge:window.okDesktop}),typeof window<`u`&&as({bridge:window.okDesktop}),typeof window<`u`&&ts({bridge:window.okDesktop}),typeof window<`u`&&Xd({bridge:window.okDesktop}),typeof window<`u`&&vd({bridge:window.okDesktop});var LH=new Hs({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),RH=document.getElementById(`root`);if(!RH)throw Error(`Root element not found`);var zH=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Qs.createRoot)(RH).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:Y,children:(0,Z.jsx)(dn,{client:LH,children:(0,Z.jsxs)(zn,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Hr,{children:zH&&window.okDesktop?(0,Z.jsx)(Ld,{bridge:window.okDesktop}):(0,Z.jsx)(IH,{})}),(0,Z.jsx)(Vd,{richColors:!0,closeButton:!0})]})})})}));
|